3 Commits

Author SHA1 Message Date
Ian Li
3f3ffed9c2
[MLIR][Math][XeVM] Reintroduce MathToXeVM (math-to-xevm) pass (#162934)
This PR is a fix for https://github.com/llvm/llvm-project/pull/159878,
which failed in postcommit testing due to linker errors that were not
caught in precommit.

Original PR:

---

This PR introduces a `MathToXeVM` pass, which implements support for the
`afn` fastmath flag for SPIRV/XeVM targets - It takes supported `Math`
Ops with the `afn` flag, and converts them to function calls to OpenCL
`native_` intrinsics.

These intrinsic functions are supported by the SPIRV backend, and are
automatically converted to `OpExtInst` calls to `native_` ops from the
OpenCL SPIRV ext. inst. set when outputting to SPIRV/XeVM.

Note:
- This pass also supports converting `arith.divf` to native equivalents.
There is an option provided in the pass to turn this behavior off.
- This pass preserves fastmath flags, but these flags are currently
ignored by the SPIRV backend. Thus, in order to generate SPIRV that
truly preserves fastmath flags, support needs to be added to the SPIRV
backend.
2025-10-13 23:38:52 -05:00
Md Abdullah Shahneous Bari
b92483c42c
Revert "[MLIR][Math][XeVM] Add MathToXeVM (math-to-xevm) pass" (#162923)
Reverts llvm/llvm-project#159878
2025-10-10 17:06:36 -05:00
Ian Li
fabd1c418a
[MLIR][Math][XeVM] Add MathToXeVM (math-to-xevm) pass (#159878)
This PR introduces a `MathToXeVM` pass, which implements support for the
`afn` fastmath flag for SPIRV/XeVM targets - It takes supported `Math`
Ops with the `afn` flag, and converts them to function calls to OpenCL
`native_` intrinsics.

These intrinsic functions are supported by the SPIRV backend, and are
automatically converted to `OpExtInst` calls to `native_` ops from the
OpenCL SPIRV ext. inst. set when outputting to SPIRV/XeVM.

Note:
- This pass also supports converting `arith.divf` to native equivalents.
There is an option provided in the pass to turn this behavior off.
- This pass preserves fastmath flags, but these flags are currently
ignored by the SPIRV backend. Thus, in order to generate SPIRV that
truly preserves fastmath flags, support needs to be added to the SPIRV
backend.
2025-10-10 16:03:58 -05:00