Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 23 additions & 1 deletion clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -942,7 +942,29 @@ static void addBackendOptions(const ArgList &Args,
SmallVector<StringRef, 8> &CmdArgs, bool IsCPU) {
StringRef OptC =
Args.getLastArgValue(OPT_sycl_backend_compile_options_from_image_EQ);
OptC.split(CmdArgs, " ", /*MaxSplit=*/-1, /*KeepEmpty=*/false);
if (IsCPU) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

any way to add a test?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There should be already. The case I'm fixing here is because a test failed downstream. Let me double-check if there are also for CPU case.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So for the CPU case, I think this test covers it: https://github.com/intel/llvm/blob/sycl/sycl/test-e2e/NewOffloadDriver/cpu.cpp
For the GPU case, https://github.com/intel/llvm/blob/sycl/sycl/test-e2e/SYCLBIN/simple_kernel_aot. was the one failing downstream, so it covers the GPU case.

OptC.split(CmdArgs, " ", /*MaxSplit=*/-1, /*KeepEmpty=*/false);
} else {
// ocloc -options args need to be comma separated, e.g. `-options
// "-g,-cl-opt-disable"`. Otherwise, only the first arg is processed by
// ocloc as an arg for -options, and the rest are processed as standalone
// flags, possibly leading to errors.
// split function here returns a pair with everything before the separator
// ("-options") in the first member of the pair, and everything after the
// separator in the second part of the pair. The separator is not included
// in any of them.
auto [BeforeOptions, AfterOptions] = OptC.split("-options ");
// Only add if not empty, an empty arg can lead to ocloc errors.
if (!BeforeOptions.empty())
CmdArgs.push_back(BeforeOptions);
if (!AfterOptions.empty()) {
// Separator not included by the split function, so explicitly added here.
CmdArgs.push_back("-options");
std::string Replace = AfterOptions.str();
std::replace(Replace.begin(), Replace.end(), ' ', ',');
CmdArgs.push_back(Args.MakeArgString(Replace));
}
}
StringRef OptL =
Args.getLastArgValue(OPT_sycl_backend_link_options_from_image_EQ);
OptL.split(CmdArgs, " ", /*MaxSplit=*/-1, /*KeepEmpty=*/false);
Expand Down
Loading