fix: add poll for aub completion on queue synchronize

Signed-off-by: Bartosz Dunajski <bartosz.dunajski@intel.com>
This commit is contained in:
Bartosz Dunajski
2025-08-06 12:17:14 +00:00
committed by Compute-Runtime-Automation
parent 545c018ecf
commit b95ba7cf05
3 changed files with 22 additions and 26 deletions

View File

@@ -188,6 +188,8 @@ ze_result_t CommandQueueImp::synchronizeByPollingForTaskCount(uint64_t timeoutNa
}
postSyncOperations(false);
getCsr()->pollForAubCompletion();
return ZE_RESULT_SUCCESS;
}

View File

@@ -163,6 +163,26 @@ HWTEST_F(CommandQueueCreate, givenPrintfKernelAndDetectedHangWhenSynchronizingTh
commandQueue->destroy();
}
HWTEST_F(CommandQueueCreate, whenSynchronizedThenPollForAubCompletion) {
const ze_command_queue_desc_t desc{};
ze_result_t returnValue;
auto commandQueue = whiteboxCast(CommandQueue::create(productFamily,
device,
neoDevice->getDefaultEngine().commandStreamReceiver,
&desc,
false,
false,
false,
returnValue));
auto &csr = neoDevice->getUltCommandStreamReceiver<FamilyType>();
auto numPolls = csr.pollForAubCompletionCalled;
EXPECT_EQ(ZE_RESULT_SUCCESS, commandQueue->synchronize(std::numeric_limits<uint64_t>::max()));
EXPECT_EQ(numPolls + 1, csr.pollForAubCompletionCalled);
commandQueue->destroy();
}
HWTEST_F(CommandQueueCreate, givenGpuHangOnSecondReserveWhenReservingLinearStreamThenReturnGpuHang) {
const ze_command_queue_desc_t desc{};
ze_result_t returnValue;

View File

@@ -156,32 +156,6 @@ HWTEST_TEMPLATED_F(AubCsrTest, givenAubCsrSyncQueueAndKmdWaitWhenCallingExecuteC
L0::CommandQueue::fromHandle(commandQueue)->destroy();
}
HWTEST_TEMPLATED_F(AubCsrTest, givenAubCsrAndSyncQueueWhenCallingExecuteCommandListsThenPollForCompletionIsNotCalled) {
auto csr = neoDevice->getDefaultEngine().commandStreamReceiver;
ze_result_t returnValue;
ze_command_queue_desc_t desc = {};
desc.mode = ZE_COMMAND_QUEUE_MODE_SYNCHRONOUS;
ze_command_queue_handle_t commandQueue = {};
ze_result_t res = context->createCommandQueue(device, &desc, &commandQueue);
ASSERT_EQ(ZE_RESULT_SUCCESS, res);
ASSERT_NE(nullptr, commandQueue);
auto aubCsr = static_cast<NEO::UltAubCommandStreamReceiver<FamilyType> *>(csr);
CommandQueue *queue = static_cast<CommandQueue *>(L0::CommandQueue::fromHandle(commandQueue));
EXPECT_EQ(aubCsr->pollForCompletionCalled, 0u);
std::unique_ptr<L0::CommandList> commandList(L0::CommandList::create(productFamily, device, NEO::EngineGroupType::compute, 0u, returnValue, false));
ASSERT_NE(nullptr, commandList);
auto commandListHandle = commandList->toHandle();
commandList->close();
queue->executeCommandLists(1, &commandListHandle, nullptr, false, nullptr, nullptr);
EXPECT_EQ(aubCsr->pollForCompletionCalled, 0u);
L0::CommandQueue::fromHandle(commandQueue)->destroy();
}
HWTEST_TEMPLATED_F(AubCsrTest, givenAubCsrAndAsyncQueueWhenCallingExecuteCommandListsThenPollForCompletionIsNotCalled) {
auto csr = neoDevice->getDefaultEngine().commandStreamReceiver;
ze_result_t returnValue;