[llvm] [Offload] Try to load Level Zero loader with version suffix (PR #180042)
Alex Duran via llvm-commits
llvm-commits at lists.llvm.org
Fri Feb 6 06:47:43 PST 2026
================
@@ -111,6 +111,24 @@ static bool loadLevelZero() {
ODBG(OLDT_Init) << "Trying to load " << L0Library;
auto DynlibHandle = std::make_unique<llvm::sys::DynamicLibrary>(
llvm::sys::DynamicLibrary::getPermanentLibrary(L0Library, &ErrMsg));
+#ifndef _WIN32
+ if (!DynlibHandle->isValid()) {
+ // Try to open loader with major version number. It is repeated from the
+ // current version down to 1.
+ std::string LoaderName{LEVEL_ZERO_LIBRARY};
+ LoaderName += ".";
+ constexpr int MinZeVersion{1};
+ int CurrVersion = ZE_MAJOR_VERSION(ZE_API_VERSION_CURRENT);
+ for (int I = CurrVersion; I >= MinZeVersion && !DynlibHandle->isValid();
+ I--) {
+ std::string LoaderVer{LoaderName + std::to_string(I)};
+ ODBG(OLDT_Init) << "Trying to load " << LoaderVer;
+ DynlibHandle = std::make_unique<llvm::sys::DynamicLibrary>(
----------------
adurang wrote:
If the ABI would change for the APIs that we use, it wouldn't compile without a source change.
If a source change is needed, then minVersion number needs to be bumped, so I feel l this is correct.
https://github.com/llvm/llvm-project/pull/180042
More information about the llvm-commits
mailing list