@@ -400,6 +400,55 @@ def NVVM_FenceScClusterOp : NVVM_Op<"fence.sc.cluster"> {
400
400
let assemblyFormat = "attr-dict";
401
401
}
402
402
403
+ def SharedSpaceCTA : I32EnumAttrCase<"shared_cta", 0, "cta">;
404
+ def SharedSpaceCluster : I32EnumAttrCase<"shared_cluster", 1, "cluster">;
405
+ def SharedSpace : I32EnumAttr<"SharedSpace", "Shared memory space",
406
+ [SharedSpaceCTA, SharedSpaceCluster]> {
407
+ let genSpecializedAttr = 0;
408
+ let cppNamespace = "::mlir::NVVM";
409
+ }
410
+ def SharedSpaceAttr : EnumAttr<NVVM_Dialect, SharedSpace, "shared_space"> {
411
+ let assemblyFormat = "`<` $value `>`";
412
+ }
413
+
414
+ def ProxyAlias : I32EnumAttrCase<"alias", 0, "alias">;
415
+ def ProxyAsync : I32EnumAttrCase<"async", 1, "async">;
416
+ def ProxyAsyncGlobal : I32EnumAttrCase<"async_global", 2, "async.global">;
417
+ def ProxyAsyncShared : I32EnumAttrCase<"async_shared", 3, "async.shared">;
418
+ def ProxyKind : I32EnumAttr<"ProxyKind", "Proxy kind",
419
+ [ProxyAlias, ProxyAsync, ProxyAsyncGlobal, ProxyAsyncShared]> {
420
+ let genSpecializedAttr = 0;
421
+ let cppNamespace = "::mlir::NVVM";
422
+ }
423
+
424
+ def ProxyKindAttr : EnumAttr<NVVM_Dialect, ProxyKind, "proxy_kind"> {
425
+ let assemblyFormat = "`<` $value `>`";
426
+ }
427
+
428
+ def NVVM_FenceProxyOp : NVVM_PTXBuilder_Op<"fence.proxy">,
429
+ Arguments<(ins ProxyKindAttr:$kind,
430
+ OptionalAttr<SharedSpaceAttr>:$space)> {
431
+ let description = [{
432
+ Fence operation with proxy to establish an ordering between memory accesses
433
+ that may happen through different proxies.
434
+ [For more information, see PTX ISA]
435
+ (https://docs.nvidia.com/cuda/parallel-thread-execution/index.html#parallel-synchronization-and-communication-instructions-membar)
436
+ }];
437
+
438
+ let assemblyFormat = "attr-dict";
439
+ let extraClassDefinition = [{
440
+ std::string $cppClass::getPtx() {
441
+ std::string ptx = "fence.proxy.";
442
+ ptx += stringifyProxyKind(getKind());
443
+ if(getKind() == NVVM::ProxyKind::async_shared)
444
+ { ptx += "::"; ptx += stringifySharedSpace(getSpace().value()); }
445
+ ptx += ";";
446
+ return ptx;
447
+ }
448
+ }];
449
+ let hasVerifier = 1;
450
+ }
451
+
403
452
def SetMaxRegisterActionIncrease : I32EnumAttrCase<"increase", 0>;
404
453
def SetMaxRegisterActionDecrease : I32EnumAttrCase<"decrease", 1>;
405
454
def SetMaxRegisterAction : I32EnumAttr<"SetMaxRegisterAction", "NVVM set max register action",
0 commit comments