Revert "fix: ensure regular event completion in in-order mode 2"

This reverts commit 9c2e5f5568.

Signed-off-by: Compute-Runtime-Validation <compute-runtime-validation@intel.com>
This commit is contained in:
Compute-Runtime-Validation 2024-12-20 01:53:44 +01:00 committed by Compute-Runtime-Automation
parent 7d4e05410f
commit 630cbe8e41
4 changed files with 16 additions and 44 deletions

View File

@ -195,7 +195,7 @@ void CommandListCoreFamily<gfxCoreFamily>::handleInOrderDependencyCounter(Event
this->commandContainer.addToResidencyContainer(inOrderExecInfo->getHostCounterAllocation()); this->commandContainer.addToResidencyContainer(inOrderExecInfo->getHostCounterAllocation());
if (signalEvent) { if (signalEvent) {
if (signalEvent->isCounterBased() || nonWalkerInOrderCmdsChaining || isImmediateType()) { if (signalEvent->isCounterBased() || nonWalkerInOrderCmdsChaining) {
signalEvent->updateInOrderExecState(inOrderExecInfo, inOrderExecInfo->getCounterValue(), inOrderExecInfo->getAllocationOffset()); signalEvent->updateInOrderExecState(inOrderExecInfo, inOrderExecInfo->getCounterValue(), inOrderExecInfo->getAllocationOffset());
} else { } else {
signalEvent->unsetInOrderExecInfo(); signalEvent->unsetInOrderExecInfo();

View File

@ -78,7 +78,7 @@ struct EventImp : public Event {
const uint32_t count, const ze_kernel_timestamp_result_t *pKernelTimestampsBuffer); const uint32_t count, const ze_kernel_timestamp_result_t *pKernelTimestampsBuffer);
void copyDataToEventAlloc(void *dstHostAddr, uint64_t dstGpuVa, size_t copySize, const void *copyData); void copyDataToEventAlloc(void *dstHostAddr, uint64_t dstGpuVa, size_t copySize, const void *copyData);
void copyTbxData(uint64_t dstGpuVa, size_t copySize); void copyTbxData(uint64_t dstGpuVa, size_t copySize);
void synchronizeTimestampCompletionWithTimeout(); void synchronizeCounterBasedTimestampCompletionWithTimeout();
}; };
} // namespace L0 } // namespace L0

View File

@ -762,7 +762,7 @@ void EventImp<TagSizeT>::resetDeviceCompletionData(bool resetAllPackets) {
} }
template <typename TagSizeT> template <typename TagSizeT>
void EventImp<TagSizeT>::synchronizeTimestampCompletionWithTimeout() { void EventImp<TagSizeT>::synchronizeCounterBasedTimestampCompletionWithTimeout() {
std::chrono::high_resolution_clock::time_point startTime = std::chrono::high_resolution_clock::now(); std::chrono::high_resolution_clock::time_point startTime = std::chrono::high_resolution_clock::now();
constexpr uint64_t timeoutMs = 1000 * 5; // 5s constexpr uint64_t timeoutMs = 1000 * 5; // 5s
uint64_t timeDiff = 0; uint64_t timeDiff = 0;
@ -787,8 +787,8 @@ ze_result_t EventImp<TagSizeT>::queryKernelTimestamp(ze_kernel_timestamp_result_
assignKernelEventCompletionData(getHostAddress()); assignKernelEventCompletionData(getHostAddress());
calculateProfilingData(); calculateProfilingData();
if (contextEndTS == Event::STATE_CLEARED || contextEndTS == 0) { if (isCounterBased() && (contextEndTS == Event::STATE_CLEARED || contextEndTS == 0)) {
synchronizeTimestampCompletionWithTimeout(); synchronizeCounterBasedTimestampCompletionWithTimeout();
} }
auto eventTsSetFunc = [&](uint64_t &timestampFieldToCopy, uint64_t &timestampFieldForWriting) { auto eventTsSetFunc = [&](uint64_t &timestampFieldToCopy, uint64_t &timestampFieldForWriting) {

View File

@ -460,7 +460,7 @@ HWTEST2_F(InOrderCmdListTests, givenCounterBasedTimestampEventWhenQueryingTimest
uint64_t notReadyData = Event::STATE_CLEARED; uint64_t notReadyData = Event::STATE_CLEARED;
void assignKernelEventCompletionData(void *address) override { void assignKernelEventCompletionData(void *address) override {
auto completionAddress = reinterpret_cast<uint64_t *>(ptrOffset(getHostAddress(), NEO::TimestampPackets<uint64_t, 1>::getContextEndOffset())); auto completionAddress = reinterpret_cast<uint64_t *>(getCompletionFieldHostAddress());
assignKernelEventCompletionDataCalled++; assignKernelEventCompletionDataCalled++;
if (assignKernelEventCompletionDataCalled <= assignKernelEventCompletionDataFailCounter) { if (assignKernelEventCompletionDataCalled <= assignKernelEventCompletionDataFailCounter) {
*completionAddress = notReadyData; *completionAddress = notReadyData;
@ -477,7 +477,6 @@ HWTEST2_F(InOrderCmdListTests, givenCounterBasedTimestampEventWhenQueryingTimest
auto eventPool = createEvents<FamilyType>(1, true); auto eventPool = createEvents<FamilyType>(1, true);
auto event1 = std::make_unique<MyMockEvent>(eventPool.get(), device); auto event1 = std::make_unique<MyMockEvent>(eventPool.get(), device);
auto event2 = std::make_unique<MyMockEvent>(eventPool.get(), device); auto event2 = std::make_unique<MyMockEvent>(eventPool.get(), device);
auto event3 = std::make_unique<MyMockEvent>(eventPool.get(), device);
event1->enableCounterBasedMode(true, ZE_EVENT_POOL_COUNTER_BASED_EXP_FLAG_IMMEDIATE); event1->enableCounterBasedMode(true, ZE_EVENT_POOL_COUNTER_BASED_EXP_FLAG_IMMEDIATE);
event1->assignKernelEventCompletionDataFailCounter = 2; event1->assignKernelEventCompletionDataFailCounter = 2;
@ -488,37 +487,26 @@ HWTEST2_F(InOrderCmdListTests, givenCounterBasedTimestampEventWhenQueryingTimest
event2->setUsingContextEndOffset(true); event2->setUsingContextEndOffset(true);
event2->notReadyData = 0; event2->notReadyData = 0;
event3->disableImplicitCounterBasedMode();
event3->assignKernelEventCompletionDataFailCounter = 2;
event3->setUsingContextEndOffset(true);
cmdList->appendLaunchKernel(kernel->toHandle(), groupCount, event1->toHandle(), 0, nullptr, launchParams, false); cmdList->appendLaunchKernel(kernel->toHandle(), groupCount, event1->toHandle(), 0, nullptr, launchParams, false);
cmdList->appendLaunchKernel(kernel->toHandle(), groupCount, event2->toHandle(), 0, nullptr, launchParams, false); cmdList->appendLaunchKernel(kernel->toHandle(), groupCount, event2->toHandle(), 0, nullptr, launchParams, false);
cmdList->appendLaunchKernel(kernel->toHandle(), groupCount, event3->toHandle(), 0, nullptr, launchParams, false);
*reinterpret_cast<uint64_t *>(event1->getCompletionFieldHostAddress()) = Event::STATE_CLEARED; *reinterpret_cast<uint64_t *>(event1->getCompletionFieldHostAddress()) = Event::STATE_CLEARED;
*reinterpret_cast<uint64_t *>(event2->getCompletionFieldHostAddress()) = 0; *reinterpret_cast<uint64_t *>(event2->getCompletionFieldHostAddress()) = 0;
*reinterpret_cast<uint64_t *>(event3->getCompletionFieldHostAddress()) = 0;
event1->getInOrderExecInfo()->setLastWaitedCounterValue(2); event1->getInOrderExecInfo()->setLastWaitedCounterValue(2);
event2->getInOrderExecInfo()->setLastWaitedCounterValue(2); event2->getInOrderExecInfo()->setLastWaitedCounterValue(2);
event3->getInOrderExecInfo()->setLastWaitedCounterValue(3);
EXPECT_EQ(ZE_RESULT_SUCCESS, event1->queryStatus()); EXPECT_EQ(ZE_RESULT_SUCCESS, event1->queryStatus());
EXPECT_EQ(ZE_RESULT_SUCCESS, event2->queryStatus()); EXPECT_EQ(ZE_RESULT_SUCCESS, event2->queryStatus());
EXPECT_EQ(ZE_RESULT_SUCCESS, event3->queryStatus());
ze_kernel_timestamp_result_t kernelTimestamps = {}; ze_kernel_timestamp_result_t kernelTimestamps = {};
EXPECT_EQ(0u, event1->assignKernelEventCompletionDataCalled); EXPECT_EQ(0u, event1->assignKernelEventCompletionDataCalled);
EXPECT_EQ(0u, event2->assignKernelEventCompletionDataCalled); EXPECT_EQ(0u, event2->assignKernelEventCompletionDataCalled);
EXPECT_EQ(0u, event3->assignKernelEventCompletionDataCalled);
event1->queryKernelTimestamp(&kernelTimestamps); event1->queryKernelTimestamp(&kernelTimestamps);
event2->queryKernelTimestamp(&kernelTimestamps); event2->queryKernelTimestamp(&kernelTimestamps);
event3->queryKernelTimestamp(&kernelTimestamps);
EXPECT_EQ(event1->assignKernelEventCompletionDataFailCounter + 1, event1->assignKernelEventCompletionDataCalled); EXPECT_EQ(event1->assignKernelEventCompletionDataFailCounter + 1, event1->assignKernelEventCompletionDataCalled);
EXPECT_EQ(event2->assignKernelEventCompletionDataFailCounter + 1, event2->assignKernelEventCompletionDataCalled); EXPECT_EQ(event2->assignKernelEventCompletionDataFailCounter + 1, event2->assignKernelEventCompletionDataCalled);
EXPECT_EQ(event3->assignKernelEventCompletionDataFailCounter + 1, event3->assignKernelEventCompletionDataCalled);
} }
HWTEST2_F(InOrderCmdListTests, givenInterruptableEventsWhenExecutingOnDifferentCsrThenAssignItToEventOnExecute, IsAtLeastXeHpCore) { HWTEST2_F(InOrderCmdListTests, givenInterruptableEventsWhenExecutingOnDifferentCsrThenAssignItToEventOnExecute, IsAtLeastXeHpCore) {
@ -799,16 +787,16 @@ HWTEST2_F(InOrderCmdListTests, givenInOrderEventWhenAppendEventResetCalledThenRe
} }
HWTEST2_F(InOrderCmdListTests, givenRegularEventWithTemporaryInOrderDataAssignmentWhenCallingSynchronizeOrResetThenUnset, MatchAny) { HWTEST2_F(InOrderCmdListTests, givenRegularEventWithTemporaryInOrderDataAssignmentWhenCallingSynchronizeOrResetThenUnset, MatchAny) {
auto cmdList = createRegularCmdList<gfxCoreFamily>(false); auto immCmdList = createImmCmdList<gfxCoreFamily>();
auto hostAddress = static_cast<uint64_t *>(cmdList->inOrderExecInfo->getDeviceCounterAllocation()->getUnderlyingBuffer()); auto hostAddress = static_cast<uint64_t *>(immCmdList->inOrderExecInfo->getDeviceCounterAllocation()->getUnderlyingBuffer());
auto eventPool = createEvents<FamilyType>(1, true); auto eventPool = createEvents<FamilyType>(1, true);
events[0]->makeCounterBasedImplicitlyDisabled(eventPool->getAllocation()); events[0]->makeCounterBasedImplicitlyDisabled(eventPool->getAllocation());
auto nonWalkerSignallingSupported = cmdList->isInOrderNonWalkerSignalingRequired(events[0].get()); auto nonWalkerSignallingSupported = immCmdList->isInOrderNonWalkerSignalingRequired(events[0].get());
cmdList->appendLaunchKernel(kernel->toHandle(), groupCount, events[0]->toHandle(), 0, nullptr, launchParams, false); immCmdList->appendLaunchKernel(kernel->toHandle(), groupCount, events[0]->toHandle(), 0, nullptr, launchParams, false);
EXPECT_EQ(nonWalkerSignallingSupported, events[0]->inOrderExecInfo.get() != nullptr); EXPECT_EQ(nonWalkerSignallingSupported, events[0]->inOrderExecInfo.get() != nullptr);
@ -824,7 +812,7 @@ HWTEST2_F(InOrderCmdListTests, givenRegularEventWithTemporaryInOrderDataAssignme
EXPECT_EQ(ZE_RESULT_SUCCESS, events[0]->hostSynchronize(1)); EXPECT_EQ(ZE_RESULT_SUCCESS, events[0]->hostSynchronize(1));
EXPECT_EQ(events[0]->inOrderExecInfo.get(), nullptr); EXPECT_EQ(events[0]->inOrderExecInfo.get(), nullptr);
cmdList->appendLaunchKernel(kernel->toHandle(), groupCount, events[0]->toHandle(), 0, nullptr, launchParams, false); immCmdList->appendLaunchKernel(kernel->toHandle(), groupCount, events[0]->toHandle(), 0, nullptr, launchParams, false);
EXPECT_EQ(nonWalkerSignallingSupported, events[0]->inOrderExecInfo.get() != nullptr); EXPECT_EQ(nonWalkerSignallingSupported, events[0]->inOrderExecInfo.get() != nullptr);
EXPECT_EQ(ZE_RESULT_SUCCESS, events[0]->reset()); EXPECT_EQ(ZE_RESULT_SUCCESS, events[0]->reset());
@ -834,16 +822,16 @@ HWTEST2_F(InOrderCmdListTests, givenRegularEventWithTemporaryInOrderDataAssignme
HWTEST2_F(InOrderCmdListTests, givenInOrderModeWheUsingRegularEventThenSetInOrderParamsOnlyWhenChainingIsRequired, MatchAny) { HWTEST2_F(InOrderCmdListTests, givenInOrderModeWheUsingRegularEventThenSetInOrderParamsOnlyWhenChainingIsRequired, MatchAny) {
uint32_t counterOffset = 64; uint32_t counterOffset = 64;
auto cmdList = createRegularCmdList<gfxCoreFamily>(false); auto immCmdList = createImmCmdList<gfxCoreFamily>();
cmdList->inOrderExecInfo->setAllocationOffset(counterOffset); immCmdList->inOrderExecInfo->setAllocationOffset(counterOffset);
auto eventPool = createEvents<FamilyType>(1, false); auto eventPool = createEvents<FamilyType>(1, false);
events[0]->makeCounterBasedImplicitlyDisabled(eventPool->getAllocation()); events[0]->makeCounterBasedImplicitlyDisabled(eventPool->getAllocation());
cmdList->appendLaunchKernel(kernel->toHandle(), groupCount, events[0]->toHandle(), 0, nullptr, launchParams, false); immCmdList->appendLaunchKernel(kernel->toHandle(), groupCount, events[0]->toHandle(), 0, nullptr, launchParams, false);
EXPECT_FALSE(events[0]->isCounterBased()); EXPECT_FALSE(events[0]->isCounterBased());
if (cmdList->isInOrderNonWalkerSignalingRequired(events[0].get())) { if (immCmdList->isInOrderNonWalkerSignalingRequired(events[0].get())) {
EXPECT_EQ(events[0]->inOrderExecSignalValue, 1u); EXPECT_EQ(events[0]->inOrderExecSignalValue, 1u);
EXPECT_NE(events[0]->inOrderExecInfo.get(), nullptr); EXPECT_NE(events[0]->inOrderExecInfo.get(), nullptr);
EXPECT_EQ(events[0]->inOrderAllocationOffset, counterOffset); EXPECT_EQ(events[0]->inOrderAllocationOffset, counterOffset);
@ -853,7 +841,7 @@ HWTEST2_F(InOrderCmdListTests, givenInOrderModeWheUsingRegularEventThenSetInOrde
EXPECT_EQ(events[0]->inOrderAllocationOffset, 0u); EXPECT_EQ(events[0]->inOrderAllocationOffset, 0u);
} }
auto copyImmCmdList = createRegularCmdList<gfxCoreFamily>(true); auto copyImmCmdList = createCopyOnlyImmCmdList<gfxCoreFamily>();
uint32_t copyData = 0; uint32_t copyData = 0;
void *deviceAlloc = nullptr; void *deviceAlloc = nullptr;
@ -871,19 +859,6 @@ HWTEST2_F(InOrderCmdListTests, givenInOrderModeWheUsingRegularEventThenSetInOrde
context->freeMem(deviceAlloc); context->freeMem(deviceAlloc);
} }
HWTEST2_F(InOrderCmdListTests, givenInOrderModeWheUsingRegularEventAndImmediateCmdListThenSetInOrderParams, MatchAny) {
auto cmdList = createImmCmdList<gfxCoreFamily>();
auto eventPool = createEvents<FamilyType>(1, false);
events[0]->makeCounterBasedImplicitlyDisabled(eventPool->getAllocation());
cmdList->appendLaunchKernel(kernel->toHandle(), groupCount, events[0]->toHandle(), 0, nullptr, launchParams, false);
EXPECT_FALSE(events[0]->isCounterBased());
EXPECT_EQ(events[0]->inOrderExecSignalValue, 1u);
EXPECT_NE(events[0]->inOrderExecInfo.get(), nullptr);
}
HWTEST2_F(InOrderCmdListTests, givenRegularEventWithInOrderExecInfoWhenReusedOnRegularCmdListThenUnsetInOrderData, MatchAny) { HWTEST2_F(InOrderCmdListTests, givenRegularEventWithInOrderExecInfoWhenReusedOnRegularCmdListThenUnsetInOrderData, MatchAny) {
auto immCmdList = createImmCmdList<gfxCoreFamily>(); auto immCmdList = createImmCmdList<gfxCoreFamily>();
@ -891,9 +866,6 @@ HWTEST2_F(InOrderCmdListTests, givenRegularEventWithInOrderExecInfoWhenReusedOnR
events[0]->makeCounterBasedImplicitlyDisabled(eventPool->getAllocation()); events[0]->makeCounterBasedImplicitlyDisabled(eventPool->getAllocation());
auto nonWalkerSignallingSupported = immCmdList->isInOrderNonWalkerSignalingRequired(events[0].get()); auto nonWalkerSignallingSupported = immCmdList->isInOrderNonWalkerSignalingRequired(events[0].get());
if (!nonWalkerSignallingSupported) {
GTEST_SKIP();
}
EXPECT_TRUE(immCmdList->isInOrderExecutionEnabled()); EXPECT_TRUE(immCmdList->isInOrderExecutionEnabled());