@@ -1192,25 +1192,81 @@ def ROCDL_RawBufferAtomicCmpSwap :
11921192// Memory prefetch intrinsics
11931193
11941194def ROCDL_GlobalPrefetchOp :
1195- ROCDL_IntrOp<"global.prefetch", [], [], [], 0, 0, 0, 0, [1], ["scope"]>,
1196- Arguments<(ins Arg<LLVM_PointerInAddressSpace<1>, "", []>:$ptr, I32Attr:$scope)> {
1195+ ROCDL_IntrOp<"global.prefetch", [], [], [], 0, 0, 1, 0, [1], ["scope"]> {
1196+ dag args = (ins Arg<LLVM_PointerInAddressSpace<1>, "", [MemRead]>:$ptr,
1197+ I32Attr:$scope);
1198+ let arguments = !con(args, baseArgs);
11971199 let description = [{
11981200 Prefetches 1 byte of data per lane from global memory into the WGP-cache or L2-cache.
11991201 Available on gfx1250+.
12001202 }];
12011203 let results = (outs);
12021204 let assemblyFormat = "$ptr `,` `scope` $scope attr-dict `:` qualified(type($ptr))";
1205+ let extraClassDefinition = [{
1206+ SmallVector<Value> $cppClass::getAccessedOperands() {
1207+ return {getPtr()};
1208+ }
1209+ }];
12031210}
12041211
12051212def ROCDL_FlatPrefetchOp :
1206- ROCDL_IntrOp<"flat.prefetch", [], [], [], 0, 0, 0, 0, [1], ["scope"]>,
1207- Arguments<(ins Arg<LLVM_PointerInAddressSpace<0>, "", []>:$ptr, I32Attr:$scope)> {
1213+ ROCDL_IntrOp<"flat.prefetch", [], [], [], 0, 0, 1, 0, [1], ["scope"]> {
1214+ dag args = (ins Arg<LLVM_PointerInAddressSpace<0>, "", [MemRead]>:$ptr,
1215+ I32Attr:$scope);
1216+ let arguments = !con(args, baseArgs);
12081217 let description = [{
12091218 Prefetches 1 byte of data per lane using flat-memory addresses into the WGP-cache or L2-cache.
12101219 Available on gfx1250+.
12111220 }];
12121221 let results = (outs);
12131222 let assemblyFormat = "$ptr `,` `scope` $scope attr-dict `:` qualified(type($ptr))";
1223+ let extraClassDefinition = [{
1224+ SmallVector<Value> $cppClass::getAccessedOperands() {
1225+ return {getPtr()};
1226+ }
1227+ }];
1228+ }
1229+
1230+ //===---------------------------------------------------------------------===//
1231+ // Atomic barrier intrinsic (LDS memory barriers).
1232+
1233+ def ROCDL_DsAtomicBarrierArriveRtnOp :
1234+ ROCDL_IntrOp<"ds.atomic.barrier.arrive.rtn.b64", [], [], [], 1, 0, 1, 0, [], []> {
1235+ dag args = (ins Arg<ROCDLBufferLDS, "", [MemRead, MemWrite]>:$barrierPtr,
1236+ I64:$val);
1237+ let arguments = !con(args, baseArgs);
1238+ let description = [{
1239+ Waits on a given DS barrier and decrements its pending count by a given value. Note, the barrier state
1240+ is given as a 64-bit structure containing pending count, phase and init count. The op returns the old
1241+ barrier state. The op is executed as an ordinary LDS operations and it is ordered with other LDS operations.
1242+ Thus, check DSCNT to determine when this instruction has executed.
1243+ Available on gfx1250+.
1244+ }];
1245+ let results = (outs I64:$res);
1246+ let assemblyFormat = "$barrierPtr `,` $val attr-dict `:` qualified(type($barrierPtr)) `,` type($val) `->` type($res)";
1247+ let extraClassDefinition = [{
1248+ SmallVector<Value> $cppClass::getAccessedOperands() {
1249+ return {getBarrierPtr()};
1250+ }
1251+ }];
1252+ }
1253+
1254+ def ROCDL_DsAtomicAsyncBarrierArriveOp :
1255+ ROCDL_IntrOp<"ds.atomic.async.barrier.arrive.b64", [], [], [], 0, 0, 1, 0, [], []> {
1256+ dag args = (ins Arg<ROCDLBufferLDS, "", [MemWrite]>:$barrierPtr);
1257+ let arguments = !con(args, baseArgs);
1258+ let description = [{
1259+ Waits on a given DS barrier and decrements pending count by -1.
1260+ Stays in order with ASYNC loads to LDS, and uses ASYNCcnt to track its completion.
1261+ Available on gfx1250+.
1262+ }];
1263+ let results = (outs);
1264+ let assemblyFormat = "$barrierPtr attr-dict `:` qualified(type($barrierPtr))";
1265+ let extraClassDefinition = [{
1266+ SmallVector<Value> $cppClass::getAccessedOperands() {
1267+ return {getBarrierPtr()};
1268+ }
1269+ }];
12141270}
12151271
12161272//===---------------------------------------------------------------------===//
0 commit comments