From 013936e25058c3415dec61dfbee82e305f8fe6b5 Mon Sep 17 00:00:00 2001 From: Georg Lehmann Date: Wed, 22 Apr 2026 15:04:31 +0200 Subject: [PATCH] intel/nir_opt_peephole_ffma: fix fp_math_ctlr for modifiers If abs/neg don't preserve nan/inf/sz, the whole expressions won't. Fixes: 1b0808adf3d ("intel/nir: Make ffma peephole optimization preserve fp_fast_math flags") Reviewed-by: Alyssa Rosenzweig (cherry picked from commit 26ec32dada30211d88f7fc73bc0616cef82a68de) Part-of: --- .pick_status.json | 2 +- src/intel/compiler/intel_nir_opt_peephole_ffma.c | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index eff5ac5afd0..d0b1be250c0 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -644,7 +644,7 @@ "description": "intel/nir_opt_peephole_ffma: fix fp_math_ctlr for modifiers", "nominated": true, "nomination_type": 2, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": "1b0808adf3d95c64081e393f021f624f72e86d88", "notes": null diff --git a/src/intel/compiler/intel_nir_opt_peephole_ffma.c b/src/intel/compiler/intel_nir_opt_peephole_ffma.c index eb62ef440df..51646fd8abc 100644 --- a/src/intel/compiler/intel_nir_opt_peephole_ffma.c +++ b/src/intel/compiler/intel_nir_opt_peephole_ffma.c @@ -209,6 +209,7 @@ intel_nir_opt_peephole_ffma_instr(nir_builder *b, } b->cursor = nir_before_instr(&add->instr); + b->fp_math_ctrl = mul->fp_math_ctrl | add->fp_math_ctrl; if (abs) { for (unsigned i = 0; i < 2; i++) @@ -219,7 +220,7 @@ intel_nir_opt_peephole_ffma_instr(nir_builder *b, mul_src[0] = nir_fneg(b, mul_src[0]); nir_alu_instr *ffma = nir_alu_instr_create(b->shader, nir_op_ffma); - ffma->fp_math_ctrl = mul->fp_math_ctrl | add->fp_math_ctrl; + ffma->fp_math_ctrl = b->fp_math_ctrl; for (unsigned i = 0; i < 2; i++) { ffma->src[i].src = nir_src_for_ssa(mul_src[i]);