Skip to content

Commit 8da81b7

Browse files
committed
add search path for sycl-jit-toolchain
1 parent db7fc8a commit 8da81b7

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

clang/lib/Driver/ToolChains/SYCL.cpp

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,20 +64,26 @@ const char *SYCLInstallationDetector::findLibspirvPath(
6464

6565
const SmallString<64> Basename =
6666
getLibSpirvBasename(DeviceTriple, HostTriple);
67-
auto searchAt = [&](StringRef Path, const Twine &a = "", const Twine &b = "",
68-
const Twine &c = "") -> const char * {
69-
SmallString<128> LibraryPath(Path);
70-
llvm::sys::path::append(LibraryPath, a, b, c, Basename);
71-
67+
auto searchAt = [&](StringRef Path) -> const char * {
68+
SmallString<256> LibraryPath(Path);
69+
llvm::sys::path::append(LibraryPath, "lib", "libclc", Basename);
7270
if (D.getVFS().exists(LibraryPath))
7371
return Args.MakeArgString(LibraryPath);
7472

7573
return nullptr;
7674
};
7775

78-
if (const char *R = searchAt(D.ResourceDir, "lib", "libclc"))
76+
if (const char *R = searchAt(D.ResourceDir))
7977
return R;
8078

79+
// For sycl-jit
80+
for (const auto &IC : InstallationCandidates) {
81+
SmallString<256> ICPath(IC);
82+
llvm::sys::path::append(ICPath, "dummy", "dummy");
83+
if (const char *R = searchAt(D.GetResourcesPath(ICPath)))
84+
return R;
85+
}
86+
8187
return nullptr;
8288
}
8389

0 commit comments

Comments
 (0)