diff --git a/docs/features.txt b/docs/features.txt index 35a7f1901b0..0ef9eb5dabb 100644 --- a/docs/features.txt +++ b/docs/features.txt @@ -828,6 +828,7 @@ Rusticl extensions that are not part of any OpenCL version: cl_khr_int64_base_atomics not started cl_khr_int64_extended_atomics not started cl_khr_integer_dot_product DONE + cl_khr_kernel_clock DONE (freedreno, iris, llvmpipe, nvc0, panfrost, radeonsi, zink, needs llvm-19) cl_khr_mipmap_image not started cl_khr_pci_bus_info DONE (iris, nvc0, radeonsi, zink) cl_khr_priority_hints not started diff --git a/docs/relnotes/new_features.txt b/docs/relnotes/new_features.txt index acc15a89cf5..cc525ebfc03 100644 --- a/docs/relnotes/new_features.txt +++ b/docs/relnotes/new_features.txt @@ -25,3 +25,4 @@ VK_EXT_zero_initialize_device_memory on RADV and NVK VK_EXT_primitive_topology_list_restart on panvk VK_EXT_image_2d_view_of_3d on panvk VK_EXT_texel_buffer_alignment on panvk +cl_khr_kernel_clock on freedreno, iris, llvmpipe, nvc0, panfrost, radeonsi and zink with llvm-19 or newer diff --git a/docs/rusticl.rst b/docs/rusticl.rst index d8f4eb979f0..771d6dc757b 100644 --- a/docs/rusticl.rst +++ b/docs/rusticl.rst @@ -51,9 +51,9 @@ The minimum versions to build Rusticl are: - Rust: 1.78 - Meson: 1.4.0 - Bindgen: 0.65.0 -- LLVM: 15.0.0 +- LLVM: 15.0.0 (recommended 19.0.0) - Clang: 15.0.0 - Updating clang requires a rebuilt of mesa and rusticl if and only if the value of + Updating clang requires a rebuilt mesa and rusticl if and only if the value of ``CLANG_RESOURCE_DIR`` changes. It is defined through ``clang/Config/config.h``. - SPIRV-Tools: any version (recommended: v2025.1) diff --git a/src/gallium/frontends/rusticl/api/device.rs b/src/gallium/frontends/rusticl/api/device.rs index 5e53198ef18..9536765ded3 100644 --- a/src/gallium/frontends/rusticl/api/device.rs +++ b/src/gallium/frontends/rusticl/api/device.rs @@ -150,7 +150,13 @@ unsafe impl CLInfo for cl_device_id { ) }) } - + CL_DEVICE_KERNEL_CLOCK_CAPABILITIES_KHR if dev.kernel_clock_supported() => { + v.write::( + (CL_DEVICE_KERNEL_CLOCK_SCOPE_DEVICE_KHR + | CL_DEVICE_KERNEL_CLOCK_SCOPE_SUB_GROUP_KHR) + .into(), + ) + } CL_DEVICE_LATEST_CONFORMANCE_VERSION_PASSED => { v.write::<&CStr>(dev.screen().cl_cts_version()) } diff --git a/src/gallium/frontends/rusticl/core/device.rs b/src/gallium/frontends/rusticl/core/device.rs index f96530ea7b6..22bc2d9ab9f 100644 --- a/src/gallium/frontends/rusticl/core/device.rs +++ b/src/gallium/frontends/rusticl/core/device.rs @@ -17,6 +17,7 @@ use mesa_rust::pipe::transfer::PipeTransfer; use mesa_rust_gen::*; use mesa_rust_util::math::SetBitIndices; use mesa_rust_util::static_assert; +use rusticl_llvm_gen::*; use rusticl_opencl_gen::*; use std::cmp::max; @@ -684,6 +685,13 @@ impl Device { add_feat(1, 0, 0, "__opencl_c_int64"); } + if self.kernel_clock_supported() { + add_ext(1, 0, 0, "cl_khr_kernel_clock"); + add_feat(1, 0, 0, "__opencl_c_kernel_clock_scope_device"); + add_feat(1, 0, 0, "__opencl_c_kernel_clock_scope_sub_group"); + add_spirv(c"SPV_KHR_shader_clock"); + } + if self.caps.has_images { add_feat(1, 0, 0, "__opencl_c_images"); @@ -1128,6 +1136,10 @@ impl Device { self.screen.compute_caps().max_subgroups } + pub fn kernel_clock_supported(&self) -> bool { + self.screen.caps().shader_clock && LLVM_VERSION_MAJOR >= 19 + } + pub fn subgroups_supported(&self) -> bool { let subgroup_sizes = self.subgroup_sizes().len(); @@ -1187,6 +1199,7 @@ impl Device { images_write_3d: self.caps.has_3d_image_writes, integer_dot_product: true, intel_subgroups: self.intel_subgroups_supported(), + kernel_clock: self.kernel_clock_supported(), subgroups: subgroups_supported, subgroups_shuffle: subgroups_supported, subgroups_shuffle_relative: subgroups_supported, diff --git a/src/gallium/frontends/rusticl/mesa/compiler/clc/spirv.rs b/src/gallium/frontends/rusticl/mesa/compiler/clc/spirv.rs index 7861d6e875c..9c70cac28cb 100644 --- a/src/gallium/frontends/rusticl/mesa/compiler/clc/spirv.rs +++ b/src/gallium/frontends/rusticl/mesa/compiler/clc/spirv.rs @@ -297,6 +297,7 @@ impl SPIRVBin { LiteralSampler: true, SampledBuffer: true, Sampled1D: true, + ShaderClockKHR: true, UniformDecoration: true, Vector16: true, ..Default::default()