[llvm] [Offload][AMDGPU] Fix olQueryQueue uninitialized output parameter (PR #178464)

via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 28 08:48:24 PST 2026


https://github.com/mugiwaraluffy56 created https://github.com/llvm/llvm-project/pull/178464

## Summary
- Fix uninitialized output parameter in `olQueryQueue_impl` when `Queue->AsyncInfo->Queue` is null
- Set `IsQueueWorkCompleted` to `true` when no underlying queue exists (no pending work)
- Resolves test failure on AMDGPU for `olQueryQueueTest.SuccessEmptyAsyncQueueCheckResult`

Fixes #178462.

## Test plan
- [x] Fixed `OffloadAPI/queue.unittests/olQueryQueueTest/SuccessEmptyAsyncQueueCheckResult/AMDGPU_AMD_Radeon_RX_7700_XT_0` test
- [ ] CI tests pass

>From 02da973c2c15d0231e40c95bd6bae3acb582c8cd 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