[Mlir-commits] [mlir] [MLIR][Math][XeVM] Add MathToXeVM (`math-to-xevm`) pass (PR #159878)

Adam Siemieniuk llvmlistbot at llvm.org
Fri Oct 10 08:24:16 PDT 2025


================
@@ -796,6 +796,32 @@ def ConvertMathToSPIRVPass : Pass<"convert-math-to-spirv"> {
   let dependentDialects = ["spirv::SPIRVDialect"];
 }
 
+//===----------------------------------------------------------------------===//
+// MathToXeVM
+//===----------------------------------------------------------------------===//
+
+def ConvertMathToXeVM : Pass<"convert-math-to-xevm", "ModuleOp"> {
+  let summary =
+      "Convert (fast) math operations to native XeVM/SPIRV equivalents";
+  let description = [{
+    This pass converts supported math ops marked with the `afn` fastmath flag
+    to function calls for OpenCL `native_` math intrinsics: These intrinsics
+    are typically mapped directly to native device instructions, often resulting
+    in better performance. However, the precision/error of these intrinsics
+    are implementation-defined, and thus math ops are only converted when they
+    have the `afn` fastmath flag enabled.
+  }];
+  let options = [Option<
+      "convertArith", "convert-arith", "bool", /*default=*/"true",
----------------
adam-smnk wrote:

If the lowering ever needs to be more selective then we can switch to a call control callback.

https://github.com/llvm/llvm-project/pull/159878


More information about the Mlir-commits mailing list