[llvm] [OFFLOAD] Add asynchronous queue query API for libomptarget migration (PR #172231)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Jan 19 23:08:32 PST 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/unittests/OffloadAPI/queue/olQueryQueue.cpp offload/liboffload/src/OffloadImpl.cpp offload/plugins-nextgen/amdgpu/src/rtl.cpp offload/plugins-nextgen/common/include/PluginInterface.h offload/plugins-nextgen/common/src/PluginInterface.cpp offload/plugins-nextgen/cuda/src/rtl.cpp offload/plugins-nextgen/host/src/rtl.cpp offload/plugins-nextgen/level_zero/include/L0Device.h offload/plugins-nextgen/level_zero/src/L0Device.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/liboffload/src/OffloadImpl.cpp b/offload/liboffload/src/OffloadImpl.cpp
index 1906c7a2e..cf38f7280 100644
--- a/offload/liboffload/src/OffloadImpl.cpp
+++ b/offload/liboffload/src/OffloadImpl.cpp
@@ -1233,7 +1233,8 @@ Error olMemUnregister_impl(ol_device_handle_t Device, void *Ptr) {
Error olQueryQueue_impl(ol_queue_handle_t Queue, bool *IsQueueWorkCompleted) {
if (Queue->AsyncInfo->Queue) {
- if (auto Err = Queue->Device->Device->queryAsync(Queue->AsyncInfo, false, IsQueueWorkCompleted))
+ if (auto Err = Queue->Device->Device->queryAsync(Queue->AsyncInfo, false,
+ IsQueueWorkCompleted))
return Err;
}
return Error::success();
diff --git a/offload/plugins-nextgen/amdgpu/src/rtl.cpp b/offload/plugins-nextgen/amdgpu/src/rtl.cpp
index e0205375f..379c8ec11 100644
--- a/offload/plugins-nextgen/amdgpu/src/rtl.cpp
+++ b/offload/plugins-nextgen/amdgpu/src/rtl.cpp
@@ -2431,8 +2431,7 @@ struct AMDGPUDeviceTy : public GenericDeviceTy, AMDGenericDeviceTy {
}
/// Query for the completion of the pending operations on the async info.
- Error queryAsyncImpl(__tgt_async_info &AsyncInfo,
- bool ReleaseQueue,
+ Error queryAsyncImpl(__tgt_async_info &AsyncInfo, bool ReleaseQueue,
bool *IsQueueWorkCompleted) override {
if (IsQueueWorkCompleted)
*IsQueueWorkCompleted = false;
diff --git a/offload/plugins-nextgen/common/include/PluginInterface.h b/offload/plugins-nextgen/common/include/PluginInterface.h
index be58b611d..19db44cf0 100644
--- a/offload/plugins-nextgen/common/include/PluginInterface.h
+++ b/offload/plugins-nextgen/common/include/PluginInterface.h
@@ -856,8 +856,7 @@ struct GenericDeviceTy : public DeviceAllocatorTy {
/// structure in a non-blocking manner.
Error queryAsync(__tgt_async_info *AsyncInfo, bool ReleaseQueue = true,
bool *IsQueueWorkCompleted = nullptr);
- virtual Error queryAsyncImpl(__tgt_async_info &AsyncInfo,
- bool ReleaseQueue,
+ virtual Error queryAsyncImpl(__tgt_async_info &AsyncInfo, bool ReleaseQueue,
bool *IsQueueWorkCompleted) = 0;
/// Check whether the architecture supports VA management
diff --git a/offload/plugins-nextgen/cuda/src/rtl.cpp b/offload/plugins-nextgen/cuda/src/rtl.cpp
index fb44b59b8..d5ab0b330 100644
--- a/offload/plugins-nextgen/cuda/src/rtl.cpp
+++ b/offload/plugins-nextgen/cuda/src/rtl.cpp
@@ -793,8 +793,7 @@ struct CUDADeviceTy : public GenericDeviceTy {
}
/// Query for the completion of the pending operations on the async info.
- Error queryAsyncImpl(__tgt_async_info &AsyncInfo,
- bool ReleaseQueue,
+ Error queryAsyncImpl(__tgt_async_info &AsyncInfo, bool ReleaseQueue,
bool *IsQueueWorkCompleted) override {
if (IsQueueWorkCompleted)
*IsQueueWorkCompleted = false;
@@ -804,7 +803,7 @@ struct CUDADeviceTy : public GenericDeviceTy {
// Not ready streams must be considered as successful operations.
if (Res == CUDA_ERROR_NOT_READY)
return Plugin::success();
-
+
if (IsQueueWorkCompleted)
*IsQueueWorkCompleted = true;
// Once the stream is synchronized and the operations completed (or an error
diff --git a/offload/plugins-nextgen/host/src/rtl.cpp b/offload/plugins-nextgen/host/src/rtl.cpp
index 30fe612c4..603379630 100644
--- a/offload/plugins-nextgen/host/src/rtl.cpp
+++ b/offload/plugins-nextgen/host/src/rtl.cpp
@@ -336,8 +336,7 @@ struct GenELF64DeviceTy : public GenericDeviceTy {
/// All functions are already synchronous. No need to do anything on this
/// query function.
- Error queryAsyncImpl(__tgt_async_info &AsyncInfo,
- bool ReleaseQueue,
+ Error queryAsyncImpl(__tgt_async_info &AsyncInfo, bool ReleaseQueue,
bool *IsQueueWorkCompleted) override {
if (IsQueueWorkCompleted)
*IsQueueWorkCompleted = true;
diff --git a/offload/plugins-nextgen/level_zero/include/L0Device.h b/offload/plugins-nextgen/level_zero/include/L0Device.h
index 9bbe900c2..001a41ba7 100644
--- a/offload/plugins-nextgen/level_zero/include/L0Device.h
+++ b/offload/plugins-nextgen/level_zero/include/L0Device.h
@@ -576,8 +576,7 @@ public:
AsyncInfoWrapperTy &AsyncInfoWrapper) override;
Error synchronizeImpl(__tgt_async_info &AsyncInfo,
bool ReleaseQueue) override;
- Error queryAsyncImpl(__tgt_async_info &AsyncInfo,
- bool ReleaseQueue,
+ Error queryAsyncImpl(__tgt_async_info &AsyncInfo, bool ReleaseQueue,
bool *IsQueueWorkCompleted) override;
Error dataSubmitImpl(void *TgtPtr, const void *HstPtr, int64_t Size,
AsyncInfoWrapperTy &AsyncInfoWrapper) override;
diff --git a/offload/plugins-nextgen/level_zero/src/L0Device.cpp b/offload/plugins-nextgen/level_zero/src/L0Device.cpp
index cc1b6fe5c..4db3c4e47 100644
--- a/offload/plugins-nextgen/level_zero/src/L0Device.cpp
+++ b/offload/plugins-nextgen/level_zero/src/L0Device.cpp
@@ -355,16 +355,15 @@ L0DeviceTy::hasPendingWorkImpl(AsyncInfoWrapperTy &AsyncInfoWrapper) {
return true;
}
-Error L0DeviceTy::queryAsyncImpl(__tgt_async_info &AsyncInfo,
- bool ReleaseQueue,
+Error L0DeviceTy::queryAsyncImpl(__tgt_async_info &AsyncInfo, bool ReleaseQueue,
bool *IsQueueWorkCompleted) {
if (IsQueueWorkCompleted)
- *IsQueueWorkCompleted = true;
+ *IsQueueWorkCompleted = true;
const bool IsAsync = AsyncInfo.Queue && asyncEnabled();
if (!IsAsync)
return Plugin::success();
if (IsQueueWorkCompleted)
- *IsQueueWorkCompleted = false;
+ *IsQueueWorkCompleted = false;
auto &Plugin = getPlugin();
auto *AsyncQueue = static_cast<AsyncQueueTy *>(AsyncInfo.Queue);
@@ -373,7 +372,7 @@ Error L0DeviceTy::queryAsyncImpl(__tgt_async_info &AsyncInfo,
return Plugin::success();
if (IsQueueWorkCompleted)
- *IsQueueWorkCompleted = true;
+ *IsQueueWorkCompleted = true;
// Commit delayed USM2M copies.
for (auto &USM2M : AsyncQueue->USM2MList) {
diff --git a/offload/unittests/OffloadAPI/queue/olQueryQueue.cpp b/offload/unittests/OffloadAPI/queue/olQueryQueue.cpp
index 766269bab..45cfe9b72 100644
--- a/offload/unittests/OffloadAPI/queue/olQueryQueue.cpp
+++ b/offload/unittests/OffloadAPI/queue/olQueryQueue.cpp
@@ -1,4 +1,5 @@
-//===------- Offload API tests - olQueryQueue ------------------------------===//
+//===------- Offload API tests - olQueryQueue
+//------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
``````````
</details>
https://github.com/llvm/llvm-project/pull/172231
More information about the llvm-commits
mailing list