[Mlir-commits] [mlir] [mlir][arith] Clarify the meaning of fastmath flags (PR #217087)

Ivan R. Ivanov llvmlistbot at llvm.org
Tue Aug 18 10:28:13 PDT 2026


https://github.com/ivanradanov created https://github.com/llvm/llvm-project/pull/217087

The arith dialect did not specify the meaning of its fastmath flags.

Provide a description that points to the LLVM Language Reference. I opted to list out the currently available ones explicitly so that if we add a new arith-specific fastmath flag, the description will not point to the lang ref for it.

>From 4373fe7a0205841c258af4ed378b457841fe5e9b Mon Sep 17 00:00:00 2001
From: Ivan Radanov Ivanov <iivanov at nvidia.com>
Date: Tue, 18 Aug 2026 10:12:18 -0700
Subject: [PATCH] [mlir][arith] Clarify the meaning of fastmath flags

The arith dialect did not specify the meaning of its fastmath flags.

Provide a description that points to the LLVM Language Reference. I
opted to list out the currently available ones explicitly so that if we
add a new arith-specific fastmath flag, the description will not point
to the lang ref for it.
---
 mlir/include/mlir/Dialect/Arith/IR/ArithBase.td | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/mlir/include/mlir/Dialect/Arith/IR/ArithBase.td b/mlir/include/mlir/Dialect/Arith/IR/ArithBase.td
index 985ae01008002..25833d8388666 100644
--- a/mlir/include/mlir/Dialect/Arith/IR/ArithBase.td
+++ b/mlir/include/mlir/Dialect/Arith/IR/ArithBase.td
@@ -139,6 +139,12 @@ def FastMathFlags : I32BitEnumAttr<
   let cppNamespace = "::mlir::arith";
   let genSpecializedAttr = 0;
   let printBitEnumPrimaryGroups = 1;
+  let description = [{
+    For the `reassoc`, `nnan`, `ninf`, `nsz`, `arcp`, `contract`, `afn`, `fast`
+    flags, the arith dialect follows the same semantics as LLVM IR. Refer to the
+    [LLVM Language Reference](https://llvm.org/docs/LangRef.html#fast-math-flags)
+    for their meaning.
+  }];
 }
 
 def Arith_FastMathAttr :



More information about the Mlir-commits mailing list