Skip to content

Commit cd2dd9b

Browse files
Artem Gindinsonbader
authored andcommitted
[SYCL] Preserve filename passed to ocloc through -output
A flag "-output_no_suffix" was added to ocloc, and enabling it prevents the tool from appending it's family name (e.g. "_Gen9core.bin") to the filename passed through the -output option. Meanwhile, clang-offload-bundler expects no suffixes with the binary image name. Enabling the option ensures that our toolchain is always able to find the image by the given name. Signed-off-by: Artem Gindinson <[email protected]>
1 parent af63c6e commit cd2dd9b

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

clang/lib/Driver/ToolChains/SYCL.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -389,6 +389,8 @@ void SYCL::gen::BackendCompiler::ConstructJob(Compilation &C,
389389
CmdArgs.push_back("-file");
390390
CmdArgs.push_back(II.getFilename());
391391
}
392+
// The next line prevents ocloc from modifying the image name
393+
CmdArgs.push_back("-output_no_suffix");
392394
CmdArgs.push_back("-spirv_input");
393395
TranslateSYCLTargetArgs(C, Args, getToolChain(), CmdArgs);
394396
SmallString<128> ExecPath(getToolChain().GetProgramPath("ocloc"));

clang/test/Driver/sycl-offload.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -530,7 +530,7 @@
530530

531531
// RUN: %clang -### -target x86_64-unknown-linux-gnu -fsycl -fsycl-targets=spir64_gen-unknown-linux-sycldevice -Xsycl-target-backend "-DFOO1 -DFOO2" %s 2>&1 \
532532
// RUN: | FileCheck -check-prefix=CHK-TOOLS-GEN-OPTS %s
533-
// CHK-TOOLS-GEN-OPTS: ocloc{{.*}} "-output" {{.*}} "-DFOO1" "-DFOO2"
533+
// CHK-TOOLS-GEN-OPTS: ocloc{{.*}} "-output" {{.*}} "-output_no_suffix" {{.*}} "-DFOO1" "-DFOO2"
534534

535535
// RUN: %clang -### -target x86_64-unknown-linux-gnu -fsycl -fsycl-targets=spir64_x86_64-unknown-linux-sycldevice -Xsycl-target-backend "-DFOO1 -DFOO2" %s 2>&1 \
536536
// RUN: | FileCheck -check-prefix=CHK-TOOLS-CPU-OPTS %s

0 commit comments

Comments
 (0)