[Mlir-commits] [mlir] [mlir][gpu] Add pass for emulating unsupported types. (PR #138087)
Krzysztof Drewniak
llvmlistbot at llvm.org
Thu May 1 11:48:43 PDT 2025
krzysz00 wrote:
To rephrase my comment: this rewrite + patterns shouldn't be needed
If you have a `bf16` in, say, a `memref`, then SPIR-V should just make that be a memref of i16 and load from it. Similarly, a `vector<2 x bf16>` is actually a `vector,2 x i16>` after conversion to SPIR-V. And `arith.truncf %x : f32 to bf16` is just the `ConvertToBFloat` that returns an `i16`.
For an example of how this is handled, run an example that operations on `f8E4M3FN` through teh LLVM lowering. Notice that this type is search-replaced with `i8` everywhere, and that you need some platform-specific logic for conversion (as with `-arith-to-amdgpu`). With SPIR-V, because the conversion is a built-in operation, you don't even need an `-arith-to-amdgpu` equivalent.
Therefore, I recommend rejecting this PR in favor of fixing the SPIR-V lowering patterns
https://github.com/llvm/llvm-project/pull/138087
More information about the Mlir-commits
mailing list