Skip to content

Commit d163988

Browse files
authored
[MLIR][NVVM][NFC] Re-order mem_scope and shared_space attrs (#168348)
The mbarrier Ops also require access to the `mem_scope` and `shared_space` attributes. Hence, this patch moves their definitions to the beginning of the file alongside the other attribute definitions. Signed-off-by: Durgadoss R <[email protected]>
1 parent 4dd2796 commit d163988

File tree

1 file changed

+27
-26
lines changed

1 file changed

+27
-26
lines changed

mlir/include/mlir/Dialect/LLVMIR/NVVMOps.td

Lines changed: 27 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,33 @@ def NVVMMemorySpaceAttr :
228228
let assemblyFormat = "`<` $value `>`";
229229
}
230230

231+
// Attrs describing the scope of the Memory Operation
232+
def MemScopeKindCTA : I32EnumAttrCase<"CTA", 0, "cta">;
233+
def MemScopeKindCluster : I32EnumAttrCase<"CLUSTER", 1, "cluster">;
234+
def MemScopeKindGPU : I32EnumAttrCase<"GPU", 2, "gpu">;
235+
def MemScopeKindSYS : I32EnumAttrCase<"SYS", 3, "sys">;
236+
237+
def MemScopeKind : I32EnumAttr<"MemScopeKind", "NVVM Memory Scope kind",
238+
[MemScopeKindCTA, MemScopeKindCluster, MemScopeKindGPU, MemScopeKindSYS]> {
239+
let genSpecializedAttr = 0;
240+
let cppNamespace = "::mlir::NVVM";
241+
}
242+
def MemScopeKindAttr : EnumAttr<NVVM_Dialect, MemScopeKind, "mem_scope"> {
243+
let assemblyFormat = "`<` $value `>`";
244+
}
245+
246+
// Attrs to disambiguate the cta or cluster space within shared memory
247+
def SharedSpaceCTA : I32EnumAttrCase<"shared_cta", 0, "cta">;
248+
def SharedSpaceCluster : I32EnumAttrCase<"shared_cluster", 1, "cluster">;
249+
def SharedSpace : I32EnumAttr<"SharedSpace", "Shared memory space",
250+
[SharedSpaceCTA, SharedSpaceCluster]> {
251+
let genSpecializedAttr = 0;
252+
let cppNamespace = "::mlir::NVVM";
253+
}
254+
def SharedSpaceAttr : EnumAttr<NVVM_Dialect, SharedSpace, "shared_space"> {
255+
let assemblyFormat = "`<` $value `>`";
256+
}
257+
231258
//===----------------------------------------------------------------------===//
232259
// NVVM intrinsic operations
233260
//===----------------------------------------------------------------------===//
@@ -1107,17 +1134,6 @@ def NVVM_FenceScClusterOp : NVVM_Op<"fence.sc.cluster"> {
11071134
let assemblyFormat = "attr-dict";
11081135
}
11091136

1110-
def SharedSpaceCTA : I32EnumAttrCase<"shared_cta", 0, "cta">;
1111-
def SharedSpaceCluster : I32EnumAttrCase<"shared_cluster", 1, "cluster">;
1112-
def SharedSpace : I32EnumAttr<"SharedSpace", "Shared memory space",
1113-
[SharedSpaceCTA, SharedSpaceCluster]> {
1114-
let genSpecializedAttr = 0;
1115-
let cppNamespace = "::mlir::NVVM";
1116-
}
1117-
def SharedSpaceAttr : EnumAttr<NVVM_Dialect, SharedSpace, "shared_space"> {
1118-
let assemblyFormat = "`<` $value `>`";
1119-
}
1120-
11211137
def ProxyAlias : I32EnumAttrCase<"alias", 0, "alias">;
11221138
def ProxyAsync : I32EnumAttrCase<"async", 1, "async">;
11231139
def ProxyAsyncGlobal : I32EnumAttrCase<"async_global", 2, "async.global">;
@@ -1158,21 +1174,6 @@ def NVVM_FenceProxyOp : NVVM_PTXBuilder_Op<"fence.proxy">,
11581174
let hasVerifier = 1;
11591175
}
11601176

1161-
// Attrs describing the scope of the Memory Operation
1162-
def MemScopeKindCTA : I32EnumAttrCase<"CTA", 0, "cta">;
1163-
def MemScopeKindCluster : I32EnumAttrCase<"CLUSTER", 1, "cluster">;
1164-
def MemScopeKindGPU : I32EnumAttrCase<"GPU", 2, "gpu">;
1165-
def MemScopeKindSYS : I32EnumAttrCase<"SYS", 3, "sys">;
1166-
1167-
def MemScopeKind : I32EnumAttr<"MemScopeKind", "NVVM Memory Scope kind",
1168-
[MemScopeKindCTA, MemScopeKindCluster, MemScopeKindGPU, MemScopeKindSYS]> {
1169-
let genSpecializedAttr = 0;
1170-
let cppNamespace = "::mlir::NVVM";
1171-
}
1172-
def MemScopeKindAttr : EnumAttr<NVVM_Dialect, MemScopeKind, "mem_scope"> {
1173-
let assemblyFormat = "`<` $value `>`";
1174-
}
1175-
11761177
def NVVM_FenceProxyAcquireOp : NVVM_Op<"fence.proxy.acquire">,
11771178
Arguments<(ins MemScopeKindAttr:$scope, LLVM_PointerGeneric:$addr, I32:$size,
11781179
DefaultValuedAttr<ProxyKindAttr,

0 commit comments

Comments
 (0)