performance(debugger): optimize ATT handling - minimize mem allocs

- do not allocate state save area every time attention event
is handled
- keep allocated memory for subsequent events
- remove not needed DBEUG_BREAK

Related-To: NEO-8183

Signed-off-by: Mateusz Hoppe <mateusz.hoppe@intel.com>
This commit is contained in:
Mateusz Hoppe
2023-07-17 13:44:19 +00:00
committed by Compute-Runtime-Automation
parent 6d458cd002
commit 8e07dd30cb
5 changed files with 54 additions and 12 deletions

View File

@@ -1783,6 +1783,44 @@ TEST(DebugSessionTest, givenStoppedThreadWhenGettingNotStoppedThreadsThenOnlyRun
EXPECT_EQ(thread1, newStops[0]);
}
TEST(DebugSessionTest, givenSizeBiggerThanPreviousWhenAllocatingStateSaveAreaMemoryThenNewMemoryIsAllocated) {
zet_debug_config_t config = {};
config.pid = 0x1234;
auto hwInfo = *NEO::defaultHwInfo.get();
NEO::MockDevice *neoDevice(NEO::MockDevice::createWithNewExecutionEnvironment<NEO::MockDevice>(&hwInfo, 0));
Mock<L0::DeviceImp> deviceImp(neoDevice, neoDevice->getExecutionEnvironment());
auto sessionMock = std::make_unique<MockDebugSession>(config, &deviceImp);
EXPECT_EQ(0u, sessionMock->stateSaveAreaMemory.size());
sessionMock->allocateStateSaveAreaMemory(0x1000);
EXPECT_EQ(0x1000u, sessionMock->stateSaveAreaMemory.size());
sessionMock->allocateStateSaveAreaMemory(0x2000);
EXPECT_EQ(0x2000u, sessionMock->stateSaveAreaMemory.size());
}
TEST(DebugSessionTest, givenTheSameSizeWhenAllocatingStateSaveAreaMemoryThenNewMemoryIsNotAllocated) {
zet_debug_config_t config = {};
config.pid = 0x1234;
auto hwInfo = *NEO::defaultHwInfo.get();
NEO::MockDevice *neoDevice(NEO::MockDevice::createWithNewExecutionEnvironment<NEO::MockDevice>(&hwInfo, 0));
Mock<L0::DeviceImp> deviceImp(neoDevice, neoDevice->getExecutionEnvironment());
auto sessionMock = std::make_unique<MockDebugSession>(config, &deviceImp);
EXPECT_EQ(0u, sessionMock->stateSaveAreaMemory.size());
sessionMock->allocateStateSaveAreaMemory(0x1000);
EXPECT_EQ(0x1000u, sessionMock->stateSaveAreaMemory.size());
auto oldMem = sessionMock->stateSaveAreaMemory.data();
sessionMock->allocateStateSaveAreaMemory(0x1000);
EXPECT_EQ(oldMem, sessionMock->stateSaveAreaMemory.data());
}
using MultiTileDebugSessionTest = Test<MultipleDevicesWithCustomHwInfo>;
TEST_F(MultiTileDebugSessionTest, givenThreadsFromMultipleTilesWhenResumeCalledThenThreadsResumedInAllTiles) {

View File

@@ -141,6 +141,7 @@ struct MockDebugSession : public L0::DebugSessionImp {
using L0::DebugSession::debugArea;
using L0::DebugSessionImp::addThreadToNewlyStoppedFromRaisedAttention;
using L0::DebugSessionImp::allocateStateSaveAreaMemory;
using L0::DebugSessionImp::apiEvents;
using L0::DebugSessionImp::applyResumeWa;
using L0::DebugSessionImp::calculateThreadSlotOffset;
@@ -156,6 +157,7 @@ struct MockDebugSession : public L0::DebugSessionImp {
using L0::DebugSessionImp::registersAccessHelper;
using L0::DebugSessionImp::resumeAccidentallyStoppedThreads;
using L0::DebugSessionImp::sendInterrupts;
using L0::DebugSessionImp::stateSaveAreaMemory;
using L0::DebugSessionImp::typeToRegsetDesc;
using L0::DebugSessionImp::validateAndSetStateSaveAreaHeader;