From 85d0f2dd633d040ac7531e8fab5305f562278e69 Mon Sep 17 00:00:00 2001 From: Compute-Runtime-Validation Date: Wed, 22 May 2024 20:25:38 +0200 Subject: [PATCH] Revert "performance: Stop direct submission before removing host ptrs" This reverts commit 0977d9e09d76e691b9a23b5cc0e4d841772aa939. Signed-off-by: Compute-Runtime-Validation --- level_zero/core/source/cmdlist/cmdlist.cpp | 19 --------- .../sources/cmdlist/test_cmdlist_3.cpp | 40 ------------------- shared/source/os_interface/product_helper.h | 1 - shared/source/os_interface/product_helper.inl | 5 --- .../source/os_interface/product_helper_hw.h | 1 - 5 files changed, 66 deletions(-) diff --git a/level_zero/core/source/cmdlist/cmdlist.cpp b/level_zero/core/source/cmdlist/cmdlist.cpp index 5d94696628..97795310e4 100644 --- a/level_zero/core/source/cmdlist/cmdlist.cpp +++ b/level_zero/core/source/cmdlist/cmdlist.cpp @@ -52,29 +52,10 @@ 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) { - auto lock = engine.commandStreamReceiver->obtainUniqueOwnership(); - engine.commandStreamReceiver->flushTagUpdate(); - } - } - hostPtrMap.clear(); } diff --git a/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_3.cpp b/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_3.cpp index c7aa42af80..68bd939810 100644 --- a/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_3.cpp +++ b/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_3.cpp @@ -314,46 +314,6 @@ 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 *>(engine.commandStreamReceiver); - ultCsr->callFlushTagUpdate = false; - } - - auto commandList = std::make_unique<::L0::ult::CommandListCoreFamily>(); - 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 *>(engine.commandStreamReceiver); - EXPECT_FALSE(ultCsr->stopDirectSubmissionCalled); - EXPECT_FALSE(ultCsr->flushTagUpdateCalled); - } - - commandList->removeHostPtrAllocations(); - - for (const auto &engine : engines) { - auto ultCsr = static_cast *>(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; HWTEST2_F(CommandListCreate, givenCommandListWhenMemoryCopyRegionHavingHostMemoryWithSignalAndWaitScopeEventsUsingRenderEngineThenPipeControlsWithDcFlushIsFound, diff --git a/shared/source/os_interface/product_helper.h b/shared/source/os_interface/product_helper.h index 9605ff8cc7..a78caef65f 100644 --- a/shared/source/os_interface/product_helper.h +++ b/shared/source/os_interface/product_helper.h @@ -109,7 +109,6 @@ class ProductHelper { virtual bool isNewResidencyModelSupported() const = 0; virtual bool isDirectSubmissionSupported(ReleaseHelper *releaseHelper) const = 0; virtual bool isDirectSubmissionConstantCacheInvalidationNeeded(const HardwareInfo &hwInfo) const = 0; - virtual bool restartDirectSubmissionForHostptrFree() const = 0; virtual bool isAdjustDirectSubmissionTimeoutOnThrottleAndAcLineStatusEnabled() const = 0; virtual TimeoutParams getDirectSubmissionControllerTimeoutParams(bool acLineConnected, QueueThrottle queueThrottle) const = 0; virtual std::pair isPipeControlPriorToNonPipelinedStateCommandsWARequired(const HardwareInfo &hwInfo, bool isRcs, const ReleaseHelper *releaseHelper) const = 0; diff --git a/shared/source/os_interface/product_helper.inl b/shared/source/os_interface/product_helper.inl index 421d15424b..ab4cf6f2d2 100644 --- a/shared/source/os_interface/product_helper.inl +++ b/shared/source/os_interface/product_helper.inl @@ -331,11 +331,6 @@ bool ProductHelperHw::isDirectSubmissionConstantCacheInvalidationNee return false; } -template -bool ProductHelperHw::restartDirectSubmissionForHostptrFree() const { - return false; -} - template bool ProductHelperHw::isAdjustDirectSubmissionTimeoutOnThrottleAndAcLineStatusEnabled() const { return false; diff --git a/shared/source/os_interface/product_helper_hw.h b/shared/source/os_interface/product_helper_hw.h index 237cbf80e4..81e1099897 100644 --- a/shared/source/os_interface/product_helper_hw.h +++ b/shared/source/os_interface/product_helper_hw.h @@ -54,7 +54,6 @@ class ProductHelperHw : public ProductHelper { bool isNewResidencyModelSupported() const override; bool isDirectSubmissionSupported(ReleaseHelper *releaseHelper) const override; bool isDirectSubmissionConstantCacheInvalidationNeeded(const HardwareInfo &hwInfo) const override; - bool restartDirectSubmissionForHostptrFree() const override; bool isAdjustDirectSubmissionTimeoutOnThrottleAndAcLineStatusEnabled() const override; TimeoutParams getDirectSubmissionControllerTimeoutParams(bool acLineConnected, QueueThrottle queueThrottle) const override; std::pair isPipeControlPriorToNonPipelinedStateCommandsWARequired(const HardwareInfo &hwInfo, bool isRcs, const ReleaseHelper *releaseHelper) const override;