From c63ea755feab96003cc9d079a95214ca0f02bbdd Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Tue, 19 Dec 2023 16:57:49 -0800 Subject: [PATCH] intel/fs: Use nir_opt_uniform_subgroup shader-db: All Skylake and newer platforms had similar results. (Ice Lake shown) total instructions in shared programs: 20300435 -> 20300384 (<.01%) instructions in affected programs: 303 -> 252 (-16.83%) helped: 2 / HURT: 0 total cycles in shared programs: 842810326 -> 842809750 (<.01%) cycles in affected programs: 8374 -> 7798 (-6.88%) helped: 2 / HURT: 0 fossil-db: All Intel platforms (note below) had similar results. (Ice Lake shown) Instrs: 165559735 -> 165551893 (-0.00%) Cycles: 15133083961 -> 15132539132 (-0.00%); split: -0.00%, +0.00% Spill count: 45262 -> 45258 (-0.01%) Fill count: 74293 -> 74286 (-0.01%) Totals from 854 (0.13% of 656120) affected shaders: Instrs: 3461998 -> 3454156 (-0.23%) Cycles: 154252729 -> 153707900 (-0.35%); split: -0.36%, +0.01% Spill count: 2655 -> 2651 (-0.15%) Fill count: 3881 -> 3874 (-0.18%) DG2 did not see changes in spills or fills. Reviewed-by: Lionel Landwerlin Part-of: --- src/intel/compiler/brw_nir.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/intel/compiler/brw_nir.c b/src/intel/compiler/brw_nir.c index 729c9b5f2cc..144e540bb40 100644 --- a/src/intel/compiler/brw_nir.c +++ b/src/intel/compiler/brw_nir.c @@ -1713,6 +1713,18 @@ brw_postprocess_nir(nir_shader *nir, const struct brw_compiler *compiler, divergence_analysis_dirty = true; } + /* nir_opt_uniform_subgroup can create some operations (e.g., + * load_subgroup_lt_mask) that need to be lowered again. + */ + if (OPT(nir_opt_uniform_subgroup)) { + const nir_lower_subgroups_options subgroups_options = { + .ballot_bit_size = 32, + .ballot_components = 1, + .lower_subgroup_masks = true, + }; + OPT(nir_lower_subgroups, &subgroups_options); + } + /* Do this only after the last opt_gcm. GCM will undo this lowering. */ if (nir->info.stage == MESA_SHADER_FRAGMENT) { if (divergence_analysis_dirty) {