Hello, I recently studied MLIR quant.Reading some posts to learn about the history of F8 type support and the development of Quant Dialect, and whether the current uniformQuantizedType in Quant Dialect should support more types, the MLIR system already supports different formats of F8 format. MLIR also supports the uniform quantization type from Floating-point arithmetic numbers such as F32 or F16 to signed and unsigned INT8, but I need to use the uniform quantize from F32 to F8. Unfortunately, the UniformQuantizedType does not support the F8 storage type. I try to use AnyQuantizedType, But without common methods for obtaining maximum and minimum values, carrying attributes such as scale and zp, what should I do to ?
It has been (many) years since I have looked at that, and those quantized types far predate more modern conceptions of quantization – they are built to represent fixed point quantization schemes from the middle of the last decade era.
I suspect that UniformQuantizedType is not applicable to this case because it is defined as a quantization from integer values with a scale and zero point translation to arrive at a co-working fp value.
What you want to do makes sense, but it probably calls for a new QuantizedType subtype which is defined for the relationship you are trying to express.
I’m glad to receive your reply. Currently, it seems that the design of UniformQuantizedType does not meet the requirements of non Integer Storage types. Except for the Stroage type, it can be reused. UniformQuantized is suitable for most types. Regarding derivation, can we use Type-related TableGen tools in this Dialect to generate it? Can there be some cases?
UniformQuantizedType represents a specific mathematical relationship. If you have a different relationship, given the way it is modeled, it calls for a different type.
This dialect is old. It predated tablegen type definitions. Patches welcome to upgrade and extend it.
I hit the same issue with the one @Rrice metioned. Missing support for F8E4M3FType in Quant dialect. I would like to know if LLVM has future plans to extend the Quant dialect with new QuantizedType subtype which to properly define the relationship between some high precision float expressed type (for example float) and some lower precision float storage type (like the supported FP8 formats).
Afaik, that dialect is basically unowned. I wrote it many years ago but my groups don’t actually use type based quantization like that anymore.
Feel free to take it on if you need it.