Skip to content

Commit e3704bf

Browse files
committed
Pass offload options only to non-Ffpga targets
1 parent f91de92 commit e3704bf

File tree

2 files changed

+15
-10
lines changed

2 files changed

+15
-10
lines changed

clang/lib/Driver/ToolChains/Clang.cpp

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10354,20 +10354,25 @@ void OffloadWrapper::ConstructJob(Compilation &C, const JobAction &JA,
1035410354
C.getArgs().hasArg(options::OPT_fsycl_link_EQ)) {
1035510355

1035610356
// When compiling and linking separately, we need to propagate the
10357-
// compression related CLI options to offload-wrapper.
10358-
if (C.getInputArgs().getLastArg(options::OPT_offload_compress)) {
10359-
CmdArgs.push_back(C.getArgs().MakeArgString(Twine("-offload-compress")));
10360-
// -offload-compression-level=<>
10361-
if (Arg *A = C.getInputArgs().getLastArg(
10362-
options::OPT_offload_compression_level_EQ))
10363-
CmdArgs.push_back(C.getArgs().MakeArgString(
10364-
Twine("-offload-compression-level=") + A->getValue()));
10357+
// compression related CLI options to offload-wrapper. Don't propagate
10358+
// these options when wrapping objects for FPGA.
10359+
if (!C.getArgs().hasArg(options::OPT_fintelfpga)) {
10360+
10361+
if (C.getInputArgs().getLastArg(options::OPT_offload_compress)) {
10362+
CmdArgs.push_back(
10363+
C.getArgs().MakeArgString(Twine("-offload-compress")));
10364+
// -offload-compression-level=<>
10365+
if (Arg *A = C.getInputArgs().getLastArg(
10366+
options::OPT_offload_compression_level_EQ))
10367+
CmdArgs.push_back(C.getArgs().MakeArgString(
10368+
Twine("-offload-compression-level=") + A->getValue()));
10369+
}
1036510370
}
1036610371

1036710372
// For FPGA, we wrap the host objects before archiving them when using
1036810373
// -fsycl-link. This allows for better extraction control from the
1036910374
// archive when we need the host objects for subsequent compilations.
10370-
if (C.getArgs().hasArg(options::OPT_fintelfpga)) {
10375+
else {
1037110376
// Add offload targets and inputs.
1037210377
CmdArgs.push_back(C.getArgs().MakeArgString(
1037310378
Twine("-kind=") + Action::GetOffloadKindName(OffloadingKind)));

sycl/test-e2e/Compression/compression_separate_compile.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// RUN: %clangxx -fsycl -fsycl-targets=spir64_x86_64 -fsycl-host-compiler=clang++ -fsycl-host-compiler-options='-std=c++17 -Wno-attributes -Wno-deprecated-declarations -fPIC -DENABLE_KERNEL2' -DENABLE_KERNEL2 -c %s -o %t_kernel2_aot.o
99

1010
////////////////////// Link device images
11-
// RUN: %clangxx --offload-compress -fsycl -fsycl-link -fsycl-targets=spir64_x86_64 -fPIC %t_kernel1_aot.o %t_kernel2_aot.o -o %t_compressed_image.o
11+
// RUN: %clangxx --offload-compress -fsycl -fsycl-link -fsycl-targets=spir64_x86_64 -fPIC %t_kernel1_aot.o %t_kernel2_aot.o -o %t_compressed_image.o -v
1212

1313
// Make sure the clang-offload-wrapper is called with the --offload-compress
1414
// option.

0 commit comments

Comments
 (0)