panfrost: Don't merge workgroups with variable shared mem

If nir->info.shared_size = 0 but grid->variable_shared_mem > 0, the shader uses
shared memory but the compiler may not realize that. We need to disable
workgroup merging even in this case. The alternate approach is to statically
check for shared intrinsics in the compiler, but this is a bit easier all things
considered.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18581>
This commit is contained in:
Alyssa Rosenzweig 2022-09-19 11:06:12 -04:00 committed by Marge Bot
parent cd37325dd9
commit 5f93feed61
2 changed files with 14 additions and 2 deletions

View file

@ -4158,7 +4158,16 @@ panfrost_launch_grid(struct pipe_context *pipe,
batch->rsd[PIPE_SHADER_COMPUTE],
panfrost_emit_shared_memory(batch, info));
cfg.allow_merging_workgroups = cs->info.cs.allow_merging_workgroups;
/* Workgroups may be merged if the shader does not use barriers
* or shared memory. This condition is checked against the
* static shared_size at compile-time. We need to check the
* variable shared size at launch_grid time, because the
* compiler doesn't know about that.
*/
cfg.allow_merging_workgroups =
cs->info.cs.allow_merging_workgroups &&
(info->variable_shared_mem == 0);
cfg.task_increment = 1;
cfg.task_axis = MALI_TASK_AXIS_Z;
}

View file

@ -335,7 +335,10 @@ struct pan_shader_info {
struct {
/* Is it legal to merge workgroups? This is true if the
* shader uses neither barriers nor shared memory.
* shader uses neither barriers nor shared memory. This
* requires caution: if the API allows specifying shared
* memory at launch time (instead of compile time), that
* memory will not be accounted for by the compiler.
*
* Used by the Valhall hardware.
*/