Skip to content

Commit ade67f5

Browse files
ravil-mobilegithub-actions[bot]
authored andcommitted
Automerge: [ROCDL] Added asynccnt and tensorcnt wait ops (gfx1250) (#163533)
This patch introduces some missing `s.wait.asynccnt` and `tensorcnt` instructions in the ROCDL dialect. The op is lowered to `@llvm.amdgcn.s.wait.asynccnt(i16 0)` and `@llvm.amdgcn.s.wait.tensorcnt(i16 0)` intrinsic calls
2 parents 4f83264 + a561a08 commit ade67f5

File tree

3 files changed

+54
-0
lines changed

3 files changed

+54
-0
lines changed

mlir/include/mlir/Dialect/LLVMIR/ROCDLOps.td

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -412,6 +412,32 @@ def ROCDL_WaitExpcntOp: ROCDL_ConcreteNonMemIntrOp<"s.wait.expcnt", [], 0, [0],
412412
let assemblyFormat = "$count attr-dict";
413413
}
414414

415+
def ROCDL_WaitAsynccntOp: ROCDL_ConcreteNonMemIntrOp<"s.wait.asynccnt", [], 0, [0], ["count"]>,
416+
Arguments<(ins I16Attr:$count)> {
417+
let summary = "Wait until ASYNCCNT is less than or equal to `count`";
418+
let description = [{
419+
Wait for the counter specified to be less-than or equal-to the `count`
420+
before continuing.
421+
422+
Available on gfx1250+.
423+
}];
424+
let results = (outs);
425+
let assemblyFormat = "$count attr-dict";
426+
}
427+
428+
def ROCDL_WaitTensorcntOp: ROCDL_ConcreteNonMemIntrOp<"s.wait.tensorcnt", [], 0, [0], ["count"]>,
429+
Arguments<(ins I16Attr:$count)> {
430+
let summary = "Wait until TENSORCNT is less than or equal to `count`";
431+
let description = [{
432+
Wait for the counter specified to be less-than or equal-to the `count`
433+
before continuing.
434+
435+
Available on gfx1250+.
436+
}];
437+
let results = (outs);
438+
let assemblyFormat = "$count attr-dict";
439+
}
440+
415441
def ROCDL_SetPrioOp : ROCDL_ConcreteNonMemIntrOp<"s.setprio", [], 0, [0], ["priority"]>,
416442
Arguments<(ins I16Attr:$priority)> {
417443
let assemblyFormat = "$priority attr-dict";

mlir/test/Dialect/LLVMIR/rocdl.mlir

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1035,6 +1035,20 @@ llvm.func @rocdl.s.wait.expcnt() {
10351035
llvm.return
10361036
}
10371037

1038+
llvm.func @rocdl.s.wait.asynccnt() {
1039+
// CHECK-LABEL: rocdl.s.wait.asynccnt
1040+
// CHECK: rocdl.s.wait.asynccnt 0
1041+
rocdl.s.wait.asynccnt 0
1042+
llvm.return
1043+
}
1044+
1045+
llvm.func @rocdl.s.wait.tensorcnt() {
1046+
// CHECK-LABEL: rocdl.s.wait.tensorcnt
1047+
// CHECK: rocdl.s.wait.tensorcnt 0
1048+
rocdl.s.wait.tensorcnt 0
1049+
llvm.return
1050+
}
1051+
10381052
// -----
10391053

10401054
llvm.func @rocdl.readfirstlane(%src : f32) -> f32 {

mlir/test/Target/LLVMIR/rocdl.mlir

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,20 @@ llvm.func @rocdl.s.wait.expcnt() {
276276
llvm.return
277277
}
278278

279+
llvm.func @rocdl.s.wait.asynccnt() {
280+
// CHECK-LABEL: rocdl.s.wait.asynccnt
281+
// CHECK-NEXT: call void @llvm.amdgcn.s.wait.asynccnt(i16 0)
282+
rocdl.s.wait.asynccnt 0
283+
llvm.return
284+
}
285+
286+
llvm.func @rocdl.s.wait.tensorcnt() {
287+
// CHECK-LABEL: rocdl.s.wait.tensorcnt
288+
// CHECK-NEXT: call void @llvm.amdgcn.s.wait.tensorcnt(i16 0)
289+
rocdl.s.wait.tensorcnt 0
290+
llvm.return
291+
}
292+
279293
llvm.func @rocdl.setprio() {
280294
// CHECK: call void @llvm.amdgcn.s.setprio(i16 0)
281295
rocdl.s.setprio 0

0 commit comments

Comments
 (0)