From ba3fd5dc5739a208033bc4cec47acc5e492cce0e Mon Sep 17 00:00:00 2001 From: Caio Oliveira Date: Sat, 3 Aug 2024 20:38:22 -0700 Subject: [PATCH] intel/brw: Don't retype load_subgroup_invocation result to signed The values are small unsigned integers, so their signed representation will be the same -- the sign conversion is not needed. As a result the extra MOV can be elided by the optimizations. Fossil-db results for DG2 ``` Totals: Instrs: 151779000 -> 151761591 (-0.01%) Cycle count: 12743968649 -> 12742826024 (-0.01%); split: -0.01%, +0.00% Max live registers: 31834993 -> 31834996 (+0.00%) Totals from 17018 (2.70% of 631450) affected shaders: Instrs: 2381740 -> 2364331 (-0.73%) Cycle count: 76798588 -> 75655963 (-1.49%); split: -1.70%, +0.22% Max live registers: 378921 -> 378924 (+0.00%) ``` and TGL ``` Totals: Instrs: 149812033 -> 149794080 (-0.01%); split: -0.01%, +0.00% Cycle count: 11534727002 -> 11534929834 (+0.00%); split: -0.01%, +0.01% Spill count: 42510 -> 42511 (+0.00%); split: -0.00%, +0.01% Fill count: 75100 -> 75101 (+0.00%); split: -0.00%, +0.00% Max live registers: 31727318 -> 31727321 (+0.00%) Totals from 17421 (2.76% of 630458) affected shaders: Instrs: 3092614 -> 3074661 (-0.58%); split: -0.58%, +0.00% Cycle count: 286061417 -> 286264249 (+0.07%); split: -0.32%, +0.39% Spill count: 11538 -> 11539 (+0.01%); split: -0.02%, +0.03% Fill count: 21359 -> 21360 (+0.00%); split: -0.01%, +0.01% Max live registers: 418954 -> 418957 (+0.00%) ``` Reviewed-by: Kenneth Graunke Part-of: --- src/intel/compiler/brw_fs_nir.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/intel/compiler/brw_fs_nir.cpp b/src/intel/compiler/brw_fs_nir.cpp index f4f6ce65de5..5666d32f82a 100644 --- a/src/intel/compiler/brw_fs_nir.cpp +++ b/src/intel/compiler/brw_fs_nir.cpp @@ -7333,7 +7333,7 @@ fs_nir_emit_intrinsic(nir_to_brw_state &ntb, break; case nir_intrinsic_load_subgroup_invocation: - bld.MOV(retype(dest, BRW_TYPE_D), + bld.MOV(retype(dest, BRW_TYPE_UD), ntb.system_values[SYSTEM_VALUE_SUBGROUP_INVOCATION]); break;