Repository navigation
[SYCL][Driver] Resolve device library locations by library name #23525
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
7951c3c
61b60db
29ced20
2e32c8e
1fa1007
1446f6f
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 |
|---|---|---|
|
|
@@ -198,6 +198,19 @@ void SYCLInstallationDetector::getSYCLDeviceLibPath( | |
| DeviceLibPaths.emplace_back(Path.str()); | ||
| } | ||
|
|
||
| std::optional<SmallString<128>> | ||
|
Collaborator
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. 🔵 Suggestion: |
||
| SYCLInstallationDetector::findSYCLDeviceLib(StringRef LibName) const { | ||
| SmallVector<SmallString<128>, 4> DeviceLibPaths; | ||
| getSYCLDeviceLibPath(DeviceLibPaths); | ||
| for (const auto &LibPath : DeviceLibPaths) { | ||
| SmallString<128> FullLibName(LibPath); | ||
| llvm::sys::path::append(FullLibName, LibName); | ||
| if (D.getVFS().exists(FullLibName)) | ||
| return FullLibName; | ||
| } | ||
| return std::nullopt; | ||
| } | ||
|
|
||
| void SYCLInstallationDetector::addSYCLIncludeArgs( | ||
| const ArgList &DriverArgs, ArgStringList &CC1Args) const { | ||
| if (DriverArgs.hasArg(options::OPT_nostdlibinc, options::OPT_nostdinc)) { | ||
|
|
@@ -2075,31 +2088,19 @@ SYCLToolChain::getDeviceLibs( | |
| const Action::OffloadKind DeviceOffloadingKind) const { | ||
| llvm::SmallVector<ToolChain::BitCodeLibraryInfo, 12> BCLibs; | ||
|
|
||
| SmallVector<SmallString<128>, 4> LibraryPaths; | ||
| SYCLInstallation.getSYCLDeviceLibPath(LibraryPaths); | ||
|
|
||
| // Formulate all of the device libraries needed for this compilation. | ||
| SmallVector<BitCodeLibraryInfo, 8> DeviceLibs = | ||
| getDeviceLibNames(getDriver(), DriverArgs, getTriple()); | ||
|
|
||
| // Create full path names to each device library. If found, add to the list | ||
| // of device libraries that will be linked against. | ||
| for (const auto &DeviceLib : DeviceLibs) { | ||
| bool DeviceLibFound = false; | ||
| for (const auto &LibraryPath : LibraryPaths) { | ||
| SmallString<128> FullLibName(LibraryPath); | ||
| llvm::sys::path::append(FullLibName, DeviceLib.Path); | ||
| if (llvm::sys::fs::exists(FullLibName)) { | ||
| BitCodeLibraryInfo BitCodeLibrary( | ||
| {FullLibName, DeviceLib.ShouldInternalize}); | ||
| BCLibs.emplace_back(BitCodeLibrary); | ||
| DeviceLibFound = true; | ||
| break; | ||
| } | ||
| } | ||
| // The device libraries are all known internal libraries. If any are not | ||
| // found, emit an error. | ||
| if (!DeviceLibFound) | ||
| if (auto FullLibName = SYCLInstallation.findSYCLDeviceLib(DeviceLib.Path)) | ||
| BCLibs.emplace_back( | ||
| BitCodeLibraryInfo({*FullLibName, DeviceLib.ShouldInternalize})); | ||
| else | ||
| getDriver().Diag(diag::err_drv_no_sycl_device_lib) << DeviceLib.Path; | ||
| } | ||
| return BCLibs; | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.