mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-04 23:56:39 +08:00
fix: madvise order and reset
Related-To: NEO-16173, NEO-13715 Signed-off-by: Chandio, Bibrak Qamar <bibrak.qamar.chandio@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
2f2a7bb84a
commit
421b1861e5
@@ -107,6 +107,7 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::reset() {
|
||||
this->storeFillPatternResourcesForReuse();
|
||||
removeDeallocationContainerData();
|
||||
removeHostPtrAllocations();
|
||||
this->memAdviseOperations.clear();
|
||||
removeMemoryPrefetchAllocations();
|
||||
commandContainer.reset();
|
||||
clearCommandsToPatch();
|
||||
|
||||
@@ -55,6 +55,14 @@ ze_result_t CommandQueueHw<gfxCoreFamily>::createFence(const ze_fence_desc_t *de
|
||||
return ZE_RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
template <GFXCORE_FAMILY gfxCoreFamily>
|
||||
void CommandQueueHw<gfxCoreFamily>::processMemAdviseOperations(CommandList *commandList) {
|
||||
auto &memAdviseOperations = commandList->getMemAdviseOperations();
|
||||
for (auto &operation : memAdviseOperations) {
|
||||
commandList->executeMemAdvise(operation.hDevice, operation.ptr, operation.size, operation.advice);
|
||||
}
|
||||
}
|
||||
|
||||
template <GFXCORE_FAMILY gfxCoreFamily>
|
||||
ze_result_t CommandQueueHw<gfxCoreFamily>::executeCommandLists(
|
||||
uint32_t numCommandLists,
|
||||
@@ -83,6 +91,11 @@ ze_result_t CommandQueueHw<gfxCoreFamily>::executeCommandLists(
|
||||
|
||||
auto neoDevice = device->getNEODevice();
|
||||
|
||||
for (auto i = 0u; i < numCommandLists; ++i) {
|
||||
auto commandList = CommandList::fromHandle(phCommandLists[i]);
|
||||
this->processMemAdviseOperations(commandList);
|
||||
}
|
||||
|
||||
if (NEO::ApiSpecificConfig::isSharedAllocPrefetchEnabled()) {
|
||||
auto svmAllocMgr = device->getDriverHandle()->getSvmAllocsManager();
|
||||
svmAllocMgr->prefetchSVMAllocs(*neoDevice, *csr);
|
||||
@@ -131,15 +144,6 @@ ze_result_t CommandQueueHw<gfxCoreFamily>::executeCommandLists(
|
||||
return ret;
|
||||
}
|
||||
|
||||
template <GFXCORE_FAMILY gfxCoreFamily>
|
||||
void CommandQueueHw<gfxCoreFamily>::processMemAdviseOperations(CommandList *commandList) {
|
||||
auto &memAdviseOperations = commandList->getMemAdviseOperations();
|
||||
for (auto &operation : memAdviseOperations) {
|
||||
commandList->executeMemAdvise(operation.hDevice, operation.ptr, operation.size, operation.advice);
|
||||
}
|
||||
memAdviseOperations.clear();
|
||||
}
|
||||
|
||||
template <GFXCORE_FAMILY gfxCoreFamily>
|
||||
ze_result_t CommandQueueHw<gfxCoreFamily>::executeCommandListsRegularHeapless(
|
||||
CommandListExecutionContext &ctx,
|
||||
@@ -217,7 +221,6 @@ ze_result_t CommandQueueHw<gfxCoreFamily>::executeCommandListsRegularHeapless(
|
||||
cmdListWithAssertExecuted.exchange(true);
|
||||
}
|
||||
|
||||
this->processMemAdviseOperations(commandList);
|
||||
this->collectPrintfContentsFromCommandsList(commandList);
|
||||
this->dispatchPatchPreambleInOrderNoop(ctx, commandList);
|
||||
}
|
||||
@@ -442,7 +445,6 @@ ze_result_t CommandQueueHw<gfxCoreFamily>::executeCommandListsRegular(
|
||||
cmdListWithAssertExecuted.exchange(true);
|
||||
}
|
||||
|
||||
this->processMemAdviseOperations(commandList);
|
||||
this->collectPrintfContentsFromCommandsList(commandList);
|
||||
this->dispatchPatchPreambleInOrderNoop(ctx, commandList);
|
||||
}
|
||||
|
||||
@@ -1202,7 +1202,7 @@ HWTEST2_F(AppendMemoryCopyFenceTest, givenAppendMemAdviseWithRegularAndHeapLessC
|
||||
cmdList.close();
|
||||
mockCmdQHw->executeCommandLists(1, &cmdListHandle, nullptr, false, nullptr, nullptr);
|
||||
EXPECT_EQ(1u, cmdList.executeMemAdviseCallCount);
|
||||
EXPECT_EQ(0u, cmdList.getMemAdviseOperations().size());
|
||||
EXPECT_EQ(1u, cmdList.getMemAdviseOperations().size());
|
||||
}
|
||||
|
||||
{
|
||||
@@ -1212,7 +1212,7 @@ HWTEST2_F(AppendMemoryCopyFenceTest, givenAppendMemAdviseWithRegularAndHeapLessC
|
||||
cmdList.close();
|
||||
mockCmdQHw->executeCommandLists(1, &cmdListHandle, nullptr, false, nullptr, nullptr);
|
||||
EXPECT_EQ(2u, cmdList.executeMemAdviseCallCount);
|
||||
EXPECT_EQ(0u, cmdList.getMemAdviseOperations().size());
|
||||
EXPECT_EQ(1u, cmdList.getMemAdviseOperations().size());
|
||||
}
|
||||
|
||||
context->freeMem(deviceBuffer);
|
||||
|
||||
Reference in New Issue
Block a user