From cac9f670d1fe9beb238b8b94d40de83822b99af7 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Mon, 6 Apr 2026 16:36:28 -0700 Subject: [PATCH] intel/compiler: Use nir_static_workgroup_size helper Reviewed-by: Alyssa Rosenzweig Part-of: --- src/intel/compiler/brw/brw_nir.c | 9 +++------ src/intel/compiler/elk/elk_fs.cpp | 9 +++------ 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/src/intel/compiler/brw/brw_nir.c b/src/intel/compiler/brw/brw_nir.c index 55cc9d1712a..0bf922e28c9 100644 --- a/src/intel/compiler/brw/brw_nir.c +++ b/src/intel/compiler/brw/brw_nir.c @@ -3436,12 +3436,9 @@ lower_simd(nir_builder *b, nir_instr *instr, void *options) /* If the whole workgroup fits in one thread, we can lower subgroup_id * to a constant zero. */ - if (!b->shader->info.workgroup_size_variable) { - unsigned local_workgroup_size = b->shader->info.workgroup_size[0] * - b->shader->info.workgroup_size[1] * - b->shader->info.workgroup_size[2]; - if (local_workgroup_size <= simd_width) - return nir_imm_int(b, 0); + if (!b->shader->info.workgroup_size_variable && + nir_static_workgroup_size(b->shader) <= simd_width) { + return nir_imm_int(b, 0); } return NULL; diff --git a/src/intel/compiler/elk/elk_fs.cpp b/src/intel/compiler/elk/elk_fs.cpp index ead4475bc61..4151f4a9776 100644 --- a/src/intel/compiler/elk/elk_fs.cpp +++ b/src/intel/compiler/elk/elk_fs.cpp @@ -6900,12 +6900,9 @@ lower_simd(nir_builder *b, nir_instr *instr, void *options) /* If the whole workgroup fits in one thread, we can lower subgroup_id * to a constant zero. */ - if (!b->shader->info.workgroup_size_variable) { - unsigned local_workgroup_size = b->shader->info.workgroup_size[0] * - b->shader->info.workgroup_size[1] * - b->shader->info.workgroup_size[2]; - if (local_workgroup_size <= simd_width) - return nir_imm_int(b, 0); + if (!b->shader->info.workgroup_size_variable && + nir_static_workgroup_size(b->shader) <= simd_width) { + return nir_imm_int(b, 0); } return NULL;