Skip to content

Commit 0122b76

Browse files
committed
address comments
1 parent c8852c7 commit 0122b76

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

mlir/include/mlir/Dialect/LLVMIR/NVVMTraits.h

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,15 @@ namespace NVVM {
2424
// Structure to store and check compatibility of SM versions.
2525
struct NVVMCheckSMVersion {
2626
int archVersion;
27+
28+
// true if the SM version is accelerated (Ex. sm_90a vs sm_90)
2729
bool archAccelerated;
28-
bool exactMatch;
30+
31+
// true if the target SM version must exactly match this one
32+
// (both archVersion and archAccelerated)
33+
// Ex. sm_90a with exactMatch = false will also match with
34+
// sm_100a, sm_120a, etc...
35+
bool exactMatch;
2936

3037
NVVMCheckSMVersion()
3138
: archVersion(0), archAccelerated(false), exactMatch(false) {}

mlir/lib/Dialect/LLVMIR/IR/NVVMDialect.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1738,14 +1738,16 @@ LogicalResult NVVMTargetAttr::verifyTarget(Operation *gpuModule) {
17381738
return success();
17391739

17401740
auto gpuModuleOp = llvm::dyn_cast<gpu::GPUModuleOp>(gpuModule);
1741-
if (!gpuModuleOp)
1741+
if (!gpuModuleOp) {
17421742
return emitError(gpuModule->getLoc(),
17431743
"NVVM target attribute must be attached to a GPU module");
1744+
}
17441745

17451746
NVVMCheckSMVersion targetSMVersion(getChip());
1746-
if (targetSMVersion.archVersion < 20)
1747+
if (targetSMVersion.archVersion < 20) {
17471748
return emitError(gpuModule->getLoc(),
17481749
"Minimum NVVM target SM version is sm_20");
1750+
}
17491751

17501752
gpuModuleOp->walk([&](Operation *op) {
17511753
if (auto reqOp = llvm::dyn_cast<NVVM::RequiresSMInterface>(op)) {

0 commit comments

Comments
 (0)