@@ -48,8 +48,9 @@ class TPU_Attr<string name, string mnemonic_, list<Trait> traits = []>
4848// TODO(b/369418606): Find out the way to verify vreg size.
4949def TPU_Vreg : Type<IsVectorOfNonZeroRankTypePred, "native-sized vreg", "::mlir::VectorType">;
5050
51- class TPU_Type<string name, string mnemonic_, list<Trait> traits = []>
52- : TypeDef<TPU_Dialect, name, traits> {
51+ class TPU_Type<string name, string mnemonic_, list<Trait> traits = [],
52+ string baseCppType = "::mlir::Type">
53+ : TypeDef<TPU_Dialect, name, traits, baseCppType> {
5354 let mnemonic = mnemonic_;
5455}
5556
@@ -82,6 +83,25 @@ def TPU_SemaphoreType : TPU_Type<"Semaphore", "semaphore", [MemRefElementTypeInt
8283def TPU_DMASemaphoreType : TPU_Type<"DMASemaphore", "dma_semaphore", [MemRefElementTypeInterface]>;
8384def TPU_SomeSemaphoreType : AnyTypeOf<[TPU_SemaphoreType, TPU_DMASemaphoreType]>;
8485
86+ def TPU_Float8EXMYType : TPU_Type<"Float8EXMY", "float8_exmy",
87+ [DeclareTypeInterfaceMethods<FloatTypeInterface, ["getFloatSemantics"]>]> {
88+ let summary = "EXMY type in a nearest power-of-2 bitwidth type container";
89+ let description = [{
90+ EXMY type in a nearest power-of-2 bitwidth type container. Meaningful bits
91+ are aligned to LSB, and bits higher than the underlying exmy type in the
92+ container are considered as ignored. See https://arxiv.org/abs/2405.13938
93+ for more details.
94+ }];
95+
96+ let parameters = (ins
97+ TypeParameter<"::mlir::Type", "Underlying EXMY type">:$underlying_type
98+ );
99+
100+ let assemblyFormat = [{
101+ `<` $underlying_type `>`
102+ }];
103+ }
104+
85105def TPU_DimensionSemantics : I32EnumAttr<"DimensionSemantics", "Dimension semantics", [
86106 I32EnumAttrCase<"parallel", 0>,
87107 I32EnumAttrCase<"arbitrary", 1>,
0 commit comments