mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-10 15:12:56 +08:00
performance: Stop direct submission before removing host ptrs
Signed-off-by: Lukasz Jobczyk <lukasz.jobczyk@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
387ec34207
commit
7e6a08098b
@@ -52,10 +52,30 @@ void CommandList::storePrintfKernel(Kernel *kernel) {
|
||||
|
||||
void CommandList::removeHostPtrAllocations() {
|
||||
auto memoryManager = device ? device->getNEODevice()->getMemoryManager() : nullptr;
|
||||
|
||||
bool restartDirectSubmission = !this->hostPtrMap.empty() && memoryManager && device->getNEODevice()->getRootDeviceEnvironment().getProductHelper().restartDirectSubmissionForHostptrFree();
|
||||
if (restartDirectSubmission) {
|
||||
const auto &engines = memoryManager->getRegisteredEngines(device->getRootDeviceIndex());
|
||||
for (const auto &engine : engines) {
|
||||
auto lock = engine.commandStreamReceiver->obtainUniqueOwnership();
|
||||
engine.commandStreamReceiver->stopDirectSubmission(false);
|
||||
}
|
||||
}
|
||||
|
||||
for (auto &allocation : hostPtrMap) {
|
||||
UNRECOVERABLE_IF(memoryManager == nullptr);
|
||||
memoryManager->freeGraphicsMemory(allocation.second);
|
||||
}
|
||||
|
||||
if (restartDirectSubmission) {
|
||||
const auto &engines = memoryManager->getRegisteredEngines(device->getRootDeviceIndex());
|
||||
for (const auto &engine : engines) {
|
||||
if (engine.commandStreamReceiver->isAnyDirectSubmissionEnabled()) {
|
||||
engine.commandStreamReceiver->flushTagUpdate();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
hostPtrMap.clear();
|
||||
}
|
||||
|
||||
|
||||
@@ -314,6 +314,48 @@ HWTEST2_F(CommandListCreate,
|
||||
device->getNEODevice()->getMemoryManager()->freeSystemMemory(cmdListHostBuffer);
|
||||
}
|
||||
|
||||
HWTEST2_F(CommandListCreate,
|
||||
givenCmdListHostPointerUsedWhenRemoveHostPtrAllocationThenStopDirectSubmissions,
|
||||
IsAtLeastSkl) {
|
||||
const auto &engines = device->getNEODevice()->getMemoryManager()->getRegisteredEngines(device->getRootDeviceIndex());
|
||||
for (const auto &engine : engines) {
|
||||
auto ultCsr = static_cast<NEO::UltCommandStreamReceiver<FamilyType> *>(engine.commandStreamReceiver);
|
||||
ultCsr->callFlushTagUpdate = false;
|
||||
ultCsr->directSubmissionAvailable = true;
|
||||
ultCsr->callBaseStopDirectSubmission = false;
|
||||
}
|
||||
|
||||
auto commandList = std::make_unique<::L0::ult::CommandListCoreFamily<gfxCoreFamily>>();
|
||||
commandList->initialize(device, NEO::EngineGroupType::renderCompute, 0u);
|
||||
|
||||
size_t cmdListHostPtrSize = MemoryConstants::pageSize;
|
||||
void *cmdListHostBuffer = device->getNEODevice()->getMemoryManager()->allocateSystemMemory(cmdListHostPtrSize, cmdListHostPtrSize);
|
||||
|
||||
AlignedAllocationData outData = commandList->getAlignedAllocationData(device, cmdListHostBuffer, cmdListHostPtrSize, false);
|
||||
ASSERT_NE(nullptr, outData.alloc);
|
||||
|
||||
for (const auto &engine : engines) {
|
||||
auto ultCsr = static_cast<NEO::UltCommandStreamReceiver<FamilyType> *>(engine.commandStreamReceiver);
|
||||
EXPECT_FALSE(ultCsr->stopDirectSubmissionCalled);
|
||||
EXPECT_FALSE(ultCsr->flushTagUpdateCalled);
|
||||
}
|
||||
|
||||
commandList->removeHostPtrAllocations();
|
||||
|
||||
for (const auto &engine : engines) {
|
||||
auto ultCsr = static_cast<NEO::UltCommandStreamReceiver<FamilyType> *>(engine.commandStreamReceiver);
|
||||
if (device->getNEODevice()->getRootDeviceEnvironment().getProductHelper().restartDirectSubmissionForHostptrFree()) {
|
||||
EXPECT_TRUE(ultCsr->stopDirectSubmissionCalled);
|
||||
EXPECT_TRUE(ultCsr->flushTagUpdateCalled);
|
||||
} else {
|
||||
EXPECT_FALSE(ultCsr->stopDirectSubmissionCalled);
|
||||
EXPECT_FALSE(ultCsr->flushTagUpdateCalled);
|
||||
}
|
||||
}
|
||||
|
||||
device->getNEODevice()->getMemoryManager()->freeSystemMemory(cmdListHostBuffer);
|
||||
}
|
||||
|
||||
using PlatformSupport = IsWithinProducts<IGFX_SKYLAKE, IGFX_DG1>;
|
||||
HWTEST2_F(CommandListCreate,
|
||||
givenCommandListWhenMemoryCopyRegionHavingHostMemoryWithSignalAndWaitScopeEventsUsingRenderEngineThenPipeControlsWithDcFlushIsFound,
|
||||
|
||||
Reference in New Issue
Block a user