Skip to content

Commit bc68b70

Browse files
fix: perform full host synchronization upon immediate cmdlist destruction
Related-To: NEO-10356 Signed-off-by: Zbigniew Zdanowicz <[email protected]>
1 parent cd90426 commit bc68b70

File tree

9 files changed

+112
-13
lines changed

9 files changed

+112
-13
lines changed

level_zero/core/source/cmdlist/cmdlist_hw_immediate.inl

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1651,15 +1651,17 @@ ze_result_t CommandListCoreFamilyImmediate<gfxCoreFamily>::synchronizeInOrderExe
16511651

16521652
bool signaled = true;
16531653

1654-
const uint64_t *hostAddress = ptrOffset(inOrderExecInfo->getBaseHostAddress(), inOrderExecInfo->getAllocationOffset());
1654+
if (csr->getType() != NEO::CommandStreamReceiverType::aub) {
1655+
const uint64_t *hostAddress = ptrOffset(inOrderExecInfo->getBaseHostAddress(), inOrderExecInfo->getAllocationOffset());
16551656

1656-
for (uint32_t i = 0; i < inOrderExecInfo->getNumHostPartitionsToWait(); i++) {
1657-
if (!NEO::WaitUtils::waitFunctionWithPredicate<const uint64_t>(hostAddress, waitValue, std::greater_equal<uint64_t>())) {
1658-
signaled = false;
1659-
break;
1660-
}
1657+
for (uint32_t i = 0; i < inOrderExecInfo->getNumHostPartitionsToWait(); i++) {
1658+
if (!NEO::WaitUtils::waitFunctionWithPredicate<const uint64_t>(hostAddress, waitValue, std::greater_equal<uint64_t>())) {
1659+
signaled = false;
1660+
break;
1661+
}
16611662

1662-
hostAddress = ptrOffset(hostAddress, this->device->getL0GfxCoreHelper().getImmediateWritePostSyncOffset());
1663+
hostAddress = ptrOffset(hostAddress, this->device->getL0GfxCoreHelper().getImmediateWritePostSyncOffset());
1664+
}
16631665
}
16641666

16651667
if (signaled) {

level_zero/core/source/cmdlist/cmdlist_imp.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,7 @@ ze_result_t CommandListImp::destroy() {
5050
}
5151

5252
if (isImmediateType() && this->isFlushTaskSubmissionEnabled && !this->isSyncModeQueue) {
53-
auto timeoutMicroseconds = NEO::TimeoutControls::maxTimeout;
54-
getCsr(false)->waitForCompletionWithTimeout(NEO::WaitParams{false, false, false, timeoutMicroseconds}, getCsr(false)->peekTaskCount());
53+
this->hostSynchronize(std::numeric_limits<uint64_t>::max());
5554
}
5655

5756
if (!isImmediateType() &&

level_zero/core/test/unit_tests/fixtures/in_order_cmd_list_fixture.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include "shared/test/common/test_macros/hw_test.h"
1414

1515
#include "level_zero/core/source/event/event_imp.h"
16+
#include "level_zero/core/source/gfx_core_helpers/l0_gfx_core_helper.h"
1617
#include "level_zero/core/test/unit_tests/fixtures/module_fixture.h"
1718
#include "level_zero/core/test/unit_tests/mocks/mock_cmdlist.h"
1819
#include "level_zero/core/test/unit_tests/mocks/mock_cmdqueue.h"
@@ -196,11 +197,23 @@ struct InOrderCmdListFixture : public ::Test<ModuleFixture> {
196197
cmdList->copyOperationFenceSupported = device->getProductHelper().isDeviceToHostCopySignalingFenceRequired();
197198
}
198199

200+
completeHostAddress<gfxCoreFamily>(cmdList.get());
201+
199202
createdCmdLists++;
200203

201204
return cmdList;
202205
}
203206

207+
template <GFXCORE_FAMILY gfxCoreFamily, typename CmdListT>
208+
void completeHostAddress(CmdListT *cmdList) {
209+
uint64_t maxValue = std::numeric_limits<uint64_t>::max();
210+
void *hostAddress = ptrOffset(cmdList->inOrderExecInfo->getBaseHostAddress(), cmdList->inOrderExecInfo->getAllocationOffset());
211+
for (uint32_t i = 0; i < cmdList->inOrderExecInfo->getNumHostPartitionsToWait(); i++) {
212+
memcpy(hostAddress, &maxValue, sizeof(maxValue));
213+
hostAddress = ptrOffset(hostAddress, device->getL0GfxCoreHelper().getImmediateWritePostSyncOffset());
214+
}
215+
}
216+
204217
template <GFXCORE_FAMILY gfxCoreFamily>
205218
DestroyableZeUniquePtr<WhiteBox<L0::CommandListCoreFamily<gfxCoreFamily>>> createRegularCmdList(bool copyOnly) {
206219
auto cmdList = makeZeUniquePtr<WhiteBox<L0::CommandListCoreFamily<gfxCoreFamily>>>();

level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_1.cpp

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1314,6 +1314,11 @@ HWTEST2_F(CommandListCreateTests, givenDirectSubmissionAndImmCmdListWhenDispatch
13141314
for (bool inOrderExecution : {false, true}) {
13151315
if (inOrderExecution && !inOrderExecAlreadyEnabled) {
13161316
whiteBoxCmdList->enableInOrderExecution();
1317+
uint64_t *hostAddress = ptrOffset(whiteBoxCmdList->inOrderExecInfo->getBaseHostAddress(), whiteBoxCmdList->inOrderExecInfo->getAllocationOffset());
1318+
for (uint32_t i = 0; i < whiteBoxCmdList->inOrderExecInfo->getNumHostPartitionsToWait(); i++) {
1319+
*hostAddress = std::numeric_limits<uint64_t>::max();
1320+
hostAddress = ptrOffset(hostAddress, device->getL0GfxCoreHelper().getImmediateWritePostSyncOffset());
1321+
}
13171322
inOrderExecAlreadyEnabled = true;
13181323
}
13191324

@@ -1670,6 +1675,11 @@ HWTEST2_F(CommandListCreateTests, givenInOrderExecutionWhenDispatchingRelaxedOrd
16701675
ASSERT_NE(nullptr, commandList);
16711676
auto whiteBoxCmdList = static_cast<CommandList *>(commandList.get());
16721677
whiteBoxCmdList->enableInOrderExecution();
1678+
uint64_t *hostAddress = ptrOffset(whiteBoxCmdList->inOrderExecInfo->getBaseHostAddress(), whiteBoxCmdList->inOrderExecInfo->getAllocationOffset());
1679+
for (uint32_t i = 0; i < whiteBoxCmdList->inOrderExecInfo->getNumHostPartitionsToWait(); i++) {
1680+
*hostAddress = std::numeric_limits<uint64_t>::max();
1681+
hostAddress = ptrOffset(hostAddress, device->getL0GfxCoreHelper().getImmediateWritePostSyncOffset());
1682+
}
16731683

16741684
ze_event_pool_desc_t eventPoolDesc = {};
16751685
eventPoolDesc.count = 1;
@@ -1726,6 +1736,11 @@ HWTEST2_F(CommandListCreateTests, givenInOrderExecutionWhenDispatchingBarrierThe
17261736
ASSERT_NE(nullptr, commandList);
17271737
auto whiteBoxCmdList = static_cast<CommandList *>(commandList.get());
17281738
whiteBoxCmdList->enableInOrderExecution();
1739+
uint64_t *hostAddress = ptrOffset(whiteBoxCmdList->inOrderExecInfo->getBaseHostAddress(), whiteBoxCmdList->inOrderExecInfo->getAllocationOffset());
1740+
for (uint32_t i = 0; i < whiteBoxCmdList->inOrderExecInfo->getNumHostPartitionsToWait(); i++) {
1741+
*hostAddress = std::numeric_limits<uint64_t>::max();
1742+
hostAddress = ptrOffset(hostAddress, device->getL0GfxCoreHelper().getImmediateWritePostSyncOffset());
1743+
}
17291744

17301745
ze_event_pool_desc_t eventPoolDesc = {};
17311746
eventPoolDesc.count = 1;
@@ -1798,6 +1813,11 @@ HWTEST2_F(CommandListCreateTests, givenInOrderExecutionWhenDispatchingBarrierWit
17981813
auto whiteBoxCmdList0 = static_cast<CommandList *>(commandList0.get());
17991814
auto whiteBoxCmdList = static_cast<CommandList *>(commandList.get());
18001815
whiteBoxCmdList->enableInOrderExecution();
1816+
uint64_t *hostAddress = ptrOffset(whiteBoxCmdList->inOrderExecInfo->getBaseHostAddress(), whiteBoxCmdList->inOrderExecInfo->getAllocationOffset());
1817+
for (uint32_t i = 0; i < whiteBoxCmdList->inOrderExecInfo->getNumHostPartitionsToWait(); i++) {
1818+
*hostAddress = std::numeric_limits<uint64_t>::max();
1819+
hostAddress = ptrOffset(hostAddress, device->getL0GfxCoreHelper().getImmediateWritePostSyncOffset());
1820+
}
18011821

18021822
ze_event_pool_desc_t eventPoolDesc = {};
18031823
eventPoolDesc.count = 1;
@@ -1874,6 +1894,11 @@ HWTEST2_F(CommandListCreateTests, givenInOrderExecutionWhenDispatchingRelaxedOrd
18741894
cmdList.reset(CommandList::whiteboxCast(CommandList::createImmediate(productFamily, device, &desc, false, engineGroupType, returnValue)));
18751895
cmdList->isFlushTaskSubmissionEnabled = true;
18761896
cmdList->enableInOrderExecution();
1897+
uint64_t *hostAddress = ptrOffset(cmdList->inOrderExecInfo->getBaseHostAddress(), cmdList->inOrderExecInfo->getAllocationOffset());
1898+
for (uint32_t i = 0; i < cmdList->inOrderExecInfo->getNumHostPartitionsToWait(); i++) {
1899+
*hostAddress = std::numeric_limits<uint64_t>::max();
1900+
hostAddress = ptrOffset(hostAddress, device->getL0GfxCoreHelper().getImmediateWritePostSyncOffset());
1901+
}
18771902

18781903
std::unique_ptr<L0::ult::Module> mockModule = std::make_unique<L0::ult::Module>(device, nullptr, ModuleType::builtin);
18791904
Mock<::L0::KernelImp> kernel;

level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_2.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1903,7 +1903,11 @@ HWTEST2_F(PrimaryBatchBufferCmdListTest, givenRelaxedOrderingAndRegularCmdListAn
19031903
ASSERT_NE(nullptr, immCommandList);
19041904
auto whiteBoxCmdList = static_cast<CommandList *>(immCommandList.get());
19051905
whiteBoxCmdList->enableInOrderExecution();
1906-
1906+
uint64_t *hostAddress = ptrOffset(whiteBoxCmdList->inOrderExecInfo->getBaseHostAddress(), whiteBoxCmdList->inOrderExecInfo->getAllocationOffset());
1907+
for (uint32_t i = 0; i < whiteBoxCmdList->inOrderExecInfo->getNumHostPartitionsToWait(); i++) {
1908+
*hostAddress = std::numeric_limits<uint64_t>::max();
1909+
hostAddress = ptrOffset(hostAddress, device->getL0GfxCoreHelper().getImmediateWritePostSyncOffset());
1910+
}
19071911
auto ultCsr = static_cast<NEO::UltCommandStreamReceiver<FamilyType> *>(whiteBoxCmdList->getCsr(false));
19081912
ultCsr->recordFlushedBatchBuffer = true;
19091913

level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_4.cpp

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1757,5 +1757,25 @@ HWTEST2_F(ImmediateCommandListTest,
17571757
EXPECT_EQ(MI_BATCH_BUFFER_START::SECOND_LEVEL_BATCH_BUFFER::SECOND_LEVEL_BATCH_BUFFER_FIRST_LEVEL_BATCH, bbStart->getSecondLevelBatchBuffer());
17581758
}
17591759

1760+
HWTEST2_F(ImmediateCommandListTest, givenAsyncCmdlistWhenCmdlistIsDestroyedThenHostSynchronizeCalled, MatchAny) {
1761+
ze_command_queue_desc_t queueDesc{ZE_STRUCTURE_TYPE_COMMAND_QUEUE_DESC};
1762+
queueDesc.ordinal = 0u;
1763+
queueDesc.mode = ZE_COMMAND_QUEUE_MODE_ASYNCHRONOUS;
1764+
1765+
ze_result_t returnValue;
1766+
auto immediateCmdList = CommandList::whiteboxCast(CommandList::createImmediate(productFamily, device, &queueDesc, false, engineGroupType, returnValue));
1767+
1768+
immediateCmdList->cmdQImmediate->registerCsrClient();
1769+
auto csr = immediateCmdList->getCsr(false);
1770+
1771+
auto clientCount = csr->getNumClients();
1772+
EXPECT_EQ(1u, clientCount);
1773+
1774+
immediateCmdList->destroy();
1775+
1776+
clientCount = csr->getNumClients();
1777+
EXPECT_EQ(0u, clientCount);
1778+
}
1779+
17601780
} // namespace ult
17611781
} // namespace L0

level_zero/core/test/unit_tests/sources/cmdlist/test_in_order_cmdlist_1.cpp

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,9 @@ HWTEST2_F(InOrderCmdListTests, givenCmdListsWhenDispatchingThenUseInternalTaskCo
308308

309309
context->freeMem(deviceAlloc);
310310
}
311+
312+
completeHostAddress<gfxCoreFamily, WhiteBox<L0::CommandListCoreFamilyImmediate<gfxCoreFamily>>>(immCmdList0.get());
313+
completeHostAddress<gfxCoreFamily, WhiteBox<L0::CommandListCoreFamilyImmediate<gfxCoreFamily>>>(immCmdList1.get());
311314
}
312315

313316
HWTEST2_F(InOrderCmdListTests, givenCounterBasedEventsWhenHostWaitsAreCalledThenLatestWaitIsRecorded, MatchAny) {
@@ -343,6 +346,8 @@ HWTEST2_F(InOrderCmdListTests, givenCounterBasedEventsWhenHostWaitsAreCalledThen
343346
inOrderExecInfo->setAllocationOffset(4u);
344347
EXPECT_FALSE(inOrderExecInfo->isCounterAlreadyDone(0u));
345348
EXPECT_FALSE(inOrderExecInfo->isCounterAlreadyDone(counterValue));
349+
350+
completeHostAddress<gfxCoreFamily, WhiteBox<L0::CommandListCoreFamilyImmediate<gfxCoreFamily>>>(immCmdList.get());
346351
}
347352

348353
HWTEST2_F(InOrderCmdListTests, givenDebugFlagSetWhenEventHostSyncCalledThenCallWaitUserFence, IsAtLeastXeHpCore) {
@@ -975,6 +980,8 @@ HWTEST2_F(InOrderCmdListTests, givenInOrderModeWhenSubmittingThenProgramSemaphor
975980
}
976981

977982
ASSERT_TRUE(verifyInOrderDependency<FamilyType>(itor, 1, immCmdList->inOrderExecInfo->getBaseDeviceAddress() + counterOffset, immCmdList->isQwordInOrderCounter(), false));
983+
984+
completeHostAddress<gfxCoreFamily, WhiteBox<L0::CommandListCoreFamilyImmediate<gfxCoreFamily>>>(immCmdList.get());
978985
}
979986

980987
HWTEST2_F(InOrderCmdListTests, givenResolveDependenciesViaPipeControlsForInOrderModeWhenSubmittingThenProgramPipeControlInBetweenDispatches, IsAtLeastXeHpCore) {
@@ -1002,6 +1009,8 @@ HWTEST2_F(InOrderCmdListTests, givenResolveDependenciesViaPipeControlsForInOrder
10021009

10031010
auto itor = find<typename FamilyType::PIPE_CONTROL *>(cmdList.begin(), cmdList.end());
10041011
ASSERT_NE(cmdList.end(), itor);
1012+
1013+
completeHostAddress<gfxCoreFamily, WhiteBox<L0::CommandListCoreFamilyImmediate<gfxCoreFamily>>>(immCmdList.get());
10051014
}
10061015

10071016
HWTEST2_F(InOrderCmdListTests, givenOptimizedCbEventWhenSubmittingThenProgramPipeControlOrSemaphoreInBetweenDispatches, IsAtLeastXeHpCore) {
@@ -1035,6 +1044,8 @@ HWTEST2_F(InOrderCmdListTests, givenOptimizedCbEventWhenSubmittingThenProgramPip
10351044
auto itor = find<typename FamilyType::MI_SEMAPHORE_WAIT *>(cmdList.begin(), cmdList.end());
10361045
ASSERT_NE(cmdList.end(), itor);
10371046
}
1047+
1048+
completeHostAddress<gfxCoreFamily, WhiteBox<L0::CommandListCoreFamilyImmediate<gfxCoreFamily>>>(immCmdList.get());
10381049
}
10391050

10401051
HWTEST2_F(InOrderCmdListTests, givenInOrderCmdListWhenSubmittingThenProgramPipeControlOrSemaphoreInBetweenDispatches, IsAtLeastXeHpCore) {
@@ -1068,6 +1079,8 @@ HWTEST2_F(InOrderCmdListTests, givenInOrderCmdListWhenSubmittingThenProgramPipeC
10681079
auto itor = find<typename FamilyType::MI_SEMAPHORE_WAIT *>(cmdList.begin(), cmdList.end());
10691080
ASSERT_NE(cmdList.end(), itor);
10701081
}
1082+
1083+
completeHostAddress<gfxCoreFamily, WhiteBox<L0::CommandListCoreFamilyImmediate<gfxCoreFamily>>>(immCmdList.get());
10711084
}
10721085

10731086
HWTEST2_F(InOrderCmdListTests, givenDependencyFromDifferentRootDeviceWhenAppendCalledThenCreatePeerAllocation, MatchAny) {
@@ -1107,6 +1120,11 @@ HWTEST2_F(InOrderCmdListTests, givenDependencyFromDifferentRootDeviceWhenAppendC
11071120
cmdList->initialize(inputDevice, NEO::EngineGroupType::renderCompute, 0u);
11081121
cmdList->commandContainer.setImmediateCmdListCsr(csr);
11091122
cmdList->enableInOrderExecution();
1123+
uint64_t *hostAddress = ptrOffset(cmdList->inOrderExecInfo->getBaseHostAddress(), cmdList->inOrderExecInfo->getAllocationOffset());
1124+
for (uint32_t i = 0; i < cmdList->inOrderExecInfo->getNumHostPartitionsToWait(); i++) {
1125+
*hostAddress = std::numeric_limits<uint64_t>::max();
1126+
hostAddress = ptrOffset(hostAddress, device->getL0GfxCoreHelper().getImmediateWritePostSyncOffset());
1127+
}
11101128

11111129
createdCmdLists++;
11121130

@@ -1418,6 +1436,9 @@ HWTEST2_F(InOrderCmdListTests, givenInOrderEventModeWhenSubmittingThenProgramSem
14181436

14191437
itor = find<MI_SEMAPHORE_WAIT *>(itor, cmdList.end());
14201438
EXPECT_EQ(cmdList.end(), itor);
1439+
1440+
completeHostAddress<gfxCoreFamily, WhiteBox<L0::CommandListCoreFamilyImmediate<gfxCoreFamily>>>(immCmdList.get());
1441+
completeHostAddress<gfxCoreFamily, WhiteBox<L0::CommandListCoreFamilyImmediate<gfxCoreFamily>>>(immCmdList2.get());
14211442
}
14221443

14231444
HWTEST2_F(InOrderCmdListTests, givenImplicitEventConvertionEnabledWhenUsingImmediateCmdListThenConvertEventToCounterBased, MatchAny) {
@@ -4403,6 +4424,8 @@ HWTEST2_F(InOrderCmdListTests, givenInOrderModeWhenProgrammingCounterWithOverflo
44034424

44044425
useZeroOffset = !useZeroOffset;
44054426
}
4427+
4428+
completeHostAddress<gfxCoreFamily, WhiteBox<L0::CommandListCoreFamilyImmediate<gfxCoreFamily>>>(immCmdList.get());
44064429
}
44074430

44084431
HWTEST2_F(InOrderCmdListTests, givenInOrderModeWhenProgrammingCounterWithOverflowThenHandleItCorrectly, IsAtLeastXeHpCore) {
@@ -4503,6 +4526,8 @@ HWTEST2_F(InOrderCmdListTests, givenInOrderModeWhenProgrammingCounterWithOverflo
45034526

45044527
EXPECT_EQ(expectedCounter, events[0]->inOrderExecSignalValue);
45054528
EXPECT_EQ(offset, events[0]->inOrderAllocationOffset);
4529+
4530+
completeHostAddress<gfxCoreFamily, WhiteBox<L0::CommandListCoreFamilyImmediate<gfxCoreFamily>>>(immCmdList.get());
45064531
}
45074532

45084533
HWTEST2_F(InOrderCmdListTests, givenCopyOnlyInOrderModeWhenProgrammingBarrierThenSignalInOrderAllocation, IsAtLeastXeHpCore) {
@@ -5978,6 +6003,8 @@ HWTEST2_F(InOrderCmdListTests, givenInOrderModeWhenGpuHangDetectedInCpuCopyPathT
59786003

59796004
ultCsr->forceReturnGpuHang = false;
59806005

6006+
*hostAddress = std::numeric_limits<uint64_t>::max();
6007+
59816008
context->freeMem(deviceAlloc);
59826009
}
59836010

level_zero/core/test/unit_tests/sources/cmdlist/test_in_order_cmdlist_2.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -763,6 +763,7 @@ HWTEST2_F(CopyOffloadInOrderTests, givenInOrderModeWhenCallingSyncThenHandleComp
763763
EXPECT_EQ(0u, mainQueueCsr->waitForCompletionWithTimeoutTaskCountCalled.load());
764764
EXPECT_EQ(0u, offloadCsr->waitForCompletionWithTimeoutTaskCountCalled.load());
765765
}
766+
*hostAddress = std::numeric_limits<uint64_t>::max();
766767
}
767768

768769
HWTEST2_F(CopyOffloadInOrderTests, givenTbxModeWhenSyncCalledAlwaysDownloadAllocationsFromBothCsrs, IsAtLeastXeHpCore) {
@@ -844,6 +845,7 @@ HWTEST2_F(CopyOffloadInOrderTests, givenNonInOrderModeWaitWhenCallingSyncThenHan
844845
immCmdList->hostSynchronize(0, true);
845846
EXPECT_EQ(1u, mainQueueCsr->waitForCompletionWithTimeoutTaskCountCalled.load());
846847
EXPECT_EQ(1u, offloadCsr->waitForCompletionWithTimeoutTaskCountCalled.load());
848+
*hostAddress = std::numeric_limits<uint64_t>::max();
847849
}
848850

849851
HWTEST2_F(CopyOffloadInOrderTests, givenNonInOrderModeWaitWhenCallingSyncThenHandleCompletionAndTempAllocations, IsAtLeastXeHpCore) {
@@ -918,6 +920,7 @@ HWTEST2_F(CopyOffloadInOrderTests, givenNonInOrderModeWaitWhenCallingSyncThenHan
918920
immCmdList->hostSynchronize(0, true);
919921
EXPECT_TRUE(mainInternalStorage->getTemporaryAllocations().peekIsEmpty());
920922
EXPECT_TRUE(offloadInternalStorage->getTemporaryAllocations().peekIsEmpty());
923+
*hostAddress = std::numeric_limits<uint64_t>::max();
921924
}
922925

923926
HWTEST2_F(CopyOffloadInOrderTests, givenInterruptEventWhenDispatchingTheProgramUserInterrupt, IsAtLeastXeHpcCore) {
@@ -1970,8 +1973,7 @@ HWTEST2_F(StandaloneInOrderTimestampAllocationTests, givenTimestampEventWhenDisp
19701973

19711974
cmdList->appendLaunchKernel(kernel->toHandle(), groupCount, eventHandle, 0, nullptr, launchParams, false);
19721975

1973-
// mark as not ready, to make sure that destructor will release everything anyway
1974-
*hostAddress = 0;
1976+
*hostAddress = std::numeric_limits<uint64_t>::max();
19751977
}
19761978

19771979
using SynchronizedDispatchTests = InOrderCmdListFixture;
@@ -3205,6 +3207,8 @@ HWTEST2_F(MultiTileInOrderCmdListTests, givenMultiTileInOrderModeWhenCallingSync
32053207
*hostAddress1 = 3;
32063208
EXPECT_EQ(ZE_RESULT_SUCCESS, immCmdList->hostSynchronize(0, false));
32073209
EXPECT_EQ(ZE_RESULT_SUCCESS, events[0]->hostSynchronize(0));
3210+
3211+
completeHostAddress<gfxCoreFamily, WhiteBox<L0::CommandListCoreFamilyImmediate<gfxCoreFamily>>>(immCmdList.get());
32083212
}
32093213

32103214
HWTEST2_F(MultiTileInOrderCmdListTests, whenUsingRegularCmdListThenAddWalkerToPatch, IsAtLeastXeHpCore) {

level_zero/core/test/unit_tests/sources/cmdlist/test_in_order_cmdlist_3.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ HWTEST2_F(InOrderIpcTests, givenCounterOffsetWhenOpenIsCalledThenPassCorrectData
131131

132132
static_cast<WhiteboxInOrderExecInfo *>(events[0]->inOrderExecInfo.get())->numDevicePartitionsToWait = 2;
133133
static_cast<WhiteboxInOrderExecInfo *>(events[0]->inOrderExecInfo.get())->numHostPartitionsToWait = 3;
134-
134+
static_cast<WhiteboxInOrderExecInfo *>(events[0]->inOrderExecInfo.get())->initializeAllocationsFromHost();
135135
auto deviceAlloc = static_cast<MemoryAllocation *>(events[0]->inOrderExecInfo->getDeviceCounterAllocation());
136136
auto hostAlloc = static_cast<MemoryAllocation *>(events[0]->inOrderExecInfo->getHostCounterAllocation());
137137

@@ -155,6 +155,8 @@ HWTEST2_F(InOrderIpcTests, givenCounterOffsetWhenOpenIsCalledThenPassCorrectData
155155
EXPECT_TRUE(expectedOffset == ipcData.counterOffset);
156156
EXPECT_TRUE(events[0]->inOrderExecInfo->getNumDevicePartitionsToWait() == ipcData.devicePartitions);
157157
EXPECT_TRUE(events[0]->inOrderExecInfo->isHostStorageDuplicated() ? events[0]->inOrderExecInfo->getNumHostPartitionsToWait() : events[0]->inOrderExecInfo->getNumDevicePartitionsToWait() == ipcData.hostPartitions);
158+
159+
completeHostAddress<gfxCoreFamily, WhiteBox<L0::CommandListCoreFamilyImmediate<gfxCoreFamily>>>(immCmdList2.get());
158160
}
159161

160162
HWTEST2_F(InOrderIpcTests, givenIpcHandleWhenCreatingNewEventThenSetCorrectData, MatchAny) {
@@ -169,6 +171,7 @@ HWTEST2_F(InOrderIpcTests, givenIpcHandleWhenCreatingNewEventThenSetCorrectData,
169171
auto event0InOrderInfo = static_cast<WhiteboxInOrderExecInfo *>(events[0]->inOrderExecInfo.get());
170172
event0InOrderInfo->numDevicePartitionsToWait = 2;
171173
event0InOrderInfo->numHostPartitionsToWait = 3;
174+
event0InOrderInfo->initializeAllocationsFromHost();
172175

173176
zex_ipc_counter_based_event_handle_t zexIpcData = {};
174177

@@ -208,6 +211,8 @@ HWTEST2_F(InOrderIpcTests, givenIpcHandleWhenCreatingNewEventThenSetCorrectData,
208211
EXPECT_EQ(expectedOffset, newEventMock->inOrderAllocationOffset);
209212

210213
zexCounterBasedEventCloseIpcHandle(newEvent);
214+
215+
completeHostAddress<gfxCoreFamily, WhiteBox<L0::CommandListCoreFamilyImmediate<gfxCoreFamily>>>(immCmdList2.get());
211216
}
212217

213218
HWTEST2_F(InOrderIpcTests, givenInvalidInternalHandleWhenOpenCalledThenReturnError, MatchAny) {

0 commit comments

Comments
 (0)