[Mlir-commits] [mlir] [MLIR][NVVM] Add support for nvvm.breakpoint Op (PR #107193)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Wed Sep 4 00:42:52 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-mlir
Author: Pradeep Kumar (schwarzschild-radius)
<details>
<summary>Changes</summary>
This commit adds support for `nvvm.breakpoint` Op which lowers to the PTX brkpt instruction. Also, added the respective tests in `nvvmir.mlir`
---
Full diff: https://github.com/llvm/llvm-project/pull/107193.diff
2 Files Affected:
- (modified) mlir/include/mlir/Dialect/LLVMIR/NVVMOps.td (+17)
- (modified) mlir/test/Target/LLVMIR/nvvmir.mlir (+8)
``````````diff
diff --git a/mlir/include/mlir/Dialect/LLVMIR/NVVMOps.td b/mlir/include/mlir/Dialect/LLVMIR/NVVMOps.td
index 709dd922b8fa2f..adf0bcee50e5ea 100644
--- a/mlir/include/mlir/Dialect/LLVMIR/NVVMOps.td
+++ b/mlir/include/mlir/Dialect/LLVMIR/NVVMOps.td
@@ -2101,6 +2101,23 @@ def NVVM_WgmmaMmaAsyncOp : NVVM_Op<"wgmma.mma_async",
}];
}
+//===----------------------------------------------------------------------===//
+// NVVM breakpoint Op
+//===----------------------------------------------------------------------===//
+
+def NVVM_Breakpoint : NVVM_Op<"breakpoint"> {
+ let summary = "Breakpoint Op";
+ let description = [{
+ breakpoint suspends execution of the program for debugging.
+ [For more information, see PTX ISA](https://docs.nvidia.com/cuda/parallel-thread-execution/index.html#miscellaneous-instructions-brkpt)
+ }];
+ string llvmBuilder = [{
+ createIntrinsicCall(builder, llvm::Intrinsic::debugtrap);
+ }];
+
+ let assemblyFormat = "attr-dict";
+}
+
//===----------------------------------------------------------------------===//
// NVVM target attribute.
//===----------------------------------------------------------------------===//
diff --git a/mlir/test/Target/LLVMIR/nvvmir.mlir b/mlir/test/Target/LLVMIR/nvvmir.mlir
index 6e2787d121ae64..35f159840d7314 100644
--- a/mlir/test/Target/LLVMIR/nvvmir.mlir
+++ b/mlir/test/Target/LLVMIR/nvvmir.mlir
@@ -610,4 +610,12 @@ llvm.func @nvvm_fence_proxy_tensormap_generic_acquire(%addr : !llvm.ptr) {
// CHECK: call void @llvm.nvvm.fence.proxy.tensormap_generic.acquire.sys(ptr {{%[0-9]+}}, i32 128)
nvvm.fence.proxy.acquire #nvvm.mem_scope<sys> %addr, %c128
llvm.return
+}
+
+// -----
+// CHECK-LABEL: @nvvm_breakpoint
+llvm.func @nvvm_breakpoint() {
+ // CHECK: call void @llvm.debugtrap()
+ nvvm.breakpoint
+ llvm.return
}
\ No newline at end of file
``````````
</details>
https://github.com/llvm/llvm-project/pull/107193
More information about the Mlir-commits
mailing list