[MLIR] Add f8E8M0FNU type (#111028)
This PR adds `f8E8M0FNU` type to MLIR. `f8E8M0FNU` type is proposed in [OpenCompute MX Specification](https://www.opencompute.org/documents/ocp-microscaling-formats-mx-v1-0-spec-final-pdf). It defines a 8-bit floating point number with bit layout S0E8M0. Unlike IEEE-754 types, there are no infinity, denormals, zeros or negative values. ```c f8E8M0FNU - Exponent bias: 127 - Maximum stored exponent value: 254 (binary 1111'1110) - Maximum unbiased exponent value: 254 - 127 = 127 - Minimum stored exponent value: 0 (binary 0000'0000) - Minimum unbiased exponent value: 0 − 127 = -127 - Doesn't have zero - Doesn't have infinity - NaN is encoded as binary 1111'1111 Additional details: - Zeros cannot be represented - Negative values cannot be represented - Mantissa is always 1 ``` Related PRs: - [PR-107127](https://github.com/llvm/llvm-project/pull/107127) [APFloat] Add APFloat support for E8M0 type - [PR-105573](https://github.com/llvm/llvm-project/pull/105573) [MLIR] Add f6E3M2FN type - was used as a template for this PR - [PR-107999](https://github.com/llvm/llvm-project/pull/107999) [MLIR] Add f6E2M3FN type - [PR-108877](https://github.com/llvm/llvm-project/pull/108877) [MLIR] Add f4E2M1FN type
This commit is contained in:
@@ -179,6 +179,16 @@ MLIR_CAPI_EXPORTED bool mlirTypeIsAFloat8E3M4(MlirType type);
|
||||
/// context.
|
||||
MLIR_CAPI_EXPORTED MlirType mlirFloat8E3M4TypeGet(MlirContext ctx);
|
||||
|
||||
/// Returns the typeID of an Float8E8M0FNU type.
|
||||
MLIR_CAPI_EXPORTED MlirTypeID mlirFloat8E8M0FNUTypeGetTypeID(void);
|
||||
|
||||
/// Checks whether the given type is an f8E8M0FNU type.
|
||||
MLIR_CAPI_EXPORTED bool mlirTypeIsAFloat8E8M0FNU(MlirType type);
|
||||
|
||||
/// Creates an f8E8M0FNU type in the given context. The type is owned by the
|
||||
/// context.
|
||||
MLIR_CAPI_EXPORTED MlirType mlirFloat8E8M0FNUTypeGet(MlirContext ctx);
|
||||
|
||||
/// Returns the typeID of an BFloat16 type.
|
||||
MLIR_CAPI_EXPORTED MlirTypeID mlirBFloat16TypeGetTypeID(void);
|
||||
|
||||
|
||||
@@ -70,6 +70,7 @@ public:
|
||||
FloatType getFloat8E4M3FNUZType();
|
||||
FloatType getFloat8E4M3B11FNUZType();
|
||||
FloatType getFloat8E3M4Type();
|
||||
FloatType getFloat8E8M0FNUType();
|
||||
FloatType getBF16Type();
|
||||
FloatType getF16Type();
|
||||
FloatType getTF32Type();
|
||||
|
||||
@@ -70,6 +70,7 @@ public:
|
||||
static FloatType getFloat4E2M1FN(MLIRContext *ctx);
|
||||
static FloatType getFloat6E2M3FN(MLIRContext *ctx);
|
||||
static FloatType getFloat6E3M2FN(MLIRContext *ctx);
|
||||
static FloatType getFloat8E8M0FNU(MLIRContext *ctx);
|
||||
|
||||
/// Methods for support type inquiry through isa, cast, and dyn_cast.
|
||||
static bool classof(Type type);
|
||||
@@ -416,11 +417,12 @@ inline bool BaseMemRefType::isValidElementType(Type type) {
|
||||
}
|
||||
|
||||
inline bool FloatType::classof(Type type) {
|
||||
return llvm::isa<
|
||||
Float4E2M1FNType, Float6E2M3FNType, Float6E3M2FNType, Float8E5M2Type,
|
||||
Float8E4M3Type, Float8E4M3FNType, Float8E5M2FNUZType, Float8E4M3FNUZType,
|
||||
Float8E4M3B11FNUZType, Float8E3M4Type, BFloat16Type, Float16Type,
|
||||
FloatTF32Type, Float32Type, Float64Type, Float80Type, Float128Type>(type);
|
||||
return llvm::isa<Float4E2M1FNType, Float6E2M3FNType, Float6E3M2FNType,
|
||||
Float8E5M2Type, Float8E4M3Type, Float8E4M3FNType,
|
||||
Float8E5M2FNUZType, Float8E4M3FNUZType,
|
||||
Float8E4M3B11FNUZType, Float8E3M4Type, Float8E8M0FNUType,
|
||||
BFloat16Type, Float16Type, FloatTF32Type, Float32Type,
|
||||
Float64Type, Float80Type, Float128Type>(type);
|
||||
}
|
||||
|
||||
inline FloatType FloatType::getFloat4E2M1FN(MLIRContext *ctx) {
|
||||
@@ -463,6 +465,10 @@ inline FloatType FloatType::getFloat8E3M4(MLIRContext *ctx) {
|
||||
return Float8E3M4Type::get(ctx);
|
||||
}
|
||||
|
||||
inline FloatType FloatType::getFloat8E8M0FNU(MLIRContext *ctx) {
|
||||
return Float8E8M0FNUType::get(ctx);
|
||||
}
|
||||
|
||||
inline FloatType FloatType::getBF16(MLIRContext *ctx) {
|
||||
return BFloat16Type::get(ctx);
|
||||
}
|
||||
|
||||
@@ -296,6 +296,29 @@ def Builtin_Float6E3M2FN : Builtin_FloatType<"Float6E3M2FN", "f6E3M2FN"> {
|
||||
}];
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// Float8E8M0FNUType
|
||||
|
||||
def Builtin_Float8E8M0FNU : Builtin_FloatType<"Float8E8M0FNU", "f8E8M0FNU"> {
|
||||
let summary = "8-bit floating point with 8-bit exponent, no mantissa or sign";
|
||||
let description = [{
|
||||
An 8-bit floating point type with no sign bit, 8 bits exponent and no
|
||||
mantissa. This is not a standard type as defined by IEEE-754; it is intended
|
||||
to be used for representing scaling factors, so it cannot represent zeros
|
||||
and negative numbers. The values it can represent are powers of two in the
|
||||
range [-127,127] and NaN.
|
||||
|
||||
* bit encoding: S0E8M0
|
||||
* exponent bias: 127
|
||||
* infinities: Not supported
|
||||
* NaNs: Supported with all bits set to 1
|
||||
* denormals: Not supported
|
||||
|
||||
Open Compute Project (OCP) microscaling formats (MX) specification:
|
||||
https://www.opencompute.org/documents/ocp-microscaling-formats-mx-v1-0-spec-final-pdf
|
||||
}];
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// BFloat16Type
|
||||
|
||||
|
||||
@@ -353,6 +353,8 @@ def F6E2M3FN : Type<CPred<"$_self.isFloat6E2M3FN()">, "f6E2M3FN type">,
|
||||
BuildableType<"$_builder.getFloat6E2M3FNType()">;
|
||||
def F6E3M2FN : Type<CPred<"$_self.isFloat6E3M2FN()">, "f6E3M2FN type">,
|
||||
BuildableType<"$_builder.getFloat6E3M2FNType()">;
|
||||
def F8E8M0FNU : Type<CPred<"$_self.isFloat8E8M0FNU()">, "f8E8M0FNU type">,
|
||||
BuildableType<"$_builder.getFloat8E8M0FNUType()">;
|
||||
|
||||
def AnyComplex : Type<CPred<"::llvm::isa<::mlir::ComplexType>($_self)">,
|
||||
"complex-type", "::mlir::ComplexType">;
|
||||
|
||||
@@ -135,6 +135,7 @@ public:
|
||||
bool isFloat8E4M3FNUZ() const;
|
||||
bool isFloat8E4M3B11FNUZ() const;
|
||||
bool isFloat8E3M4() const;
|
||||
bool isFloat8E8M0FNU() const;
|
||||
bool isBF16() const;
|
||||
bool isF16() const;
|
||||
bool isTF32() const;
|
||||
|
||||
@@ -104,6 +104,7 @@ TOK_KEYWORD(f8E3M4)
|
||||
TOK_KEYWORD(f4E2M1FN)
|
||||
TOK_KEYWORD(f6E2M3FN)
|
||||
TOK_KEYWORD(f6E3M2FN)
|
||||
TOK_KEYWORD(f8E8M0FNU)
|
||||
TOK_KEYWORD(f128)
|
||||
TOK_KEYWORD(false)
|
||||
TOK_KEYWORD(floordiv)
|
||||
|
||||
@@ -49,6 +49,7 @@ OptionalParseResult Parser::parseOptionalType(Type &type) {
|
||||
case Token::kw_f8E4M3FNUZ:
|
||||
case Token::kw_f8E4M3B11FNUZ:
|
||||
case Token::kw_f8E3M4:
|
||||
case Token::kw_f8E8M0FNU:
|
||||
case Token::kw_bf16:
|
||||
case Token::kw_f16:
|
||||
case Token::kw_tf32:
|
||||
@@ -336,6 +337,9 @@ Type Parser::parseNonFunctionType() {
|
||||
case Token::kw_f8E3M4:
|
||||
consumeToken(Token::kw_f8E3M4);
|
||||
return builder.getFloat8E3M4Type();
|
||||
case Token::kw_f8E8M0FNU:
|
||||
consumeToken(Token::kw_f8E8M0FNU);
|
||||
return builder.getFloat8E8M0FNUType();
|
||||
case Token::kw_bf16:
|
||||
consumeToken(Token::kw_bf16);
|
||||
return builder.getBF16Type();
|
||||
|
||||
@@ -331,6 +331,27 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
/// Floating Point Type subclass - Float8E8M0FNUType.
|
||||
class PyFloat8E8M0FNUType
|
||||
: public PyConcreteType<PyFloat8E8M0FNUType, PyFloatType> {
|
||||
public:
|
||||
static constexpr IsAFunctionTy isaFunction = mlirTypeIsAFloat8E8M0FNU;
|
||||
static constexpr GetTypeIDFunctionTy getTypeIdFunction =
|
||||
mlirFloat8E8M0FNUTypeGetTypeID;
|
||||
static constexpr const char *pyClassName = "Float8E8M0FNUType";
|
||||
using PyConcreteType::PyConcreteType;
|
||||
|
||||
static void bindDerived(ClassTy &c) {
|
||||
c.def_static(
|
||||
"get",
|
||||
[](DefaultingPyMlirContext context) {
|
||||
MlirType t = mlirFloat8E8M0FNUTypeGet(context->get());
|
||||
return PyFloat8E8M0FNUType(context->getRef(), t);
|
||||
},
|
||||
py::arg("context") = py::none(), "Create a float8_e8m0fnu type.");
|
||||
}
|
||||
};
|
||||
|
||||
/// Floating Point Type subclass - BF16Type.
|
||||
class PyBF16Type : public PyConcreteType<PyBF16Type, PyFloatType> {
|
||||
public:
|
||||
@@ -953,6 +974,7 @@ void mlir::python::populateIRTypes(py::module &m) {
|
||||
PyFloat8E4M3B11FNUZType::bind(m);
|
||||
PyFloat8E5M2FNUZType::bind(m);
|
||||
PyFloat8E3M4Type::bind(m);
|
||||
PyFloat8E8M0FNUType::bind(m);
|
||||
PyBF16Type::bind(m);
|
||||
PyF16Type::bind(m);
|
||||
PyTF32Type::bind(m);
|
||||
|
||||
@@ -205,6 +205,18 @@ MlirType mlirFloat8E3M4TypeGet(MlirContext ctx) {
|
||||
return wrap(FloatType::getFloat8E3M4(unwrap(ctx)));
|
||||
}
|
||||
|
||||
MlirTypeID mlirFloat8E8M0FNUTypeGetTypeID() {
|
||||
return wrap(Float8E8M0FNUType::getTypeID());
|
||||
}
|
||||
|
||||
bool mlirTypeIsAFloat8E8M0FNU(MlirType type) {
|
||||
return unwrap(type).isFloat8E8M0FNU();
|
||||
}
|
||||
|
||||
MlirType mlirFloat8E8M0FNUTypeGet(MlirContext ctx) {
|
||||
return wrap(FloatType::getFloat8E8M0FNU(unwrap(ctx)));
|
||||
}
|
||||
|
||||
MlirTypeID mlirBFloat16TypeGetTypeID() {
|
||||
return wrap(BFloat16Type::getTypeID());
|
||||
}
|
||||
|
||||
@@ -250,7 +250,8 @@ Type LLVMTypeConverter::convertFloatType(FloatType type) const {
|
||||
if (type.isFloat8E5M2() || type.isFloat8E4M3() || type.isFloat8E4M3FN() ||
|
||||
type.isFloat8E5M2FNUZ() || type.isFloat8E4M3FNUZ() ||
|
||||
type.isFloat8E4M3B11FNUZ() || type.isFloat8E3M4() ||
|
||||
type.isFloat4E2M1FN() || type.isFloat6E2M3FN() || type.isFloat6E3M2FN())
|
||||
type.isFloat4E2M1FN() || type.isFloat6E2M3FN() || type.isFloat6E3M2FN() ||
|
||||
type.isFloat8E8M0FNU())
|
||||
return IntegerType::get(&getContext(), type.getWidth());
|
||||
return type;
|
||||
}
|
||||
|
||||
@@ -370,6 +370,7 @@ std::optional<FloatType> parseFloatType(MLIRContext *ctx, StringRef name) {
|
||||
.Case("f8E5M2FNUZ", b.getFloat8E5M2FNUZType())
|
||||
.Case("f8E4M3FNUZ", b.getFloat8E4M3FNUZType())
|
||||
.Case("f8E3M4", b.getFloat8E3M4Type())
|
||||
.Case("f8E8M0FNU", b.getFloat8E8M0FNUType())
|
||||
.Case("bf16", b.getBF16Type())
|
||||
.Case("f16", b.getF16Type())
|
||||
.Case("f32", b.getF32Type())
|
||||
|
||||
@@ -2593,6 +2593,7 @@ void AsmPrinter::Impl::printTypeImpl(Type type) {
|
||||
.Case<Float8E4M3FNUZType>([&](Type) { os << "f8E4M3FNUZ"; })
|
||||
.Case<Float8E4M3B11FNUZType>([&](Type) { os << "f8E4M3B11FNUZ"; })
|
||||
.Case<Float8E3M4Type>([&](Type) { os << "f8E3M4"; })
|
||||
.Case<Float8E8M0FNUType>([&](Type) { os << "f8E8M0FNU"; })
|
||||
.Case<BFloat16Type>([&](Type) { os << "bf16"; })
|
||||
.Case<Float16Type>([&](Type) { os << "f16"; })
|
||||
.Case<FloatTF32Type>([&](Type) { os << "tf32"; })
|
||||
|
||||
@@ -74,6 +74,10 @@ FloatType Builder::getFloat8E3M4Type() {
|
||||
return FloatType::getFloat8E3M4(context);
|
||||
}
|
||||
|
||||
FloatType Builder::getFloat8E8M0FNUType() {
|
||||
return FloatType::getFloat8E8M0FNU(context);
|
||||
}
|
||||
|
||||
FloatType Builder::getBF16Type() { return FloatType::getBF16(context); }
|
||||
|
||||
FloatType Builder::getF16Type() { return FloatType::getF16(context); }
|
||||
|
||||
@@ -121,6 +121,8 @@ const llvm::fltSemantics &FloatType::getFloatSemantics() {
|
||||
return APFloat::Float8E4M3B11FNUZ();
|
||||
if (llvm::isa<Float8E3M4Type>(*this))
|
||||
return APFloat::Float8E3M4();
|
||||
if (llvm::isa<Float8E8M0FNUType>(*this))
|
||||
return APFloat::Float8E8M0FNU();
|
||||
if (llvm::isa<BFloat16Type>(*this))
|
||||
return APFloat::BFloat();
|
||||
if (llvm::isa<Float16Type>(*this))
|
||||
|
||||
@@ -231,6 +231,7 @@ public:
|
||||
Float8E4M3FNUZType f8E4M3FNUZTy;
|
||||
Float8E4M3B11FNUZType f8E4M3B11FNUZTy;
|
||||
Float8E3M4Type f8E3M4Ty;
|
||||
Float8E8M0FNUType f8E8M0FNUTy;
|
||||
BFloat16Type bf16Ty;
|
||||
Float16Type f16Ty;
|
||||
FloatTF32Type tf32Ty;
|
||||
@@ -326,6 +327,7 @@ MLIRContext::MLIRContext(const DialectRegistry ®istry, Threading setting)
|
||||
impl->f8E4M3FNUZTy = TypeUniquer::get<Float8E4M3FNUZType>(this);
|
||||
impl->f8E4M3B11FNUZTy = TypeUniquer::get<Float8E4M3B11FNUZType>(this);
|
||||
impl->f8E3M4Ty = TypeUniquer::get<Float8E3M4Type>(this);
|
||||
impl->f8E8M0FNUTy = TypeUniquer::get<Float8E8M0FNUType>(this);
|
||||
impl->bf16Ty = TypeUniquer::get<BFloat16Type>(this);
|
||||
impl->f16Ty = TypeUniquer::get<Float16Type>(this);
|
||||
impl->tf32Ty = TypeUniquer::get<FloatTF32Type>(this);
|
||||
@@ -1049,6 +1051,9 @@ Float8E4M3B11FNUZType Float8E4M3B11FNUZType::get(MLIRContext *context) {
|
||||
Float8E3M4Type Float8E3M4Type::get(MLIRContext *context) {
|
||||
return context->getImpl().f8E3M4Ty;
|
||||
}
|
||||
Float8E8M0FNUType Float8E8M0FNUType::get(MLIRContext *context) {
|
||||
return context->getImpl().f8E8M0FNUTy;
|
||||
}
|
||||
BFloat16Type BFloat16Type::get(MLIRContext *context) {
|
||||
return context->getImpl().bf16Ty;
|
||||
}
|
||||
|
||||
@@ -49,6 +49,9 @@ bool Type::isFloat8E4M3FNUZ() const {
|
||||
bool Type::isFloat8E4M3B11FNUZ() const {
|
||||
return llvm::isa<Float8E4M3B11FNUZType>(*this);
|
||||
}
|
||||
bool Type::isFloat8E8M0FNU() const {
|
||||
return llvm::isa<Float8E8M0FNUType>(*this);
|
||||
}
|
||||
bool Type::isFloat8E3M4() const { return llvm::isa<Float8E3M4Type>(*this); }
|
||||
bool Type::isBF16() const { return llvm::isa<BFloat16Type>(*this); }
|
||||
bool Type::isF16() const { return llvm::isa<Float16Type>(*this); }
|
||||
|
||||
@@ -117,6 +117,7 @@ __all__ = [
|
||||
"Float8E4M3Type",
|
||||
"Float8E5M2FNUZType",
|
||||
"Float8E5M2Type",
|
||||
"Float8E8M0FNUType",
|
||||
"FloatAttr",
|
||||
"FloatTF32Type",
|
||||
"FloatType",
|
||||
@@ -1660,6 +1661,19 @@ class Float8E5M2Type(FloatType):
|
||||
@property
|
||||
def typeid(self) -> TypeID: ...
|
||||
|
||||
class Float8E8M0FNUType(FloatType):
|
||||
static_typeid: ClassVar[TypeID]
|
||||
@staticmethod
|
||||
def get(context: Context | None = None) -> Float8E8M0FNUType:
|
||||
"""
|
||||
Create a float8_e8m0fnu type.
|
||||
"""
|
||||
@staticmethod
|
||||
def isinstance(other: Type) -> bool: ...
|
||||
def __init__(self, cast_from_type: Type) -> None: ...
|
||||
@property
|
||||
def typeid(self) -> TypeID: ...
|
||||
|
||||
class FloatAttr(Attribute):
|
||||
static_typeid: ClassVar[TypeID]
|
||||
@staticmethod
|
||||
|
||||
@@ -20,6 +20,7 @@ from ..ir import (
|
||||
Float8E4M3FNType,
|
||||
Float8E4M3Type,
|
||||
Float8E5M2Type,
|
||||
Float8E8M0FNUType,
|
||||
FunctionType,
|
||||
IndexType,
|
||||
IntegerType,
|
||||
@@ -80,6 +81,7 @@ f8E3M4 = lambda: Float8E3M4Type.get()
|
||||
f4E2M1FN = lambda: Float4E2M1FNType.get()
|
||||
f6E2M3FN = lambda: Float6E2M3FNType.get()
|
||||
f6E3M2FN = lambda: Float6E3M2FNType.get()
|
||||
f8E8M0FNU = lambda: Float8E8M0FNUType.get()
|
||||
|
||||
none = lambda: NoneType.get()
|
||||
|
||||
|
||||
@@ -76,6 +76,10 @@ func.func @float_attrs_pass() {
|
||||
// CHECK: float_attr = 2.000000e+00 : f8E3M4
|
||||
float_attr = 2. : f8E3M4
|
||||
} : () -> ()
|
||||
"test.float_attrs"() {
|
||||
// CHECK: float_attr = 2.000000e+00 : f8E8M0FNU
|
||||
float_attr = 2. : f8E8M0FNU
|
||||
} : () -> ()
|
||||
"test.float_attrs"() {
|
||||
// CHECK: float_attr = 2.000000e+00 : f16
|
||||
float_attr = 2. : f16
|
||||
|
||||
@@ -72,6 +72,9 @@ llvm.mlir.global internal @f8E5M2FNUZ_global_as_i8(1.5 : f8E5M2FNUZ) : i8
|
||||
// CHECK: @f8E4M3B11FNUZ_global_as_i8 = internal global i8 92
|
||||
llvm.mlir.global internal @f8E4M3B11FNUZ_global_as_i8(1.5 : f8E4M3B11FNUZ) : i8
|
||||
|
||||
// CHECK: @f8E8M0FNU_global_as_i8 = internal global i8 127
|
||||
llvm.mlir.global internal @f8E8M0FNU_global_as_i8(1.0 : f8E8M0FNU) : i8
|
||||
|
||||
// CHECK: @bf16_global_as_i16 = internal global i16 16320
|
||||
llvm.mlir.global internal @bf16_global_as_i16(1.5 : bf16) : i16
|
||||
|
||||
|
||||
@@ -133,6 +133,8 @@ def testFloatTypeSubclasses():
|
||||
# CHECK: True
|
||||
print(isinstance(Type.parse("f8E5M2FNUZ", ctx), FloatType))
|
||||
# CHECK: True
|
||||
print(isinstance(Type.parse("f8E8M0FNU", ctx), FloatType))
|
||||
# CHECK: True
|
||||
print(isinstance(Type.parse("f16", ctx), FloatType))
|
||||
# CHECK: True
|
||||
print(isinstance(Type.parse("bf16", ctx), FloatType))
|
||||
@@ -259,6 +261,8 @@ def testFloatType():
|
||||
print("float:", Float8E4M3FNUZType.get())
|
||||
# CHECK: float: f8E4M3B11FNUZ
|
||||
print("float:", Float8E4M3B11FNUZType.get())
|
||||
# CHECK: float: f8E8M0FNU
|
||||
print("float:", Float8E8M0FNUType.get())
|
||||
# CHECK: float: bf16
|
||||
print("float:", BF16Type.get())
|
||||
# CHECK: float: f16
|
||||
@@ -631,6 +635,7 @@ def testTypeIDs():
|
||||
(Float8E4M3FNUZType, Float8E4M3FNUZType.get()),
|
||||
(Float8E4M3B11FNUZType, Float8E4M3B11FNUZType.get()),
|
||||
(Float8E5M2FNUZType, Float8E5M2FNUZType.get()),
|
||||
(Float8E8M0FNUType, Float8E8M0FNUType.get()),
|
||||
(BF16Type, BF16Type.get()),
|
||||
(F16Type, F16Type.get()),
|
||||
(F32Type, F32Type.get()),
|
||||
@@ -659,6 +664,7 @@ def testTypeIDs():
|
||||
# CHECK: Float8E4M3FNUZType(f8E4M3FNUZ)
|
||||
# CHECK: Float8E4M3B11FNUZType(f8E4M3B11FNUZ)
|
||||
# CHECK: Float8E5M2FNUZType(f8E5M2FNUZ)
|
||||
# CHECK: Float8E8M0FNUType(f8E8M0FNU)
|
||||
# CHECK: BF16Type(bf16)
|
||||
# CHECK: F16Type(f16)
|
||||
# CHECK: F32Type(f32)
|
||||
@@ -761,6 +767,9 @@ def testConcreteTypesRoundTrip():
|
||||
# CHECK: Float8E5M2FNUZType
|
||||
# CHECK: Float8E5M2FNUZType(f8E5M2FNUZ)
|
||||
print_downcasted(Float8E5M2FNUZType.get())
|
||||
# CHECK: Float8E8M0FNUType
|
||||
# CHECK: Float8E8M0FNUType(f8E8M0FNU)
|
||||
print_downcasted(Float8E8M0FNUType.get())
|
||||
# CHECK: BF16Type
|
||||
# CHECK: BF16Type(bf16)
|
||||
print_downcasted(BF16Type.get())
|
||||
|
||||
@@ -60,6 +60,7 @@ builtin_attr_type_mnemonics = {
|
||||
"mlir::Float8E4M3FNUZType": '"f8E4M3FNUZ"',
|
||||
"mlir::Float8E4M3B11FNUZType": '"f8E4M3B11FNUZ"',
|
||||
"mlir::Float8E3M4Type": '"f8E3M4"',
|
||||
"mlir::Float8E8M0FNUType": '"f8E8M0FNU"',
|
||||
"mlir::BFloat16Type": '"bf16"',
|
||||
"mlir::Float16Type": '"f16"',
|
||||
"mlir::FloatTF32Type": '"tf32"',
|
||||
|
||||
@@ -231,7 +231,8 @@ const common = {
|
||||
token(seq(choice('si', 'ui', 'i'), /[1-9]/, repeat(/[0-9]/))),
|
||||
float_type : $ => token(
|
||||
choice('f16', 'f32', 'f64', 'f80', 'f128', 'bf16', 'f8E3M4', 'f8E4M3FN',
|
||||
'f8E4M3', 'f8E5M2', 'f4E2M1FN', 'f6E2M3FN', 'f6E3M2FN')),
|
||||
'f8E4M3', 'f8E5M2', 'f4E2M1FN', 'f6E2M3FN', 'f6E3M2FN',
|
||||
'f8E8M0FNU')),
|
||||
index_type : $ => token('index'),
|
||||
none_type : $ => token('none'),
|
||||
complex_type : $ => seq(token('complex'), '<', $._prim_type, '>'),
|
||||
|
||||
Reference in New Issue
Block a user