rusticl/kernel: implement CL_KERNEL_GLOBAL_WORK_SIZE for custom devices

Apparently we are supposed to support this on custom devices.

Cc: mesa-stable
(cherry picked from commit 97a137ac88)

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40979>
This commit is contained in:
Karol Herbst 2026-04-12 23:56:34 +02:00 committed by Eric Engestrom
parent 6fa9e9b757
commit b2b54a0194
2 changed files with 11 additions and 1 deletions

View file

@ -974,7 +974,7 @@
"description": "rusticl/kernel: implement CL_KERNEL_GLOBAL_WORK_SIZE for custom devices",
"nominated": true,
"nomination_type": 1,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": null,
"notes": null

View file

@ -115,6 +115,16 @@ unsafe impl CLInfoObj<cl_kernel_work_group_info, cl_device_id> for cl_kernel {
match *q {
CL_KERNEL_COMPILE_WORK_GROUP_SIZE => v.write::<[usize; 3]>(kernel.work_group_size()),
CL_KERNEL_GLOBAL_WORK_SIZE => {
// If device is not a custom device and kernel is not a built-in kernel
// clGetKernelWorkGroupInfo returns the error CL_INVALID_VALUE.
if dev.device_type & CL_DEVICE_TYPE_CUSTOM == 0 {
return Err(CL_INVALID_VALUE);
}
// We don't have any enqueue limits.
v.write::<[usize; 3]>([usize::MAX; 3])
}
CL_KERNEL_LOCAL_MEM_SIZE => v.write::<cl_ulong>(kernel.local_mem_size(dev)),
CL_KERNEL_PREFERRED_WORK_GROUP_SIZE_MULTIPLE => {
v.write::<usize>(kernel.preferred_simd_size(dev))