From 8d3438a5fbaaf3839be3f29d7c903227752d8258 Mon Sep 17 00:00:00 2001 From: Mateusz Hoppe Date: Wed, 8 Sep 2021 07:44:06 +0000 Subject: [PATCH] Allocate single Isa instance when debugging enabled - Related-To: NEO-6221 Signed-off-by: Mateusz Hoppe --- .../sources/debugger/test_l0_debugger.cpp | 24 +++++++++++++++++++ .../definitions/storage_info.cpp | 3 +-- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/level_zero/core/test/unit_tests/sources/debugger/test_l0_debugger.cpp b/level_zero/core/test/unit_tests/sources/debugger/test_l0_debugger.cpp index 2f9062c6e2..3f9dc003d1 100644 --- a/level_zero/core/test/unit_tests/sources/debugger/test_l0_debugger.cpp +++ b/level_zero/core/test/unit_tests/sources/debugger/test_l0_debugger.cpp @@ -108,6 +108,30 @@ TEST(Debugger, givenL0DebuggerOFFWhenGettingStateSaveAreaHeaderThenValidSipTypeI } } +TEST(Debugger, givenDebuggingEnabledInExecEnvWhenAllocatingIsaThenSingleBankIsUsed) { + auto executionEnvironment = new NEO::ExecutionEnvironment(); + executionEnvironment->prepareRootDeviceEnvironments(1); + executionEnvironment->setDebuggingEnabled(); + + auto hwInfo = *NEO::defaultHwInfo.get(); + hwInfo.featureTable.ftrLocalMemory = true; + executionEnvironment->rootDeviceEnvironments[0]->setHwInfo(&hwInfo); + executionEnvironment->initializeMemoryManager(); + + std::unique_ptr neoDevice(NEO::MockDevice::create(executionEnvironment, 0u)); + + auto allocation = neoDevice->getMemoryManager()->allocateGraphicsMemoryWithProperties( + {neoDevice->getRootDeviceIndex(), 4096, NEO::GraphicsAllocation::AllocationType::KERNEL_ISA, neoDevice->getDeviceBitfield()}); + + if (allocation->getMemoryPool() == MemoryPool::LocalMemory) { + EXPECT_EQ(1u, allocation->storageInfo.getMemoryBanks()); + } else { + EXPECT_EQ(0u, allocation->storageInfo.getMemoryBanks()); + } + + neoDevice->getMemoryManager()->freeGraphicsMemory(allocation); +} + HWTEST_F(L0DebuggerTest, givenL0DebuggerWhenCreatedThenPerContextSbaTrackingBuffersAreAllocated) { auto debugger = device->getL0Debugger(); ASSERT_NE(nullptr, debugger); diff --git a/shared/source/memory_manager/definitions/storage_info.cpp b/shared/source/memory_manager/definitions/storage_info.cpp index d99ab0f515..37ec336d7d 100644 --- a/shared/source/memory_manager/definitions/storage_info.cpp +++ b/shared/source/memory_manager/definitions/storage_info.cpp @@ -47,8 +47,7 @@ StorageInfo MemoryManager::createStorageInfoFromProperties(const AllocationPrope case GraphicsAllocation::AllocationType::DEBUG_MODULE_AREA: { auto placeIsaOnMultiTile = (properties.subDevicesBitfield.count() != 1); - if (executionEnvironment.isDebuggingEnabled() && - executionEnvironment.rootDeviceEnvironments[properties.rootDeviceIndex]->debugger.get()) { + if (executionEnvironment.isDebuggingEnabled()) { placeIsaOnMultiTile = false; }