@@ -33,6 +33,7 @@ def AMDGPU_Dialect : Dialect {
3333 "gpu::GPUDialect"
3434 ];
3535 let useDefaultAttributePrinterParser = 1;
36+ let useDefaultTypePrinterParser = 1;
3637}
3738
3839def AnyIntegerOrFloat : AnyTypeOf<[AnySignlessInteger, AnyFloat], "Integer or Float">;
@@ -79,6 +80,30 @@ def AMDGPU_AddressSpaceAttr : EnumAttr<AMDGPU_Dialect, AMDGPU_AddressSpace,
7980 let assemblyFormat = "`<` $value `>`";
8081}
8182
83+ class AMDGPU_Type<string name, string typeMnemonic, list<Trait> traits = []>
84+ : TypeDef<AMDGPU_Dialect, name, traits> {
85+ let mnemonic = typeMnemonic;
86+ }
87+
88+ //===----------------------------------------------------------------------===//
89+ // AMDGPU Type definitions
90+ //===----------------------------------------------------------------------===//
91+
92+ def AMDGPU_TDMBaseType : AMDGPU_Type<"TDMBase", "tdm_base"> {
93+ let summary = "Pair of base addresses that move data between LDS and global storage.";
94+ let description = [{
95+ This type is opaque and it is used to represent a struct of two addresses.
96+ One address is in LDS while the other is in global memory.
97+ }];
98+ let parameters = (ins "Type":$elementType);
99+ let builders = [
100+ TypeBuilderWithInferredContext<(ins "Type":$elementType), [{
101+ return $_get(elementType.getContext(), elementType);
102+ }]>
103+ ];
104+ let assemblyFormat = "`<` $elementType `>`";
105+ }
106+
82107//===----------------------------------------------------------------------===//
83108// AMDGPU Op definitions
84109//===----------------------------------------------------------------------===//
@@ -1192,4 +1217,35 @@ def AMDGPU_ScaledMFMAOp :
11921217 }];
11931218 let hasCanonicalizer = 1;
11941219}
1220+
1221+ def AMDGPU_MakeDmaBaseOp :
1222+ AMDGPU_Op<"make_dma_base", [Pure, AttrSizedOperandSegments]>,
1223+ Arguments<(ins
1224+ Arg<AnyMemRef, "buffer to read from">:$src,
1225+ Variadic<Index>:$srcIndices,
1226+ Arg<AnyMemRef, "buffer to write to">:$dst,
1227+ Variadic<Index>:$dstIndices)>,
1228+ Results<(outs AMDGPU_TDMBaseType: $base)> {
1229+
1230+ // TODO:
1231+ // * Add verifiers such that one of the memrefs is from LDS and the other global.
1232+ // * Add verifiers to make sure that the type is in the correct direction.
1233+ // * Add verifiers to make sure that the number of indices do not exceed the number of dimensions.
1234+
1235+ let summary = "Pair of based addresses used when moving tiles between LDS and global memory.";
1236+ let description = [{
1237+ This operation creates a pair of addresses that will be used by tensor_load_to_lds
1238+ and tensor_store_from_lds.
1239+
1240+ This operation creates a value corresponding to the tensor descriptor (D#) group 0
1241+ found in TensorLoadToLDSOp and TensorStoreFromLDSOp in the rocdl dialect.
1242+
1243+ These tensor DMA operations were introduced in gfx1250.
1244+ }];
1245+
1246+ let assemblyFormat = [{
1247+ $src `[` $srcIndices `]` `,` $dst `[` $dstIndices `]` attr-dict `:` type($src) `,` type($dst) `to` type(results)
1248+ }];
1249+ }
1250+
11951251#endif // AMDGPU
0 commit comments