llvm-project
c793abb8 - [mlir][MathToXeVM] Route math ops by fastmath: native for `afn`, OCL otherwise. (#223816)

Commit
7 days ago
[mlir][MathToXeVM] Route math ops by fastmath: native for `afn`, OCL otherwise. (#223816) The pass had two lowerings for the same math ops. `afn` fastmath ops went to the OpenCL `native_` intrinsics. Everything else was only lowered when the `convert-to-ocl` option was set, which defaulted to off, so those ops were left untouched. Make `convert-to-ocl` default to true. The fastmath flag now picks the intrinsic on its own: - `afn` set -> `__spirv_ocl_native_*`, fast but approximate. - `afn` unset -> `__spirv_ocl_*`, precise. `fastmath<fast>` is a group that expands to include `afn`, so it takes the native path too. Other flags without `afn` do not. The precedence already worked: the native patterns get a higher pattern benefit than the precise ones, so an `afn` op still gets the native intrinsic when both pattern sets are live. Spell the benefits out instead of deriving one from the option value. Set `convert-to-ocl=false` to get the old behavior of leaving non-`afn` ops alone. math-to-xevm.mlir pins the native half, so it now passes that flag. math-to-ocl.mlir gains a routing case covering all five flag states, since the benefit tie only has to be broken when both pattern sets are live. Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
Author
Parents
Loading