Skip to content

Commit 0cc7540

Browse files
[SYCL][Driver] Pass -emit-param-info (almost) unconditionally (#5926)
Motivation behind this change is that user can set different optimization levels at compil and link stages when separate compilation is performed: ``` clang++ -fsycl -c a.cpp -O2 -o a.o clang++ -fsycl a.o -O0 -o a.out ``` In such situation, compile step launches dead argument eliminination optimization, which could alter kernels signature. However, during the link step `-emit-param-info` weren't passed until this commit and without that information runtime is not capable to handle altered kernel signature (with arguments being optimized out).
1 parent 289e33d commit 0cc7540

File tree

2 files changed

+2
-6
lines changed

2 files changed

+2
-6
lines changed

clang/lib/Driver/ToolChains/Clang.cpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9543,11 +9543,7 @@ void SYCLPostLink::ConstructJob(Compilation &C, const JobAction &JA,
95439543
// OPT_fsycl_device_code_split is not checked as it is an alias to
95449544
// -fsycl-device-code-split=auto
95459545

9546-
// Turn on Dead Parameter Elimination Optimization with early optimizations
9547-
if (!(getToolChain().getTriple().isAMDGCN()) &&
9548-
TCArgs.hasFlag(options::OPT_fsycl_dead_args_optimization,
9549-
options::OPT_fno_sycl_dead_args_optimization,
9550-
isSYCLOptimizationO2orHigher(TCArgs)))
9546+
if (!(getToolChain().getTriple().isAMDGCN()))
95519547
addArgs(CmdArgs, TCArgs, {"-emit-param-info"});
95529548
// Enable PI program metadata
95539549
if (getToolChain().getTriple().isNVPTX())

clang/test/Driver/sycl-device-optimizations.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
// RUN: %clang_cl -### -fsycl -fno-sycl-dead-args-optimization %s 2>&1 \
4444
// RUN: | FileCheck -check-prefix=CHECK-NO-DAE %s
4545
// CHECK-NO-DAE-NOT: clang{{.*}} "-fenable-sycl-dae"
46-
// CHECK-NO-DAE-NOT: sycl-post-link{{.*}} "-emit-param-info"
46+
// CHECK-NO-DAE: sycl-post-link{{.*}} "-emit-param-info"
4747

4848
// Check "-fgpu-inline-threshold" is passed to the front-end:
4949
// RUN: %clang -### -fsycl -fgpu-inline-threshold=100000 %s 2>&1 \

0 commit comments

Comments
 (0)