From 765d74eebe6676042cb55b9d10752a496aedbadb Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Mon, 6 Apr 2026 17:25:32 -0700 Subject: [PATCH] brw: Set nir->info.{min,max}_subgroup_size in brw_nir_apply_key This records the actual SIMD width we selected for the shader, in all cases except fragment shaders, where we don't know it yet. MR 37258 notes that "Backends can update [these fields] when they make new decisions about the subgroup size" - which is what we now do. Note that nir->info.api_subgroup_size may be different than min/max subgroup size on Vulkan prior to SPV1.6/VK_EXT_subgroup_size_control, so we do not alter that. Reviewed-by: Alyssa Rosenzweig Part-of: --- src/intel/compiler/brw/brw_nir.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/intel/compiler/brw/brw_nir.c b/src/intel/compiler/brw/brw_nir.c index 0bf922e28c9..544235f1ba4 100644 --- a/src/intel/compiler/brw/brw_nir.c +++ b/src/intel/compiler/brw/brw_nir.c @@ -3038,6 +3038,22 @@ brw_nir_apply_key(brw_pass_tracker *pt, pt->progress = false; + unsigned subgroup_size = get_subgroup_size(&nir->info, max_subgroup_size); + + /* VS/TCS/TES/GS always run at a fixed SIMD width, which is what our + * max_subgroup_size parameter represents. Compute/Mesh can run at + * different sizes, but we clone the NIR for each SIMD width, and pass + * our chosen width here as max_subgroup_size. + * + * For fragment shaders, we may dispatch at multiple SIMD widths, + * and use a single copy of the NIR for all sizes, so we can't lower + * the actual width at this point. + */ + if (nir->info.stage != MESA_SHADER_FRAGMENT) { + nir->info.min_subgroup_size = max_subgroup_size; + nir->info.max_subgroup_size = max_subgroup_size; + } + const nir_lower_subgroups_options subgroups_options = { .subgroup_size = get_subgroup_size(&nir->info, max_subgroup_size), .ballot_bit_size = 32,