[Mlir-commits] [mlir] [mlir][IR] Turn `FloatType` into a type interface (PR #118891)

Matthias Springer llvmlistbot at llvm.org
Fri Dec 6 08:16:49 PST 2024


matthias-springer wrote:

This PR does not remove the MLIR type classes (e.g., `Float16Type`). They are still there. The only difference is that `FloatType` is no longer a hand-written class but a type interface. From a functional perspective this is almost NFC; the only difference is that you can no longer attach an interface to `FloatType` (because it's an interface now), that's why one test changed.

> I am wondering how say FP8 (whatever variant) gets lowered to LLVM given we don't have a Type instance that can represent that IIRC.

LLVM does not seem to support "fancy" FP types in the type system. We use integer types instead. See [here](https://github.com/llvm/llvm-project/blob/main/mlir/lib/Conversion/LLVMCommon/TypeConverter.cpp#L248).

The one place that must extended in LLVM to support new floating-point types are the [floating-point semantics](https://github.com/llvm/llvm-project/blob/main/llvm/lib/Support/APFloat.cpp#L138). That's not possible yet, but I plan to make that part extensible as a follow-up.


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


More information about the Mlir-commits mailing list