-
Notifications
You must be signed in to change notification settings - Fork 795
[Driver][SYCL][NFC] Update interface to access SYCL header additions #15302
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 1 commit
7613f5a
b4bd41c
79ef94e
a865550
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 |
|---|---|---|
|
|
@@ -43,6 +43,30 @@ void SYCLInstallationDetector::getSYCLDeviceLibPath( | |
| DeviceLibPaths.emplace_back(D.SysRoot + "/lib"); | ||
| } | ||
|
|
||
| void SYCLInstallationDetector::AddSYCLIncludeArgs( | ||
| const ArgList &DriverArgs, ArgStringList &CC1Args) const { | ||
| // Add the SYCL header search locations in the specified order. | ||
| // ../include/sycl | ||
| // ../include/sycl/stl_wrappers | ||
| // ../include | ||
| SmallString<128> IncludePath(D.Dir); | ||
| llvm::sys::path::append(IncludePath, ".."); | ||
| llvm::sys::path::append(IncludePath, "include"); | ||
| SmallString<128> SYCLPath(IncludePath); | ||
| llvm::sys::path::append(SYCLPath, "sycl"); | ||
| // This is used to provide our wrappers around STL headers that provide | ||
| // additional functions/template specializations when the user includes those | ||
| // STL headers in their programs (e.g., <complex>). | ||
| SmallString<128> STLWrappersPath(SYCLPath); | ||
| llvm::sys::path::append(STLWrappersPath, "stl_wrappers"); | ||
| CC1Args.push_back("-internal-isystem"); | ||
| CC1Args.push_back(DriverArgs.MakeArgString(SYCLPath)); | ||
| CC1Args.push_back("-internal-isystem"); | ||
| CC1Args.push_back(DriverArgs.MakeArgString(STLWrappersPath)); | ||
| CC1Args.push_back("-internal-isystem"); | ||
| CC1Args.push_back(DriverArgs.MakeArgString(IncludePath)); | ||
| } | ||
|
|
||
| void SYCLInstallationDetector::print(llvm::raw_ostream &OS) const { | ||
| if (!InstallationCandidates.size()) | ||
| return; | ||
|
|
@@ -1389,7 +1413,7 @@ static std::vector<OptSpecifier> getUnsupportedOpts(void) { | |
|
|
||
| SYCLToolChain::SYCLToolChain(const Driver &D, const llvm::Triple &Triple, | ||
| const ToolChain &HostTC, const ArgList &Args) | ||
| : ToolChain(D, Triple, Args), HostTC(HostTC), | ||
| : ToolChain(D, Triple, Args), HostTC(HostTC), SYCLInstallation(D), | ||
| IsSYCLNativeCPU(Triple == HostTC.getTriple()) { | ||
| // Lookup binaries into the driver directory, this is used to | ||
| // discover the clang-offload-bundler executable. | ||
|
|
@@ -1824,29 +1848,9 @@ SYCLToolChain::GetCXXStdlibType(const ArgList &Args) const { | |
| return HostTC.GetCXXStdlibType(Args); | ||
| } | ||
|
|
||
| void SYCLToolChain::AddSYCLIncludeArgs(const clang::driver::Driver &Driver, | ||
| const ArgList &DriverArgs, | ||
| ArgStringList &CC1Args) { | ||
| // Add the SYCL header search locations in the specified order. | ||
| // ../include/sycl | ||
| // ../include/sycl/stl_wrappers | ||
| // ../include | ||
| SmallString<128> IncludePath(Driver.Dir); | ||
| llvm::sys::path::append(IncludePath, ".."); | ||
| llvm::sys::path::append(IncludePath, "include"); | ||
| SmallString<128> SYCLPath(IncludePath); | ||
| llvm::sys::path::append(SYCLPath, "sycl"); | ||
| // This is used to provide our wrappers around STL headers that provide | ||
| // additional functions/template specializations when the user includes those | ||
| // STL headers in their programs (e.g., <complex>). | ||
| SmallString<128> STLWrappersPath(SYCLPath); | ||
| llvm::sys::path::append(STLWrappersPath, "stl_wrappers"); | ||
| CC1Args.push_back("-internal-isystem"); | ||
| CC1Args.push_back(DriverArgs.MakeArgString(SYCLPath)); | ||
| CC1Args.push_back("-internal-isystem"); | ||
| CC1Args.push_back(DriverArgs.MakeArgString(STLWrappersPath)); | ||
| CC1Args.push_back("-internal-isystem"); | ||
| CC1Args.push_back(DriverArgs.MakeArgString(IncludePath)); | ||
| void SYCLToolChain::AddSYCLIncludeArgs(const ArgList &DriverArgs, | ||
| ArgStringList &CC1Args) const { | ||
|
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. Should this have the 'override' specifier?
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. AFAIK, the |
||
| SYCLInstallation.AddSYCLIncludeArgs(DriverArgs, CC1Args); | ||
| } | ||
|
|
||
| void SYCLToolChain::AddClangSystemIncludeArgs(const ArgList &DriverArgs, | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@intel/llvm-reviewers-runtime, I suggest we remove the need for the driver to add 3 different locations for SYCL headers restricted by specific order. Considering that we expose only one header to the user API -
sycl/sycl.hpp, the driver can include only one location and runtime library project can put everything into a single location or include from other locations. Right?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know about
include/syclvsinclude/, but thestl_wrapperspath has to be added in the driver.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are there any conflicts between the files in
../include/sycl/stl_wrappersand../include?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe maintainability benefits of having these headers in a separate dedicated folder outweigh the costs of having driver add one extra include path, if that's where you're going with your question.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What exactly is "maintainability benefits"? Note, these are directories of deployed compiler. We can still have separate directories in the sources code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
First, "smart" deploy is extra maintainability burden. Second, I want to be able to remove
stl_wrappersfrom search path via manually modifyingclang -cc1, merging them together with other includes would prevent that. I'm sure there are "third"/"fourth" if I were to think about it just a bit more.