[llvm] [OFFLOAD][L0] More error handling (PR #188496)

via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 25 08:13:32 PDT 2026


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff origin/main HEAD --extensions cpp,h -- offload/plugins-nextgen/level_zero/include/L0Trace.h offload/plugins-nextgen/level_zero/src/L0Device.cpp offload/plugins-nextgen/level_zero/src/L0Kernel.cpp offload/plugins-nextgen/level_zero/src/L0Memory.cpp offload/plugins-nextgen/level_zero/src/L0Program.cpp --diff_from_common_commit
``````````

:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/offload/plugins-nextgen/level_zero/src/L0Device.cpp b/offload/plugins-nextgen/level_zero/src/L0Device.cpp
index cc755d18e..fc7f9f3b4 100644
--- a/offload/plugins-nextgen/level_zero/src/L0Device.cpp
+++ b/offload/plugins-nextgen/level_zero/src/L0Device.cpp
@@ -802,9 +802,8 @@ Error L0DeviceTy::enqueueMemCopy(void *Dst, const void *Src, size_t Size,
     CALL_ZE_RET_ERROR(zeCommandListAppendMemoryCopy, CmdList, Dst, Src, Size,
                       nullptr, 0, nullptr);
     CALL_ZE_RET_ERROR(zeCommandListClose, CmdList);
-    llvm::scope_exit ResetOnExit([&]() {
-      CALL_ZE_SILENT(zeCommandListReset, CmdList);
-    });
+    llvm::scope_exit ResetOnExit(
+        [&]() { CALL_ZE_SILENT(zeCommandListReset, CmdList); });
     CALL_ZE_RET_ERROR_MTX(zeCommandQueueExecuteCommandLists, getMutex(),
                           CmdQueue, 1, &CmdList, nullptr);
     CALL_ZE_RET_ERROR(zeCommandQueueSynchronize, CmdQueue, L0DefaultTimeout);
@@ -1156,9 +1155,8 @@ Error L0DeviceTy::dataFence(__tgt_async_info *Async) {
     CmdQueue = *CmdQueueOrerr;
     CALL_ZE_RET_ERROR(zeCommandListAppendBarrier, CmdList, nullptr, 0, nullptr);
     CALL_ZE_RET_ERROR(zeCommandListClose, CmdList);
-    llvm::scope_exit ResetOnExit([&]() {
-      CALL_ZE_SILENT(zeCommandListReset, CmdList);
-    });
+    llvm::scope_exit ResetOnExit(
+        [&]() { CALL_ZE_SILENT(zeCommandListReset, CmdList); });
     CALL_ZE_RET_ERROR(zeCommandQueueExecuteCommandLists, CmdQueue, 1, &CmdList,
                       nullptr);
     CALL_ZE_RET_ERROR(zeCommandQueueSynchronize, CmdQueue, L0DefaultTimeout);
diff --git a/offload/plugins-nextgen/level_zero/src/L0Kernel.cpp b/offload/plugins-nextgen/level_zero/src/L0Kernel.cpp
index 5d56555ec..8cccb5e11 100644
--- a/offload/plugins-nextgen/level_zero/src/L0Kernel.cpp
+++ b/offload/plugins-nextgen/level_zero/src/L0Kernel.cpp
@@ -341,9 +341,8 @@ static Error launchKernelWithCmdQueue(L0DeviceTy &l0Device,
   CALL_ZE_RET_ERROR(zeCommandListClose, CmdList);
 
   // Ensure command list is reset even on errors after this point.
-  llvm::scope_exit ResetOnExit([&]() {
-    CALL_ZE_SILENT(zeCommandListReset, CmdList);
-  });
+  llvm::scope_exit ResetOnExit(
+      [&]() { CALL_ZE_SILENT(zeCommandListReset, CmdList); });
 
   CALL_ZE_RET_ERROR_MTX(zeCommandQueueExecuteCommandLists, l0Device.getMutex(),
                         CmdQueue, 1, &CmdList, nullptr);

``````````

</details>


https://github.com/llvm/llvm-project/pull/188496


More information about the llvm-commits mailing list