[llvm] [offload] Fix compatibility for level_zero 25.22.33944 (PR #214215)

via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 5 06:45:44 PDT 2026


https://github.com/blazej-smorawski updated https://github.com/llvm/llvm-project/pull/214215

>From c548cbea398ff4565f88fd4f94c30780624b771a Mon Sep 17 00:00:00 2001
From: blazej-smorawski <blazej.smorawski at intel.com>
Date: Tue, 4 Aug 2026 15:13:35 +0200
Subject: [PATCH 1/6] [offload] Fix compatibility for level_zero 25.22.33944

---
 .../common/include/APIHelpers.h               | 25 +++++++++++++++++
 .../level_zero/dynamic_l0/L0DynWrapper.cpp    | 28 +++++++++++++++++++
 .../level_zero/dynamic_l0/level_zero/ze_api.h | 18 ++++++++++++
 .../level_zero/include/L0CmdListManager.h     | 12 ++++----
 .../level_zero/include/L0Compat.h             | 10 +++++++
 .../level_zero/include/L0Context.h            | 14 ----------
 .../level_zero/src/L0Context.cpp              | 11 --------
 .../level_zero/src/L0Plugin.cpp               |  6 ++--
 .../OffloadAPI/queue/olLaunchHostFunction.cpp | 15 +++++++++-
 9 files changed, 105 insertions(+), 34 deletions(-)

diff --git a/offload/plugins-nextgen/common/include/APIHelpers.h b/offload/plugins-nextgen/common/include/APIHelpers.h
index 30f2a10c92894..1949b1d74f235 100644
--- a/offload/plugins-nextgen/common/include/APIHelpers.h
+++ b/offload/plugins-nextgen/common/include/APIHelpers.h
@@ -16,6 +16,8 @@
 
 #include "DLWrap.h"
 
+#include <tuple>
+
 #define API_HELPER_STRINGIFY_INNER(x) #x
 #define API_HELPER_STRINGIFY(x) API_HELPER_STRINGIFY_INNER(x)
 
@@ -53,6 +55,29 @@ template <auto Fn> bool canCall() {
                 "decorated with API_HELPER_OPTIONAL!");
 }
 
+// Currently APIHelpers.h supports only interatctions with lvalue references
+template <typename Fn> struct FunctionArgs {
+  static_assert(sizeof(Fn) == 0,
+                "FunctionArgs: Fn should be an lvalue reference to a function! "
+                "Supported form: R(A...).");
+};
+// Arguments to a function are just a tuple with all the types inside
+template <typename ReturnType, typename... ArgsTypes>
+struct FunctionArgs<ReturnType(ArgsTypes...)> {
+  using type = std::tuple<ArgsTypes...>;
+};
+
+// Template to call function with all arguments initialized
+// with default values, so we can check if APIs are not returning
+// any kind of NOT_SUPPORTED errors
+template <typename Fn> auto callDefaulted(Fn &FunctionByLValue) {
+  // Get arguments tuple type corresponding to the function
+  using FunctionArgsType = typename FunctionArgs<Fn>::type;
+
+  // Call the function
+  return std::apply(FunctionByLValue, FunctionArgsType{});
+}
+
 } // namespace api_helper
 
 #endif // OPENMP_LIBOMPTARGET_PLUGINS_NEXTGEN_COMMON_APIHELPERS_H
diff --git a/offload/plugins-nextgen/level_zero/dynamic_l0/L0DynWrapper.cpp b/offload/plugins-nextgen/level_zero/dynamic_l0/L0DynWrapper.cpp
index 55e4b6b856a96..ab15e48d0f4fa 100644
--- a/offload/plugins-nextgen/level_zero/dynamic_l0/L0DynWrapper.cpp
+++ b/offload/plugins-nextgen/level_zero/dynamic_l0/L0DynWrapper.cpp
@@ -9,6 +9,7 @@
 #include <memory>
 #include <mutex>
 
+#include "APIHelpers.h"
 #include "DLWrap.h"
 #include "Shared/Debug.h"
 #include "llvm/Support/DynamicLibrary.h"
@@ -94,6 +95,8 @@ DLWRAP(zeCommandListHostSynchronize, 2)
 DLWRAP(zeCommandListAppendSignalEvent, 2)
 DLWRAP(zeCommandListAppendWaitOnEvents, 3)
 DLWRAP(zeEventQueryStatus, 1)
+DLWRAP(zeDriverGetDefaultContext, 1)
+DLWRAP(zeCommandListAppendHostFunction, 7)
 
 DLWRAP_FINALIZE()
 
@@ -110,6 +113,23 @@ DLWRAP_FINALIZE()
 #define DEBUG_PREFIX "TARGET " GETNAME(TARGET_NAME) " RTL"
 #endif
 
+// Macro used to make APIs that are returning
+// ZE_RESULT_ERROR_UNSUPPORTED_FEATURE nullptr in dlwrap.
+#define INVALIDATE_LEVEL_ZERO_API(function)                                    \
+  if (dlwrap::function##_loaded() &&                                           \
+      api_helper::callDefaulted(function) ==                                   \
+          ZE_RESULT_ERROR_UNSUPPORTED_FEATURE) {                               \
+    for (size_t I = 0; I < dlwrap::size(); I++) {                              \
+      const char *Sym = dlwrap::symbol(I);                                     \
+      if (std::strcmp(Sym, #function) != 0)                                    \
+        continue;                                                              \
+      ODBG(OLDT_Init) << #function                                             \
+                      << " returns ZE_RESULT_ERROR_UNSUPPORTED_FEATURE, "      \
+                         "fallback might be available";                        \
+      *dlwrap::pointer(I) = nullptr;                                           \
+    }                                                                          \
+  }
+
 // Extension function pointer for getting argument sizes.
 static ze_result_t (*zexKernelGetArgumentSize_ptr)(ze_kernel_handle_t, uint32_t,
                                                    uint32_t *) = nullptr;
@@ -276,6 +296,10 @@ static bool loadLevelZero() {
   return true;
 }
 
+static void invalidateLevelZeroSymbols() {
+  INVALIDATE_LEVEL_ZERO_API(zeCommandListAppendLaunchKernelWithArguments);
+}
+
 static void addLevelZeroFallbacks() {
   std::string L0Library{LEVEL_ZERO_LIBRARY};
 
@@ -306,6 +330,10 @@ ze_result_t ZE_APICALL zeInit(ze_init_flags_t flags) {
 
   auto InitResult = dlwrap_zeInit(flags);
 
+  // Some functions might be present in loader but return
+  // ZE_ERROR
+  invalidateLevelZeroSymbols();
+
   // Add fallbacks after calling zeInit, so we can
   // use level_zero APIs to check if they work
   addLevelZeroFallbacks();
diff --git a/offload/plugins-nextgen/level_zero/dynamic_l0/level_zero/ze_api.h b/offload/plugins-nextgen/level_zero/dynamic_l0/level_zero/ze_api.h
index 4d8cf1e9367c0..d458522176f1d 100644
--- a/offload/plugins-nextgen/level_zero/dynamic_l0/level_zero/ze_api.h
+++ b/offload/plugins-nextgen/level_zero/dynamic_l0/level_zero/ze_api.h
@@ -654,6 +654,17 @@ typedef struct _ze_copy_region_t {
   uint32_t depth;
 } ze_copy_region_t;
 
+/* Callbacks for host functions */
+#ifndef ZE_CALLBACK_CONV
+#if defined(_WIN32)
+/// @brief Callback function calling convention
+#define ZE_CALLBACK_CONV __stdcall
+#else
+#define ZE_CALLBACK_CONV
+#endif // defined(_WIN32)
+#endif // ZE_CALLBACK_CONV
+typedef void(ZE_CALLBACK_CONV *ze_host_function_callback_t)(void *pUserData);
+
 /*
  * ============================================================================
  * Level Zero API Functions
@@ -670,6 +681,8 @@ ZE_APIEXPORT ze_result_t ZE_APICALL zeDriverGetExtensionFunctionAddress(
     ze_driver_handle_t hDriver, const char *name, void **ppFunctionAddress);
 ZE_APIEXPORT ze_result_t ZE_APICALL zeDriverGetExtensionProperties(
     ze_driver_handle_t hDriver, uint32_t *pCount, void *pExtensionProperties);
+ZE_APIEXPORT ze_context_handle_t ZE_APICALL
+zeDriverGetDefaultContext(ze_driver_handle_t hDriver);
 
 /* Device functions */
 ZE_APIEXPORT ze_result_t ZE_APICALL zeDeviceGet(ze_driver_handle_t hDriver,
@@ -787,6 +800,11 @@ ZE_APIEXPORT ze_result_t ZE_APICALL zeCommandListAppendMemoryPrefetch(
 ZE_APIEXPORT ze_result_t ZE_APICALL zeCommandListAppendMemAdvise(
     ze_command_list_handle_t hCommandList, ze_device_handle_t hDevice,
     const void *ptr, size_t size, uint32_t advice);
+ZE_APIEXPORT ze_result_t ZE_APICALL zeCommandListAppendHostFunction(
+    ze_command_list_handle_t hCommandList,
+    ze_host_function_callback_t pfnHostFunction, void *pUserData,
+    const void *pNext, ze_event_handle_t hSignalEvent, uint32_t numWaitEvents,
+    ze_event_handle_t *phWaitEvents);
 
 /* Memory functions */
 ZE_APIEXPORT ze_result_t ZE_APICALL zeMemAllocDevice(
diff --git a/offload/plugins-nextgen/level_zero/include/L0CmdListManager.h b/offload/plugins-nextgen/level_zero/include/L0CmdListManager.h
index 1f86006b30a0b..8a5a9374682f1 100644
--- a/offload/plugins-nextgen/level_zero/include/L0CmdListManager.h
+++ b/offload/plugins-nextgen/level_zero/include/L0CmdListManager.h
@@ -13,6 +13,7 @@
 #ifndef OPENMP_LIBOMPTARGET_PLUGINS_NEXTGEN_LEVEL_ZERO_L0CMDLISTMANAGER_H
 #define OPENMP_LIBOMPTARGET_PLUGINS_NEXTGEN_LEVEL_ZERO_L0CMDLISTMANAGER_H
 
+#include "APIHelpers.h"
 #include "L0Compat.h"
 #include "L0Context.h"
 #include "L0Defs.h"
@@ -177,16 +178,15 @@ class L0CmdListManagerTy {
                            ze_event_handle_t SignalEvent = nullptr,
                            uint32_t NumWaitEvents = 0,
                            ze_event_handle_t *WaitEvents = nullptr) {
-    auto zeCommandListAppendHost = Context.zeCommandListAppendHostFunction;
-    if (!zeCommandListAppendHost)
+    if (!api_helper::canCall<zeCommandListAppendHostFunction>())
       return Plugin::error(ErrorCode::UNSUPPORTED,
                            "zeCommandListAppendHostFunction extension is not "
                            "available on this driver");
     std::lock_guard<std::mutex> Lock(Mtx);
-    CALL_ZE_RET_ERROR(zeCommandListAppendHost, CmdList,
-                      reinterpret_cast<void *>(Callback), UserData,
-                      /*pReserved*/ nullptr, SignalEvent, NumWaitEvents,
-                      WaitEvents);
+    CALL_ZE_RET_ERROR(
+        zeCommandListAppendHostFunction, CmdList,
+        reinterpret_cast<ze_host_function_callback_t>(Callback), UserData,
+        /*pNext*/ nullptr, SignalEvent, NumWaitEvents, WaitEvents);
     return Plugin::success();
   }
 };
diff --git a/offload/plugins-nextgen/level_zero/include/L0Compat.h b/offload/plugins-nextgen/level_zero/include/L0Compat.h
index 2062c9624ad20..f13ff32c4def1 100644
--- a/offload/plugins-nextgen/level_zero/include/L0Compat.h
+++ b/offload/plugins-nextgen/level_zero/include/L0Compat.h
@@ -25,4 +25,14 @@ API_HELPER_OPTIONAL(ze_result_t, zeCommandListAppendLaunchKernelWithArguments,
                     const void *pNext, ze_event_handle_t hSignalEvent,
                     uint32_t numWaitEvents, ze_event_handle_t *phWaitEvents);
 
+API_HELPER_OPTIONAL(ze_context_handle_t, zeDriverGetDefaultContext,
+                    ze_driver_handle_t hDriver);
+
+API_HELPER_OPTIONAL(ze_result_t, zeCommandListAppendHostFunction,
+                    ze_command_list_handle_t hCommandList,
+                    ze_host_function_callback_t pfnHostFunction,
+                    void *pUserData, const void *pNext,
+                    ze_event_handle_t hSignalEvent, uint32_t numWaitEvents,
+                    ze_event_handle_t *phWaitEvents);
+
 #endif // OPENMP_LIBOMPTARGET_PLUGINS_NEXTGEN_LEVEL_ZERO_L0COMPAT_H
diff --git a/offload/plugins-nextgen/level_zero/include/L0Context.h b/offload/plugins-nextgen/level_zero/include/L0Context.h
index 7bd082571b1a1..42cedbb704f00 100644
--- a/offload/plugins-nextgen/level_zero/include/L0Context.h
+++ b/offload/plugins-nextgen/level_zero/include/L0Context.h
@@ -141,21 +141,7 @@ class L0ContextTy {
   ze_result_t(ZE_APICALL *zexKernelGetArgumentSize)(
       ze_kernel_handle_t hKernel, uint32_t argIndex,
       uint32_t *pArgSize) = nullptr;
-
-  /// Level Zero extension function pointer for host function callbacks.
-  ze_result_t(ZE_APICALL *zeCommandListAppendHostFunction)(
-      ze_command_list_handle_t hCommandList, void *pfnHostFunction,
-      void *pUserData, void *pReserved, ze_event_handle_t hSignalEvent,
-      uint32_t numWaitEvents, ze_event_handle_t *phWaitEvents) = nullptr;
-
-  /// Level Zero extension function pointer for querying the driver's default
-  /// ze_context, when the extension is supported. Used by
-  /// LevelZeroPluginTy::createPluginContext to reuse the driver default
-  /// context when the user asks for every device on the driver.
-  ze_context_handle_t(ZE_APICALL *zeDriverGetDefaultContext)(
-      ze_driver_handle_t hDriver) = nullptr;
 };
-
 } // namespace llvm::omp::target::plugin
 
 #endif // OPENMP_LIBOMPTARGET_PLUGINS_NEXTGEN_LEVEL_ZERO_L0CONTEXT_H
diff --git a/offload/plugins-nextgen/level_zero/src/L0Context.cpp b/offload/plugins-nextgen/level_zero/src/L0Context.cpp
index be21a2fdc22ed..c1c144d622df9 100644
--- a/offload/plugins-nextgen/level_zero/src/L0Context.cpp
+++ b/offload/plugins-nextgen/level_zero/src/L0Context.cpp
@@ -57,17 +57,6 @@ Error L0ContextTy::init() {
   if (RC != ZE_RESULT_SUCCESS)
     zexKernelGetArgumentSize = nullptr;
 
-  CALL_ZE(RC, zeDriverGetExtensionFunctionAddress, zeDriver,
-          "zeCommandListAppendHostFunction",
-          (void **)&zeCommandListAppendHostFunction);
-  if (RC != ZE_RESULT_SUCCESS)
-    zeCommandListAppendHostFunction = nullptr;
-
-  CALL_ZE(RC, zeDriverGetExtensionFunctionAddress, zeDriver,
-          "zeDriverGetDefaultContext", (void **)&zeDriverGetDefaultContext);
-  if (RC != ZE_RESULT_SUCCESS)
-    zeDriverGetDefaultContext = nullptr;
-
   return Plugin::success();
 }
 
diff --git a/offload/plugins-nextgen/level_zero/src/L0Plugin.cpp b/offload/plugins-nextgen/level_zero/src/L0Plugin.cpp
index 5723644c6763c..be5890abf8456 100644
--- a/offload/plugins-nextgen/level_zero/src/L0Plugin.cpp
+++ b/offload/plugins-nextgen/level_zero/src/L0Plugin.cpp
@@ -12,6 +12,8 @@
 
 #include <level_zero/zes_api.h>
 
+#include "APIHelpers.h"
+#include "L0Compat.h"
 #include "L0Device.h"
 #include "L0Interop.h"
 #include "L0Kernel.h"
@@ -292,8 +294,8 @@ LevelZeroPluginTy::createPluginContext(
 
   ze_context_handle_t ZeContext = nullptr;
   bool OwnsZeContext = false;
-  if (IsFullDriver && DriverCtx.zeDriverGetDefaultContext)
-    ZeContext = DriverCtx.zeDriverGetDefaultContext(Driver);
+  if (IsFullDriver && api_helper::canCall<zeDriverGetDefaultContext>())
+    ZeContext = zeDriverGetDefaultContext(Driver);
   if (!ZeContext) {
     ze_context_desc_t Desc{ZE_STRUCTURE_TYPE_CONTEXT_DESC, nullptr, 0};
     CALL_ZE_RET_ERROR(zeContextCreate, Driver, &Desc, &ZeContext);
diff --git a/offload/unittests/OffloadAPI/queue/olLaunchHostFunction.cpp b/offload/unittests/OffloadAPI/queue/olLaunchHostFunction.cpp
index 28d9b78c35f76..66ee89f8fcafb 100644
--- a/offload/unittests/OffloadAPI/queue/olLaunchHostFunction.cpp
+++ b/offload/unittests/OffloadAPI/queue/olLaunchHostFunction.cpp
@@ -12,7 +12,20 @@
 #include <thread>
 
 struct olLaunchHostFunctionTest : OffloadQueueTest {
-  void SetUp() override { RETURN_ON_FATAL_FAILURE(OffloadQueueTest::SetUp()); }
+  void SetUp() override {
+    RETURN_ON_FATAL_FAILURE(OffloadQueueTest::SetUp());
+
+    // Test if olLaunchHostFunction is supported
+    auto *Result = olLaunchHostFunction(
+        Queue,
+        [](void *) {
+          printf(""); // Making sure the function has side effect
+        },
+        nullptr);
+    if (Result->Code == OL_ERRC_UNSUPPORTED)
+      GTEST_SKIP() << "olLaunchHostFunction is not supported on this platform. "
+                      "Please update your environment";
+  }
 };
 OFFLOAD_TESTS_INSTANTIATE_DEVICE_FIXTURE(olLaunchHostFunctionTest);
 

>From d3a8d405e491ca43e4108b8cc26eb1e74157c69f Mon Sep 17 00:00:00 2001
From: blazej-smorawski <blazej.smorawski at intel.com>
Date: Wed, 5 Aug 2026 15:30:29 +0200
Subject: [PATCH 2/6] Remove unused context parameter from L0CmdListManagerTy

---
 .../plugins-nextgen/level_zero/include/L0CmdListManager.h   | 6 ++----
 offload/plugins-nextgen/level_zero/include/L0Device.h       | 2 +-
 2 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/offload/plugins-nextgen/level_zero/include/L0CmdListManager.h b/offload/plugins-nextgen/level_zero/include/L0CmdListManager.h
index 8a5a9374682f1..5bfda655c6728 100644
--- a/offload/plugins-nextgen/level_zero/include/L0CmdListManager.h
+++ b/offload/plugins-nextgen/level_zero/include/L0CmdListManager.h
@@ -28,14 +28,12 @@ namespace llvm::omp::target::plugin {
 class L0CmdListManagerTy {
   /// Underlying immediate command list.
   ze_command_list_handle_t CmdList;
-  /// Owning context (provides driver-loaded extension function pointers).
-  L0ContextTy &Context;
   /// Mutex to protect L0 operations that are not thread safe.
   std::mutex Mtx;
 
 public:
-  L0CmdListManagerTy(ze_command_list_handle_t CmdList, L0ContextTy &Context)
-      : CmdList(CmdList), Context(Context) {}
+  L0CmdListManagerTy(ze_command_list_handle_t CmdList)
+      : CmdList(CmdList) {}
 
   ze_command_list_handle_t getCmdList() const { return CmdList; }
 
diff --git a/offload/plugins-nextgen/level_zero/include/L0Device.h b/offload/plugins-nextgen/level_zero/include/L0Device.h
index 88332f3818dfe..eaf4387b15b4a 100644
--- a/offload/plugins-nextgen/level_zero/include/L0Device.h
+++ b/offload/plugins-nextgen/level_zero/include/L0Device.h
@@ -386,7 +386,7 @@ class L0DeviceTy final : public GenericDeviceTy {
     auto CmdListOrErr = createImmCmdList(InOrder);
     if (!CmdListOrErr)
       return CmdListOrErr.takeError();
-    return new L0CmdListManagerTy(*CmdListOrErr, L0Context);
+    return new L0CmdListManagerTy(*CmdListOrErr);
   }
 
   Error releaseCmdListManager(L0CmdListManagerTy *CmndListMngr) {

>From 64c6774aca4535fdadd9765a9a043172a263a3d8 Mon Sep 17 00:00:00 2001
From: blazej-smorawski <blazej.smorawski at intel.com>
Date: Wed, 5 Aug 2026 15:37:51 +0200
Subject: [PATCH 3/6] Add more comments and return early if zeInit fails

---
 .../level_zero/dynamic_l0/L0DynWrapper.cpp               | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/offload/plugins-nextgen/level_zero/dynamic_l0/L0DynWrapper.cpp b/offload/plugins-nextgen/level_zero/dynamic_l0/L0DynWrapper.cpp
index ab15e48d0f4fa..3624077105f8a 100644
--- a/offload/plugins-nextgen/level_zero/dynamic_l0/L0DynWrapper.cpp
+++ b/offload/plugins-nextgen/level_zero/dynamic_l0/L0DynWrapper.cpp
@@ -296,6 +296,10 @@ static bool loadLevelZero() {
   return true;
 }
 
+// Some APIs might be invalid in some level zero and
+// compute runtime environments. They will return
+// `ZE_RESULT_ERROR_UNSUPPORTED_FEATURE`. This
+// function sets their dlwrap pointers to null
 static void invalidateLevelZeroSymbols() {
   INVALIDATE_LEVEL_ZERO_API(zeCommandListAppendLaunchKernelWithArguments);
 }
@@ -330,8 +334,11 @@ ze_result_t ZE_APICALL zeInit(ze_init_flags_t flags) {
 
   auto InitResult = dlwrap_zeInit(flags);
 
+  if (InitResult != ZE_RESULT_SUCCESS)
+    return InitResult;
+
   // Some functions might be present in loader but return
-  // ZE_ERROR
+  // ZE_RESULT_ERROR_UNSUPPORTED_FEATURE
   invalidateLevelZeroSymbols();
 
   // Add fallbacks after calling zeInit, so we can

>From 50288786af8dff2d3344d8401b5937d8b585a02d Mon Sep 17 00:00:00 2001
From: blazej-smorawski <blazej.smorawski at intel.com>
Date: Wed, 5 Aug 2026 15:41:29 +0200
Subject: [PATCH 4/6] Update commen for host launch

---
 offload/unittests/OffloadAPI/queue/olLaunchHostFunction.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/offload/unittests/OffloadAPI/queue/olLaunchHostFunction.cpp b/offload/unittests/OffloadAPI/queue/olLaunchHostFunction.cpp
index 66ee89f8fcafb..e915da93ad36b 100644
--- a/offload/unittests/OffloadAPI/queue/olLaunchHostFunction.cpp
+++ b/offload/unittests/OffloadAPI/queue/olLaunchHostFunction.cpp
@@ -24,7 +24,8 @@ struct olLaunchHostFunctionTest : OffloadQueueTest {
         nullptr);
     if (Result->Code == OL_ERRC_UNSUPPORTED)
       GTEST_SKIP() << "olLaunchHostFunction is not supported on this platform. "
-                      "Please update your environment";
+                      "Either the device does not support the feature or "
+                      "you need to update its drivers";
   }
 };
 OFFLOAD_TESTS_INSTANTIATE_DEVICE_FIXTURE(olLaunchHostFunctionTest);

>From efa64a29e40339abc282b04f5b153cba5448e802 Mon Sep 17 00:00:00 2001
From: blazej-smorawski <blazej.smorawski at intel.com>
Date: Wed, 5 Aug 2026 15:44:02 +0200
Subject: [PATCH 5/6] Rename `callDefaulted`

---
 offload/plugins-nextgen/common/include/APIHelpers.h            | 2 +-
 offload/plugins-nextgen/level_zero/dynamic_l0/L0DynWrapper.cpp | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/offload/plugins-nextgen/common/include/APIHelpers.h b/offload/plugins-nextgen/common/include/APIHelpers.h
index 1949b1d74f235..3c3da0604e23b 100644
--- a/offload/plugins-nextgen/common/include/APIHelpers.h
+++ b/offload/plugins-nextgen/common/include/APIHelpers.h
@@ -70,7 +70,7 @@ struct FunctionArgs<ReturnType(ArgsTypes...)> {
 // Template to call function with all arguments initialized
 // with default values, so we can check if APIs are not returning
 // any kind of NOT_SUPPORTED errors
-template <typename Fn> auto callDefaulted(Fn &FunctionByLValue) {
+template <typename Fn> auto callWithDefaultArgs(Fn &FunctionByLValue) {
   // Get arguments tuple type corresponding to the function
   using FunctionArgsType = typename FunctionArgs<Fn>::type;
 
diff --git a/offload/plugins-nextgen/level_zero/dynamic_l0/L0DynWrapper.cpp b/offload/plugins-nextgen/level_zero/dynamic_l0/L0DynWrapper.cpp
index 3624077105f8a..a94668ebeab2a 100644
--- a/offload/plugins-nextgen/level_zero/dynamic_l0/L0DynWrapper.cpp
+++ b/offload/plugins-nextgen/level_zero/dynamic_l0/L0DynWrapper.cpp
@@ -117,7 +117,7 @@ DLWRAP_FINALIZE()
 // ZE_RESULT_ERROR_UNSUPPORTED_FEATURE nullptr in dlwrap.
 #define INVALIDATE_LEVEL_ZERO_API(function)                                    \
   if (dlwrap::function##_loaded() &&                                           \
-      api_helper::callDefaulted(function) ==                                   \
+      api_helper::callWithDefaultArgs(function) ==                                   \
           ZE_RESULT_ERROR_UNSUPPORTED_FEATURE) {                               \
     for (size_t I = 0; I < dlwrap::size(); I++) {                              \
       const char *Sym = dlwrap::symbol(I);                                     \

>From 28d4c3da4db19c4b6d50903f916c8efcc8e5b9a7 Mon Sep 17 00:00:00 2001
From: blazej-smorawski <blazej.smorawski at intel.com>
Date: Wed, 5 Aug 2026 15:44:39 +0200
Subject: [PATCH 6/6] Fix format

---
 offload/plugins-nextgen/level_zero/dynamic_l0/L0DynWrapper.cpp | 2 +-
 offload/plugins-nextgen/level_zero/include/L0CmdListManager.h  | 3 +--
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/offload/plugins-nextgen/level_zero/dynamic_l0/L0DynWrapper.cpp b/offload/plugins-nextgen/level_zero/dynamic_l0/L0DynWrapper.cpp
index a94668ebeab2a..e2d3e2e9c8619 100644
--- a/offload/plugins-nextgen/level_zero/dynamic_l0/L0DynWrapper.cpp
+++ b/offload/plugins-nextgen/level_zero/dynamic_l0/L0DynWrapper.cpp
@@ -117,7 +117,7 @@ DLWRAP_FINALIZE()
 // ZE_RESULT_ERROR_UNSUPPORTED_FEATURE nullptr in dlwrap.
 #define INVALIDATE_LEVEL_ZERO_API(function)                                    \
   if (dlwrap::function##_loaded() &&                                           \
-      api_helper::callWithDefaultArgs(function) ==                                   \
+      api_helper::callWithDefaultArgs(function) ==                             \
           ZE_RESULT_ERROR_UNSUPPORTED_FEATURE) {                               \
     for (size_t I = 0; I < dlwrap::size(); I++) {                              \
       const char *Sym = dlwrap::symbol(I);                                     \
diff --git a/offload/plugins-nextgen/level_zero/include/L0CmdListManager.h b/offload/plugins-nextgen/level_zero/include/L0CmdListManager.h
index 5bfda655c6728..ea08ca46eac65 100644
--- a/offload/plugins-nextgen/level_zero/include/L0CmdListManager.h
+++ b/offload/plugins-nextgen/level_zero/include/L0CmdListManager.h
@@ -32,8 +32,7 @@ class L0CmdListManagerTy {
   std::mutex Mtx;
 
 public:
-  L0CmdListManagerTy(ze_command_list_handle_t CmdList)
-      : CmdList(CmdList) {}
+  L0CmdListManagerTy(ze_command_list_handle_t CmdList) : CmdList(CmdList) {}
 
   ze_command_list_handle_t getCmdList() const { return CmdList; }
 



More information about the llvm-commits mailing list