Skip to content

Commit e88b4d7

Browse files
fix: correct signaling of partitioned aggregated event 2
Related-To: NEO-14557 Signed-off-by: Bartosz Dunajski <bartosz.dunajski@intel.com>
1 parent f87ff34 commit e88b4d7

File tree

11 files changed

+131
-15
lines changed

11 files changed

+131
-15
lines changed

level_zero/core/source/cmdlist/cmdlist_hw.inl

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ void CommandListCoreFamily<gfxCoreFamily>::handleInOrderDependencyCounter(Event
183183

184184
this->addResidency(inOrderExecInfo->getDeviceCounterAllocation(), inOrderExecInfo->getHostCounterAllocation());
185185

186-
if (signalEvent && signalEvent->getInOrderIncrementValue() == 0) {
186+
if (signalEvent && signalEvent->getInOrderIncrementValue(this->partitionCount) == 0) {
187187
if (signalEvent->isCounterBased() || nonWalkerInOrderCmdsChaining || (isImmediateType() && this->duplicatedInOrderCounterStorageEnabled)) {
188188
assignInOrderExecInfoToEvent(signalEvent);
189189
} else {
@@ -3322,8 +3322,10 @@ void CommandListCoreFamily<gfxCoreFamily>::appendSignalAggregatedEventAtomic(Eve
33223322
using ATOMIC_OPCODES = typename GfxFamily::MI_ATOMIC::ATOMIC_OPCODES;
33233323
using DATA_SIZE = typename GfxFamily::MI_ATOMIC::DATA_SIZE;
33243324

3325+
auto incValue = event.getInOrderIncrementValue(this->partitionCount);
3326+
33253327
NEO::EncodeAtomic<GfxFamily>::programMiAtomic(*commandContainer.getCommandStream(), event.getInOrderExecInfo()->getBaseDeviceAddress(), ATOMIC_OPCODES::ATOMIC_8B_ADD,
3326-
DATA_SIZE::DATA_SIZE_QWORD, 0, 0, event.getInOrderIncrementValue(), 0);
3328+
DATA_SIZE::DATA_SIZE_QWORD, 0, 0, incValue, 0);
33273329
}
33283330

33293331
template <GFXCORE_FAMILY gfxCoreFamily>

level_zero/core/source/cmdlist/cmdlist_hw_immediate.inl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1962,7 +1962,7 @@ ze_result_t CommandListCoreFamilyImmediate<gfxCoreFamily>::appendStagingMemoryCo
19621962
return ret;
19631963
}
19641964

1965-
if (event && event->isCounterBased() && event->getInOrderIncrementValue() == 0) {
1965+
if (event && event->isCounterBased() && event->getInOrderIncrementValue(this->partitionCount) == 0) {
19661966
this->assignInOrderExecInfoToEvent(event);
19671967
} else if (event && !event->isCounterBased() && !event->isEventTimestampFlagSet()) {
19681968
ret = this->appendBarrier(hSignalEvent, 0, nullptr, relaxedOrdering);

level_zero/core/source/cmdlist/cmdlist_hw_xehp_and_later.inl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -352,9 +352,9 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendLaunchKernelWithParams(K
352352
inOrderExecInfo = this->inOrderExecInfo.get();
353353
if (eventForInOrderExec && eventForInOrderExec->isCounterBased()) {
354354
isCounterBasedEvent = true;
355-
if (eventForInOrderExec->getInOrderIncrementValue() > 0) {
355+
if (eventForInOrderExec->getInOrderIncrementValue(this->partitionCount) > 0) {
356356
inOrderIncrementGpuAddress = eventForInOrderExec->getInOrderExecInfo()->getBaseDeviceAddress();
357-
inOrderIncrementValue = eventForInOrderExec->getInOrderIncrementValue();
357+
inOrderIncrementValue = eventForInOrderExec->getInOrderIncrementValue(this->partitionCount);
358358
}
359359
}
360360
}

level_zero/core/source/device/bcs_split.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,10 @@ struct BcsSplit {
9393
uint64_t aggregatedEventIncrementVal = 1;
9494

9595
const bool useSignalEventForSubcopy = aggregatedEventsMode && cmdList->isUsingAdditionalBlitProperties() && Event::isAggregatedEvent(signalEvent) &&
96-
(signalEvent->getInOrderIncrementValue() % engineCount == 0);
96+
(signalEvent->getInOrderIncrementValue(1) % engineCount == 0);
9797

9898
if (useSignalEventForSubcopy) {
99-
aggregatedEventIncrementVal = signalEvent->getInOrderIncrementValue() / engineCount;
99+
aggregatedEventIncrementVal = signalEvent->getInOrderIncrementValue(1) / engineCount;
100100
} else {
101101
auto markerEventIndexRet = this->events.obtainForSplit(Context::fromHandle(cmdList->getCmdListContext()), maxEventCountInPool);
102102
if (!markerEventIndexRet.has_value()) {

level_zero/core/source/event/event.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -659,6 +659,11 @@ uint64_t Event::getInOrderExecSignalValueWithSubmissionCounter() const {
659659
return (inOrderExecSignalValue + appendCounter);
660660
}
661661

662+
uint64_t Event::getInOrderIncrementValue(uint32_t partitionCount) const {
663+
DEBUG_BREAK_IF(inOrderIncrementValue % partitionCount != 0);
664+
return (inOrderIncrementValue / partitionCount);
665+
}
666+
662667
void Event::setLatestUsedCmdQueue(CommandQueue *newCmdQ) {
663668
this->latestUsedCmdQueue = newCmdQ;
664669
}

level_zero/core/source/event/event.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ struct Event : _ze_event_handle_t {
307307
uint64_t getInOrderExecSignalValueWithSubmissionCounter() const;
308308
uint64_t getInOrderExecBaseSignalValue() const { return inOrderExecSignalValue; }
309309
uint32_t getInOrderAllocationOffset() const { return inOrderAllocationOffset; }
310-
uint64_t getInOrderIncrementValue() const { return inOrderIncrementValue; }
310+
uint64_t getInOrderIncrementValue(uint32_t partitionCount) const;
311311
void setLatestUsedCmdQueue(CommandQueue *newCmdQ);
312312
NEO::TimeStampData *peekReferenceTs() {
313313
return static_cast<NEO::TimeStampData *>(ptrOffset(getHostAddress(), getMaxPacketsCount() * getSinglePacketSize()));
@@ -349,7 +349,7 @@ struct Event : _ze_event_handle_t {
349349
this->isEventOnBarrierOptimized = value;
350350
}
351351

352-
static bool isAggregatedEvent(const Event *event) { return (event && event->getInOrderIncrementValue() > 0); }
352+
static bool isAggregatedEvent(const Event *event) { return (event && event->getInOrderIncrementValue(1) > 0); }
353353

354354
CommandList *getRecordedSignalFrom() const {
355355
return this->recordedSignalFrom;

level_zero/core/source/mutable_cmdlist/mutable_cmdlist_hw.inl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -828,7 +828,7 @@ void MutableCommandListCoreFamily<gfxCoreFamily>::storeSignalEventVariable(Mutab
828828
if (CommandListImp::isInOrderExecutionEnabled()) {
829829
mutableEventParams.eventInsideInOrder = true;
830830
mutableEventParams.counterBasedEvent = event->isCounterBased();
831-
mutableEventParams.inOrderIncrementEvent = event->getInOrderIncrementValue() > 0;
831+
mutableEventParams.inOrderIncrementEvent = event->getInOrderIncrementValue(this->partitionCount) > 0;
832832
if (mutableEventParams.counterBasedEvent && CommandListCoreFamily<gfxCoreFamily>::duplicatedInOrderCounterStorageEnabled) {
833833
mutableEventParams.counterBasedTimestampEvent = event->isEventTimestampFlagSet();
834834
}

level_zero/core/source/mutable_cmdlist/variable.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ ze_result_t Variable::setAsSignalEvent(Event *event, MutableComputeWalker *walke
121121
this->eventValue.event = event;
122122
this->eventValue.eventPoolAllocation = event->getAllocation(cmdList->getBase()->getDevice());
123123
this->eventValue.counterBasedEvent = event->isCounterBased();
124-
this->eventValue.inOrderIncrementEvent = event->getInOrderIncrementValue() > 0;
124+
this->eventValue.inOrderIncrementEvent = event->getInOrderIncrementValue(cmdList->getBase()->getPartitionCount()) > 0;
125125
this->eventValue.walkerCmd = walkerCmd;
126126
this->eventValue.postSyncCmd = postSyncCmd;
127127
this->eventValue.kernelCount = event->getKernelCount();

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1251,7 +1251,7 @@ HWTEST2_F(AggregatedBcsSplitTests, whenObtainCalledThenAggregatedEventsCreated,
12511251
EXPECT_EQ(0u, *bcsSplit->events.subcopy[i]->getInOrderExecInfo()->getBaseHostAddress());
12521252
EXPECT_FALSE(bcsSplit->events.subcopy[i]->isSignalScope(ZE_EVENT_SCOPE_FLAG_HOST));
12531253
EXPECT_TRUE(bcsSplit->events.subcopy[i]->isSignalScope(ZE_EVENT_SCOPE_FLAG_DEVICE));
1254-
EXPECT_EQ(1u, bcsSplit->events.subcopy[i]->getInOrderIncrementValue());
1254+
EXPECT_EQ(1u, bcsSplit->events.subcopy[i]->getInOrderIncrementValue(1));
12551255
EXPECT_EQ(static_cast<uint64_t>(bcsSplit->cmdLists.size()), bcsSplit->events.subcopy[i]->getInOrderExecBaseSignalValue());
12561256

12571257
EXPECT_EQ(nullptr, bcsSplit->events.marker[i]->getInOrderExecInfo());
@@ -1296,7 +1296,7 @@ HWTEST2_F(AggregatedBcsSplitTests, whenObtainCalledThenAggregatedEventsCreated,
12961296

12971297
for (auto &event : bcsSplit->events.subcopy) {
12981298
EXPECT_TRUE(event->isCounterBased());
1299-
EXPECT_EQ(1u, event->getInOrderIncrementValue());
1299+
EXPECT_EQ(1u, event->getInOrderIncrementValue(1));
13001300
EXPECT_EQ(static_cast<uint64_t>(bcsSplit->cmdLists.size()), event->getInOrderExecSignalValueWithSubmissionCounter());
13011301
}
13021302
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5716,7 +5716,7 @@ HWTEST_F(InOrderCmdListTests, givenExternalSyncStorageWhenCreatingCounterBasedEv
57165716

57175717
auto inOrderExecInfo = eventObj->getInOrderExecInfo();
57185718

5719-
EXPECT_EQ(incValue, eventObj->getInOrderIncrementValue());
5719+
EXPECT_EQ(incValue, eventObj->getInOrderIncrementValue(1));
57205720
EXPECT_EQ(counterValue, inOrderExecInfo->getCounterValue());
57215721
EXPECT_EQ(castToUint64(externalStorageAllocProperties.deviceAddress), inOrderExecInfo->getBaseDeviceAddress());
57225722
EXPECT_NE(nullptr, inOrderExecInfo->getDeviceCounterAllocation());
@@ -5775,7 +5775,7 @@ HWTEST_F(InOrderCmdListTests, givenExternalSyncStorageWhenCallingAppendThenDontR
57755775
EXPECT_EQ(inOrderExecInfo, eventObj->getInOrderExecInfo());
57765776
EXPECT_EQ(counterValue, eventObj->getInOrderExecInfo()->getCounterValue());
57775777
EXPECT_EQ(counterValue, eventObj->getInOrderExecSignalValueWithSubmissionCounter());
5778-
EXPECT_EQ(incValue, eventObj->getInOrderIncrementValue());
5778+
EXPECT_EQ(incValue, eventObj->getInOrderIncrementValue(1));
57795779

57805780
context->freeMem(devAddress);
57815781
}

0 commit comments

Comments
 (0)