Skip to content

Commit 0ca38b7

Browse files
Only set fast math contract flag for Add/Mul operators (#4197)
Fixes #4185. Signed-off-by: Whitney Tsang <[email protected]>
1 parent 22a9821 commit 0ca38b7

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

third_party/intel/triton_xpu.cc

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -287,9 +287,10 @@ void init_triton_intel(py::module &&m) {
287287
FastMathFlags FMF;
288288
// Default to allow contract when default fp fusion is not disabled.
289289
if ((!enableFpFusion.has_value() || enableFpFusion.value()) &&
290-
!fastMath.has_value())
291-
FMF.setAllowContract(true);
292-
else if (fastMath.has_value() && fastMath.value())
290+
!fastMath.has_value()) {
291+
if (isa<AddOperator>(op) || isa<MulOperator>(op))
292+
FMF.setAllowContract(true);
293+
} else if (fastMath.has_value() && fastMath.value())
293294
FMF.setFast(true);
294295
inst.setFastMathFlags(FMF);
295296
}

0 commit comments

Comments
 (0)