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 7fd8c8538b..64a5e8c839 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 @@ -739,6 +739,78 @@ TEST(MemoryManagerTest, givenDirectSemaphorePlacementSetWhenOverrideToSystemThen EXPECT_EQ(1u, allocationData.flags.useSystemMemory); } +TEST(MemoryManagerTest, givenDirectBufferAddressingWhenOverrideToNo48BitThenExpect48BitFlagFalse) { + DebugManagerStateRestore restorer; + DebugManager.flags.DirectSubmissionBufferAddressing.set(0); + AllocationData allocationData; + AllocationProperties properties(0, 0x1000, GraphicsAllocation::AllocationType::RING_BUFFER); + allocationData.flags.resource48Bit = 1; + MockMemoryManager::overrideAllocationData(allocationData, properties); + + EXPECT_EQ(0u, allocationData.flags.resource48Bit); +} + +TEST(MemoryManagerTest, givenDirectBufferAddressingWhenOverrideTo48BitThenExpect48BitFlagTrue) { + DebugManagerStateRestore restorer; + DebugManager.flags.DirectSubmissionBufferAddressing.set(1); + AllocationData allocationData; + AllocationProperties properties(0, 0x1000, GraphicsAllocation::AllocationType::RING_BUFFER); + allocationData.flags.resource48Bit = 0; + MockMemoryManager::overrideAllocationData(allocationData, properties); + + EXPECT_EQ(1u, allocationData.flags.resource48Bit); +} + +TEST(MemoryManagerTest, givenDirectBufferAddressingDefaultWhenNoOverrideThenExpect48BitFlagSame) { + AllocationData allocationData; + AllocationProperties properties(0, 0x1000, GraphicsAllocation::AllocationType::RING_BUFFER); + allocationData.flags.resource48Bit = 0; + MockMemoryManager::overrideAllocationData(allocationData, properties); + + EXPECT_EQ(0u, allocationData.flags.resource48Bit); + + allocationData.flags.resource48Bit = 1; + MockMemoryManager::overrideAllocationData(allocationData, properties); + + EXPECT_EQ(1u, allocationData.flags.resource48Bit); +} + +TEST(MemoryManagerTest, givenDirectSemaphoreAddressingWhenOverrideToNo48BitThenExpect48BitFlagFalse) { + DebugManagerStateRestore restorer; + DebugManager.flags.DirectSubmissionSemaphoreAddressing.set(0); + AllocationData allocationData; + AllocationProperties properties(0, 0x1000, GraphicsAllocation::AllocationType::SEMAPHORE_BUFFER); + allocationData.flags.resource48Bit = 1; + MockMemoryManager::overrideAllocationData(allocationData, properties); + + EXPECT_EQ(0u, allocationData.flags.resource48Bit); +} + +TEST(MemoryManagerTest, givenDirectSemaphoreAddressingWhenOverrideTo48BitThenExpect48BitFlagTrue) { + DebugManagerStateRestore restorer; + DebugManager.flags.DirectSubmissionSemaphoreAddressing.set(1); + AllocationData allocationData; + AllocationProperties properties(0, 0x1000, GraphicsAllocation::AllocationType::SEMAPHORE_BUFFER); + allocationData.flags.resource48Bit = 0; + MockMemoryManager::overrideAllocationData(allocationData, properties); + + EXPECT_EQ(1u, allocationData.flags.resource48Bit); +} + +TEST(MemoryManagerTest, givenDirectSemaphoreAddressingDefaultWhenNoOverrideThenExpect48BitFlagSame) { + AllocationData allocationData; + AllocationProperties properties(0, 0x1000, GraphicsAllocation::AllocationType::SEMAPHORE_BUFFER); + allocationData.flags.resource48Bit = 0; + MockMemoryManager::overrideAllocationData(allocationData, properties); + + EXPECT_EQ(0u, allocationData.flags.resource48Bit); + + allocationData.flags.resource48Bit = 1; + MockMemoryManager::overrideAllocationData(allocationData, properties); + + EXPECT_EQ(1u, allocationData.flags.resource48Bit); +} + using MemoryManagerGetAlloctionDataHaveToBeForcedTo48BitTest = testing::TestWithParam>; TEST_P(MemoryManagerGetAlloctionDataHaveToBeForcedTo48BitTest, givenAllocationTypesHaveToBeForcedTo48BitThenAllocationDataResource48BitIsSet) { diff --git a/opencl/test/unit_test/test_files/igdrcl.config b/opencl/test/unit_test/test_files/igdrcl.config index c9a47abe0f..d3dd97331f 100644 --- a/opencl/test/unit_test/test_files/igdrcl.config +++ b/opencl/test/unit_test/test_files/igdrcl.config @@ -138,4 +138,6 @@ WddmResidencyLogger = 0 DirectSubmissionEnableDebugBuffer = 0 DirectSubmissionDisableCacheFlush = 0 DirectSubmissionDisableMonitorFence = 0 -ForceFineGrainedSVMSupport = -1 \ No newline at end of file +ForceFineGrainedSVMSupport = -1 +DirectSubmissionBufferAddressing = -1 +DirectSubmissionSemaphoreAddressing = -1 \ No newline at end of file diff --git a/shared/source/debug_settings/debug_variables_base.inl b/shared/source/debug_settings/debug_variables_base.inl index dec9caa52b..df10078648 100644 --- a/shared/source/debug_settings/debug_variables_base.inl +++ b/shared/source/debug_settings/debug_variables_base.inl @@ -83,6 +83,8 @@ DECLARE_DEBUG_VARIABLE(int32_t, PrintDriverDiagnostics, -1, "prints driver diagn DECLARE_DEBUG_VARIABLE(int32_t, EnableDirectSubmission, -1, "-1: default (disabled), 0: disable, 1:enable. Enables direct submission of command buffers bypassing KMD") DECLARE_DEBUG_VARIABLE(int32_t, DirectSubmissionBufferPlacement, -1, "-1: do not override, 0: non-system, 1: system") DECLARE_DEBUG_VARIABLE(int32_t, DirectSubmissionSemaphorePlacement, -1, "-1: do not override, 0: non-system, 1: system") +DECLARE_DEBUG_VARIABLE(int32_t, DirectSubmissionBufferAddressing, -1, "-1: do not override, 0: not use 48bit, 1: use 48bit") +DECLARE_DEBUG_VARIABLE(int32_t, DirectSubmissionSemaphoreAddressing, -1, "-1: do not override, 0: not use 48bit, 1: use 48bit") DECLARE_DEBUG_VARIABLE(int32_t, DirectSubmissionDisableCpuCacheFlush, -1, "-1: do not override, 0: disable, 1: enable") DECLARE_DEBUG_VARIABLE(int32_t, DirectSubmissionEnableDebugBuffer, 0, "0: diagnostic feature disabled - dispatch regular workload, 1: dispatch diagnostic buffer - mode 1 - single SDI command, 2: dispatch diagnostic buffer - mode 2 - no command") DECLARE_DEBUG_VARIABLE(bool, DirectSubmissionDisableCacheFlush, false, "Disable dispatching cache flush commands") diff --git a/shared/source/memory_manager/memory_manager.cpp b/shared/source/memory_manager/memory_manager.cpp index 1f23451f1a..b060e52a4b 100644 --- a/shared/source/memory_manager/memory_manager.cpp +++ b/shared/source/memory_manager/memory_manager.cpp @@ -588,26 +588,45 @@ bool MemoryManager::isCopyRequired(ImageInfo &imgInfo, const void *hostPtr) { void MemoryManager::overrideAllocationData(AllocationData &allocationData, const AllocationProperties &properties) { int32_t directRingPlacement = DebugManager.flags.DirectSubmissionBufferPlacement.get(); - if (properties.allocationType == GraphicsAllocation::AllocationType::RING_BUFFER && - directRingPlacement != -1) { - if (directRingPlacement == 0) { - allocationData.flags.requiresCpuAccess = true; - allocationData.flags.useSystemMemory = false; - } else { - allocationData.flags.requiresCpuAccess = false; - allocationData.flags.useSystemMemory = true; + int32_t directRingAddressing = DebugManager.flags.DirectSubmissionBufferAddressing.get(); + if (properties.allocationType == GraphicsAllocation::AllocationType::RING_BUFFER) { + if (directRingPlacement != -1) { + if (directRingPlacement == 0) { + allocationData.flags.requiresCpuAccess = true; + allocationData.flags.useSystemMemory = false; + } else { + allocationData.flags.requiresCpuAccess = false; + allocationData.flags.useSystemMemory = true; + } + } + + if (directRingAddressing != -1) { + if (directRingAddressing == 0) { + allocationData.flags.resource48Bit = false; + } else { + allocationData.flags.resource48Bit = true; + } } } int32_t directSemaphorePlacement = DebugManager.flags.DirectSubmissionSemaphorePlacement.get(); - if (properties.allocationType == GraphicsAllocation::AllocationType::SEMAPHORE_BUFFER && - directSemaphorePlacement != -1) { - if (directSemaphorePlacement == 0) { - allocationData.flags.requiresCpuAccess = true; - allocationData.flags.useSystemMemory = false; - } else { - allocationData.flags.requiresCpuAccess = false; - allocationData.flags.useSystemMemory = true; + int32_t directSemaphoreAddressing = DebugManager.flags.DirectSubmissionSemaphoreAddressing.get(); + if (properties.allocationType == GraphicsAllocation::AllocationType::SEMAPHORE_BUFFER) { + if (directSemaphorePlacement != -1) { + if (directSemaphorePlacement == 0) { + allocationData.flags.requiresCpuAccess = true; + allocationData.flags.useSystemMemory = false; + } else { + allocationData.flags.requiresCpuAccess = false; + allocationData.flags.useSystemMemory = true; + } + } + if (directSemaphoreAddressing != -1) { + if (directSemaphoreAddressing == 0) { + allocationData.flags.resource48Bit = false; + } else { + allocationData.flags.resource48Bit = true; + } } } -} +} // namespace NEO } // namespace NEO