nir: range analysis for ffract

Foz-DB Navi21:
Totals from 75 (0.09% of 79377) affected shaders:
Instrs: 69239 -> 68383 (-1.24%)
CodeSize: 385088 -> 379532 (-1.44%)
Latency: 427188 -> 421729 (-1.28%); split: -1.28%, +0.00%
InvThroughput: 103086 -> 101926 (-1.13%)
VClause: 785 -> 753 (-4.08%)
SClause: 1624 -> 1598 (-1.60%)
Copies: 5679 -> 5671 (-0.14%); split: -0.72%, +0.58%
PreSGPRs: 3961 -> 3937 (-0.61%)
VALU: 51107 -> 50457 (-1.27%)
SALU: 9034 -> 8950 (-0.93%)
VMEM: 1123 -> 1091 (-2.85%)
SMEM: 2862 -> 2830 (-1.12%)

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33557>
This commit is contained in:
Georg Lehmann 2025-02-14 18:54:09 +01:00 committed by Marge Bot
parent 030c8b57b0
commit 1f3494b886

View file

@ -600,6 +600,7 @@ process_fp_query(struct analysis_state *state, struct analysis_query *aq, uint32
case nir_op_ffloor:
case nir_op_fceil:
case nir_op_ftrunc:
case nir_op_ffract:
case nir_op_fdot2:
case nir_op_fdot3:
case nir_op_fdot4:
@ -1179,6 +1180,22 @@ process_fp_query(struct analysis_state *state, struct analysis_query *aq, uint32
break;
}
case nir_op_ffract: {
const struct ssa_result_range left = unpack_data(src_res[0]);
/* fract(±Inf) is NaN */
r.is_a_number = left.is_a_number && left.is_finite;
r.is_integral = left.is_integral;
r.is_finite = r.is_a_number;
if (left.is_integral || left.range == eq_zero)
r.range = eq_zero;
else
r.range = ge_zero;
break;
}
case nir_op_flt:
case nir_op_fge:
case nir_op_feq: