Skip to content

Commit 4e31910

Browse files
committed
[MLIR] Add f6E2M3FN type
This PR adds `f6E2M3FN` type to mlir. `f6E2M3FN` type is proposed in [OpenCompute MX Specification](https://www.opencompute.org/documents/ocp-microscaling-formats-mx-v1-0-spec-final-pdf). It defines a 6-bit floating point number with bit layout S1E2M3. Unlike IEEE-754 types, there are no infinity or NaN values. ```c f6E2M3FN - Exponent bias: 1 - Maximum stored exponent value: 3 (binary 11) - Maximum unbiased exponent value: 3 - 1 = 2 - Minimum stored exponent value: 1 (binary 01) - Minimum unbiased exponent value: 1 − 1 = 0 - Has Positive and Negative zero - Doesn't have infinity - Doesn't have NaNs Additional details: - Zeros (+/-): S.00.000 - Max normal number: S.11.111 = ±2^(2) x (1 + 0.875) = ±7.5 - Min normal number: S.01.000 = ±2^(0) = ±1.0 - Max subnormal number: S.00.111 = ±2^(0) x 0.875 = ±0.875 - Min subnormal number: S.00.001 = ±2^(0) x 0.125 = ±0.125 ``` Related PRs: - [PR-94735](#94735) [APFloat] Add APFloat support for FP6 data types - [PR-105573](#105573) [MLIR] Add f6E3M2FN type - was used as a template for this PR
1 parent 433ca3e commit 4e31910

File tree

24 files changed

+134
-8
lines changed

24 files changed

+134
-8
lines changed

mlir/include/mlir-c/BuiltinTypes.h

+10
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,16 @@ MLIR_CAPI_EXPORTED bool mlirTypeIsAFloat(MlirType type);
7979
/// Returns the bitwidth of a floating-point type.
8080
MLIR_CAPI_EXPORTED unsigned mlirFloatTypeGetWidth(MlirType type);
8181

82+
/// Returns the typeID of an Float6E2M3FN type.
83+
MLIR_CAPI_EXPORTED MlirTypeID mlirFloat6E2M3FNTypeGetTypeID(void);
84+
85+
/// Checks whether the given type is an f6E2M3FN type.
86+
MLIR_CAPI_EXPORTED bool mlirTypeIsAFloat6E2M3FN(MlirType type);
87+
88+
/// Creates an f6E2M3FN type in the given context. The type is owned by the
89+
/// context.
90+
MLIR_CAPI_EXPORTED MlirType mlirFloat6E2M3FNTypeGet(MlirContext ctx);
91+
8292
/// Returns the typeID of an Float6E3M2FN type.
8393
MLIR_CAPI_EXPORTED MlirTypeID mlirFloat6E3M2FNTypeGetTypeID(void);
8494

mlir/include/mlir/IR/Builders.h

+1
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ class Builder {
6060
Attribute metadata = Attribute());
6161

6262
// Types.
63+
FloatType getFloat6E2M3FNType();
6364
FloatType getFloat6E3M2FNType();
6465
FloatType getFloat8E5M2Type();
6566
FloatType getFloat8E4M3Type();

mlir/include/mlir/IR/BuiltinTypes.h

+10-5
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ class FloatType : public Type {
6767
static FloatType getFloat8E4M3FNUZ(MLIRContext *ctx);
6868
static FloatType getFloat8E4M3B11FNUZ(MLIRContext *ctx);
6969
static FloatType getFloat8E3M4(MLIRContext *ctx);
70+
static FloatType getFloat6E2M3FN(MLIRContext *ctx);
7071
static FloatType getFloat6E3M2FN(MLIRContext *ctx);
7172

7273
/// Methods for support type inquiry through isa, cast, and dyn_cast.
@@ -414,11 +415,15 @@ inline bool BaseMemRefType::isValidElementType(Type type) {
414415
}
415416

416417
inline bool FloatType::classof(Type type) {
417-
return llvm::isa<Float6E3M2FNType, Float8E5M2Type, Float8E4M3Type,
418-
Float8E4M3FNType, Float8E5M2FNUZType, Float8E4M3FNUZType,
419-
Float8E4M3B11FNUZType, Float8E3M4Type, BFloat16Type,
420-
Float16Type, FloatTF32Type, Float32Type, Float64Type,
421-
Float80Type, Float128Type>(type);
418+
return llvm::isa<Float6E2M3FNType, Float6E3M2FNType, Float8E5M2Type,
419+
Float8E4M3Type, Float8E4M3FNType, Float8E5M2FNUZType,
420+
Float8E4M3FNUZType, Float8E4M3B11FNUZType, Float8E3M4Type,
421+
BFloat16Type, Float16Type, FloatTF32Type, Float32Type,
422+
Float64Type, Float80Type, Float128Type>(type);
423+
}
424+
425+
inline FloatType FloatType::getFloat6E2M3FN(MLIRContext *ctx) {
426+
return Float6E2M3FNType::get(ctx);
422427
}
423428

424429
inline FloatType FloatType::getFloat6E3M2FN(MLIRContext *ctx) {

mlir/include/mlir/IR/BuiltinTypes.td

+22-1
Original file line numberDiff line numberDiff line change
@@ -233,11 +233,32 @@ def Builtin_Float8E3M4 : Builtin_FloatType<"Float8E3M4", "f8E3M4"> {
233233
}];
234234
}
235235

236+
//===----------------------------------------------------------------------===//
237+
// Float6E2M3FNType
238+
239+
def Builtin_Float6E2M3FN : Builtin_FloatType<"Float6E2M3FN", "f6E2M3FN"> {
240+
let summary = "6-bit floating point with 2-bit exponent and 3-bit mantissa";
241+
let description = [{
242+
An 6-bit floating point type with 1 sign bit, 2 bits exponent and 3 bits
243+
mantissa. This is not a standard type as defined by IEEE-754, but it
244+
follows similar conventions with the following characteristics:
245+
246+
* bit encoding: S1E2M3
247+
* exponent bias: 1
248+
* infinities: Not supported
249+
* NaNs: Not supported
250+
* denormals when exponent is 0
251+
252+
Open Compute Project (OCP) microscaling formats (MX) specification:
253+
https://www.opencompute.org/documents/ocp-microscaling-formats-mx-v1-0-spec-final-pdf
254+
}];
255+
}
256+
236257
//===----------------------------------------------------------------------===//
237258
// Float6E3M2FNType
238259

239260
def Builtin_Float6E3M2FN : Builtin_FloatType<"Float6E3M2FN", "f6E3M2FN"> {
240-
let summary = "6-bit floating point with 3 bits exponent and 2 bit mantissa";
261+
let summary = "6-bit floating point with 3-bit exponent and 2-bit mantissa";
241262
let description = [{
242263
An 6-bit floating point type with 1 sign bit, 3 bits exponent and 2 bits
243264
mantissa. This is not a standard type as defined by IEEE-754, but it

mlir/include/mlir/IR/CommonTypeConstraints.td

+2
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,8 @@ def F8E5M2FNUZ : Type<CPred<"$_self.isFloat8E5M2FNUZ()">, "f8E5M2FNUZ type">,
344344
BuildableType<"$_builder.getFloat8E5M2FNUZType()">;
345345
def F8E3M4 : Type<CPred<"$_self.isFloat8E3M4()">, "f8E3M4 type">,
346346
BuildableType<"$_builder.getFloat8E3M4Type()">;
347+
def F6E2M3FN : Type<CPred<"$_self.isFloat6E2M3FN()">, "f6E2M3FN type">,
348+
BuildableType<"$_builder.getFloat6E2M3FNType()">;
347349
def F6E3M2FN : Type<CPred<"$_self.isFloat6E3M2FN()">, "f6E3M2FN type">,
348350
BuildableType<"$_builder.getFloat6E3M2FNType()">;
349351

mlir/include/mlir/IR/Types.h

+1
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ class Type {
125125
// Convenience predicates. This is only for floating point types,
126126
// derived types should use isa/dyn_cast.
127127
bool isIndex() const;
128+
bool isFloat6E2M3FN() const;
128129
bool isFloat6E3M2FN() const;
129130
bool isFloat8E5M2() const;
130131
bool isFloat8E4M3() const;

mlir/lib/AsmParser/TokenKinds.def

+1
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ TOK_KEYWORD(f8E5M2FNUZ)
101101
TOK_KEYWORD(f8E4M3FNUZ)
102102
TOK_KEYWORD(f8E4M3B11FNUZ)
103103
TOK_KEYWORD(f8E3M4)
104+
TOK_KEYWORD(f6E2M3FN)
104105
TOK_KEYWORD(f6E3M2FN)
105106
TOK_KEYWORD(f128)
106107
TOK_KEYWORD(false)

mlir/lib/AsmParser/TypeParser.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ OptionalParseResult Parser::parseOptionalType(Type &type) {
3939
case Token::kw_tuple:
4040
case Token::kw_vector:
4141
case Token::inttype:
42+
case Token::kw_f6E2M3FN:
4243
case Token::kw_f6E3M2FN:
4344
case Token::kw_f8E5M2:
4445
case Token::kw_f8E4M3:
@@ -304,6 +305,9 @@ Type Parser::parseNonFunctionType() {
304305
}
305306

306307
// float-type
308+
case Token::kw_f6E2M3FN:
309+
consumeToken(Token::kw_f6E2M3FN);
310+
return builder.getFloat6E2M3FNType();
307311
case Token::kw_f6E3M2FN:
308312
consumeToken(Token::kw_f6E3M2FN);
309313
return builder.getFloat6E3M2FNType();

mlir/lib/Bindings/Python/IRTypes.cpp

+22
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,27 @@ class PyFloatType : public PyConcreteType<PyFloatType> {
124124
}
125125
};
126126

127+
/// Floating Point Type subclass - Float6E2M3FNType.
128+
class PyFloat6E2M3FNType
129+
: public PyConcreteType<PyFloat6E2M3FNType, PyFloatType> {
130+
public:
131+
static constexpr IsAFunctionTy isaFunction = mlirTypeIsAFloat6E2M3FN;
132+
static constexpr GetTypeIDFunctionTy getTypeIdFunction =
133+
mlirFloat6E2M3FNTypeGetTypeID;
134+
static constexpr const char *pyClassName = "Float6E2M3FNType";
135+
using PyConcreteType::PyConcreteType;
136+
137+
static void bindDerived(ClassTy &c) {
138+
c.def_static(
139+
"get",
140+
[](DefaultingPyMlirContext context) {
141+
MlirType t = mlirFloat6E2M3FNTypeGet(context->get());
142+
return PyFloat6E2M3FNType(context->getRef(), t);
143+
},
144+
py::arg("context") = py::none(), "Create a float6_e2m3fn type.");
145+
}
146+
};
147+
127148
/// Floating Point Type subclass - Float6E3M2FNType.
128149
class PyFloat6E3M2FNType
129150
: public PyConcreteType<PyFloat6E3M2FNType, PyFloatType> {
@@ -901,6 +922,7 @@ void mlir::python::populateIRTypes(py::module &m) {
901922
PyIntegerType::bind(m);
902923
PyFloatType::bind(m);
903924
PyIndexType::bind(m);
925+
PyFloat6E2M3FNType::bind(m);
904926
PyFloat6E3M2FNType::bind(m);
905927
PyFloat8E4M3FNType::bind(m);
906928
PyFloat8E5M2Type::bind(m);

mlir/lib/CAPI/IR/BuiltinTypes.cpp

+12
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,18 @@ unsigned mlirFloatTypeGetWidth(MlirType type) {
8585
return llvm::cast<FloatType>(unwrap(type)).getWidth();
8686
}
8787

88+
MlirTypeID mlirFloat6E2M3FNTypeGetTypeID() {
89+
return wrap(Float6E2M3FNType::getTypeID());
90+
}
91+
92+
bool mlirTypeIsAFloat6E2M3FN(MlirType type) {
93+
return unwrap(type).isFloat6E2M3FN();
94+
}
95+
96+
MlirType mlirFloat6E2M3FNTypeGet(MlirContext ctx) {
97+
return wrap(FloatType::getFloat6E2M3FN(unwrap(ctx)));
98+
}
99+
88100
MlirTypeID mlirFloat6E3M2FNTypeGetTypeID() {
89101
return wrap(Float6E3M2FNType::getTypeID());
90102
}

mlir/lib/Conversion/LLVMCommon/TypeConverter.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ Type LLVMTypeConverter::convertFloatType(FloatType type) const {
250250
if (type.isFloat8E5M2() || type.isFloat8E4M3() || type.isFloat8E4M3FN() ||
251251
type.isFloat8E5M2FNUZ() || type.isFloat8E4M3FNUZ() ||
252252
type.isFloat8E4M3B11FNUZ() || type.isFloat8E3M4() ||
253-
type.isFloat6E3M2FN())
253+
type.isFloat6E2M3FN() || type.isFloat6E3M2FN())
254254
return IntegerType::get(&getContext(), type.getWidth());
255255
return type;
256256
}

mlir/lib/Dialect/Arith/Transforms/EmulateUnsupportedFloats.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ static std::optional<FloatType> parseFloatType(MLIRContext *ctx,
5555
StringRef name) {
5656
Builder b(ctx);
5757
return llvm::StringSwitch<std::optional<FloatType>>(name)
58+
.Case("f6E2M3FN", b.getFloat6E2M3FNType())
5859
.Case("f6E3M2FN", b.getFloat6E3M2FNType())
5960
.Case("f8E5M2", b.getFloat8E5M2Type())
6061
.Case("f8E4M3", b.getFloat8E4M3Type())

mlir/lib/IR/AsmPrinter.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -2575,6 +2575,7 @@ void AsmPrinter::Impl::printTypeImpl(Type type) {
25752575
opaqueTy.getTypeData());
25762576
})
25772577
.Case<IndexType>([&](Type) { os << "index"; })
2578+
.Case<Float6E2M3FNType>([&](Type) { os << "f6E2M3FN"; })
25782579
.Case<Float6E3M2FNType>([&](Type) { os << "f6E3M2FN"; })
25792580
.Case<Float8E5M2Type>([&](Type) { os << "f8E5M2"; })
25802581
.Case<Float8E4M3Type>([&](Type) { os << "f8E4M3"; })

mlir/lib/IR/Builders.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ Location Builder::getFusedLoc(ArrayRef<Location> locs, Attribute metadata) {
3434
// Types.
3535
//===----------------------------------------------------------------------===//
3636

37+
FloatType Builder::getFloat6E2M3FNType() {
38+
return FloatType::getFloat6E2M3FN(context);
39+
}
40+
3741
FloatType Builder::getFloat6E3M2FNType() {
3842
return FloatType::getFloat6E3M2FN(context);
3943
}

mlir/lib/IR/BuiltinTypes.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,8 @@ unsigned FloatType::getWidth() {
101101

102102
/// Returns the floating semantics for the given type.
103103
const llvm::fltSemantics &FloatType::getFloatSemantics() {
104+
if (llvm::isa<Float6E2M3FNType>(*this))
105+
return APFloat::Float6E2M3FN();
104106
if (llvm::isa<Float6E3M2FNType>(*this))
105107
return APFloat::Float6E3M2FN();
106108
if (llvm::isa<Float8E5M2Type>(*this))

mlir/lib/IR/MLIRContext.cpp

+5
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,7 @@ class MLIRContextImpl {
221221
llvm::DenseMap<StringRef, AbstractType *> nameToType;
222222

223223
/// Cached Type Instances.
224+
Float6E2M3FNType f6E2M3FNTy;
224225
Float6E3M2FNType f6E3M2FNTy;
225226
Float8E5M2Type f8E5M2Ty;
226227
Float8E4M3Type f8E4M3Ty;
@@ -314,6 +315,7 @@ MLIRContext::MLIRContext(const DialectRegistry &registry, Threading setting)
314315

315316
//// Types.
316317
/// Floating-point Types.
318+
impl->f6E2M3FNTy = TypeUniquer::get<Float6E2M3FNType>(this);
317319
impl->f6E3M2FNTy = TypeUniquer::get<Float6E3M2FNType>(this);
318320
impl->f8E5M2Ty = TypeUniquer::get<Float8E5M2Type>(this);
319321
impl->f8E4M3Ty = TypeUniquer::get<Float8E4M3Type>(this);
@@ -1015,6 +1017,9 @@ AbstractType::lookup(StringRef name, MLIRContext *context) {
10151017
/// This should not be used directly.
10161018
StorageUniquer &MLIRContext::getTypeUniquer() { return getImpl().typeUniquer; }
10171019

1020+
Float6E2M3FNType Float6E2M3FNType::get(MLIRContext *context) {
1021+
return context->getImpl().f6E2M3FNTy;
1022+
}
10181023
Float6E3M2FNType Float6E3M2FNType::get(MLIRContext *context) {
10191024
return context->getImpl().f6E3M2FNTy;
10201025
}

mlir/lib/IR/Types.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ Type AbstractType::replaceImmediateSubElements(Type type,
3434

3535
MLIRContext *Type::getContext() const { return getDialect().getContext(); }
3636

37+
bool Type::isFloat6E2M3FN() const { return llvm::isa<Float6E2M3FNType>(*this); }
3738
bool Type::isFloat6E3M2FN() const { return llvm::isa<Float6E3M2FNType>(*this); }
3839
bool Type::isFloat8E5M2() const { return llvm::isa<Float8E5M2Type>(*this); }
3940
bool Type::isFloat8E4M3() const { return llvm::isa<Float8E4M3Type>(*this); }

mlir/python/mlir/_mlir_libs/_mlir/ir.pyi

+14
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ __all__ = [
120120
"F32Type",
121121
"F64Type",
122122
"FlatSymbolRefAttr",
123+
"Float6E2M3FNType",
123124
"Float6E3M2FNType",
124125
"Float8E3M4Type",
125126
"Float8E4M3B11FNUZType",
@@ -1540,6 +1541,19 @@ class FlatSymbolRefAttr(Attribute):
15401541
Returns the value of the FlatSymbolRef attribute as a string
15411542
"""
15421543

1544+
class Float6E2M3FNType(FloatType):
1545+
static_typeid: ClassVar[TypeID]
1546+
@staticmethod
1547+
def get(context: Optional[Context] = None) -> Float6E2M3FNType:
1548+
"""
1549+
Create a float6_e2m3fn type.
1550+
"""
1551+
@staticmethod
1552+
def isinstance(other: Type) -> bool: ...
1553+
def __init__(self, cast_from_type: Type) -> None: ...
1554+
@property
1555+
def typeid(self) -> TypeID: ...
1556+
15431557
class Float6E3M2FNType(FloatType):
15441558
static_typeid: ClassVar[TypeID]
15451559
@staticmethod

mlir/python/mlir/extras/types.py

+2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
F16Type,
1313
F32Type,
1414
F64Type,
15+
Float6E2M3FNType,
1516
Float6E3M2FNType,
1617
Float8E3M4Type,
1718
Float8E4M3B11FNUZType,
@@ -75,6 +76,7 @@ def ui(width):
7576
f8E4M3FN = lambda: Float8E4M3FNType.get()
7677
f8E4M3B11FNUZ = lambda: Float8E4M3B11FNUZType.get()
7778
f8E3M4 = lambda: Float8E3M4Type.get()
79+
f6E2M3FN = lambda: Float6E2M3FNType.get()
7880
f6E3M2FN = lambda: Float6E3M2FNType.get()
7981

8082
none = lambda: NoneType.get()

mlir/test/IR/attribute.mlir

+4
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@ func.func @any_attr_of_fail() {
3636
//===----------------------------------------------------------------------===//
3737

3838
func.func @float_attrs_pass() {
39+
"test.float_attrs"() {
40+
// CHECK: float_attr = 2.000000e+00 : f6E2M3FN
41+
float_attr = 2. : f6E2M3FN
42+
} : () -> ()
3943
"test.float_attrs"() {
4044
// CHECK: float_attr = 2.000000e+00 : f6E3M2FN
4145
float_attr = 2. : f6E3M2FN

mlir/test/Target/LLVMIR/llvmir.mlir

+3
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ llvm.mlir.global internal @int_global_undef() : i64
4242
// CHECK: @externally_initialized_global = internal externally_initialized global i32 0
4343
llvm.mlir.global internal @externally_initialized_global(0 : i32) {externally_initialized} : i32
4444

45+
// CHECK: @f6E2M3FN_global_as_i6 = internal global i6 12
46+
llvm.mlir.global internal @f6E2M3FN_global_as_i6(1.5 : f6E2M3FN) : i6
47+
4548
// CHECK: @f6E3M2FN_global_as_i6 = internal global i6 14
4649
llvm.mlir.global internal @f6E3M2FN_global_as_i6(1.5 : f6E3M2FN) : i6
4750

mlir/test/python/ir/builtin_types.py

+9
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,8 @@ def testTypeIsInstance():
113113
def testFloatTypeSubclasses():
114114
ctx = Context()
115115
# CHECK: True
116+
print(isinstance(Type.parse("f6E2M3FN", ctx), FloatType))
117+
# CHECK: True
116118
print(isinstance(Type.parse("f6E3M2FN", ctx), FloatType))
117119
# CHECK: True
118120
print(isinstance(Type.parse("f8E3M4", ctx), FloatType))
@@ -235,6 +237,8 @@ def testIndexType():
235237
@run
236238
def testFloatType():
237239
with Context():
240+
# CHECK: float: f6E2M3FN
241+
print("float:", Float6E2M3FNType.get())
238242
# CHECK: float: f6E3M2FN
239243
print("float:", Float6E3M2FNType.get())
240244
# CHECK: float: f8E3M4
@@ -613,6 +617,7 @@ def testTypeIDs():
613617
types = [
614618
(IntegerType, IntegerType.get_signless(16)),
615619
(IndexType, IndexType.get()),
620+
(Float6E2M3FNType, Float6E2M3FNType.get()),
616621
(Float6E3M2FNType, Float6E3M2FNType.get()),
617622
(Float8E3M4Type, Float8E3M4Type.get()),
618623
(Float8E4M3Type, Float8E4M3Type.get()),
@@ -639,6 +644,7 @@ def testTypeIDs():
639644

640645
# CHECK: IntegerType(i16)
641646
# CHECK: IndexType(index)
647+
# CHECK: Float6E2M3FNType(f6E2M3FN)
642648
# CHECK: Float6E3M2FNType(f6E3M2FN)
643649
# CHECK: Float8E3M4Type(f8E3M4)
644650
# CHECK: Float8E4M3Type(f8E4M3)
@@ -719,6 +725,9 @@ def print_downcasted(typ):
719725
# CHECK: F64Type
720726
# CHECK: F64Type(f64)
721727
print_downcasted(F64Type.get())
728+
# CHECK: Float6E2M3FNType
729+
# CHECK: Float6E2M3FNType(f6E2M3FN)
730+
print_downcasted(Float6E2M3FNType.get())
722731
# CHECK: Float6E3M2FNType
723732
# CHECK: Float6E3M2FNType(f6E3M2FN)
724733
print_downcasted(Float6E3M2FNType.get())

mlir/utils/lldb-scripts/mlirDataFormatters.py

+1
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ def build_ptr_str_from_addr(addrValue: lldb.SBValue, type: lldb.SBType):
5050
"mlir::CallSiteLoc": '"loc(callsite(...))"',
5151
"mlir::FusedLoc": '"loc(fused<...>[...])"',
5252
"mlir::UnknownLoc": '"loc(unknown)"',
53+
"mlir::Float6E2M3FNType": '"f6E2M3FN"',
5354
"mlir::Float6E3M2FNType": '"f6E3M2FN"',
5455
"mlir::Float8E5M2Type": '"f8E5M2"',
5556
"mlir::Float8E4M3Type": '"f8E4M3"',

mlir/utils/tree-sitter-mlir/grammar.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ const common = {
231231
token(seq(choice('si', 'ui', 'i'), /[1-9]/, repeat(/[0-9]/))),
232232
float_type : $ => token(
233233
choice('f16', 'f32', 'f64', 'f80', 'f128', 'bf16', 'f8E3M4', 'f8E4M3FN',
234-
'f8E4M3', 'f8E5M2', 'f6E3M2FN')),
234+
'f8E4M3', 'f8E5M2', 'f6E2M3FN', 'f6E3M2FN')),
235235
index_type : $ => token('index'),
236236
none_type : $ => token('none'),
237237
complex_type : $ => seq(token('complex'), '<', $._prim_type, '>'),

0 commit comments

Comments
 (0)