[all-commits] [llvm/llvm-project] 47347d: Quantile Type and Low FP Support (#190321)

vsimion26 via All-commits all-commits at lists.llvm.org
Tue Jun 2 07:15:06 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 47347d24f0a9f68ae60a54ce2ab46a023b739b8d
      https://github.com/llvm/llvm-project/commit/47347d24f0a9f68ae60a54ce2ab46a023b739b8d
  Author: vsimion26 <vlad.simion at intel.com>
  Date:   2026-06-02 (Tue, 02 Jun 2026)

  Changed paths:
    M mlir/include/mlir/Dialect/Quant/IR/QuantTypes.h
    M mlir/lib/Dialect/Quant/IR/QuantOps.cpp
    M mlir/lib/Dialect/Quant/IR/QuantTypes.cpp
    M mlir/lib/Dialect/Quant/IR/TypeDetail.h
    M mlir/lib/Dialect/Quant/IR/TypeParser.cpp
    A mlir/test/Dialect/Quant/invalid-quantile-types.mlir
    M mlir/test/Dialect/Quant/parse-uniform-invalid.mlir
    M mlir/test/Dialect/Quant/parse-uniform.mlir
    A mlir/test/Dialect/Quant/quantile-types.mlir

  Log Message:
  -----------
  Quantile Type and Low FP Support (#190321)

# **QuantileType: Composing with Interface-Based Storage Types in MLIR
Quantization**
 
## **Context**
 
Recent [community
work](https://discourse.llvm.org/t/rfc-extending-uniformquantizedtype-with-interface-based-support-for-new-storage-types-in-quant-dialect/87803)
(RFC by Roman-Pevnyi, Aug 2025)
successfully extended UniformQuantizedType with a StorageTypeInterface.
This
made the quantization framework extensible, allowing new storage types 
(Integer, Float8E5M2, Float8E4M3FN, NF4) to be plugged in without
modifying
core quantization logic.
 
## **Building on that work**
 
QuantileType follows the same interface-driven philosophy but addresses
a
different level of abstraction: the storage type itself.
 
The observation: Many low-precision storage types (ui4, si8, f8, NF4) 
can be enhanced with a quantile lookup table. Rather than creating a new
complete quantized type for each variant (QuantileQuantizedType, 
QuantileQuantizedPerAxisType, etc.), we insert an abstraction layer.
 
QuantileType is a builtin that wraps any storage type with quantile
metadata:
 
    quantile<ui4:f16, {-1.0, -0.696, ..., 1.0}>
    quantile<si8:f32, {-2.0, -1.0, 0.0, 1.0, 2.0}>
    quantile<f8E4M3FN:f16, {...}>
 
This storage abstraction then composes naturally with existing
quantization:
 
    !quant.uniform<quantile<ui4:f16, {...}>:f32, scale:zeropoint>
 
## **Architecture**
 
Roman's StorageTypeInterface allows UniformQuantizedType to work with
any
compliant storage type. QuantileType extends this by making it possible
to
augment any storage type WITH quantile information, creating composable
layers:
 
    Builtin QuantileType (unified storage + quantiles)
         ↓ (implements StorageTypeInterface)
    UniformQuantizedType (uniform quantization logic)
         ↓
    Hardware-specific lowering
 
## **Key benefits**
 
1. SINGLE INTERFACE FOR ALL QUANTILE SCHEMES
 
   With QuantileType: One parameterized abstraction
   
       quantile<ui4:f16, {nf4_table}>
       quantile<ui4:f16, {custom_table}>
       All compose with !quant.uniform naturally
[NF4
Type](https://github.com/openvinotoolkit/npu_compiler/blob/90b6098b9ee96055d633dc520354434bae22e336/src/vpux_compiler/include/vpux/compiler/core/types/quantile_float/types.hpp#L62)
& [NF4
Table](https://github.com/openvinotoolkit/npu_compiler/blob/90b6098b9ee96055d633dc520354434bae22e336/src/vpux_compiler/src/core/types/quantile_float/types.cpp#L116-L132)

2. EXTENSIBILITY FOR NEW STORAGE TYPES
 
   When a new low-fp storage type is added (FP3, FPx, etc.), 
   it automatically works with quantiles:
 
       quantile<fpx:f16, {...}>
   
No new dialect types needed. The type just implements
StorageTypeInterface
   and QuantileType wraps it.
 
3. CLEAN SEPARATION OF CONCERNS
 
   StorageTypeInterface:
- Defines what storage types must provide (width, signedness, min/max
values)
   
   QuantileType (builtin abstraction):
   - Wraps any StorageTypeInterface-compliant type with a lookup table
   - Acts as a "storage + quantile mapping" layer
   
   UniformQuantizedType (quantization logic):
   - Works with any StorageTypeInterface, including QuantileType
 
## **Example IR**
 
In uniform quantization context:
 
!elem_type = !quant.uniform<quantile<ui4:f16, {-1.0, ..., 1.0}>:f32,
0.01:128>
  
QuantileType is a natural extension of the StorageTypeInterface
architecture. It:
 
- Provides a unified abstraction for quantile-enhanced storage
- Avoids type explosion by parameterizing rather than creating variants
- Maintains clean separation between storage concerns and quantization
logic
- Enables portability and reusability across MLIR consumers



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list