mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-28 16:48:45 +08:00
performance: convert to CB events for all platforms
Related-To: NEO-16861 Signed-off-by: Szymon Morek <szymon.morek@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
bbba367745
commit
7661a8ee5f
@@ -2025,14 +2025,13 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendMemoryCopy(void *dstptr,
|
||||
|
||||
if (hSignalEvent) {
|
||||
signalEvent = Event::fromHandle(hSignalEvent);
|
||||
if (!handleCounterBasedEventOperations(signalEvent, false)) {
|
||||
return ZE_RESULT_ERROR_INVALID_ARGUMENT;
|
||||
}
|
||||
launchParams.isHostSignalScopeEvent = signalEvent->isSignalScope(ZE_EVENT_SCOPE_FLAG_HOST);
|
||||
dcFlush = getDcFlushRequired(signalEvent->isFlushRequiredForSignal());
|
||||
}
|
||||
|
||||
if (!handleCounterBasedEventOperations(signalEvent, false)) {
|
||||
return ZE_RESULT_ERROR_INVALID_ARGUMENT;
|
||||
}
|
||||
|
||||
bool isSplitOperation = kernelCounter > 1;
|
||||
launchParams.numKernelsInSplitLaunch = kernelCounter;
|
||||
launchParams.isKernelSplitOperation = isSplitOperation;
|
||||
@@ -2541,11 +2540,9 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendMemoryFill(void *ptr,
|
||||
CmdListKernelLaunchParams launchParams = {};
|
||||
|
||||
Event *signalEvent = nullptr;
|
||||
bool dcFlush = false;
|
||||
if (hSignalEvent) {
|
||||
signalEvent = Event::fromHandle(hSignalEvent);
|
||||
launchParams.isHostSignalScopeEvent = signalEvent->isSignalScope(ZE_EVENT_SCOPE_FLAG_HOST);
|
||||
dcFlush = getDcFlushRequired(signalEvent->isFlushRequiredForSignal());
|
||||
registerWalkerWithProfilingEnqueued(signalEvent);
|
||||
}
|
||||
|
||||
@@ -2611,6 +2608,7 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendMemoryFill(void *ptr,
|
||||
setupFillKernelArguments(dstAllocation.offset, patternSize, size, fillArguments, builtinKernel);
|
||||
|
||||
launchParams.isKernelSplitOperation = (fillArguments.leftRemainingBytes > 0 || fillArguments.rightRemainingBytes > 0);
|
||||
bool dcFlush = signalEvent && getDcFlushRequired(signalEvent->isFlushRequiredForSignal());
|
||||
bool singlePipeControlPacket = eventSignalPipeControl(launchParams.isKernelSplitOperation, dcFlush);
|
||||
launchParams.pipeControlSignalling = (signalEvent && singlePipeControlPacket) || getDcFlushRequired(dstAllocation.needsFlush);
|
||||
|
||||
@@ -4808,7 +4806,7 @@ bool CommandListCoreFamily<gfxCoreFamily>::handleCounterBasedEventOperations(Eve
|
||||
return true;
|
||||
}
|
||||
|
||||
bool implicitCounterBasedEventConversionEnable = !this->dcFlushSupport;
|
||||
bool implicitCounterBasedEventConversionEnable = true;
|
||||
if (NEO::debugManager.flags.EnableImplicitConvertionToCounterBasedEvents.get() != -1) {
|
||||
implicitCounterBasedEventConversionEnable = !!NEO::debugManager.flags.EnableImplicitConvertionToCounterBasedEvents.get();
|
||||
}
|
||||
|
||||
@@ -1813,13 +1813,12 @@ ze_result_t CommandListCoreFamilyImmediate<gfxCoreFamily>::appendCommandLists(ui
|
||||
bool dcFlush = false;
|
||||
if (hSignalEvent) {
|
||||
signalEvent = Event::fromHandle(hSignalEvent);
|
||||
if (!this->handleCounterBasedEventOperations(signalEvent, false)) {
|
||||
return ZE_RESULT_ERROR_INVALID_ARGUMENT;
|
||||
}
|
||||
dcFlush = this->getDcFlushRequired(signalEvent->isFlushRequiredForSignal());
|
||||
}
|
||||
|
||||
if (!this->handleCounterBasedEventOperations(signalEvent, false)) {
|
||||
return ZE_RESULT_ERROR_INVALID_ARGUMENT;
|
||||
}
|
||||
|
||||
CommandListCoreFamily<gfxCoreFamily>::appendEventForProfiling(signalEvent,
|
||||
nullptr,
|
||||
true,
|
||||
|
||||
@@ -1485,67 +1485,39 @@ HWTEST_F(InOrderCmdListTests, givenImplicitEventConvertionEnabledWhenUsingImmedi
|
||||
|
||||
debugManager.flags.EnableImplicitConvertionToCounterBasedEvents.set(-1);
|
||||
|
||||
bool dcFlushRequired = immCmdList->getDcFlushRequired(true);
|
||||
|
||||
immCmdList->appendLaunchKernel(kernel->toHandle(), groupCount, events[0]->toHandle(), 0, nullptr, launchParams);
|
||||
if (dcFlushRequired) {
|
||||
EXPECT_EQ(Event::CounterBasedMode::initiallyDisabled, events[0]->counterBasedMode);
|
||||
EXPECT_EQ(0u, events[0]->counterBasedFlags);
|
||||
} else {
|
||||
EXPECT_EQ(Event::CounterBasedMode::implicitlyEnabled, events[0]->counterBasedMode);
|
||||
EXPECT_EQ(static_cast<uint32_t>(ZE_EVENT_POOL_COUNTER_BASED_EXP_FLAG_IMMEDIATE), events[0]->counterBasedFlags);
|
||||
}
|
||||
EXPECT_NE(dcFlushRequired, events[0]->isCounterBased());
|
||||
EXPECT_EQ(Event::CounterBasedMode::implicitlyEnabled, events[0]->counterBasedMode);
|
||||
EXPECT_EQ(static_cast<uint32_t>(ZE_EVENT_POOL_COUNTER_BASED_EXP_FLAG_IMMEDIATE), events[0]->counterBasedFlags);
|
||||
EXPECT_TRUE(events[0]->isCounterBased());
|
||||
|
||||
regularCmdList->appendLaunchKernel(kernel->toHandle(), groupCount, events[1]->toHandle(), 0, nullptr, launchParams);
|
||||
|
||||
if (dcFlushRequired) {
|
||||
EXPECT_EQ(Event::CounterBasedMode::initiallyDisabled, events[1]->counterBasedMode);
|
||||
} else {
|
||||
EXPECT_EQ(Event::CounterBasedMode::implicitlyDisabled, events[1]->counterBasedMode);
|
||||
}
|
||||
EXPECT_EQ(Event::CounterBasedMode::implicitlyDisabled, events[1]->counterBasedMode);
|
||||
EXPECT_EQ(0u, events[1]->counterBasedFlags);
|
||||
EXPECT_FALSE(events[1]->isCounterBased());
|
||||
|
||||
outOfOrderImmCmdList->appendLaunchKernel(kernel->toHandle(), groupCount, events[2]->toHandle(), 0, nullptr, launchParams);
|
||||
if (dcFlushRequired) {
|
||||
EXPECT_EQ(Event::CounterBasedMode::initiallyDisabled, events[2]->counterBasedMode);
|
||||
} else {
|
||||
EXPECT_EQ(Event::CounterBasedMode::implicitlyDisabled, events[2]->counterBasedMode);
|
||||
}
|
||||
EXPECT_EQ(Event::CounterBasedMode::implicitlyDisabled, events[2]->counterBasedMode);
|
||||
EXPECT_EQ(0u, events[2]->counterBasedFlags);
|
||||
EXPECT_FALSE(events[2]->isCounterBased());
|
||||
|
||||
// Reuse on Regular = disable
|
||||
regularCmdList->appendLaunchKernel(kernel->toHandle(), groupCount, events[0]->toHandle(), 0, nullptr, launchParams);
|
||||
if (dcFlushRequired) {
|
||||
EXPECT_EQ(Event::CounterBasedMode::initiallyDisabled, events[0]->counterBasedMode);
|
||||
} else {
|
||||
EXPECT_EQ(Event::CounterBasedMode::implicitlyDisabled, events[0]->counterBasedMode);
|
||||
}
|
||||
EXPECT_EQ(Event::CounterBasedMode::implicitlyDisabled, events[0]->counterBasedMode);
|
||||
EXPECT_EQ(0u, events[0]->counterBasedFlags);
|
||||
EXPECT_FALSE(events[0]->isCounterBased());
|
||||
|
||||
// Reuse on non-inOrder = disable
|
||||
events[0]->counterBasedMode = Event::CounterBasedMode::implicitlyEnabled;
|
||||
regularCmdList->appendLaunchKernel(kernel->toHandle(), groupCount, events[0]->toHandle(), 0, nullptr, launchParams);
|
||||
if (dcFlushRequired) {
|
||||
EXPECT_EQ(Event::CounterBasedMode::implicitlyEnabled, events[0]->counterBasedMode);
|
||||
} else {
|
||||
EXPECT_EQ(Event::CounterBasedMode::implicitlyDisabled, events[0]->counterBasedMode);
|
||||
}
|
||||
EXPECT_EQ(Event::CounterBasedMode::implicitlyDisabled, events[0]->counterBasedMode);
|
||||
EXPECT_EQ(0u, events[0]->counterBasedFlags);
|
||||
EXPECT_EQ(dcFlushRequired, events[0]->isCounterBased());
|
||||
EXPECT_FALSE(events[0]->isCounterBased());
|
||||
|
||||
// Reuse on already disabled
|
||||
immCmdList->appendLaunchKernel(kernel->toHandle(), groupCount, events[0]->toHandle(), 0, nullptr, launchParams);
|
||||
if (dcFlushRequired) {
|
||||
EXPECT_EQ(Event::CounterBasedMode::implicitlyEnabled, events[0]->counterBasedMode);
|
||||
} else {
|
||||
EXPECT_EQ(Event::CounterBasedMode::implicitlyDisabled, events[0]->counterBasedMode);
|
||||
}
|
||||
EXPECT_EQ(Event::CounterBasedMode::implicitlyDisabled, events[0]->counterBasedMode);
|
||||
EXPECT_EQ(0u, events[0]->counterBasedFlags);
|
||||
EXPECT_EQ(dcFlushRequired, events[0]->isCounterBased());
|
||||
EXPECT_FALSE(events[0]->isCounterBased());
|
||||
|
||||
// On explicitly enabled
|
||||
events[0]->counterBasedMode = Event::CounterBasedMode::explicitlyEnabled;
|
||||
@@ -1722,8 +1694,6 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, InOrderCmdListTests, givenImmediateCmdListWhenDispa
|
||||
auto result = context->allocDeviceMem(device->toHandle(), &deviceDesc, 16384u, 4096u, &alloc);
|
||||
ASSERT_EQ(result, ZE_RESULT_SUCCESS);
|
||||
|
||||
bool dcFlushRequired = immCmdList->getDcFlushRequired(true);
|
||||
|
||||
NEO::MockGraphicsAllocation mockAllocation(0, 1u /*num gmms*/, NEO::AllocationType::internalHostMemory,
|
||||
reinterpret_cast<void *>(0x1234), 0x1000, 0, sizeof(uint32_t),
|
||||
MemoryPool::system4KBPages, MemoryManager::maxOsContextCount);
|
||||
@@ -1732,110 +1702,61 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, InOrderCmdListTests, givenImmediateCmdListWhenDispa
|
||||
|
||||
events[0]->makeCounterBasedInitiallyDisabled(eventPool->getAllocation());
|
||||
immCmdList->appendLaunchKernel(kernel->toHandle(), groupCount, eventHandle, 0, nullptr, launchParams);
|
||||
|
||||
if (dcFlushRequired) {
|
||||
EXPECT_EQ(Event::CounterBasedMode::initiallyDisabled, events[0]->counterBasedMode);
|
||||
} else {
|
||||
EXPECT_EQ(Event::CounterBasedMode::implicitlyEnabled, events[0]->counterBasedMode);
|
||||
}
|
||||
EXPECT_EQ(Event::CounterBasedMode::implicitlyEnabled, events[0]->counterBasedMode);
|
||||
|
||||
CmdListKernelLaunchParams cooperativeParams = {};
|
||||
cooperativeParams.isCooperative = true;
|
||||
|
||||
events[0]->makeCounterBasedInitiallyDisabled(eventPool->getAllocation());
|
||||
immCmdList->appendLaunchKernel(kernel->toHandle(), groupCount, eventHandle, 0, nullptr, cooperativeParams);
|
||||
if (dcFlushRequired) {
|
||||
EXPECT_EQ(Event::CounterBasedMode::initiallyDisabled, events[0]->counterBasedMode);
|
||||
} else {
|
||||
EXPECT_EQ(Event::CounterBasedMode::implicitlyEnabled, events[0]->counterBasedMode);
|
||||
}
|
||||
EXPECT_EQ(Event::CounterBasedMode::implicitlyEnabled, events[0]->counterBasedMode);
|
||||
|
||||
events[0]->makeCounterBasedInitiallyDisabled(eventPool->getAllocation());
|
||||
immCmdList->appendLaunchKernelIndirect(kernel->toHandle(), *static_cast<ze_group_count_t *>(alloc), eventHandle, 0, nullptr, false);
|
||||
if (dcFlushRequired) {
|
||||
EXPECT_EQ(Event::CounterBasedMode::initiallyDisabled, events[0]->counterBasedMode);
|
||||
} else {
|
||||
EXPECT_EQ(Event::CounterBasedMode::implicitlyEnabled, events[0]->counterBasedMode);
|
||||
}
|
||||
EXPECT_EQ(Event::CounterBasedMode::implicitlyEnabled, events[0]->counterBasedMode);
|
||||
|
||||
size_t rangeSizes = 1;
|
||||
const void **ranges = reinterpret_cast<const void **>(©Data[0]);
|
||||
events[0]->makeCounterBasedInitiallyDisabled(eventPool->getAllocation());
|
||||
immCmdList->appendMemoryRangesBarrier(1, &rangeSizes, ranges, eventHandle, 0, nullptr);
|
||||
if (dcFlushRequired) {
|
||||
EXPECT_EQ(Event::CounterBasedMode::initiallyDisabled, events[0]->counterBasedMode);
|
||||
} else {
|
||||
EXPECT_EQ(Event::CounterBasedMode::implicitlyEnabled, events[0]->counterBasedMode);
|
||||
}
|
||||
EXPECT_EQ(Event::CounterBasedMode::implicitlyEnabled, events[0]->counterBasedMode);
|
||||
|
||||
events[0]->makeCounterBasedInitiallyDisabled(eventPool->getAllocation());
|
||||
copyOnlyCmdList->appendMemoryCopyBlitRegion(&allocationData, &allocationData, region, region, {0, 0, 0}, 0, 0, 0, 0, {0, 0, 0}, {0, 0, 0}, events[0].get(), 0, nullptr, copyParams, false);
|
||||
if (dcFlushRequired) {
|
||||
EXPECT_EQ(Event::CounterBasedMode::initiallyDisabled, events[0]->counterBasedMode);
|
||||
} else {
|
||||
EXPECT_EQ(Event::CounterBasedMode::implicitlyEnabled, events[0]->counterBasedMode);
|
||||
}
|
||||
EXPECT_EQ(Event::CounterBasedMode::implicitlyEnabled, events[0]->counterBasedMode);
|
||||
if (!events[0]->inOrderTimestampNode.empty()) {
|
||||
copyOnlyCmdList->inOrderExecInfo->pushTempTimestampNode(events[0]->inOrderTimestampNode[0], events[0]->inOrderExecSignalValue);
|
||||
}
|
||||
events[0]->inOrderTimestampNode.clear();
|
||||
events[0]->makeCounterBasedInitiallyDisabled(eventPool->getAllocation());
|
||||
immCmdList->appendMemoryCopy(©Data, ©Data, 1, eventHandle, 0, nullptr, copyParams);
|
||||
if (dcFlushRequired) {
|
||||
EXPECT_EQ(Event::CounterBasedMode::initiallyDisabled, events[0]->counterBasedMode);
|
||||
} else {
|
||||
EXPECT_EQ(Event::CounterBasedMode::implicitlyEnabled, events[0]->counterBasedMode);
|
||||
}
|
||||
EXPECT_EQ(Event::CounterBasedMode::implicitlyEnabled, events[0]->counterBasedMode);
|
||||
|
||||
events[0]->makeCounterBasedInitiallyDisabled(eventPool->getAllocation());
|
||||
immCmdList->appendMemoryFill(alloc, ©Data, 1, 16, eventHandle, 0, nullptr, copyParams);
|
||||
if (dcFlushRequired) {
|
||||
EXPECT_EQ(Event::CounterBasedMode::initiallyDisabled, events[0]->counterBasedMode);
|
||||
} else {
|
||||
EXPECT_EQ(Event::CounterBasedMode::implicitlyEnabled, events[0]->counterBasedMode);
|
||||
}
|
||||
EXPECT_EQ(Event::CounterBasedMode::implicitlyEnabled, events[0]->counterBasedMode);
|
||||
|
||||
events[0]->makeCounterBasedInitiallyDisabled(eventPool->getAllocation());
|
||||
copyOnlyCmdList->appendBlitFill(alloc, ©Data, 1, 16, events[0].get(), 0, nullptr, copyParams);
|
||||
if (dcFlushRequired) {
|
||||
EXPECT_EQ(Event::CounterBasedMode::initiallyDisabled, events[0]->counterBasedMode);
|
||||
} else {
|
||||
EXPECT_EQ(Event::CounterBasedMode::implicitlyEnabled, events[0]->counterBasedMode);
|
||||
}
|
||||
EXPECT_EQ(Event::CounterBasedMode::implicitlyEnabled, events[0]->counterBasedMode);
|
||||
|
||||
events[0]->makeCounterBasedInitiallyDisabled(eventPool->getAllocation());
|
||||
immCmdList->appendSignalEvent(eventHandle, false);
|
||||
if (dcFlushRequired) {
|
||||
EXPECT_EQ(Event::CounterBasedMode::initiallyDisabled, events[0]->counterBasedMode);
|
||||
} else {
|
||||
EXPECT_EQ(Event::CounterBasedMode::implicitlyEnabled, events[0]->counterBasedMode);
|
||||
}
|
||||
EXPECT_EQ(Event::CounterBasedMode::implicitlyEnabled, events[0]->counterBasedMode);
|
||||
|
||||
events[0]->makeCounterBasedInitiallyDisabled(eventPool->getAllocation());
|
||||
immCmdList->appendWriteGlobalTimestamp(reinterpret_cast<uint64_t *>(copyData), eventHandle, 0, nullptr);
|
||||
if (dcFlushRequired) {
|
||||
EXPECT_EQ(Event::CounterBasedMode::initiallyDisabled, events[0]->counterBasedMode);
|
||||
} else {
|
||||
EXPECT_EQ(Event::CounterBasedMode::implicitlyEnabled, events[0]->counterBasedMode);
|
||||
}
|
||||
EXPECT_EQ(Event::CounterBasedMode::implicitlyEnabled, events[0]->counterBasedMode);
|
||||
|
||||
events[0]->makeCounterBasedInitiallyDisabled(eventPool->getAllocation());
|
||||
immCmdList->appendBarrier(eventHandle, 0, nullptr, false);
|
||||
if (dcFlushRequired) {
|
||||
EXPECT_EQ(Event::CounterBasedMode::initiallyDisabled, events[0]->counterBasedMode);
|
||||
} else {
|
||||
EXPECT_EQ(Event::CounterBasedMode::implicitlyEnabled, events[0]->counterBasedMode);
|
||||
}
|
||||
EXPECT_EQ(Event::CounterBasedMode::implicitlyEnabled, events[0]->counterBasedMode);
|
||||
|
||||
zex_wait_on_mem_desc_t desc;
|
||||
desc.actionFlag = ZEX_WAIT_ON_MEMORY_FLAG_NOT_EQUAL;
|
||||
events[0]->makeCounterBasedInitiallyDisabled(eventPool->getAllocation());
|
||||
immCmdList->appendWaitOnMemory(reinterpret_cast<void *>(&desc), copyData, 1, eventHandle, false);
|
||||
if (dcFlushRequired) {
|
||||
EXPECT_EQ(Event::CounterBasedMode::initiallyDisabled, events[0]->counterBasedMode);
|
||||
} else {
|
||||
EXPECT_EQ(Event::CounterBasedMode::implicitlyEnabled, events[0]->counterBasedMode);
|
||||
}
|
||||
EXPECT_EQ(Event::CounterBasedMode::implicitlyEnabled, events[0]->counterBasedMode);
|
||||
|
||||
if (immCmdList->inOrderExecInfo->isHostStorageDuplicated()) {
|
||||
|
||||
@@ -1849,11 +1770,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, InOrderCmdListTests, givenImmediateCmdListWhenDispa
|
||||
immCmdList->copyThroughLockedPtrEnabled = true;
|
||||
events[0]->makeCounterBasedInitiallyDisabled(eventPool->getAllocation());
|
||||
immCmdList->appendMemoryCopy(alloc, ©Data, 1, eventHandle, 0, nullptr, copyParams);
|
||||
if (dcFlushRequired) {
|
||||
EXPECT_EQ(Event::CounterBasedMode::initiallyDisabled, events[0]->counterBasedMode);
|
||||
} else {
|
||||
EXPECT_EQ(Event::CounterBasedMode::implicitlyEnabled, events[0]->counterBasedMode);
|
||||
}
|
||||
EXPECT_EQ(Event::CounterBasedMode::implicitlyEnabled, events[0]->counterBasedMode);
|
||||
|
||||
context->freeMem(alloc);
|
||||
}
|
||||
|
||||
@@ -1303,7 +1303,7 @@ HWTEST2_F(CopyOffloadInOrderTests, givenCopyOperationWithHostVisibleEventThenMar
|
||||
|
||||
immCmdList->appendLaunchKernel(kernel->toHandle(), groupCount, hostVisibleEvent.get(), 0, nullptr, launchParams);
|
||||
|
||||
EXPECT_TRUE(immCmdList->latestFlushIsHostVisible);
|
||||
EXPECT_EQ(immCmdList->isHeaplessModeEnabled() || !immCmdList->dcFlushSupport, immCmdList->latestFlushIsHostVisible);
|
||||
auto usmHost = allocHostMem(1);
|
||||
auto usmDevice = allocDeviceMem(1);
|
||||
immCmdList->appendMemoryCopy(usmDevice, usmHost, 1, hostVisibleEvent.get(), 0, nullptr, copyParams);
|
||||
@@ -4716,12 +4716,7 @@ HWTEST2_F(BcsSplitInOrderCmdListTests, givenImmediateCmdListWhenDispatchingWithR
|
||||
events[0]->makeCounterBasedInitiallyDisabled(eventPool->getAllocation());
|
||||
immCmdList->appendMemoryCopy(©Data, ©Data, copySize, eventHandle, 0, nullptr, copyParams);
|
||||
|
||||
if (immCmdList->getDcFlushRequired(true)) {
|
||||
EXPECT_EQ(Event::CounterBasedMode::initiallyDisabled, events[0]->counterBasedMode);
|
||||
} else {
|
||||
EXPECT_EQ(Event::CounterBasedMode::implicitlyEnabled, events[0]->counterBasedMode);
|
||||
}
|
||||
|
||||
EXPECT_EQ(Event::CounterBasedMode::implicitlyEnabled, events[0]->counterBasedMode);
|
||||
EXPECT_TRUE(verifySplit(bcsMiFlushCount + 1u));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user