rusticl/kernel: fix clGetKernelSuggestedLocalWorkSizeKHR implementation

There were two issues:
1. The global_work_offset parameter is optional but we errored on NULL
2. We didn't return the reqd_work_group_size when set on the kernel.

Fixes: 376d1e6667 ("rusticl: implement cl_khr_suggested_local_work_size")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38375>
This commit is contained in:
Karol Herbst
2025-11-11 17:48:57 +01:00
committed by Marge Bot
parent 2587a565d8
commit 810dca450c
2 changed files with 9 additions and 4 deletions

View File

@@ -857,10 +857,6 @@ fn get_kernel_suggested_local_work_size_khr(
return Err(CL_INVALID_GLOBAL_WORK_SIZE);
}
if global_work_offset.is_null() {
return Err(CL_INVALID_GLOBAL_OFFSET);
}
// CL_INVALID_VALUE if suggested_local_work_size is NULL.
if suggested_local_work_size.is_null() {
return Err(CL_INVALID_VALUE);

View File

@@ -1440,6 +1440,15 @@ impl Kernel {
grid: &mut [usize],
block: &mut [usize],
) {
// We have to use the required workgroup size if specified.
if self.work_group_size() != [0; 3] {
for i in 0..work_dim {
block[i] = self.work_group_size()[i];
grid[i] /= block[i];
}
return;
}
let mut threads = self.max_threads_per_block(d);
let dim_threads = d.max_block_sizes();
let subgroups = self.preferred_simd_size(d);