From 3168ebe2c5808622e7da448df830c0d8ee352eb1 Mon Sep 17 00:00:00 2001 From: Georg Lehmann Date: Wed, 30 Jul 2025 15:08:43 +0200 Subject: [PATCH] nir/range_analysis: look through vec2 Foz-DB Navi31: Totals from 11 out of 14 FSR4 shaders: Instrs: 58987 -> 58298 (-1.17%) CodeSize: 402844 -> 397836 (-1.24%) Latency: 209630 -> 209634 (+0.00%); split: -0.66%, +0.66% InvThroughput: 230240 -> 229152 (-0.47%); split: -0.48%, +0.00% VClause: 838 -> 826 (-1.43%); split: -1.55%, +0.12% Copies: 3019 -> 2954 (-2.15%); split: -2.82%, +0.66% VALU: 50196 -> 49637 (-1.11%) VOPD: 1950 -> 1916 (-1.74%); split: +0.72%, -2.46% Reviewed-by: Emma Anholt Part-of: --- src/compiler/nir/nir_range_analysis.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/compiler/nir/nir_range_analysis.c b/src/compiler/nir/nir_range_analysis.c index f058a515d25..d13eeb18b64 100644 --- a/src/compiler/nir/nir_range_analysis.c +++ b/src/compiler/nir/nir_range_analysis.c @@ -603,7 +603,7 @@ process_fp_query(struct analysis_state *state, struct analysis_query *aq, uint32 * reinterpreted trivially. The most important cases are between float and * non-float. */ - if (alu->op != nir_op_mov && alu->op != nir_op_bcsel) { + if (alu->op != nir_op_mov && alu->op != nir_op_bcsel && alu->op != nir_op_vec2) { const nir_alu_type use_base_type = nir_alu_type_get_base_type(use_type); const nir_alu_type src_base_type = @@ -626,6 +626,10 @@ process_fp_query(struct analysis_state *state, struct analysis_query *aq, uint32 case nir_op_mov: push_fp_query(state, alu, 0, use_type); return; + case nir_op_vec2: + push_fp_query(state, alu, 0, use_type); + push_fp_query(state, alu, 1, use_type); + return; case nir_op_i2f32: case nir_op_u2f32: case nir_op_fabs: @@ -1127,6 +1131,17 @@ process_fp_query(struct analysis_state *state, struct analysis_query *aq, uint32 r = unpack_data(src_res[0]); break; + case nir_op_vec2: { + const struct ssa_result_range left = unpack_data(src_res[0]); + const struct ssa_result_range right = unpack_data(src_res[1]); + + r.range = union_ranges(left.range, right.range); + r.is_integral = left.is_integral && right.is_integral; + r.is_a_number = left.is_a_number && right.is_a_number; + r.is_finite = left.is_finite && right.is_finite; + break; + } + case nir_op_fneg: r = unpack_data(src_res[0]); r.range = fneg_table[r.range];