Skip to content

Commit 90c7600

Browse files
authored
[MLIR][NVVM] Add exit (#120251)
PR adds `exit` instruction to nvvm dialect.
1 parent a57f4c7 commit 90c7600

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

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

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2316,6 +2316,20 @@ def NVVM_WgmmaMmaAsyncOp : NVVM_Op<"wgmma.mma_async",
23162316
}];
23172317
}
23182318

2319+
def NVVM_Exit : NVVM_Op<"exit"> {
2320+
let summary = "Exit Op";
2321+
let description = [{
2322+
Ends execution of a thread.
2323+
[For more information, see PTX ISA](https://docs.nvidia.com/cuda/parallel-thread-execution/index.html#control-flow-instructions-exit)
2324+
}];
2325+
string llvmBuilder = [{
2326+
createIntrinsicCall(builder, llvm::Intrinsic::nvvm_exit);
2327+
}];
2328+
2329+
let assemblyFormat = "attr-dict";
2330+
}
2331+
2332+
23192333
//===----------------------------------------------------------------------===//
23202334
// NVVM breakpoint Op
23212335
//===----------------------------------------------------------------------===//

mlir/test/Target/LLVMIR/nvvmir.mlir

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -696,6 +696,16 @@ llvm.func @nvvm_fence_proxy_tensormap_generic_acquire(%addr : !llvm.ptr) {
696696
nvvm.fence.proxy.acquire #nvvm.mem_scope<sys> %addr, %c128
697697
llvm.return
698698
}
699+
// -----
700+
701+
// CHECK-LABEL: @nvvm_exit
702+
llvm.func @nvvm_exit() {
703+
// CHECK: call void @llvm.nvvm.exit()
704+
nvvm.exit
705+
llvm.return
706+
}
707+
708+
699709

700710
// -----
701711
// CHECK-LABEL: @nvvm_breakpoint

0 commit comments

Comments
 (0)