[Mlir-commits] [mlir] [MLIR][NVVM] Add NVVMRequiresSM op trait (PR #126886)
Mehdi Amini
llvmlistbot at llvm.org
Tue Mar 11 03:26:26 PDT 2025
================
@@ -1439,6 +1440,36 @@ NVVMTargetAttr::verify(function_ref<InFlightDiagnostic()> emitError,
return success();
}
+//===----------------------------------------------------------------------===//
+// Requires minimum target SM trait helper functions
+//===----------------------------------------------------------------------===//
+llvm::SmallVector<NVVMCheckSMVersion> NVVM::getTargetSMVersions(Operation *op) {
+ llvm::SmallVector<NVVMCheckSMVersion> TargetSMVersions;
+ gpu::GPUModuleOp GPUModule = op->getParentOfType<gpu::GPUModuleOp>();
----------------
joker-eph wrote:
That will make it for a fairly costly verifier: for every op implementing this trait we'll walk the IR up and find the module, and then again have to lookup the attributes.
I believe a more efficient implementation would be to hook through an attribute verifier on the GPU module which would lookup the attribute and then walk the entire module once to find operation with the traits.
https://github.com/llvm/llvm-project/pull/126886
More information about the Mlir-commits
mailing list