1
0
Fork 0

nir/opt_undef: prefer 0 over NaN for pack_half_2x16_rtz_split

Using NaN doesn't usually allow any extra optimizations, and 0 is an inline
constant on AMD hw where this opcode is used with undef for fragment shader
exports.

Foz-DB GFX1201:
Totals from 889 (1.11% of 80287) affected shaders:
Instrs: 1676365 -> 1676348 (-0.00%)
CodeSize: 8827040 -> 8821760 (-0.06%)
Latency: 13346728 -> 13346699 (-0.00%)
InvThroughput: 1799283 -> 1799262 (-0.00%)
Copies: 108125 -> 108102 (-0.02%)
VALU: 974875 -> 974852 (-0.00%)

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37552>
This commit is contained in:
Georg Lehmann 2025-09-24 20:20:06 +02:00 committed by Marge Bot
parent a7f8c6ed60
commit 46a4569c22

View file

@ -222,7 +222,8 @@ visit_undef_use(nir_src *src, struct visit_info *info)
info->replace_undef_with_constant = true;
if (nir_op_infos[alu->op].input_types[i] & nir_type_float &&
alu->op != nir_op_fmulz &&
(alu->op != nir_op_ffmaz || i == 2))
(alu->op != nir_op_ffmaz || i == 2) &&
alu->op != nir_op_pack_half_2x16_rtz_split)
info->prefer_nan = true;
}
} else {