-
Notifications
You must be signed in to change notification settings - Fork 15.3k
[mlir][amdgpu] Add make_dma_base operation #169086
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
a4a1a59
d14f3e2
d3ca18c
a477104
08cd9fb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -33,6 +33,7 @@ def AMDGPU_Dialect : Dialect { | |
| "gpu::GPUDialect" | ||
| ]; | ||
| let useDefaultAttributePrinterParser = 1; | ||
| let useDefaultTypePrinterParser = 1; | ||
| } | ||
|
|
||
| def AnyIntegerOrFloat : AnyTypeOf<[AnySignlessInteger, AnyFloat], "Integer or Float">; | ||
|
|
@@ -79,6 +80,30 @@ def AMDGPU_AddressSpaceAttr : EnumAttr<AMDGPU_Dialect, AMDGPU_AddressSpace, | |
| let assemblyFormat = "`<` $value `>`"; | ||
| } | ||
|
|
||
| class AMDGPU_Type<string name, string typeMnemonic, list<Trait> traits = []> | ||
| : TypeDef<AMDGPU_Dialect, name, traits> { | ||
| let mnemonic = typeMnemonic; | ||
| } | ||
|
|
||
| //===----------------------------------------------------------------------===// | ||
| // AMDGPU Type definitions | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| def AMDGPU_TDMBaseType : AMDGPU_Type<"TDMBase", "tdm_base"> { | ||
| let summary = "Pair of base addresses that move data between LDS and global storage."; | ||
| let description = [{ | ||
| This type is opaque and it is used to represent a struct of two addresses. | ||
| One address is in LDS while the other is in global memory. | ||
| }]; | ||
| let parameters = (ins "Type":$elementType); | ||
| let builders = [ | ||
| TypeBuilderWithInferredContext<(ins "Type":$elementType), [{ | ||
| return $_get(elementType.getContext(), elementType); | ||
| }]> | ||
| ]; | ||
| let assemblyFormat = "`<` $elementType `>`"; | ||
| } | ||
|
|
||
| //===----------------------------------------------------------------------===// | ||
| // AMDGPU Op definitions | ||
| //===----------------------------------------------------------------------===// | ||
|
|
@@ -1192,4 +1217,35 @@ def AMDGPU_ScaledMFMAOp : | |
| }]; | ||
| let hasCanonicalizer = 1; | ||
| } | ||
|
|
||
| def AMDGPU_MakeDmaBaseOp : | ||
| AMDGPU_Op<"make_dma_base", [Pure, AttrSizedOperandSegments]>, | ||
| Arguments<(ins | ||
| Arg<AnyMemRef, "buffer to read from">:$src, | ||
| Variadic<Index>:$srcIndices, | ||
| Arg<AnyMemRef, "buffer to write to">:$dst, | ||
| Variadic<Index>:$dstIndices)>, | ||
| Results<(outs AMDGPU_TDMBaseType: $base)> { | ||
|
|
||
| // TODO: | ||
| // * Add verifiers such that one of the memrefs is from LDS and the other global. | ||
| // * Add verifiers to make sure that the type is in the correct direction. | ||
| // * Add verifiers to make sure that the number of indices do not exceed the number of dimensions. | ||
|
|
||
| let summary = "Pair of based addresses used when moving tiles between LDS and global memory."; | ||
| let description = [{ | ||
| This operation creates a pair of addresses that will be used by tensor_load_to_lds | ||
| and tensor_store_from_lds. | ||
|
|
||
| This operation creates a value corresponding to the tensor descriptor (D#) group 0 | ||
| found in TensorLoadToLDSOp and TensorStoreFromLDSOp in the rocdl dialect. | ||
|
|
||
| These tensor DMA operations were introduced in gfx1250. | ||
| }]; | ||
amd-eochoalo marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| let assemblyFormat = [{ | ||
| $src `[` $srcIndices `]` `,` $dst `[` $dstIndices `]` attr-dict `:` type($src) `,` type($dst) `to` type(results) | ||
| }]; | ||
| } | ||
|
|
||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok, so, are we making a separate type and op pair for gather mode DMA? Is that a future PR? (I ask because the gather flag lives in group 0)
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, I am following your design as closely as possible. |
||
| #endif // AMDGPU | ||
Uh oh!
There was an error while loading. Please reload this page.