[NewOffloadModel] Add additional options for clang-sycl-linker#21692
[NewOffloadModel] Add additional options for clang-sycl-linker#21692YixingZhang007 wants to merge 12 commits intointel:syclfrom
Conversation
4915195 to
81ce781
Compare
| if (A->getOption().matches(options::OPT_Xlinker)) { | ||
| CmdArgs.push_back(A->getValue()); | ||
| } | ||
| } |
There was a problem hiding this comment.
Why is this needed? I'm seeing values of -Xlinker already being passed as expected.
clang++ --sycl-link --target=spirv64 -### a.o -Xlinker -blah
Intel SYCL compiler development build based on:
clang version 23.0.0git (https://github.com/mdtoguchi/llvm accf054)
Target: spirv64
Thread model: posix
InstalledDir: /localdisk2/mtoguchi/github/llvm/build/bin
Build config: +assertions
"clang-sycl-linker" "a.o" "-blah" "-o" "a.out"
There was a problem hiding this comment.
Thank you for catching this! You're right, the -xlinker option is already handled within AddLinkerInputs function. I've reverted this change :)
| }; | ||
| for (auto [Opt, Flag] : SimpleFlags) | ||
| if (Args.hasArg(Opt)) | ||
| XLinker(Flag); |
There was a problem hiding this comment.
It looks like we have a bit of duplication of option names, etc, which would lead to a maintenance issue with any option name changes or even capturing new flags that need to be forwarded.
Leveraging the Args information would be beneficial here. A new 'Group' can be added for any of these options that need to be forwarded to the clang-sycl-linker. From there, check if an Arg is part of the group and then forward with render()
for (Arg *A : Args.filtered(options::OPT_sycl_Group))
A->render(Args, CmdArgs);
There was a problem hiding this comment.
Hm I am not quiet sure about this because the flags passed to clang-linker-wrapper need to be handled / processed differently when they get passed to clang-sycl-linker (for example option passed into --device-libs= need to be joined by comma). In this case, there might need to be several groups created.
elizabethandrews
left a comment
There was a problem hiding this comment.
I am not familiar with this and defer to @mdtoguchi for review and approval.
|
|
||
| def input_file_EQ : Joined<["--", "-"], "input-file=">, | ||
| Flags<[LinkerOnlyOption]>, | ||
| HelpText<"Input bitcode file for SYCL device linking">; No newline at end of file |
There was a problem hiding this comment.
Given the text information here - how is this option different than using --bitcode-library? The name of -input-file makes it sound like you can pass any input file and clang-sycl-linker will just know what to do with the file and it not be of any type of file format, so the option name should be more descriptive.
There was a problem hiding this comment.
Thanks for the suggestion. I have changed the option name to be input-bitcode-file= and add a more descriptive comment for both this option as well as --bitcode-library.
This patch is part of the ongoing effort to migrate to clang-sycl-linker. It adds the support for new options required for clang-sycl-linker, where they will be used during the linking and backend compilation stages.
Specifically, the following changes are made:
clang-sycl-linkerare defined inSYCLLinkOpts.td.ClangLinkerWrapper.cpp,appendClangSYCLLinkerArgsis introduced to forward the required flags toclang-sycl-linkervia-XlinkerwhenUseClangSYCLLinkeris enabled.UseClangSYCLLinkeris a temporary guard that will be removed onceclang-sycl-linker` is fully supported.-Xlinkerarguments toclang-sycl-linkerinSPIRV.cpp.