From 84739d85bf80987cd88ed848ccfd7101ee2e90b6 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Mon, 15 Sep 2025 13:49:46 -0700 Subject: [PATCH] intel/nir: Make ffma peephole optimization preserve fp_fast_math flags float_controls2 may have marked these as needing to preserve NaN or other values. If so, our newly contracted ffma needs to as well. Fixes dEQP-VK.spirv_assembly.instruction.compute.float_controls2.*.input_args.mat_det_testedWithout_NotNan* when nir_opt_algebraic is run after this pass. Cc: mesa-stable Reviewed-by: Ian Romanick Part-of: (cherry picked from commit 1b0808adf3d95c64081e393f021f624f72e86d88) --- .pick_status.json | 2 +- src/intel/compiler/intel_nir_opt_peephole_ffma.c | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.pick_status.json b/.pick_status.json index 41bef81ec96..892738193f9 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -124,7 +124,7 @@ "description": "intel/nir: Make ffma peephole optimization preserve fp_fast_math flags", "nominated": true, "nomination_type": 1, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": null, "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 e895b9fc415..4d82acfac9d 100644 --- a/src/intel/compiler/intel_nir_opt_peephole_ffma.c +++ b/src/intel/compiler/intel_nir_opt_peephole_ffma.c @@ -224,6 +224,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_fast_math = mul->fp_fast_math | add->fp_fast_math; for (unsigned i = 0; i < 2; i++) { ffma->src[i].src = nir_src_for_ssa(mul_src[i]);