Skip to content

Commit 466f654

Browse files
fix: move waitWithKmdNotifyFallback under debug key
Related-To: NEO-2024 Signed-off-by: Mateusz Hoppe <[email protected]>
1 parent f50ca44 commit 466f654

File tree

3 files changed

+26
-2
lines changed

3 files changed

+26
-2
lines changed

level_zero/core/source/cmdlist/cmdlist_hw_immediate.inl

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1225,11 +1225,10 @@ ze_result_t CommandListCoreFamilyImmediate<gfxCoreFamily>::hostSynchronize(uint6
12251225
if (inOrderWaitAllowed) {
12261226
status = synchronizeInOrderExecution(timeout, (waitQueue == this->cmdQImmediateCopyOffload));
12271227
} else {
1228-
12291228
const auto indefinitelyPoll = timeout == std::numeric_limits<uint64_t>::max();
12301229
auto waitStatus = NEO::WaitStatus::notReady;
12311230

1232-
if (indefinitelyPoll) {
1231+
if (indefinitelyPoll && static_cast<CommandQueueImp *>(waitQueue)->getUseKmdWaitFunction()) {
12331232
waitStatus = waitCsr->waitForTaskCountWithKmdNotifyFallback(waitTaskCount,
12341233
waitCsr->obtainCurrentFlushStamp(),
12351234
true,

level_zero/core/source/cmdqueue/cmdqueue_imp.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,10 @@ struct CommandQueueImp : public CommandQueue {
102102
return syncMode;
103103
}
104104

105+
bool getUseKmdWaitFunction() const {
106+
return useKmdWaitFunction;
107+
}
108+
105109
virtual bool getPreemptionCmdProgramming() = 0;
106110
void handleIndirectAllocationResidency(UnifiedMemoryControls unifiedMemoryControls, std::unique_lock<std::mutex> &lockForIndirect, bool performMigration) override;
107111
void makeResidentAndMigrate(bool performMigration, const NEO::ResidencyContainer &residencyContainer) override;

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

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1623,6 +1623,27 @@ HWTEST_F(ImmediateCommandListHostSynchronize, givenMaxTimeoutIsProvidedWaitParam
16231623

16241624
EXPECT_EQ(cmdList->hostSynchronize(std::numeric_limits<uint64_t>::max()), ZE_RESULT_SUCCESS);
16251625

1626+
auto waitParams = csr->latestWaitForCompletionWithTimeoutWaitParams;
1627+
EXPECT_FALSE(waitParams.enableTimeout);
1628+
EXPECT_TRUE(waitParams.indefinitelyPoll);
1629+
1630+
EXPECT_EQ(0u, csr->waitForTaskCountWithKmdNotifyInputParams.size());
1631+
}
1632+
1633+
HWTEST_F(ImmediateCommandListHostSynchronize, givenOverrideUseKmdWaitFunctionAndMaxTimeoutIsProvidedThenWaitWithKmdNotifyIsCalled) {
1634+
auto csr = static_cast<NEO::UltCommandStreamReceiver<FamilyType> *>(device->getNEODevice()->getInternalEngine().commandStreamReceiver);
1635+
DebugManagerStateRestore restore;
1636+
NEO::debugManager.flags.OverrideUseKmdWaitFunction.set(1);
1637+
1638+
auto cmdList = createCmdList<FamilyType::gfxCoreFamily>(csr);
1639+
1640+
csr->captureWaitForTaskCountWithKmdNotifyInputParams = true;
1641+
1642+
csr->callBaseWaitForCompletionWithTimeout = false;
1643+
csr->returnWaitForCompletionWithTimeout = WaitStatus::ready;
1644+
1645+
EXPECT_EQ(cmdList->hostSynchronize(std::numeric_limits<uint64_t>::max()), ZE_RESULT_SUCCESS);
1646+
16261647
auto waitParams = csr->latestWaitForCompletionWithTimeoutWaitParams;
16271648
EXPECT_FALSE(waitParams.enableTimeout);
16281649
EXPECT_FALSE(waitParams.indefinitelyPoll);

0 commit comments

Comments
 (0)