zink: emit WorkgroupSize when not using ExecutionModeLocalSize

the system_values_read bit might not be set if the value isn't read or is
DCE, but it still needs to be emitted

probably.

fixes #4591

Reviewed-by: Witold Baryluk <witold.baryluk@gmail.com>
Tested-by: Witold Baryluk <witold.baryluk@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10079>
This commit is contained in:
Mike Blumenkrantz 2021-04-07 12:56:49 -04:00 committed by Marge Bot
parent 636170c888
commit 05ecb6780c
2 changed files with 7 additions and 5 deletions

View File

@ -3645,14 +3645,14 @@ nir_to_spirv(struct nir_shader *s, const struct zink_so_info *so_info)
s->info.gs.vertices_out);
break;
case MESA_SHADER_COMPUTE:
if (s->info.cs.shared_size)
create_shared_block(&ctx, s->info.cs.shared_size);
if (s->info.cs.local_size[0] || s->info.cs.local_size[1] || s->info.cs.local_size[2])
spirv_builder_emit_exec_mode_literal3(&ctx.builder, entry_point, SpvExecutionModeLocalSize,
(uint32_t[3]){(uint32_t)s->info.cs.local_size[0], (uint32_t)s->info.cs.local_size[1],
(uint32_t)s->info.cs.local_size[2]});
if (s->info.cs.shared_size)
create_shared_block(&ctx, s->info.cs.shared_size);
if (BITSET_TEST(s->info.system_values_read, SYSTEM_VALUE_LOCAL_GROUP_SIZE)) {
else {
SpvId sizes[3];
uint32_t ids[] = {ZINK_WORKGROUP_SIZE_X, ZINK_WORKGROUP_SIZE_Y, ZINK_WORKGROUP_SIZE_Z};
const char *names[] = {"x", "y", "z"};

View File

@ -603,7 +603,9 @@ void
zink_program_update_compute_pipeline_state(struct zink_context *ctx, struct zink_compute_program *comp, const uint block[3])
{
struct zink_shader *zs = comp->shader;
bool use_local_size = BITSET_TEST(zs->nir->info.system_values_read, SYSTEM_VALUE_LOCAL_GROUP_SIZE);
bool use_local_size = !(zs->nir->info.cs.local_size[0] ||
zs->nir->info.cs.local_size[1] ||
zs->nir->info.cs.local_size[2]);
if (ctx->compute_pipeline_state.use_local_size != use_local_size)
ctx->compute_pipeline_state.dirty = true;
ctx->compute_pipeline_state.use_local_size = use_local_size;