[Mlir-commits] [llvm] [mlir] [MLIR][NVVM] Add NVVMRequiresSM op trait (PR #126886)
Durgadoss R
llvmlistbot at llvm.org
Fri Mar 14 12:22:34 PDT 2025
================
@@ -1793,6 +1793,22 @@ void GPUModuleOp::setTargets(ArrayRef<TargetAttrInterface> targets) {
targetsAttr = ArrayAttr::get(getContext(), targetsVector);
}
+LogicalResult GPUModuleOp::verify() {
+ auto targets = getOperation()->getAttrOfType<ArrayAttr>("targets");
+
+ if (!targets)
+ return success();
+
----------------
durga4github wrote:
Yes, we could do that. But I was looking for a lightweight option, if possible.
i.e. Keep the verifier for the NVVM Dialect Ops (for functionality) but only bypass this version check (to lower to llvmir etc.). When an Op fails in Verifier (until now, before this change), the lowering-to-llvmir itself will most likely fail (since an intrinsic may not exist for that invalid combination). With this, there can be a valid intrinsic to lower, but it may fail due to an invalid SMArch attached.
So, I was unsure if adding a pass solely for the SMVersion checks is a good approach.
But, if it is indeed the right/idiomatic way to achieve this, we will consider that option too.
https://github.com/llvm/llvm-project/pull/126886
More information about the Mlir-commits
mailing list