rusticl: support cl_khr_kernel_clock
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run

Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35179>
This commit is contained in:
Karol Herbst 2025-05-27 15:26:44 +02:00 committed by Marge Bot
parent 8144c7ee86
commit 0a9b871b9e
6 changed files with 25 additions and 3 deletions

View file

@ -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

View file

@ -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

View file

@ -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)

View file

@ -150,7 +150,13 @@ unsafe impl CLInfo<cl_device_info> for cl_device_id {
)
})
}
CL_DEVICE_KERNEL_CLOCK_CAPABILITIES_KHR if dev.kernel_clock_supported() => {
v.write::<cl_device_kernel_clock_capabilities_khr>(
(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())
}

View file

@ -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,

View file

@ -297,6 +297,7 @@ impl SPIRVBin {
LiteralSampler: true,
SampledBuffer: true,
Sampled1D: true,
ShaderClockKHR: true,
UniformDecoration: true,
Vector16: true,
..Default::default()