Skip to content

Commit

Permalink
[SYCL] Preserve filename passed to ocloc through -output
Browse files Browse the repository at this point in the history
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 <artem.gindinson@intel.com>
  • Loading branch information
AGindinson authored and bader committed Sep 17, 2019
1 parent af63c6e commit cd2dd9b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions clang/lib/Driver/ToolChains/SYCL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,8 @@ void SYCL::gen::BackendCompiler::ConstructJob(Compilation &C,
CmdArgs.push_back("-file");
CmdArgs.push_back(II.getFilename());
}
// The next line prevents ocloc from modifying the image name
CmdArgs.push_back("-output_no_suffix");
CmdArgs.push_back("-spirv_input");
TranslateSYCLTargetArgs(C, Args, getToolChain(), CmdArgs);
SmallString<128> ExecPath(getToolChain().GetProgramPath("ocloc"));
Expand Down
2 changes: 1 addition & 1 deletion clang/test/Driver/sycl-offload.c
Original file line number Diff line number Diff line change
Expand Up @@ -530,7 +530,7 @@

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

// 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 \
// RUN: | FileCheck -check-prefix=CHK-TOOLS-CPU-OPTS %s
Expand Down

0 comments on commit cd2dd9b

Please sign in to comment.