diff --git a/level_zero/core/source/cmdlist/cmdlist_imp.cpp b/level_zero/core/source/cmdlist/cmdlist_imp.cpp index e28e298638..73288a409d 100644 --- a/level_zero/core/source/cmdlist/cmdlist_imp.cpp +++ b/level_zero/core/source/cmdlist/cmdlist_imp.cpp @@ -54,21 +54,21 @@ ze_result_t CommandListImp::destroy() { getCsr(false)->waitForCompletionWithTimeout(NEO::WaitParams{false, false, false, timeoutMicroseconds}, getCsr(false)->peekTaskCount()); } - auto flushCachesForDebugger = this->getDevice() && this->getDevice()->getL0Debugger() && this->getDevice()->getProductHelper().isDcFlushAllowed(); - if (!isCopyOnly(false) && - ((!isImmediateType() && this->stateBaseAddressTracking) || flushCachesForDebugger) && + if (!isImmediateType() && + !isCopyOnly(false) && + this->stateBaseAddressTracking && this->cmdListHeapAddressModel == NEO::HeapAddressModel::privateHeaps) { auto surfaceStateHeap = this->commandContainer.getIndirectHeap(NEO::HeapType::surfaceState); + if (surfaceStateHeap) { + auto heapAllocation = surfaceStateHeap->getGraphicsAllocation(); - if (flushCachesForDebugger || surfaceStateHeap) { auto rootDeviceIndex = device->getRootDeviceIndex(); auto &deviceEngines = device->getNEODevice()->getMemoryManager()->getRegisteredEngines(rootDeviceIndex); for (auto &engine : deviceEngines) { if (NEO::EngineHelpers::isComputeEngine(engine.getEngineType())) { auto contextId = engine.osContext->getContextId(); - if (engine.osContext->isInitialized() && - ((flushCachesForDebugger && engine.commandStreamReceiver->isDirectSubmissionEnabled()) || (surfaceStateHeap && surfaceStateHeap->getGraphicsAllocation()->isUsedByOsContext(contextId) && surfaceStateHeap->getGraphicsAllocation()->getTaskCount(contextId) > 0))) { + if (heapAllocation->isUsedByOsContext(contextId) && engine.osContext->isInitialized() && heapAllocation->getTaskCount(contextId) > 0) { engine.commandStreamReceiver->sendRenderStateCacheFlush(); } } diff --git a/level_zero/core/test/unit_tests/sources/debugger/test_l0_debugger_1.cpp b/level_zero/core/test/unit_tests/sources/debugger/test_l0_debugger_1.cpp index 6f5263dd8c..be70dbea9f 100644 --- a/level_zero/core/test/unit_tests/sources/debugger/test_l0_debugger_1.cpp +++ b/level_zero/core/test/unit_tests/sources/debugger/test_l0_debugger_1.cpp @@ -14,7 +14,6 @@ #include "shared/test/common/cmd_parse/gen_cmd_parse.h" #include "shared/test/common/helpers/mock_product_helper_hw.h" #include "shared/test/common/helpers/raii_product_helper.h" -#include "shared/test/common/libult/ult_command_stream_receiver.h" #include "shared/test/common/mocks/mock_bindless_heaps_helper.h" #include "shared/test/common/mocks/mock_gmm_helper.h" #include "shared/test/common/mocks/mock_graphics_allocation.h" @@ -79,37 +78,6 @@ TEST_F(L0DebuggerTest, givenL0DebuggerWhenGettingStateSaveAreaHeaderThenValidSip EXPECT_EQ(expectedStateSaveAreaHeader, stateSaveAreaHeader); } -HWTEST_F(L0DebuggerTest, givenL0DebuggerAndDirectSubmissionWhenDestroyCmdListThenFlushTagUpdateOnDcFlushPlatform) { - auto &engine = device->getNEODevice()->getDefaultEngine(); - engine.osContext->ensureContextInitialized(false); - auto csr = reinterpret_cast *>(engine.commandStreamReceiver); - csr->directSubmissionAvailable = true; - csr->callBaseSendRenderStateCacheFlush = false; - csr->flushReturnValue = NEO::SubmissionStatus::success; - - ze_result_t returnValue{}; - L0::CommandList *commandList = L0::CommandList::create(productFamily, device, NEO::EngineGroupType::renderCompute, 0u, returnValue, false); - commandList->destroy(); - - if (device->getProductHelper().isDcFlushAllowed()) { - EXPECT_TRUE(csr->renderStateCacheFlushed); - } else { - EXPECT_FALSE(csr->renderStateCacheFlushed); - } -} - -HWTEST_F(L0DebuggerTest, givenL0DebuggerWhenDestroyCmdListThenDoNotFlushTagUpdate) { - auto &engine = device->getNEODevice()->getDefaultEngine(); - engine.osContext->ensureContextInitialized(false); - auto csr = reinterpret_cast *>(engine.commandStreamReceiver); - - ze_result_t returnValue{}; - L0::CommandList *commandList = L0::CommandList::create(productFamily, device, NEO::EngineGroupType::renderCompute, 0u, returnValue, false); - commandList->destroy(); - - EXPECT_FALSE(csr->renderStateCacheFlushed); -} - TEST_F(L0DebuggerTest, givenProgramDebuggingEnabledWhenDebuggerIsCreatedThenFusedEusAreDisabled) { EXPECT_TRUE(driverHandle->enableProgramDebugging == NEO::DebuggingMode::online); EXPECT_FALSE(neoDevice->getHardwareInfo().capabilityTable.fusedEuEnabled);