fix: perform full host synchronization upon immediate cmdlist destruction

Related-To: NEO-10356

Signed-off-by: Zbigniew Zdanowicz <zbigniew.zdanowicz@intel.com>
This commit is contained in:
Zbigniew Zdanowicz 2025-03-10 18:05:48 +00:00 committed by Compute-Runtime-Automation
parent cd904269ed
commit bc68b70b40
9 changed files with 112 additions and 13 deletions

View File

@ -1651,15 +1651,17 @@ ze_result_t CommandListCoreFamilyImmediate<gfxCoreFamily>::synchronizeInOrderExe
bool signaled = true; bool signaled = true;
const uint64_t *hostAddress = ptrOffset(inOrderExecInfo->getBaseHostAddress(), inOrderExecInfo->getAllocationOffset()); if (csr->getType() != NEO::CommandStreamReceiverType::aub) {
const uint64_t *hostAddress = ptrOffset(inOrderExecInfo->getBaseHostAddress(), inOrderExecInfo->getAllocationOffset());
for (uint32_t i = 0; i < inOrderExecInfo->getNumHostPartitionsToWait(); i++) { for (uint32_t i = 0; i < inOrderExecInfo->getNumHostPartitionsToWait(); i++) {
if (!NEO::WaitUtils::waitFunctionWithPredicate<const uint64_t>(hostAddress, waitValue, std::greater_equal<uint64_t>())) { if (!NEO::WaitUtils::waitFunctionWithPredicate<const uint64_t>(hostAddress, waitValue, std::greater_equal<uint64_t>())) {
signaled = false; signaled = false;
break; break;
}
hostAddress = ptrOffset(hostAddress, this->device->getL0GfxCoreHelper().getImmediateWritePostSyncOffset());
} }
hostAddress = ptrOffset(hostAddress, this->device->getL0GfxCoreHelper().getImmediateWritePostSyncOffset());
} }
if (signaled) { if (signaled) {

View File

@ -50,8 +50,7 @@ ze_result_t CommandListImp::destroy() {
} }
if (isImmediateType() && this->isFlushTaskSubmissionEnabled && !this->isSyncModeQueue) { if (isImmediateType() && this->isFlushTaskSubmissionEnabled && !this->isSyncModeQueue) {
auto timeoutMicroseconds = NEO::TimeoutControls::maxTimeout; this->hostSynchronize(std::numeric_limits<uint64_t>::max());
getCsr(false)->waitForCompletionWithTimeout(NEO::WaitParams{false, false, false, timeoutMicroseconds}, getCsr(false)->peekTaskCount());
} }
if (!isImmediateType() && if (!isImmediateType() &&

View File

@ -13,6 +13,7 @@
#include "shared/test/common/test_macros/hw_test.h" #include "shared/test/common/test_macros/hw_test.h"
#include "level_zero/core/source/event/event_imp.h" #include "level_zero/core/source/event/event_imp.h"
#include "level_zero/core/source/gfx_core_helpers/l0_gfx_core_helper.h"
#include "level_zero/core/test/unit_tests/fixtures/module_fixture.h" #include "level_zero/core/test/unit_tests/fixtures/module_fixture.h"
#include "level_zero/core/test/unit_tests/mocks/mock_cmdlist.h" #include "level_zero/core/test/unit_tests/mocks/mock_cmdlist.h"
#include "level_zero/core/test/unit_tests/mocks/mock_cmdqueue.h" #include "level_zero/core/test/unit_tests/mocks/mock_cmdqueue.h"
@ -196,11 +197,23 @@ struct InOrderCmdListFixture : public ::Test<ModuleFixture> {
cmdList->copyOperationFenceSupported = device->getProductHelper().isDeviceToHostCopySignalingFenceRequired(); cmdList->copyOperationFenceSupported = device->getProductHelper().isDeviceToHostCopySignalingFenceRequired();
} }
completeHostAddress<gfxCoreFamily>(cmdList.get());
createdCmdLists++; createdCmdLists++;
return cmdList; return cmdList;
} }
template <GFXCORE_FAMILY gfxCoreFamily, typename CmdListT>
void completeHostAddress(CmdListT *cmdList) {
uint64_t maxValue = std::numeric_limits<uint64_t>::max();
void *hostAddress = ptrOffset(cmdList->inOrderExecInfo->getBaseHostAddress(), cmdList->inOrderExecInfo->getAllocationOffset());
for (uint32_t i = 0; i < cmdList->inOrderExecInfo->getNumHostPartitionsToWait(); i++) {
memcpy(hostAddress, &maxValue, sizeof(maxValue));
hostAddress = ptrOffset(hostAddress, device->getL0GfxCoreHelper().getImmediateWritePostSyncOffset());
}
}
template <GFXCORE_FAMILY gfxCoreFamily> template <GFXCORE_FAMILY gfxCoreFamily>
DestroyableZeUniquePtr<WhiteBox<L0::CommandListCoreFamily<gfxCoreFamily>>> createRegularCmdList(bool copyOnly) { DestroyableZeUniquePtr<WhiteBox<L0::CommandListCoreFamily<gfxCoreFamily>>> createRegularCmdList(bool copyOnly) {
auto cmdList = makeZeUniquePtr<WhiteBox<L0::CommandListCoreFamily<gfxCoreFamily>>>(); auto cmdList = makeZeUniquePtr<WhiteBox<L0::CommandListCoreFamily<gfxCoreFamily>>>();

View File

@ -1314,6 +1314,11 @@ HWTEST2_F(CommandListCreateTests, givenDirectSubmissionAndImmCmdListWhenDispatch
for (bool inOrderExecution : {false, true}) { for (bool inOrderExecution : {false, true}) {
if (inOrderExecution && !inOrderExecAlreadyEnabled) { if (inOrderExecution && !inOrderExecAlreadyEnabled) {
whiteBoxCmdList->enableInOrderExecution(); whiteBoxCmdList->enableInOrderExecution();
uint64_t *hostAddress = ptrOffset(whiteBoxCmdList->inOrderExecInfo->getBaseHostAddress(), whiteBoxCmdList->inOrderExecInfo->getAllocationOffset());
for (uint32_t i = 0; i < whiteBoxCmdList->inOrderExecInfo->getNumHostPartitionsToWait(); i++) {
*hostAddress = std::numeric_limits<uint64_t>::max();
hostAddress = ptrOffset(hostAddress, device->getL0GfxCoreHelper().getImmediateWritePostSyncOffset());
}
inOrderExecAlreadyEnabled = true; inOrderExecAlreadyEnabled = true;
} }
@ -1670,6 +1675,11 @@ HWTEST2_F(CommandListCreateTests, givenInOrderExecutionWhenDispatchingRelaxedOrd
ASSERT_NE(nullptr, commandList); ASSERT_NE(nullptr, commandList);
auto whiteBoxCmdList = static_cast<CommandList *>(commandList.get()); auto whiteBoxCmdList = static_cast<CommandList *>(commandList.get());
whiteBoxCmdList->enableInOrderExecution(); whiteBoxCmdList->enableInOrderExecution();
uint64_t *hostAddress = ptrOffset(whiteBoxCmdList->inOrderExecInfo->getBaseHostAddress(), whiteBoxCmdList->inOrderExecInfo->getAllocationOffset());
for (uint32_t i = 0; i < whiteBoxCmdList->inOrderExecInfo->getNumHostPartitionsToWait(); i++) {
*hostAddress = std::numeric_limits<uint64_t>::max();
hostAddress = ptrOffset(hostAddress, device->getL0GfxCoreHelper().getImmediateWritePostSyncOffset());
}
ze_event_pool_desc_t eventPoolDesc = {}; ze_event_pool_desc_t eventPoolDesc = {};
eventPoolDesc.count = 1; eventPoolDesc.count = 1;
@ -1726,6 +1736,11 @@ HWTEST2_F(CommandListCreateTests, givenInOrderExecutionWhenDispatchingBarrierThe
ASSERT_NE(nullptr, commandList); ASSERT_NE(nullptr, commandList);
auto whiteBoxCmdList = static_cast<CommandList *>(commandList.get()); auto whiteBoxCmdList = static_cast<CommandList *>(commandList.get());
whiteBoxCmdList->enableInOrderExecution(); whiteBoxCmdList->enableInOrderExecution();
uint64_t *hostAddress = ptrOffset(whiteBoxCmdList->inOrderExecInfo->getBaseHostAddress(), whiteBoxCmdList->inOrderExecInfo->getAllocationOffset());
for (uint32_t i = 0; i < whiteBoxCmdList->inOrderExecInfo->getNumHostPartitionsToWait(); i++) {
*hostAddress = std::numeric_limits<uint64_t>::max();
hostAddress = ptrOffset(hostAddress, device->getL0GfxCoreHelper().getImmediateWritePostSyncOffset());
}
ze_event_pool_desc_t eventPoolDesc = {}; ze_event_pool_desc_t eventPoolDesc = {};
eventPoolDesc.count = 1; eventPoolDesc.count = 1;
@ -1798,6 +1813,11 @@ HWTEST2_F(CommandListCreateTests, givenInOrderExecutionWhenDispatchingBarrierWit
auto whiteBoxCmdList0 = static_cast<CommandList *>(commandList0.get()); auto whiteBoxCmdList0 = static_cast<CommandList *>(commandList0.get());
auto whiteBoxCmdList = static_cast<CommandList *>(commandList.get()); auto whiteBoxCmdList = static_cast<CommandList *>(commandList.get());
whiteBoxCmdList->enableInOrderExecution(); whiteBoxCmdList->enableInOrderExecution();
uint64_t *hostAddress = ptrOffset(whiteBoxCmdList->inOrderExecInfo->getBaseHostAddress(), whiteBoxCmdList->inOrderExecInfo->getAllocationOffset());
for (uint32_t i = 0; i < whiteBoxCmdList->inOrderExecInfo->getNumHostPartitionsToWait(); i++) {
*hostAddress = std::numeric_limits<uint64_t>::max();
hostAddress = ptrOffset(hostAddress, device->getL0GfxCoreHelper().getImmediateWritePostSyncOffset());
}
ze_event_pool_desc_t eventPoolDesc = {}; ze_event_pool_desc_t eventPoolDesc = {};
eventPoolDesc.count = 1; eventPoolDesc.count = 1;
@ -1874,6 +1894,11 @@ HWTEST2_F(CommandListCreateTests, givenInOrderExecutionWhenDispatchingRelaxedOrd
cmdList.reset(CommandList::whiteboxCast(CommandList::createImmediate(productFamily, device, &desc, false, engineGroupType, returnValue))); cmdList.reset(CommandList::whiteboxCast(CommandList::createImmediate(productFamily, device, &desc, false, engineGroupType, returnValue)));
cmdList->isFlushTaskSubmissionEnabled = true; cmdList->isFlushTaskSubmissionEnabled = true;
cmdList->enableInOrderExecution(); cmdList->enableInOrderExecution();
uint64_t *hostAddress = ptrOffset(cmdList->inOrderExecInfo->getBaseHostAddress(), cmdList->inOrderExecInfo->getAllocationOffset());
for (uint32_t i = 0; i < cmdList->inOrderExecInfo->getNumHostPartitionsToWait(); i++) {
*hostAddress = std::numeric_limits<uint64_t>::max();
hostAddress = ptrOffset(hostAddress, device->getL0GfxCoreHelper().getImmediateWritePostSyncOffset());
}
std::unique_ptr<L0::ult::Module> mockModule = std::make_unique<L0::ult::Module>(device, nullptr, ModuleType::builtin); std::unique_ptr<L0::ult::Module> mockModule = std::make_unique<L0::ult::Module>(device, nullptr, ModuleType::builtin);
Mock<::L0::KernelImp> kernel; Mock<::L0::KernelImp> kernel;

View File

@ -1903,7 +1903,11 @@ HWTEST2_F(PrimaryBatchBufferCmdListTest, givenRelaxedOrderingAndRegularCmdListAn
ASSERT_NE(nullptr, immCommandList); ASSERT_NE(nullptr, immCommandList);
auto whiteBoxCmdList = static_cast<CommandList *>(immCommandList.get()); auto whiteBoxCmdList = static_cast<CommandList *>(immCommandList.get());
whiteBoxCmdList->enableInOrderExecution(); whiteBoxCmdList->enableInOrderExecution();
uint64_t *hostAddress = ptrOffset(whiteBoxCmdList->inOrderExecInfo->getBaseHostAddress(), whiteBoxCmdList->inOrderExecInfo->getAllocationOffset());
for (uint32_t i = 0; i < whiteBoxCmdList->inOrderExecInfo->getNumHostPartitionsToWait(); i++) {
*hostAddress = std::numeric_limits<uint64_t>::max();
hostAddress = ptrOffset(hostAddress, device->getL0GfxCoreHelper().getImmediateWritePostSyncOffset());
}
auto ultCsr = static_cast<NEO::UltCommandStreamReceiver<FamilyType> *>(whiteBoxCmdList->getCsr(false)); auto ultCsr = static_cast<NEO::UltCommandStreamReceiver<FamilyType> *>(whiteBoxCmdList->getCsr(false));
ultCsr->recordFlushedBatchBuffer = true; ultCsr->recordFlushedBatchBuffer = true;

View File

@ -1757,5 +1757,25 @@ HWTEST2_F(ImmediateCommandListTest,
EXPECT_EQ(MI_BATCH_BUFFER_START::SECOND_LEVEL_BATCH_BUFFER::SECOND_LEVEL_BATCH_BUFFER_FIRST_LEVEL_BATCH, bbStart->getSecondLevelBatchBuffer()); EXPECT_EQ(MI_BATCH_BUFFER_START::SECOND_LEVEL_BATCH_BUFFER::SECOND_LEVEL_BATCH_BUFFER_FIRST_LEVEL_BATCH, bbStart->getSecondLevelBatchBuffer());
} }
HWTEST2_F(ImmediateCommandListTest, givenAsyncCmdlistWhenCmdlistIsDestroyedThenHostSynchronizeCalled, MatchAny) {
ze_command_queue_desc_t queueDesc{ZE_STRUCTURE_TYPE_COMMAND_QUEUE_DESC};
queueDesc.ordinal = 0u;
queueDesc.mode = ZE_COMMAND_QUEUE_MODE_ASYNCHRONOUS;
ze_result_t returnValue;
auto immediateCmdList = CommandList::whiteboxCast(CommandList::createImmediate(productFamily, device, &queueDesc, false, engineGroupType, returnValue));
immediateCmdList->cmdQImmediate->registerCsrClient();
auto csr = immediateCmdList->getCsr(false);
auto clientCount = csr->getNumClients();
EXPECT_EQ(1u, clientCount);
immediateCmdList->destroy();
clientCount = csr->getNumClients();
EXPECT_EQ(0u, clientCount);
}
} // namespace ult } // namespace ult
} // namespace L0 } // namespace L0

View File

@ -308,6 +308,9 @@ HWTEST2_F(InOrderCmdListTests, givenCmdListsWhenDispatchingThenUseInternalTaskCo
context->freeMem(deviceAlloc); context->freeMem(deviceAlloc);
} }
completeHostAddress<gfxCoreFamily, WhiteBox<L0::CommandListCoreFamilyImmediate<gfxCoreFamily>>>(immCmdList0.get());
completeHostAddress<gfxCoreFamily, WhiteBox<L0::CommandListCoreFamilyImmediate<gfxCoreFamily>>>(immCmdList1.get());
} }
HWTEST2_F(InOrderCmdListTests, givenCounterBasedEventsWhenHostWaitsAreCalledThenLatestWaitIsRecorded, MatchAny) { HWTEST2_F(InOrderCmdListTests, givenCounterBasedEventsWhenHostWaitsAreCalledThenLatestWaitIsRecorded, MatchAny) {
@ -343,6 +346,8 @@ HWTEST2_F(InOrderCmdListTests, givenCounterBasedEventsWhenHostWaitsAreCalledThen
inOrderExecInfo->setAllocationOffset(4u); inOrderExecInfo->setAllocationOffset(4u);
EXPECT_FALSE(inOrderExecInfo->isCounterAlreadyDone(0u)); EXPECT_FALSE(inOrderExecInfo->isCounterAlreadyDone(0u));
EXPECT_FALSE(inOrderExecInfo->isCounterAlreadyDone(counterValue)); EXPECT_FALSE(inOrderExecInfo->isCounterAlreadyDone(counterValue));
completeHostAddress<gfxCoreFamily, WhiteBox<L0::CommandListCoreFamilyImmediate<gfxCoreFamily>>>(immCmdList.get());
} }
HWTEST2_F(InOrderCmdListTests, givenDebugFlagSetWhenEventHostSyncCalledThenCallWaitUserFence, IsAtLeastXeHpCore) { HWTEST2_F(InOrderCmdListTests, givenDebugFlagSetWhenEventHostSyncCalledThenCallWaitUserFence, IsAtLeastXeHpCore) {
@ -975,6 +980,8 @@ HWTEST2_F(InOrderCmdListTests, givenInOrderModeWhenSubmittingThenProgramSemaphor
} }
ASSERT_TRUE(verifyInOrderDependency<FamilyType>(itor, 1, immCmdList->inOrderExecInfo->getBaseDeviceAddress() + counterOffset, immCmdList->isQwordInOrderCounter(), false)); ASSERT_TRUE(verifyInOrderDependency<FamilyType>(itor, 1, immCmdList->inOrderExecInfo->getBaseDeviceAddress() + counterOffset, immCmdList->isQwordInOrderCounter(), false));
completeHostAddress<gfxCoreFamily, WhiteBox<L0::CommandListCoreFamilyImmediate<gfxCoreFamily>>>(immCmdList.get());
} }
HWTEST2_F(InOrderCmdListTests, givenResolveDependenciesViaPipeControlsForInOrderModeWhenSubmittingThenProgramPipeControlInBetweenDispatches, IsAtLeastXeHpCore) { HWTEST2_F(InOrderCmdListTests, givenResolveDependenciesViaPipeControlsForInOrderModeWhenSubmittingThenProgramPipeControlInBetweenDispatches, IsAtLeastXeHpCore) {
@ -1002,6 +1009,8 @@ HWTEST2_F(InOrderCmdListTests, givenResolveDependenciesViaPipeControlsForInOrder
auto itor = find<typename FamilyType::PIPE_CONTROL *>(cmdList.begin(), cmdList.end()); auto itor = find<typename FamilyType::PIPE_CONTROL *>(cmdList.begin(), cmdList.end());
ASSERT_NE(cmdList.end(), itor); ASSERT_NE(cmdList.end(), itor);
completeHostAddress<gfxCoreFamily, WhiteBox<L0::CommandListCoreFamilyImmediate<gfxCoreFamily>>>(immCmdList.get());
} }
HWTEST2_F(InOrderCmdListTests, givenOptimizedCbEventWhenSubmittingThenProgramPipeControlOrSemaphoreInBetweenDispatches, IsAtLeastXeHpCore) { HWTEST2_F(InOrderCmdListTests, givenOptimizedCbEventWhenSubmittingThenProgramPipeControlOrSemaphoreInBetweenDispatches, IsAtLeastXeHpCore) {
@ -1035,6 +1044,8 @@ HWTEST2_F(InOrderCmdListTests, givenOptimizedCbEventWhenSubmittingThenProgramPip
auto itor = find<typename FamilyType::MI_SEMAPHORE_WAIT *>(cmdList.begin(), cmdList.end()); auto itor = find<typename FamilyType::MI_SEMAPHORE_WAIT *>(cmdList.begin(), cmdList.end());
ASSERT_NE(cmdList.end(), itor); ASSERT_NE(cmdList.end(), itor);
} }
completeHostAddress<gfxCoreFamily, WhiteBox<L0::CommandListCoreFamilyImmediate<gfxCoreFamily>>>(immCmdList.get());
} }
HWTEST2_F(InOrderCmdListTests, givenInOrderCmdListWhenSubmittingThenProgramPipeControlOrSemaphoreInBetweenDispatches, IsAtLeastXeHpCore) { HWTEST2_F(InOrderCmdListTests, givenInOrderCmdListWhenSubmittingThenProgramPipeControlOrSemaphoreInBetweenDispatches, IsAtLeastXeHpCore) {
@ -1068,6 +1079,8 @@ HWTEST2_F(InOrderCmdListTests, givenInOrderCmdListWhenSubmittingThenProgramPipeC
auto itor = find<typename FamilyType::MI_SEMAPHORE_WAIT *>(cmdList.begin(), cmdList.end()); auto itor = find<typename FamilyType::MI_SEMAPHORE_WAIT *>(cmdList.begin(), cmdList.end());
ASSERT_NE(cmdList.end(), itor); ASSERT_NE(cmdList.end(), itor);
} }
completeHostAddress<gfxCoreFamily, WhiteBox<L0::CommandListCoreFamilyImmediate<gfxCoreFamily>>>(immCmdList.get());
} }
HWTEST2_F(InOrderCmdListTests, givenDependencyFromDifferentRootDeviceWhenAppendCalledThenCreatePeerAllocation, MatchAny) { HWTEST2_F(InOrderCmdListTests, givenDependencyFromDifferentRootDeviceWhenAppendCalledThenCreatePeerAllocation, MatchAny) {
@ -1107,6 +1120,11 @@ HWTEST2_F(InOrderCmdListTests, givenDependencyFromDifferentRootDeviceWhenAppendC
cmdList->initialize(inputDevice, NEO::EngineGroupType::renderCompute, 0u); cmdList->initialize(inputDevice, NEO::EngineGroupType::renderCompute, 0u);
cmdList->commandContainer.setImmediateCmdListCsr(csr); cmdList->commandContainer.setImmediateCmdListCsr(csr);
cmdList->enableInOrderExecution(); cmdList->enableInOrderExecution();
uint64_t *hostAddress = ptrOffset(cmdList->inOrderExecInfo->getBaseHostAddress(), cmdList->inOrderExecInfo->getAllocationOffset());
for (uint32_t i = 0; i < cmdList->inOrderExecInfo->getNumHostPartitionsToWait(); i++) {
*hostAddress = std::numeric_limits<uint64_t>::max();
hostAddress = ptrOffset(hostAddress, device->getL0GfxCoreHelper().getImmediateWritePostSyncOffset());
}
createdCmdLists++; createdCmdLists++;
@ -1418,6 +1436,9 @@ HWTEST2_F(InOrderCmdListTests, givenInOrderEventModeWhenSubmittingThenProgramSem
itor = find<MI_SEMAPHORE_WAIT *>(itor, cmdList.end()); itor = find<MI_SEMAPHORE_WAIT *>(itor, cmdList.end());
EXPECT_EQ(cmdList.end(), itor); EXPECT_EQ(cmdList.end(), itor);
completeHostAddress<gfxCoreFamily, WhiteBox<L0::CommandListCoreFamilyImmediate<gfxCoreFamily>>>(immCmdList.get());
completeHostAddress<gfxCoreFamily, WhiteBox<L0::CommandListCoreFamilyImmediate<gfxCoreFamily>>>(immCmdList2.get());
} }
HWTEST2_F(InOrderCmdListTests, givenImplicitEventConvertionEnabledWhenUsingImmediateCmdListThenConvertEventToCounterBased, MatchAny) { HWTEST2_F(InOrderCmdListTests, givenImplicitEventConvertionEnabledWhenUsingImmediateCmdListThenConvertEventToCounterBased, MatchAny) {
@ -4403,6 +4424,8 @@ HWTEST2_F(InOrderCmdListTests, givenInOrderModeWhenProgrammingCounterWithOverflo
useZeroOffset = !useZeroOffset; useZeroOffset = !useZeroOffset;
} }
completeHostAddress<gfxCoreFamily, WhiteBox<L0::CommandListCoreFamilyImmediate<gfxCoreFamily>>>(immCmdList.get());
} }
HWTEST2_F(InOrderCmdListTests, givenInOrderModeWhenProgrammingCounterWithOverflowThenHandleItCorrectly, IsAtLeastXeHpCore) { HWTEST2_F(InOrderCmdListTests, givenInOrderModeWhenProgrammingCounterWithOverflowThenHandleItCorrectly, IsAtLeastXeHpCore) {
@ -4503,6 +4526,8 @@ HWTEST2_F(InOrderCmdListTests, givenInOrderModeWhenProgrammingCounterWithOverflo
EXPECT_EQ(expectedCounter, events[0]->inOrderExecSignalValue); EXPECT_EQ(expectedCounter, events[0]->inOrderExecSignalValue);
EXPECT_EQ(offset, events[0]->inOrderAllocationOffset); EXPECT_EQ(offset, events[0]->inOrderAllocationOffset);
completeHostAddress<gfxCoreFamily, WhiteBox<L0::CommandListCoreFamilyImmediate<gfxCoreFamily>>>(immCmdList.get());
} }
HWTEST2_F(InOrderCmdListTests, givenCopyOnlyInOrderModeWhenProgrammingBarrierThenSignalInOrderAllocation, IsAtLeastXeHpCore) { HWTEST2_F(InOrderCmdListTests, givenCopyOnlyInOrderModeWhenProgrammingBarrierThenSignalInOrderAllocation, IsAtLeastXeHpCore) {
@ -5978,6 +6003,8 @@ HWTEST2_F(InOrderCmdListTests, givenInOrderModeWhenGpuHangDetectedInCpuCopyPathT
ultCsr->forceReturnGpuHang = false; ultCsr->forceReturnGpuHang = false;
*hostAddress = std::numeric_limits<uint64_t>::max();
context->freeMem(deviceAlloc); context->freeMem(deviceAlloc);
} }

View File

@ -763,6 +763,7 @@ HWTEST2_F(CopyOffloadInOrderTests, givenInOrderModeWhenCallingSyncThenHandleComp
EXPECT_EQ(0u, mainQueueCsr->waitForCompletionWithTimeoutTaskCountCalled.load()); EXPECT_EQ(0u, mainQueueCsr->waitForCompletionWithTimeoutTaskCountCalled.load());
EXPECT_EQ(0u, offloadCsr->waitForCompletionWithTimeoutTaskCountCalled.load()); EXPECT_EQ(0u, offloadCsr->waitForCompletionWithTimeoutTaskCountCalled.load());
} }
*hostAddress = std::numeric_limits<uint64_t>::max();
} }
HWTEST2_F(CopyOffloadInOrderTests, givenTbxModeWhenSyncCalledAlwaysDownloadAllocationsFromBothCsrs, IsAtLeastXeHpCore) { HWTEST2_F(CopyOffloadInOrderTests, givenTbxModeWhenSyncCalledAlwaysDownloadAllocationsFromBothCsrs, IsAtLeastXeHpCore) {
@ -844,6 +845,7 @@ HWTEST2_F(CopyOffloadInOrderTests, givenNonInOrderModeWaitWhenCallingSyncThenHan
immCmdList->hostSynchronize(0, true); immCmdList->hostSynchronize(0, true);
EXPECT_EQ(1u, mainQueueCsr->waitForCompletionWithTimeoutTaskCountCalled.load()); EXPECT_EQ(1u, mainQueueCsr->waitForCompletionWithTimeoutTaskCountCalled.load());
EXPECT_EQ(1u, offloadCsr->waitForCompletionWithTimeoutTaskCountCalled.load()); EXPECT_EQ(1u, offloadCsr->waitForCompletionWithTimeoutTaskCountCalled.load());
*hostAddress = std::numeric_limits<uint64_t>::max();
} }
HWTEST2_F(CopyOffloadInOrderTests, givenNonInOrderModeWaitWhenCallingSyncThenHandleCompletionAndTempAllocations, IsAtLeastXeHpCore) { HWTEST2_F(CopyOffloadInOrderTests, givenNonInOrderModeWaitWhenCallingSyncThenHandleCompletionAndTempAllocations, IsAtLeastXeHpCore) {
@ -918,6 +920,7 @@ HWTEST2_F(CopyOffloadInOrderTests, givenNonInOrderModeWaitWhenCallingSyncThenHan
immCmdList->hostSynchronize(0, true); immCmdList->hostSynchronize(0, true);
EXPECT_TRUE(mainInternalStorage->getTemporaryAllocations().peekIsEmpty()); EXPECT_TRUE(mainInternalStorage->getTemporaryAllocations().peekIsEmpty());
EXPECT_TRUE(offloadInternalStorage->getTemporaryAllocations().peekIsEmpty()); EXPECT_TRUE(offloadInternalStorage->getTemporaryAllocations().peekIsEmpty());
*hostAddress = std::numeric_limits<uint64_t>::max();
} }
HWTEST2_F(CopyOffloadInOrderTests, givenInterruptEventWhenDispatchingTheProgramUserInterrupt, IsAtLeastXeHpcCore) { HWTEST2_F(CopyOffloadInOrderTests, givenInterruptEventWhenDispatchingTheProgramUserInterrupt, IsAtLeastXeHpcCore) {
@ -1970,8 +1973,7 @@ HWTEST2_F(StandaloneInOrderTimestampAllocationTests, givenTimestampEventWhenDisp
cmdList->appendLaunchKernel(kernel->toHandle(), groupCount, eventHandle, 0, nullptr, launchParams, false); cmdList->appendLaunchKernel(kernel->toHandle(), groupCount, eventHandle, 0, nullptr, launchParams, false);
// mark as not ready, to make sure that destructor will release everything anyway *hostAddress = std::numeric_limits<uint64_t>::max();
*hostAddress = 0;
} }
using SynchronizedDispatchTests = InOrderCmdListFixture; using SynchronizedDispatchTests = InOrderCmdListFixture;
@ -3205,6 +3207,8 @@ HWTEST2_F(MultiTileInOrderCmdListTests, givenMultiTileInOrderModeWhenCallingSync
*hostAddress1 = 3; *hostAddress1 = 3;
EXPECT_EQ(ZE_RESULT_SUCCESS, immCmdList->hostSynchronize(0, false)); EXPECT_EQ(ZE_RESULT_SUCCESS, immCmdList->hostSynchronize(0, false));
EXPECT_EQ(ZE_RESULT_SUCCESS, events[0]->hostSynchronize(0)); EXPECT_EQ(ZE_RESULT_SUCCESS, events[0]->hostSynchronize(0));
completeHostAddress<gfxCoreFamily, WhiteBox<L0::CommandListCoreFamilyImmediate<gfxCoreFamily>>>(immCmdList.get());
} }
HWTEST2_F(MultiTileInOrderCmdListTests, whenUsingRegularCmdListThenAddWalkerToPatch, IsAtLeastXeHpCore) { HWTEST2_F(MultiTileInOrderCmdListTests, whenUsingRegularCmdListThenAddWalkerToPatch, IsAtLeastXeHpCore) {

View File

@ -131,7 +131,7 @@ HWTEST2_F(InOrderIpcTests, givenCounterOffsetWhenOpenIsCalledThenPassCorrectData
static_cast<WhiteboxInOrderExecInfo *>(events[0]->inOrderExecInfo.get())->numDevicePartitionsToWait = 2; static_cast<WhiteboxInOrderExecInfo *>(events[0]->inOrderExecInfo.get())->numDevicePartitionsToWait = 2;
static_cast<WhiteboxInOrderExecInfo *>(events[0]->inOrderExecInfo.get())->numHostPartitionsToWait = 3; static_cast<WhiteboxInOrderExecInfo *>(events[0]->inOrderExecInfo.get())->numHostPartitionsToWait = 3;
static_cast<WhiteboxInOrderExecInfo *>(events[0]->inOrderExecInfo.get())->initializeAllocationsFromHost();
auto deviceAlloc = static_cast<MemoryAllocation *>(events[0]->inOrderExecInfo->getDeviceCounterAllocation()); auto deviceAlloc = static_cast<MemoryAllocation *>(events[0]->inOrderExecInfo->getDeviceCounterAllocation());
auto hostAlloc = static_cast<MemoryAllocation *>(events[0]->inOrderExecInfo->getHostCounterAllocation()); auto hostAlloc = static_cast<MemoryAllocation *>(events[0]->inOrderExecInfo->getHostCounterAllocation());
@ -155,6 +155,8 @@ HWTEST2_F(InOrderIpcTests, givenCounterOffsetWhenOpenIsCalledThenPassCorrectData
EXPECT_TRUE(expectedOffset == ipcData.counterOffset); EXPECT_TRUE(expectedOffset == ipcData.counterOffset);
EXPECT_TRUE(events[0]->inOrderExecInfo->getNumDevicePartitionsToWait() == ipcData.devicePartitions); EXPECT_TRUE(events[0]->inOrderExecInfo->getNumDevicePartitionsToWait() == ipcData.devicePartitions);
EXPECT_TRUE(events[0]->inOrderExecInfo->isHostStorageDuplicated() ? events[0]->inOrderExecInfo->getNumHostPartitionsToWait() : events[0]->inOrderExecInfo->getNumDevicePartitionsToWait() == ipcData.hostPartitions); EXPECT_TRUE(events[0]->inOrderExecInfo->isHostStorageDuplicated() ? events[0]->inOrderExecInfo->getNumHostPartitionsToWait() : events[0]->inOrderExecInfo->getNumDevicePartitionsToWait() == ipcData.hostPartitions);
completeHostAddress<gfxCoreFamily, WhiteBox<L0::CommandListCoreFamilyImmediate<gfxCoreFamily>>>(immCmdList2.get());
} }
HWTEST2_F(InOrderIpcTests, givenIpcHandleWhenCreatingNewEventThenSetCorrectData, MatchAny) { HWTEST2_F(InOrderIpcTests, givenIpcHandleWhenCreatingNewEventThenSetCorrectData, MatchAny) {
@ -169,6 +171,7 @@ HWTEST2_F(InOrderIpcTests, givenIpcHandleWhenCreatingNewEventThenSetCorrectData,
auto event0InOrderInfo = static_cast<WhiteboxInOrderExecInfo *>(events[0]->inOrderExecInfo.get()); auto event0InOrderInfo = static_cast<WhiteboxInOrderExecInfo *>(events[0]->inOrderExecInfo.get());
event0InOrderInfo->numDevicePartitionsToWait = 2; event0InOrderInfo->numDevicePartitionsToWait = 2;
event0InOrderInfo->numHostPartitionsToWait = 3; event0InOrderInfo->numHostPartitionsToWait = 3;
event0InOrderInfo->initializeAllocationsFromHost();
zex_ipc_counter_based_event_handle_t zexIpcData = {}; zex_ipc_counter_based_event_handle_t zexIpcData = {};
@ -208,6 +211,8 @@ HWTEST2_F(InOrderIpcTests, givenIpcHandleWhenCreatingNewEventThenSetCorrectData,
EXPECT_EQ(expectedOffset, newEventMock->inOrderAllocationOffset); EXPECT_EQ(expectedOffset, newEventMock->inOrderAllocationOffset);
zexCounterBasedEventCloseIpcHandle(newEvent); zexCounterBasedEventCloseIpcHandle(newEvent);
completeHostAddress<gfxCoreFamily, WhiteBox<L0::CommandListCoreFamilyImmediate<gfxCoreFamily>>>(immCmdList2.get());
} }
HWTEST2_F(InOrderIpcTests, givenInvalidInternalHandleWhenOpenCalledThenReturnError, MatchAny) { HWTEST2_F(InOrderIpcTests, givenInvalidInternalHandleWhenOpenCalledThenReturnError, MatchAny) {