diff --git a/level_zero/core/source/device/device_imp.cpp b/level_zero/core/source/device/device_imp.cpp index 36323885e2..b2bb87c968 100644 --- a/level_zero/core/source/device/device_imp.cpp +++ b/level_zero/core/source/device/device_imp.cpp @@ -586,7 +586,7 @@ Device *Device::create(DriverHandle *driverHandle, NEO::Device *neoDevice, uint3 debugSurface = neoDevice->getMemoryManager()->allocateGraphicsMemoryWithProperties( {device->getRootDeviceIndex(), true, NEO::SipKernel::maxDbgSurfaceSize, - NEO::GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY, + NEO::GraphicsAllocation::AllocationType::DEBUG_CONTEXT_SAVE_AREA, false, false, device->getNEODevice()->getDeviceBitfield()}); diff --git a/level_zero/core/test/unit_tests/sources/debugger/test_source_level_debugger.cpp b/level_zero/core/test/unit_tests/sources/debugger/test_source_level_debugger.cpp index b766b59a99..131b398c09 100644 --- a/level_zero/core/test/unit_tests/sources/debugger/test_source_level_debugger.cpp +++ b/level_zero/core/test/unit_tests/sources/debugger/test_source_level_debugger.cpp @@ -73,8 +73,9 @@ HWTEST_F(CommandQueueDebugCommandsTest, givenDebuggingEnabledWhenCommandListIsEx using DeviceWithDebuggerEnabledTest = Test; -TEST_F(DeviceWithDebuggerEnabledTest, givenDebuggingEnabledWhenDeviceIsCreatedThenItHasDebugSurfaceCreated) { - EXPECT_NE(nullptr, deviceL0->getDebugSurface()); +TEST_F(DeviceWithDebuggerEnabledTest, givenDebuggingEnabledWhenDeviceIsCreatedThenItHasDebugSurfaceCreatedWithCorrectAllocationType) { + ASSERT_NE(nullptr, deviceL0->getDebugSurface()); + EXPECT_EQ(NEO::GraphicsAllocation::AllocationType::DEBUG_CONTEXT_SAVE_AREA, deviceL0->getDebugSurface()->getAllocationType()); } struct TwoSubDevicesDebuggerEnabledTest : public ActiveDebuggerFixture, public ::testing::Test { diff --git a/opencl/source/utilities/logger.cpp b/opencl/source/utilities/logger.cpp index 3bac77f066..44a050c4e8 100644 --- a/opencl/source/utilities/logger.cpp +++ b/opencl/source/utilities/logger.cpp @@ -324,6 +324,8 @@ const char *FileLogger::getAllocationTypeString(GraphicsAllocation c return "UNKNOWN"; case GraphicsAllocation::AllocationType::WRITE_COMBINED: return "WRITE_COMBINED"; + case GraphicsAllocation::AllocationType::DEBUG_CONTEXT_SAVE_AREA: + return "DEBUG_CONTEXT_SAVE_AREA"; default: return "ILLEGAL_VALUE"; } diff --git a/opencl/test/unit_test/memory_manager/memory_manager_allocate_in_preferred_pool_tests.inl b/opencl/test/unit_test/memory_manager/memory_manager_allocate_in_preferred_pool_tests.inl index 17a894f361..ec34a69278 100644 --- a/opencl/test/unit_test/memory_manager/memory_manager_allocate_in_preferred_pool_tests.inl +++ b/opencl/test/unit_test/memory_manager/memory_manager_allocate_in_preferred_pool_tests.inl @@ -891,6 +891,14 @@ TEST(MemoryManagerTest, givenForceNonSystemMaskWhenAllocationTypeNotMatchesMaskT EXPECT_EQ(1u, allocationData.flags.useSystemMemory); } +TEST(MemoryManagerTest, givenDebugContextSaveAreaTypeWhenGetAllocationDataIsCalledThenSystemMemoryIsRequested) { + AllocationData allocData; + MockMemoryManager mockMemoryManager; + AllocationProperties properties{0, 1, GraphicsAllocation::AllocationType::DEBUG_CONTEXT_SAVE_AREA}; + mockMemoryManager.getAllocationData(allocData, properties, nullptr, mockMemoryManager.createStorageInfoFromProperties(properties)); + EXPECT_TRUE(allocData.flags.useSystemMemory); +} + using MemoryManagerGetAlloctionDataHaveToBeForcedTo48BitTest = testing::TestWithParam>; TEST_P(MemoryManagerGetAlloctionDataHaveToBeForcedTo48BitTest, givenAllocationTypesHaveToBeForcedTo48BitThenAllocationDataResource48BitIsSet) { @@ -967,6 +975,7 @@ static const GraphicsAllocation::AllocationType allocationHaveNotToBeForcedTo48B GraphicsAllocation::AllocationType::WRITE_COMBINED, GraphicsAllocation::AllocationType::RING_BUFFER, GraphicsAllocation::AllocationType::SEMAPHORE_BUFFER, + GraphicsAllocation::AllocationType::DEBUG_CONTEXT_SAVE_AREA, }; INSTANTIATE_TEST_CASE_P(ForceTo48Bit, diff --git a/opencl/test/unit_test/utilities/file_logger_tests.cpp b/opencl/test/unit_test/utilities/file_logger_tests.cpp index 9bec21ac40..2684c23d14 100644 --- a/opencl/test/unit_test/utilities/file_logger_tests.cpp +++ b/opencl/test/unit_test/utilities/file_logger_tests.cpp @@ -930,7 +930,8 @@ AllocationTypeTestCase allocationTypeValues[] = { {GraphicsAllocation::AllocationType::GLOBAL_FENCE, "GLOBAL_FENCE"}, {GraphicsAllocation::AllocationType::TIMESTAMP_PACKET_TAG_BUFFER, "TIMESTAMP_PACKET_TAG_BUFFER"}, {GraphicsAllocation::AllocationType::UNKNOWN, "UNKNOWN"}, - {GraphicsAllocation::AllocationType::WRITE_COMBINED, "WRITE_COMBINED"}}; + {GraphicsAllocation::AllocationType::WRITE_COMBINED, "WRITE_COMBINED"}, + {GraphicsAllocation::AllocationType::DEBUG_CONTEXT_SAVE_AREA, "DEBUG_CONTEXT_SAVE_AREA"}}; class AllocationTypeLogging : public ::testing::TestWithParam {}; diff --git a/shared/source/memory_manager/graphics_allocation.h b/shared/source/memory_manager/graphics_allocation.h index f9516c703e..925890563f 100644 --- a/shared/source/memory_manager/graphics_allocation.h +++ b/shared/source/memory_manager/graphics_allocation.h @@ -83,7 +83,8 @@ class GraphicsAllocation : public IDNode { TIMESTAMP_PACKET_TAG_BUFFER, WRITE_COMBINED, RING_BUFFER, - SEMAPHORE_BUFFER + SEMAPHORE_BUFFER, + DEBUG_CONTEXT_SAVE_AREA }; ~GraphicsAllocation() override; diff --git a/shared/source/memory_manager/memory_manager.cpp b/shared/source/memory_manager/memory_manager.cpp index 0e586f8443..118918cfc1 100644 --- a/shared/source/memory_manager/memory_manager.cpp +++ b/shared/source/memory_manager/memory_manager.cpp @@ -300,6 +300,7 @@ bool MemoryManager::getAllocationData(AllocationData &allocationData, const Allo case GraphicsAllocation::AllocationType::GLOBAL_FENCE: case GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY: case GraphicsAllocation::AllocationType::TIMESTAMP_PACKET_TAG_BUFFER: + case GraphicsAllocation::AllocationType::DEBUG_CONTEXT_SAVE_AREA: allocationData.flags.useSystemMemory = true; default: break;