File tree Expand file tree Collapse file tree 3 files changed +10
-7
lines changed Expand file tree Collapse file tree 3 files changed +10
-7
lines changed Original file line number Diff line number Diff 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 ; }
Original file line number Diff line number Diff 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 ));
Original file line number Diff line number Diff line change 33; RUN: llc < %s -march=nvptx64 -mcpu=sm_20 -verify-machineinstrs \
44; RUN: | FileCheck %s --check-prefixes=CHECK,CHECK-NOTRAP
55; RUN: llc < %s -march=nvptx64 -mcpu=sm_20 -verify-machineinstrs -mattr=+ptx75 \
6- ; RUN: | FileCheck %s --check-prefixes=CHECK-PTX75
6+ ; RUN: | FileCheck %s --check-prefixes=CHECK-BUG-FIXED
7+ ; RUN: llc < %s -march=nvptx64 -mcpu=sm_70 -verify-machineinstrs \
8+ ; RUN: | FileCheck %s --check-prefixes=CHECK-BUG-FIXED
79; RUN: llc < %s -march=nvptx -mcpu=sm_20 -verify-machineinstrs -trap-unreachable \
810; RUN: | FileCheck %s --check-prefixes=CHECK,CHECK-TRAP
911; RUN: llc < %s -march=nvptx64 -mcpu=sm_20 -verify-machineinstrs -trap-unreachable \
@@ -23,7 +25,7 @@ define void @kernel_func() {
2325; CHECK-TRAP: trap;
2426; CHECK-NOTRAP-NOT: trap;
2527; CHECK: exit;
26- ; CHECK-PTX75 -NOT: exit;
28+ ; CHECK-BUG-FIXED -NOT: exit;
2729 unreachable
2830}
2931
You can’t perform that action at this time.
0 commit comments