[llvm] [Offload][AMDGPU] Fix olQueryQueue uninitialized output parameter (PR #178464)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 28 08:49:39 PST 2026
https://github.com/mugiwaraluffy56 updated https://github.com/llvm/llvm-project/pull/178464
>From c4f706ebf43adf0cbf021dc2460df9b31fc056a1 Mon Sep 17 00:00:00 2001
From: mugiwaraluffy56 <myakampuneeth at gmail.com>
Date: Wed, 28 Jan 2026 22:16:09 +0530
Subject: [PATCH] [Offload][AMDGPU] Fix olQueryQueue uninitialized output
parameter
Fixes #178462
The olQueryQueue_impl function was not setting the IsQueueWorkCompleted
output parameter when Queue->AsyncInfo->Queue is null. This caused
undefined behavior in the OffloadAPI/queue.unittests test on AMDGPU.
When there is no underlying queue object, there is no pending work, so
IsQueueWorkCompleted should be set to true.
Co-Authored-By: Claude Sonnet 4.5 <noreply at anthropic.com>
---
offload/liboffload/src/OffloadImpl.cpp | 3 +++
1 file changed, 3 insertions(+)
diff --git a/offload/liboffload/src/OffloadImpl.cpp b/offload/liboffload/src/OffloadImpl.cpp
index 6e429a574bfe2..3fb587309022e 100644
--- a/offload/liboffload/src/OffloadImpl.cpp
+++ b/offload/liboffload/src/OffloadImpl.cpp
@@ -1254,6 +1254,9 @@ Error olQueryQueue_impl(ol_queue_handle_t Queue, bool *IsQueueWorkCompleted) {
if (auto Err = Queue->Device->Device->queryAsync(Queue->AsyncInfo, false,
IsQueueWorkCompleted))
return Err;
+ } else if (IsQueueWorkCompleted) {
+ // No underlying queue means there's no work to complete
+ *IsQueueWorkCompleted = true;
}
return Error::success();
}
More information about the llvm-commits
mailing list