[Mlir-commits] [mlir] [MLIR][GPU][NVVM] Add verify-target-arch option to nvvm-attach-target pass (PR #176774)
Srinivasa Ravi
llvmlistbot at llvm.org
Mon Jan 19 08:10:38 PST 2026
https://github.com/Wolfram70 created https://github.com/llvm/llvm-project/pull/176774
This change adds the `verify-target-arch` option to the `nvvm-attach-target` to control the `verifyTarget` parameter in the attached `NVVMTargetAttr` which is used to enable/disable the verification of the target architecture with respect to the NVVM Ops.
>From 92ad94ff2703c3aa1080e204cb54d8980a2cc88f Mon Sep 17 00:00:00 2001
From: Srinivasa Ravi <srinivasar at nvidia.com>
Date: Thu, 15 Jan 2026 07:11:21 +0000
Subject: [PATCH] [MLIR][GPU][NVVM] Add option to control target arch
verification in nvvm-attach-target pass
This change adds the `verify-target-arch` option to the `nvvm-attach-target`
to control the `verifyTarget` parameter in the attached NVVMTargetAttr
which is used to enable/disable the verification of the target architecture
with respect to the NVVM Ops.
---
mlir/include/mlir/Dialect/GPU/Transforms/Passes.td | 3 +++
mlir/lib/Dialect/GPU/Transforms/NVVMAttachTarget.cpp | 3 ++-
mlir/test/Dialect/GPU/nvvm-attach-target.mlir | 2 ++
3 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/mlir/include/mlir/Dialect/GPU/Transforms/Passes.td b/mlir/include/mlir/Dialect/GPU/Transforms/Passes.td
index 3a4e5d706825e..1832919133bba 100644
--- a/mlir/include/mlir/Dialect/GPU/Transforms/Passes.td
+++ b/mlir/include/mlir/Dialect/GPU/Transforms/Passes.td
@@ -162,6 +162,9 @@ def GpuNVVMAttachTarget: Pass<"nvvm-attach-target", ""> {
Option<"cmdOptions", "ptxas-cmd-options", "std::string",
/*default=*/ [{""}],
"Command line options passed to downstream compiler">,
+ Option<"verifyTarget", "verify-target-arch", "bool",
+ /*default=*/"true",
+ "Enable verification of the target architecture">,
];
}
diff --git a/mlir/lib/Dialect/GPU/Transforms/NVVMAttachTarget.cpp b/mlir/lib/Dialect/GPU/Transforms/NVVMAttachTarget.cpp
index a6f7464012f3a..a28237913ce2a 100644
--- a/mlir/lib/Dialect/GPU/Transforms/NVVMAttachTarget.cpp
+++ b/mlir/lib/Dialect/GPU/Transforms/NVVMAttachTarget.cpp
@@ -80,7 +80,8 @@ void NVVMAttachTarget::runOnOperation() {
SmallVector<StringRef> filesToLink(libs);
auto target = builder.getAttr<NVVMTargetAttr>(
optLevel, triple, chip, features, getFlags(builder),
- filesToLink.empty() ? nullptr : builder.getStrArrayAttr(filesToLink));
+ filesToLink.empty() ? nullptr : builder.getStrArrayAttr(filesToLink),
+ verifyTarget);
llvm::Regex matcher(moduleMatcher);
for (Region ®ion : getOperation()->getRegions())
for (Block &block : region.getBlocks())
diff --git a/mlir/test/Dialect/GPU/nvvm-attach-target.mlir b/mlir/test/Dialect/GPU/nvvm-attach-target.mlir
index 35450e0ad6b1b..baa3ae58dda17 100644
--- a/mlir/test/Dialect/GPU/nvvm-attach-target.mlir
+++ b/mlir/test/Dialect/GPU/nvvm-attach-target.mlir
@@ -1,10 +1,12 @@
// RUN: mlir-opt %s --nvvm-attach-target="" | FileCheck %s
// RUN: mlir-opt %s --nvvm-attach-target="ptxas-cmd-options=--register-usage-level=8" | FileCheck %s -check-prefix=CHECK-OPTIONS
+// RUN: mlir-opt %s --nvvm-attach-target="verify-target-arch=false" | FileCheck %s -check-prefix=CHECK-DISABLE-VERIFYTARGET
module attributes {gpu.container_module} {
// CHECK-LABEL:gpu.module @kernel_module1
// CHECK: [#nvvm.target]
// CHECK-OPTIONS: [#nvvm.target<flags = {"ptxas-cmd-options" = ["--register-usage-level=8"]}>]
+ // CHECK-DISABLE-VERIFYTARGET: [#nvvm.target<verifyTarget = false>]
gpu.module @kernel_module1 {
llvm.func @kernel(%arg0: i32, %arg1: !llvm.ptr,
%arg2: !llvm.ptr, %arg3: i64, %arg4: i64,
More information about the Mlir-commits
mailing list