rusticl: the CTS is a piece of shit
authorKarol Herbst <kherbst@redhat.com>
Thu, 21 Apr 2022 00:10:13 +0000 (02:10 +0200)
committerMarge Bot <emma+marge@anholt.net>
Mon, 12 Sep 2022 05:58:13 +0000 (05:58 +0000)
seriously, this fixes some image test, becaues ... rounding modes on CPU

Signed-off-by: Karol Herbst <kherbst@redhat.com>
Acked-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15439>

src/gallium/frontends/rusticl/api/device.rs
src/gallium/frontends/rusticl/core/device.rs

index 81e49c5..41d0a73 100644 (file)
@@ -163,7 +163,7 @@ impl CLInfo<cl_device_info> for cl_device_id {
             ),
             CL_DEVICE_SUB_GROUP_INDEPENDENT_FORWARD_PROGRESS => cl_prop::<bool>(false),
             CL_DEVICE_SVM_CAPABILITIES => cl_prop::<cl_device_svm_capabilities>(0),
-            CL_DEVICE_TYPE => cl_prop::<cl_device_type>(dev.device_type()),
+            CL_DEVICE_TYPE => cl_prop::<cl_device_type>(dev.device_type(false)),
             CL_DEVICE_VENDOR => cl_prop(dev.screen().device_vendor()),
             CL_DEVICE_VENDOR_ID => cl_prop::<cl_uint>(dev.vendor_id()),
             CL_DEVICE_VERSION => cl_prop::<String>(format!("OpenCL {}", dev.cl_version.api_str())),
@@ -194,7 +194,7 @@ fn devs() -> &'static Vec<Arc<Device>> {
 pub fn get_devs_for_type(device_type: cl_device_type) -> Vec<&'static Arc<Device>> {
     devs()
         .iter()
-        .filter(|d| device_type & d.device_type() != 0)
+        .filter(|d| device_type & d.device_type(true) != 0)
         .collect()
 }
 
index bed1c9d..f64a32c 100644 (file)
@@ -451,20 +451,22 @@ impl Device {
             .param(pipe_cap::PIPE_CAP_MAX_SHADER_BUFFER_SIZE_UINT) as u64
     }
 
-    pub fn device_type(&self) -> cl_device_type {
+    pub fn device_type(&self, internal: bool) -> cl_device_type {
         if self.custom {
             return CL_DEVICE_TYPE_CUSTOM as cl_device_type;
         }
-        (match self.screen.device_type() {
+        let mut res = match self.screen.device_type() {
             pipe_loader_device_type::PIPE_LOADER_DEVICE_SOFTWARE => CL_DEVICE_TYPE_CPU,
-            pipe_loader_device_type::PIPE_LOADER_DEVICE_PCI => {
-                CL_DEVICE_TYPE_GPU | CL_DEVICE_TYPE_DEFAULT
-            }
-            pipe_loader_device_type::PIPE_LOADER_DEVICE_PLATFORM => {
-                CL_DEVICE_TYPE_GPU | CL_DEVICE_TYPE_DEFAULT
-            }
+            pipe_loader_device_type::PIPE_LOADER_DEVICE_PCI => CL_DEVICE_TYPE_GPU,
+            pipe_loader_device_type::PIPE_LOADER_DEVICE_PLATFORM => CL_DEVICE_TYPE_GPU,
             pipe_loader_device_type::NUM_PIPE_LOADER_DEVICE_TYPES => CL_DEVICE_TYPE_CUSTOM,
-        }) as cl_device_type
+        };
+
+        if internal && res == CL_DEVICE_TYPE_GPU {
+            res |= CL_DEVICE_TYPE_DEFAULT;
+        }
+
+        res as cl_device_type
     }
 
     pub fn doubles_supported(&self) -> bool {