diff --git a/docs/relnotes/new_features.txt b/docs/relnotes/new_features.txt index 1a49b417a63..d72d3cf1089 100644 --- a/docs/relnotes/new_features.txt +++ b/docs/relnotes/new_features.txt @@ -12,3 +12,4 @@ VK_EXT_pipeline_protected_access on RADV VK_EXT_extended_dynamic_state3 on panvk GL_ARB_texture_query_lod on panfrost/v9+ VK_KHR_maintenance11 on RADV +OpenCL 3.1 support for rusticl on asahi, iris, radeonsi, llvmpipe and zink diff --git a/src/gallium/frontends/rusticl/core/device.rs b/src/gallium/frontends/rusticl/core/device.rs index 1fde16e680d..d7293ffb4f7 100644 --- a/src/gallium/frontends/rusticl/core/device.rs +++ b/src/gallium/frontends/rusticl/core/device.rs @@ -497,7 +497,17 @@ impl DeviceBase { // TODO add CLC checks fn check_version(&mut self) { let exts: Vec<&str> = self.extension_string.split(' ').collect(); - let mut res = CLVersion::Cl3_0; + let mut res = CLVersion::Cl3_1; + + // CL 3.1 requires a bit more than we check here, but those are all features we support on + // every device anyway. + if !self.subgroup_shuffle_supported() + || !self.subgroup_shuffle_relative_supported() + || !self.subgroup_rotate_supported() + || !self.uuid_supported() + { + res = CLVersion::Cl3_0; + } #[allow(clippy::collapsible_if)] if self.embedded { @@ -561,6 +571,11 @@ impl DeviceBase { res = val; } + if res >= CLVersion::Cl3_1 { + self.clc_versions + .push(mk_cl_version_ext(3, 1, 0, "OpenCL C")); + } + if res >= CLVersion::Cl3_0 { self.clc_versions .push(mk_cl_version_ext(3, 0, 0, "OpenCL C")); @@ -732,7 +747,7 @@ impl DeviceBase { add_ext(1, 0, 0, "cl_khr_priority_hints"); } - if self.screen().device_uuid().is_some() && self.screen().driver_uuid().is_some() { + if self.uuid_supported() { static_assert!(PIPE_UUID_SIZE == CL_UUID_SIZE_KHR); static_assert!(PIPE_LUID_SIZE == CL_LUID_SIZE_KHR); @@ -1367,6 +1382,10 @@ impl DeviceBase { pub fn are_semaphores_supported(&self) -> bool { self.screen().caps().fence_signal && self.screen().has_semaphore_create() } + + pub fn uuid_supported(&self) -> bool { + self.screen().device_uuid().is_some() && self.screen().driver_uuid().is_some() + } } impl Device { @@ -1392,8 +1411,8 @@ impl Device { caps: DeviceCaps::new(&screen, &helper_ctx), helper_ctx: Mutex::new(helper_ctx), screen: screen, - cl_version: CLVersion::Cl3_0, - clc_version: CLVersion::Cl3_0, + cl_version: CLVersion::Cl3_1, + clc_version: CLVersion::Cl3_1, clc_versions: Vec::new(), device_type: 0, embedded: false, diff --git a/src/gallium/frontends/rusticl/core/program.rs b/src/gallium/frontends/rusticl/core/program.rs index 6dc1fbcd133..e0607f3b2c8 100644 --- a/src/gallium/frontends/rusticl/core/program.rs +++ b/src/gallium/frontends/rusticl/core/program.rs @@ -309,6 +309,9 @@ fn prepare_options(options: &str, dev: &Device) -> Vec { res.iter() .filter_map(|&a| match a { + // CL3.1 doesn't add anything that's not already supported in clang, so just replace + // the argument with 3.0 so we'll be fine with an older version of clang. + "-cl-std=CL3.1" => Some("-cl-std=CL3.0"), "-cl-denorms-are-zero" => Some("-fdenormal-fp-math=positive-zero"), // We can ignore it as long as we don't support ifp "-cl-no-subgroup-ifp" => None,