fix: Flush caches on cmd list destroy with debugger
When using debugger flush caches on command list destroy to ensure correctness of reused resources for debugger. Tests ensuring that on LNL were enabled during DC flush mitigation which flushes DC on destroy for reuse. Resolves: HSD-18040962729 Signed-off-by: Lukasz Jobczyk <lukasz.jobczyk@intel.com>
This commit is contained in:
parent
047c0cd081
commit
3b4d879321
|
@ -54,21 +54,21 @@ ze_result_t CommandListImp::destroy() {
|
|||
getCsr(false)->waitForCompletionWithTimeout(NEO::WaitParams{false, false, false, timeoutMicroseconds}, getCsr(false)->peekTaskCount());
|
||||
}
|
||||
|
||||
if (!isImmediateType() &&
|
||||
!isCopyOnly(false) &&
|
||||
this->stateBaseAddressTracking &&
|
||||
auto flushCachesForDebugger = this->getDevice() && this->getDevice()->getL0Debugger() && this->getDevice()->getProductHelper().isDcFlushAllowed();
|
||||
if (!isCopyOnly(false) &&
|
||||
((!isImmediateType() && this->stateBaseAddressTracking) || flushCachesForDebugger) &&
|
||||
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 (heapAllocation->isUsedByOsContext(contextId) && engine.osContext->isInitialized() && heapAllocation->getTaskCount(contextId) > 0) {
|
||||
if (engine.osContext->isInitialized() &&
|
||||
((flushCachesForDebugger && engine.commandStreamReceiver->isDirectSubmissionEnabled()) || (surfaceStateHeap && surfaceStateHeap->getGraphicsAllocation()->isUsedByOsContext(contextId) && surfaceStateHeap->getGraphicsAllocation()->getTaskCount(contextId) > 0))) {
|
||||
engine.commandStreamReceiver->sendRenderStateCacheFlush();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2020-2024 Intel Corporation
|
||||
* Copyright (C) 2020-2025 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
|
@ -14,6 +14,7 @@
|
|||
#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"
|
||||
|
@ -78,6 +79,37 @@ 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<UltCommandStreamReceiver<FamilyType> *>(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<UltCommandStreamReceiver<FamilyType> *>(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);
|
||||
|
|
Loading…
Reference in New Issue