From 3ed262421b9be9b88db62eaf32806caf7578e2f4 Mon Sep 17 00:00:00 2001 From: Anatoly Myachev Date: Thu, 26 Jun 2025 10:02:49 +0200 Subject: [PATCH 1/4] Revert "[DEBUG] Revert "Enable `SPV_INTEL_fp_fast_math_mode` (#4058)" (#4473)" This reverts commit 38a19844a2045b038b7a1611d3de46d372b291d0. --- third_party/intel/triton_xpu.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/third_party/intel/triton_xpu.cc b/third_party/intel/triton_xpu.cc index f7f9bf858e..3e0de55552 100644 --- a/third_party/intel/triton_xpu.cc +++ b/third_party/intel/triton_xpu.cc @@ -294,8 +294,8 @@ void init_triton_intel(py::module &&m) { for (Instruction &inst : instructions(func)) { if (auto *op = dyn_cast(&inst)) { FastMathFlags FMF; - // Allow contract when default fp fusion is enabled. - if ((enableFpFusion.has_value() && enableFpFusion.value()) && + // Default to allow contract when default fp fusion is not disabled. + if ((!enableFpFusion.has_value() || enableFpFusion.value()) && !fastMath.has_value()) { if (op->getOpcode() == Instruction::FAdd || op->getOpcode() == Instruction::FMul) From f3f090f8845d1ba5a0269c0ecb30d66585e7f82d Mon Sep 17 00:00:00 2001 From: Anatoly Myachev Date: Fri, 18 Jul 2025 16:09:10 +0000 Subject: [PATCH 2/4] inst.hasNoSignedZeros && inst.hasNoNaNs && inst.hasNoInfs Signed-off-by: Anatoly Myachev --- third_party/intel/triton_xpu.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/third_party/intel/triton_xpu.cc b/third_party/intel/triton_xpu.cc index a8167b5810..3a4410b239 100644 --- a/third_party/intel/triton_xpu.cc +++ b/third_party/intel/triton_xpu.cc @@ -302,7 +302,8 @@ void init_triton_intel(py::module &&m) { FastMathFlags FMF; // Default to allow contract when default fp fusion is not disabled. if ((!enableFpFusion.has_value() || enableFpFusion.value()) && - !fastMath.has_value()) { + !fastMath.has_value() && inst.hasNoSignedZeros() && + inst.hasNoNaNs() && inst.hasNoInfs()) { if (op->getOpcode() == Instruction::FAdd || op->getOpcode() == Instruction::FMul) FMF.setAllowContract(true); From e294d73618f0ae965203a22f6a95e0bd6d5d83d9 Mon Sep 17 00:00:00 2001 From: Anatoly Myachev Date: Fri, 18 Jul 2025 18:03:38 +0000 Subject: [PATCH 3/4] leave only 'inst.hasNoNaNs' Signed-off-by: Anatoly Myachev --- third_party/intel/triton_xpu.cc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/third_party/intel/triton_xpu.cc b/third_party/intel/triton_xpu.cc index 3a4410b239..6aab56d093 100644 --- a/third_party/intel/triton_xpu.cc +++ b/third_party/intel/triton_xpu.cc @@ -302,8 +302,7 @@ void init_triton_intel(py::module &&m) { FastMathFlags FMF; // Default to allow contract when default fp fusion is not disabled. if ((!enableFpFusion.has_value() || enableFpFusion.value()) && - !fastMath.has_value() && inst.hasNoSignedZeros() && - inst.hasNoNaNs() && inst.hasNoInfs()) { + !fastMath.has_value() && inst.hasNoNaNs()) { if (op->getOpcode() == Instruction::FAdd || op->getOpcode() == Instruction::FMul) FMF.setAllowContract(true); From 22fbc12374d22a789bd7096d25ef06dfe26851e2 Mon Sep 17 00:00:00 2001 From: Anatoly Myachev Date: Mon, 21 Jul 2025 15:04:31 +0200 Subject: [PATCH 4/4] Update third_party/intel/triton_xpu.cc --- third_party/intel/triton_xpu.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/third_party/intel/triton_xpu.cc b/third_party/intel/triton_xpu.cc index 6aab56d093..a8167b5810 100644 --- a/third_party/intel/triton_xpu.cc +++ b/third_party/intel/triton_xpu.cc @@ -302,7 +302,7 @@ void init_triton_intel(py::module &&m) { FastMathFlags FMF; // Default to allow contract when default fp fusion is not disabled. if ((!enableFpFusion.has_value() || enableFpFusion.value()) && - !fastMath.has_value() && inst.hasNoNaNs()) { + !fastMath.has_value()) { if (op->getOpcode() == Instruction::FAdd || op->getOpcode() == Instruction::FMul) FMF.setAllowContract(true);