mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-03 03:28:09 +02:00
rusticl/kernel: Do not run kernels with a workgroup size beyond work_dim
When no workgroup size is specified we try to run with the most optimal one
possible. However we didn't take into account that we shouldn't run a
workgroup of higher dimensionality than requested by the application.
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:
parent
810dca450c
commit
d46be8fbf2
1 changed files with 10 additions and 4 deletions
|
|
@ -1478,7 +1478,13 @@ impl Kernel {
|
|||
}
|
||||
}
|
||||
|
||||
fn optimize_local_size(&self, d: &Device, grid: &mut [usize; 3], block: &mut [u32; 3]) {
|
||||
fn optimize_local_size(
|
||||
&self,
|
||||
d: &Device,
|
||||
work_dim: u32,
|
||||
grid: &mut [usize; 3],
|
||||
block: &mut [u32; 3],
|
||||
) {
|
||||
if !block.contains(&0) {
|
||||
for i in 0..3 {
|
||||
// we already made sure everything is fine
|
||||
|
|
@ -1492,10 +1498,10 @@ impl Kernel {
|
|||
usize_block[i] = block[i] as usize;
|
||||
}
|
||||
|
||||
self.suggest_local_size(d, 3, grid, &mut usize_block);
|
||||
self.suggest_local_size(d, work_dim as usize, grid, &mut usize_block);
|
||||
|
||||
for i in 0..3 {
|
||||
block[i] = usize_block[i] as u32;
|
||||
block[i] = 1.max(usize_block[i] as u32);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1549,7 +1555,7 @@ impl Kernel {
|
|||
|
||||
let api_grid = grid;
|
||||
|
||||
self.optimize_local_size(q.device, &mut grid, &mut block);
|
||||
self.optimize_local_size(q.device, work_dim, &mut grid, &mut block);
|
||||
|
||||
Ok(Box::new(move |cl_ctx, ctx| {
|
||||
let hw_max_grid = ctx.dev.max_grid_size();
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue