File tree Expand file tree Collapse file tree 2 files changed +13
-5
lines changed Expand file tree Collapse file tree 2 files changed +13
-5
lines changed Original file line number Diff line number Diff line change @@ -368,9 +368,15 @@ void NVPTXPassConfig::addIRPasses() {
368
368
addPass (createSROAPass ());
369
369
}
370
370
371
- const auto &Options = getNVPTXTargetMachine ().Options ;
372
- addPass (createNVPTXLowerUnreachablePass (Options.TrapUnreachable ,
373
- Options.NoTrapAfterNoreturn ));
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.
376
+ const auto &Options = getNVPTXTargetMachine ().Options ;
377
+ addPass (createNVPTXLowerUnreachablePass (Options.TrapUnreachable ,
378
+ Options.NoTrapAfterNoreturn ));
379
+ }
374
380
}
375
381
376
382
bool NVPTXPassConfig::addInstSelector () {
Original file line number Diff line number Diff line change 10
10
; RUN: | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-TRAP
11
11
; RUN: llc < %s -march=nvptx64 -mcpu=sm_20 -verify-machineinstrs -trap-unreachable -no-trap-after-noreturn=false \
12
12
; RUN: | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-TRAP
13
+ ; RUN: llc < %s -march=nvptx64 -mcpu=sm_20 -verify-machineinstrs -mattr=+ptx75 \
14
+ ; RUN: | FileCheck %s --check-prefixes=CHECK-BUG-FIXED
13
15
; RUN: %if ptxas && !ptxas-12.0 %{ llc < %s -march=nvptx -mcpu=sm_20 -verify-machineinstrs | %ptxas-verify %}
14
16
; RUN: %if ptxas %{ llc < %s -march=nvptx64 -mcpu=sm_20 -verify-machineinstrs | %ptxas-verify %}
15
17
@@ -26,12 +28,14 @@ define void @kernel_func() {
26
28
; CHECK-TRAP: trap;
27
29
; CHECK-NOTRAP-NOT: trap;
28
30
; CHECK: exit;
31
+ ; CHECK-BUG-FIXED-NOT: exit;
29
32
unreachable
30
33
}
31
34
32
35
; CHECK-LABEL: kernel_func_2
33
36
define void @kernel_func_2 () {
34
37
; CHECK: trap; exit;
38
+ ; CHECK-BUG-FIXED-NOT: exit;
35
39
call void @llvm.trap ()
36
40
37
41
;; Make sure we avoid emitting two trap instructions.
@@ -42,7 +46,5 @@ define void @kernel_func_2() {
42
46
43
47
attributes #0 = { noreturn }
44
48
45
-
46
49
!nvvm.annotations = !{!1 }
47
-
48
50
!1 = !{ptr @kernel_func , !"kernel" , i32 1 }
You can’t perform that action at this time.
0 commit comments