[Mlir-commits] [mlir] [MLIR][NVVM] Add support for nvvm.breakpoint Op (PR #107193)
Pradeep Kumar
llvmlistbot at llvm.org
Mon Sep 9 06:05:13 PDT 2024
https://github.com/schwarzschild-radius updated https://github.com/llvm/llvm-project/pull/107193
>From a202c51f0e6cb7a8fef4155128c85178dfa501a5 Mon Sep 17 00:00:00 2001
From: pradeepku <pradeepku at nvidia.com>
Date: Fri, 30 Aug 2024 19:47:17 +0530
Subject: [PATCH] [MLIR][NVVM] Add support for nvvm.breakpoint Op
This commit adds support for nvvm.breakpoint Op which lowers to the PTX brkpt instruction. Also, added the respective tests in nvvmir.mlir
---
mlir/include/mlir/Dialect/LLVMIR/NVVMOps.td | 17 +++++++++++++++++
mlir/test/Target/LLVMIR/nvvmir.mlir | 10 +++++++++-
2 files changed, 26 insertions(+), 1 deletion(-)
diff --git a/mlir/include/mlir/Dialect/LLVMIR/NVVMOps.td b/mlir/include/mlir/Dialect/LLVMIR/NVVMOps.td
index 709dd922b8fa2f..7bbf18fe0106fb 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..88ffb1c7bfdf7a 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
-}
\ No newline at end of file
+}
+
+// -----
+// CHECK-LABEL: @nvvm_breakpoint
+llvm.func @nvvm_breakpoint() {
+ // CHECK: call void @llvm.debugtrap()
+ nvvm.breakpoint
+ llvm.return
+}
More information about the Mlir-commits
mailing list