mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-12 17:33:00 +08:00
refactor: add option to skip to add to residency event external allocation
Signed-off-by: Zbigniew Zdanowicz <zbigniew.zdanowicz@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
c58aca28c1
commit
b6018010c4
@@ -231,7 +231,7 @@ struct CommandListCoreFamily : public CommandListImp {
|
||||
ze_result_t executeCommandListImmediateImpl(bool performMigration, L0::CommandQueue *cmdQImmediate);
|
||||
size_t getReserveSshSize();
|
||||
void patchInOrderCmds() override;
|
||||
MOCKABLE_VIRTUAL bool handleCounterBasedEventOperations(Event *signalEvent);
|
||||
MOCKABLE_VIRTUAL bool handleCounterBasedEventOperations(Event *signalEvent, bool skipAddingEventToResidency);
|
||||
bool isCbEventBoundToCmdList(Event *event) const;
|
||||
|
||||
protected:
|
||||
|
||||
@@ -441,7 +441,7 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendLaunchKernel(ze_kernel_h
|
||||
}
|
||||
}
|
||||
|
||||
if (!handleCounterBasedEventOperations(event)) {
|
||||
if (!handleCounterBasedEventOperations(event, launchParams.omitAddingEventResidency)) {
|
||||
return ZE_RESULT_ERROR_INVALID_ARGUMENT;
|
||||
}
|
||||
|
||||
@@ -495,7 +495,7 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendLaunchKernelIndirect(ze_
|
||||
launchParams.isHostSignalScopeEvent = event->isSignalScope(ZE_EVENT_SCOPE_FLAG_HOST);
|
||||
}
|
||||
|
||||
if (!handleCounterBasedEventOperations(event)) {
|
||||
if (!handleCounterBasedEventOperations(event, false)) {
|
||||
return ZE_RESULT_ERROR_INVALID_ARGUMENT;
|
||||
}
|
||||
|
||||
@@ -541,7 +541,7 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendLaunchMultipleKernelsInd
|
||||
launchParams.isHostSignalScopeEvent = event->isSignalScope(ZE_EVENT_SCOPE_FLAG_HOST);
|
||||
}
|
||||
|
||||
if (!handleCounterBasedEventOperations(event)) {
|
||||
if (!handleCounterBasedEventOperations(event, false)) {
|
||||
return ZE_RESULT_ERROR_INVALID_ARGUMENT;
|
||||
}
|
||||
|
||||
@@ -709,7 +709,7 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendMemoryRangesBarrier(uint
|
||||
signalEvent = Event::fromHandle(hSignalEvent);
|
||||
}
|
||||
|
||||
if (!handleCounterBasedEventOperations(signalEvent)) {
|
||||
if (!handleCounterBasedEventOperations(signalEvent, false)) {
|
||||
return ZE_RESULT_ERROR_INVALID_ARGUMENT;
|
||||
}
|
||||
|
||||
@@ -1567,7 +1567,7 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendMemoryCopyBlitRegion(Ali
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (!handleCounterBasedEventOperations(signalEvent)) {
|
||||
if (!handleCounterBasedEventOperations(signalEvent, false)) {
|
||||
return ZE_RESULT_ERROR_INVALID_ARGUMENT;
|
||||
}
|
||||
|
||||
@@ -1616,7 +1616,7 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendCopyImageBlit(NEO::Graph
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (!handleCounterBasedEventOperations(signalEvent)) {
|
||||
if (!handleCounterBasedEventOperations(signalEvent, false)) {
|
||||
return ZE_RESULT_ERROR_INVALID_ARGUMENT;
|
||||
}
|
||||
|
||||
@@ -1822,7 +1822,7 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendMemoryCopy(void *dstptr,
|
||||
dcFlush = getDcFlushRequired(signalEvent->isSignalScope());
|
||||
}
|
||||
|
||||
if (!handleCounterBasedEventOperations(signalEvent)) {
|
||||
if (!handleCounterBasedEventOperations(signalEvent, false)) {
|
||||
return ZE_RESULT_ERROR_INVALID_ARGUMENT;
|
||||
}
|
||||
|
||||
@@ -2297,7 +2297,7 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendMemoryFill(void *ptr,
|
||||
|
||||
appendSynchronizedDispatchInitializationSection();
|
||||
|
||||
if (!handleCounterBasedEventOperations(signalEvent)) {
|
||||
if (!handleCounterBasedEventOperations(signalEvent, false)) {
|
||||
return ZE_RESULT_ERROR_INVALID_ARGUMENT;
|
||||
}
|
||||
|
||||
@@ -2528,7 +2528,7 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendBlitFill(void *ptr, cons
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (!handleCounterBasedEventOperations(signalEvent)) {
|
||||
if (!handleCounterBasedEventOperations(signalEvent, false)) {
|
||||
return ZE_RESULT_ERROR_INVALID_ARGUMENT;
|
||||
}
|
||||
|
||||
@@ -2798,7 +2798,7 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendSignalEvent(ze_event_han
|
||||
auto event = Event::fromHandle(hEvent);
|
||||
event->resetKernelCountAndPacketUsedCount();
|
||||
|
||||
if (!handleCounterBasedEventOperations(event)) {
|
||||
if (!handleCounterBasedEventOperations(event, false)) {
|
||||
return ZE_RESULT_ERROR_INVALID_ARGUMENT;
|
||||
}
|
||||
|
||||
@@ -3332,7 +3332,7 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendWriteGlobalTimestamp(
|
||||
signalEvent = Event::fromHandle(hSignalEvent);
|
||||
}
|
||||
|
||||
if (!handleCounterBasedEventOperations(signalEvent)) {
|
||||
if (!handleCounterBasedEventOperations(signalEvent, false)) {
|
||||
return ZE_RESULT_ERROR_INVALID_ARGUMENT;
|
||||
}
|
||||
|
||||
@@ -3923,7 +3923,7 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendBarrier(ze_event_handle_
|
||||
signalEvent = Event::fromHandle(hSignalEvent);
|
||||
}
|
||||
|
||||
if (!handleCounterBasedEventOperations(signalEvent)) {
|
||||
if (!handleCounterBasedEventOperations(signalEvent, false)) {
|
||||
return ZE_RESULT_ERROR_INVALID_ARGUMENT;
|
||||
}
|
||||
|
||||
@@ -4064,7 +4064,7 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendWaitOnMemory(void *desc,
|
||||
handleInOrderImplicitDependencies(false, false);
|
||||
}
|
||||
|
||||
if (!handleCounterBasedEventOperations(signalEvent)) {
|
||||
if (!handleCounterBasedEventOperations(signalEvent, false)) {
|
||||
return ZE_RESULT_ERROR_INVALID_ARGUMENT;
|
||||
}
|
||||
|
||||
@@ -4410,7 +4410,7 @@ bool CommandListCoreFamily<gfxCoreFamily>::hasInOrderDependencies() const {
|
||||
}
|
||||
|
||||
template <GFXCORE_FAMILY gfxCoreFamily>
|
||||
bool CommandListCoreFamily<gfxCoreFamily>::handleCounterBasedEventOperations(Event *signalEvent) {
|
||||
bool CommandListCoreFamily<gfxCoreFamily>::handleCounterBasedEventOperations(Event *signalEvent, bool skipAddingEventToResidency) {
|
||||
if (!signalEvent) {
|
||||
return true;
|
||||
}
|
||||
@@ -4452,7 +4452,9 @@ bool CommandListCoreFamily<gfxCoreFamily>::handleCounterBasedEventOperations(Eve
|
||||
if (signalEvent->isUsingContextEndOffset()) {
|
||||
auto tag = device->getInOrderTimestampAllocator()->getTag();
|
||||
|
||||
this->commandContainer.addToResidencyContainer(tag->getBaseGraphicsAllocation()->getGraphicsAllocation(device->getRootDeviceIndex()));
|
||||
if (skipAddingEventToResidency == false) {
|
||||
this->commandContainer.addToResidencyContainer(tag->getBaseGraphicsAllocation()->getGraphicsAllocation(device->getRootDeviceIndex()));
|
||||
}
|
||||
signalEvent->resetInOrderTimestampNode(tag, this->partitionCount);
|
||||
signalEvent->resetAdditionalTimestampNode(nullptr, this->partitionCount, false);
|
||||
}
|
||||
|
||||
@@ -1404,7 +1404,7 @@ ze_result_t CommandListCoreFamilyImmediate<gfxCoreFamily>::performCpuMemcpy(cons
|
||||
signalEvent = Event::fromHandle(hSignalEvent);
|
||||
}
|
||||
|
||||
if (!this->handleCounterBasedEventOperations(signalEvent)) {
|
||||
if (!this->handleCounterBasedEventOperations(signalEvent, false)) {
|
||||
return ZE_RESULT_ERROR_INVALID_ARGUMENT;
|
||||
}
|
||||
|
||||
@@ -1777,7 +1777,7 @@ ze_result_t CommandListCoreFamilyImmediate<gfxCoreFamily>::appendCommandLists(ui
|
||||
dcFlush = this->getDcFlushRequired(signalEvent->isSignalScope());
|
||||
}
|
||||
|
||||
if (!this->handleCounterBasedEventOperations(signalEvent)) {
|
||||
if (!this->handleCounterBasedEventOperations(signalEvent, false)) {
|
||||
return ZE_RESULT_ERROR_INVALID_ARGUMENT;
|
||||
}
|
||||
|
||||
|
||||
@@ -95,7 +95,7 @@ struct BcsSplit {
|
||||
|
||||
auto signalEvent = Event::fromHandle(hSignalEvent);
|
||||
|
||||
if (!cmdList->handleCounterBasedEventOperations(signalEvent)) {
|
||||
if (!cmdList->handleCounterBasedEventOperations(signalEvent, false)) {
|
||||
return ZE_RESULT_ERROR_INVALID_ARGUMENT;
|
||||
}
|
||||
|
||||
|
||||
@@ -423,6 +423,21 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, InOrderCmdListTests, givenRegularCmdListWhenAppendQ
|
||||
context->freeMem(deviceMem);
|
||||
}
|
||||
|
||||
HWCMDTEST_F(IGFX_XE_HP_CORE, InOrderCmdListTests, givenRegularCmdListWhenAppendCbTimestampEventWithSkipAddToResidencyFlagThenEventAllocationNotAddedToResidency) {
|
||||
auto regularCmdList = createRegularCmdList<FamilyType::gfxCoreFamily>(false);
|
||||
|
||||
auto eventPool = createEvents<FamilyType>(1, true);
|
||||
|
||||
launchParams.omitAddingEventResidency = true;
|
||||
regularCmdList->appendLaunchKernel(kernel->toHandle(), groupCount, events[0]->toHandle(), 0, nullptr, launchParams);
|
||||
|
||||
auto eventAllocation = events[0]->getAllocation(this->device);
|
||||
|
||||
auto &cmdlistResidency = regularCmdList->getCmdContainer().getResidencyContainer();
|
||||
auto eventAllocationIt = std::find(cmdlistResidency.begin(), cmdlistResidency.end(), eventAllocation);
|
||||
EXPECT_EQ(eventAllocationIt, cmdlistResidency.end());
|
||||
}
|
||||
|
||||
HWCMDTEST_F(IGFX_XE_HP_CORE, InOrderCmdListTests, givenCounterBasedTimestampEventWhenQueryingTimestampThenEnsureItsCompletion) {
|
||||
struct MyMockEvent : public L0::EventImp<uint64_t> {
|
||||
using BaseClass = L0::EventImp<uint64_t>;
|
||||
@@ -2927,8 +2942,8 @@ HWTEST2_F(InOrderCmdListTests, givenRelaxedOrderingWhenProgrammingTimestampEvent
|
||||
using BaseClass = WhiteBox<L0::CommandListCoreFamilyImmediate<FamilyType::gfxCoreFamily>>;
|
||||
using BaseClass::BaseClass;
|
||||
|
||||
bool handleCounterBasedEventOperations(L0::Event *signalEvent) override {
|
||||
auto ret = BaseClass::handleCounterBasedEventOperations(signalEvent);
|
||||
bool handleCounterBasedEventOperations(L0::Event *signalEvent, bool skipAddingEventToResidency) override {
|
||||
auto ret = BaseClass::handleCounterBasedEventOperations(signalEvent, skipAddingEventToResidency);
|
||||
usedEvent = signalEvent;
|
||||
auto hostAddr = reinterpret_cast<uint32_t *>(usedEvent->getCompletionFieldHostAddress());
|
||||
*hostAddr = 0x123;
|
||||
|
||||
Reference in New Issue
Block a user