Skip to content

Commit 5ed48b4

Browse files
authored
[SYCL][ROCm] Fix compilation for AMD GPU with -fsycl-dead-args-optimization (#4126)
Prevents -emit-param-info being added if on AMD GPU
1 parent 9bc3bc4 commit 5ed48b4

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

clang/lib/Driver/ToolChains/Clang.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4624,7 +4624,7 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
46244624
}
46254625

46264626
// Turn on Dead Parameter Elimination Optimization with early optimizations
4627-
if (!RawTriple.isNVPTX() &&
4627+
if (!(RawTriple.isNVPTX() || RawTriple.isAMDGCN()) &&
46284628
Args.hasFlag(options::OPT_fsycl_dead_args_optimization,
46294629
options::OPT_fno_sycl_dead_args_optimization, false))
46304630
CmdArgs.push_back("-fenable-sycl-dae");
@@ -8856,7 +8856,8 @@ void SYCLPostLink::ConstructJob(Compilation &C, const JobAction &JA,
88568856
// -fsycl-device-code-split=auto
88578857

88588858
// Turn on Dead Parameter Elimination Optimization with early optimizations
8859-
if (!getToolChain().getTriple().isNVPTX() &&
8859+
if (!(getToolChain().getTriple().isNVPTX() ||
8860+
getToolChain().getTriple().isAMDGCN()) &&
88608861
TCArgs.hasFlag(options::OPT_fsycl_dead_args_optimization,
88618862
options::OPT_fno_sycl_dead_args_optimization, false))
88628863
addArgs(CmdArgs, TCArgs, {"-emit-param-info"});
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// RUN: %clangxx -### -fsycl -fsycl-targets=nvptx64-nvidia-cuda-sycldevice -fsycl-dead-args-optimization %s 2> %t.cuda.out
2+
// RUN: FileCheck %s --input-file %t.cuda.out
3+
//
4+
// RUN: %clangxx -### -fsycl -fsycl-targets=amdgcn-amd-amdhsa-sycldevice -fsycl-dead-args-optimization %s 2> %t.rocm.out
5+
// RUN: FileCheck %s --input-file %t.rocm.out
6+
// CHECK-NOT: -fenable-sycl-dae
7+
// CHECK-NOT: -emit-param-info
8+
//
9+
// RUN: %clangxx -### -fsycl -fsycl-targets=spir64-unknown-unknown-sycldevice -fsycl-dead-args-optimization %s 2> %t.out
10+
// RUN: FileCheck %s --check-prefixes=CHECK-FENABLE,CHECK-EMIT --input-file %t.out
11+
// CHECK-FENABLE: -fenable-sycl-dae
12+
// CHECK-EMIT: -emit-param-info

0 commit comments

Comments
 (0)