-
Notifications
You must be signed in to change notification settings - Fork 795
[SYCL] Fix handling of comma separated arch value when calling llvm-offload-binary #20130
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
9329697
3c38506
1945480
c8c9cb6
a581c88
30d218e
1dc41be
73babfa
6b271ca
30e0200
fc02714
8cee995
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -943,24 +943,29 @@ static void addSYCLBackendOptions(const ArgList &Args, | |||||
| if (IsCPU) { | ||||||
| BackendOptions.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. | ||||||
| // ocloc -options takes arguments in the form of '-options "-g | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So, Yixing's change should be merged first, right?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, I forgot to add a comment here on the PR, but I needed Yixing's change to pass testing.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ok. I think if this change is ready first, we should go ahead and merge it. It doesn't matter, which change goes first in. Both are required anyway.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sounds good. FYI @YixingZhang007, I think this should merge cleanly with your changes but just letting you know. |
||||||
| // -cl-opt-disable"' where each argument is separated with spaces. | ||||||
| // 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] = BackendOptions.split("-options "); | ||||||
| // Only add if not empty, an empty arg can lead to ocloc errors. | ||||||
| if (!BeforeOptions.empty()) | ||||||
| CmdArgs.push_back(BeforeOptions); | ||||||
| if (!BeforeOptions.empty()) { | ||||||
| SmallVector<StringRef, 8> BeforeArgs; | ||||||
| BeforeOptions.split(BeforeArgs, " ", /*MaxSplit=*/-1, | ||||||
| /*KeepEmpty=*/false); | ||||||
| for (const auto &string : BeforeArgs) { | ||||||
| CmdArgs.push_back(string); | ||||||
| } | ||||||
| } | ||||||
| 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)); | ||||||
| // Split the options string by spaces and rejoin to normalize whitespace | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| SmallVector<StringRef, 8> AfterArgs; | ||||||
| AfterOptions.split(AfterArgs, " ", /*MaxSplit=*/-1, /*KeepEmpty=*/false); | ||||||
| std::string JoinedOptions = llvm::join(AfterArgs, " "); | ||||||
| CmdArgs.push_back(Args.MakeArgString(JoinedOptions)); | ||||||
| } | ||||||
| } | ||||||
|
|
||||||
|
|
@@ -1441,9 +1446,8 @@ static Expected<StringRef> linkDevice(ArrayRef<StringRef> InputFiles, | |||||
| if (ExtractedDeviceLibFiles.empty()) { | ||||||
| // TODO: Add NVPTX when ready | ||||||
| if (Triple.isSPIROrSPIRV()) | ||||||
| return createStringError( | ||||||
| inconvertibleErrorCode(), | ||||||
| " SYCL device library file list cannot be empty."); | ||||||
| WithColor::warning(errs(), LinkerExecutable) | ||||||
| << "SYCL device library file list is empty\n"; | ||||||
| return *LinkedFile; | ||||||
| } | ||||||
|
|
||||||
|
|
||||||
Uh oh!
There was an error while loading. Please reload this page.