Skip to content

Commit 5424a9d

Browse files
Also check wether we're targeting Pascal or prior
1 parent 58ffde6 commit 5424a9d

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

llvm/lib/Target/NVPTX/NVPTXSubtarget.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,9 @@ class NVPTXSubtarget : public NVPTXGenSubtargetInfo {
9595
bool hasDotInstructions() const {
9696
return SmVersion >= 61 && PTXVersion >= 50;
9797
}
98+
bool hasPTXASUnreachableBug() const {
99+
return SmVersion < 70 && PTXVersion <= 74;
100+
}
98101
bool hasCvtaParam() const { return SmVersion >= 70 && PTXVersion >= 77; }
99102
unsigned int getFullSmVersion() const { return FullSmVersion; }
100103
unsigned int getSmVersion() const { return getFullSmVersion() / 10; }

llvm/lib/Target/NVPTX/NVPTXTargetMachine.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -368,11 +368,9 @@ void NVPTXPassConfig::addIRPasses() {
368368
addPass(createSROAPass());
369369
}
370370

371-
if (ST.getPTXVersion() <= 74) {
372-
// This pass is a WAR for a bug that's present in `ptxas` binaries that are
373-
// shipped in or prior to CUDA Toolkit 11.4. The highest version that's
374-
// supported by `ptxas` in CUDA 11.4 is 7.4. Limit this pass to only run
375-
// when targeting PTX 7.4 or lower.
371+
if (ST.hasPTXASUnreachableBug()) {
372+
// Run LowerUnreachable to WAR a ptxas bug. See the commit description of
373+
// 1ee4d880e8760256c606fe55b7af85a4f70d006d for more details.
376374
const auto &Options = getNVPTXTargetMachine().Options;
377375
addPass(createNVPTXLowerUnreachablePass(Options.TrapUnreachable,
378376
Options.NoTrapAfterNoreturn));

0 commit comments

Comments
 (0)