From c453e7fe8b9076b6360caaccc9d7a7933e4de2a2 Mon Sep 17 00:00:00 2001 From: Compute-Runtime-Validation Date: Thu, 29 Apr 2021 17:25:34 +0200 Subject: [PATCH] Revert "Mark SVM_GPU allocation as not lockable" This reverts commit 5341d0663cfedce15b0c8ffeedf86e297e584dbb. Signed-off-by: Compute-Runtime-Validation --- .../unit_test/helpers/hw_helper_tests.cpp | 33 +------------------ .../graphics_allocation_tests.cpp | 4 +-- shared/source/helpers/hw_helper_base.inl | 2 +- .../memory_manager/graphics_allocation.h | 1 + 4 files changed, 5 insertions(+), 35 deletions(-) diff --git a/opencl/test/unit_test/helpers/hw_helper_tests.cpp b/opencl/test/unit_test/helpers/hw_helper_tests.cpp index 7ec32a52ed..48789a0f90 100644 --- a/opencl/test/unit_test/helpers/hw_helper_tests.cpp +++ b/opencl/test/unit_test/helpers/hw_helper_tests.cpp @@ -937,15 +937,13 @@ HWTEST_F(HwHelperTest, givenDefaultHwHelperHwWhenMinimalSIMDSizeIsQueriedThen8Is EXPECT_EQ(8u, helper.getMinimalSIMDSize()); } -HWTEST_F(HwHelperTest, givenLockableAllocationWhenGettingIsBlitCopyRequiredForLocalMemoryThenCorrectValuesAreReturned) { +HWTEST_F(HwHelperTest, whenGettingIsBlitCopyRequiredForLocalMemoryThenCorrectValuesAreReturned) { DebugManagerStateRestore restore{}; auto &helper = HwHelper::get(renderCoreFamily); HardwareInfo hwInfo = *defaultHwInfo; hwInfo.capabilityTable.blitterOperationsSupported = true; MockGraphicsAllocation graphicsAllocation; - graphicsAllocation.setAllocationType(GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY); - EXPECT_TRUE(GraphicsAllocation::isLockable(graphicsAllocation.getAllocationType())); graphicsAllocation.overrideMemoryPool(MemoryPool::LocalMemory); auto expectedDefaultValue = (helper.getLocalMemoryAccessMode(hwInfo) == LocalMemoryAccessMode::CpuAccessDisallowed); @@ -967,35 +965,6 @@ HWTEST_F(HwHelperTest, givenLockableAllocationWhenGettingIsBlitCopyRequiredForLo EXPECT_FALSE(helper.isBlitCopyRequiredForLocalMemory(hwInfo, graphicsAllocation)); } -HWTEST_F(HwHelperTest, givenNotLockableAllocationWhenGettingIsBlitCopyRequiredForLocalMemoryThenCorrectValuesAreReturned) { - DebugManagerStateRestore restore{}; - auto &helper = HwHelper::get(renderCoreFamily); - HardwareInfo hwInfo = *defaultHwInfo; - hwInfo.capabilityTable.blitterOperationsSupported = true; - - MockGraphicsAllocation graphicsAllocation; - graphicsAllocation.setAllocationType(GraphicsAllocation::AllocationType::SVM_GPU); - EXPECT_FALSE(GraphicsAllocation::isLockable(graphicsAllocation.getAllocationType())); - graphicsAllocation.overrideMemoryPool(MemoryPool::LocalMemory); - - EXPECT_TRUE(helper.isBlitCopyRequiredForLocalMemory(hwInfo, graphicsAllocation)); - - DebugManager.flags.ForceLocalMemoryAccessMode.set(0); - EXPECT_TRUE(helper.isBlitCopyRequiredForLocalMemory(hwInfo, graphicsAllocation)); - DebugManager.flags.ForceLocalMemoryAccessMode.set(1); - EXPECT_TRUE(helper.isBlitCopyRequiredForLocalMemory(hwInfo, graphicsAllocation)); - - DebugManager.flags.ForceLocalMemoryAccessMode.set(3); - EXPECT_TRUE(helper.isBlitCopyRequiredForLocalMemory(hwInfo, graphicsAllocation)); - hwInfo.capabilityTable.blitterOperationsSupported = false; - EXPECT_FALSE(helper.isBlitCopyRequiredForLocalMemory(hwInfo, graphicsAllocation)); - - graphicsAllocation.overrideMemoryPool(MemoryPool::System64KBPages); - EXPECT_FALSE(helper.isBlitCopyRequiredForLocalMemory(hwInfo, graphicsAllocation)); - hwInfo.capabilityTable.blitterOperationsSupported = true; - EXPECT_FALSE(helper.isBlitCopyRequiredForLocalMemory(hwInfo, graphicsAllocation)); -} - HWTEST_F(HwHelperTest, givenVariousDebugKeyValuesWhenGettingLocalMemoryAccessModeThenCorrectValueIsReturned) { struct MockHwHelper : HwHelperHw { using HwHelper::getDefaultLocalMemoryAccessMode; diff --git a/opencl/test/unit_test/memory_manager/graphics_allocation_tests.cpp b/opencl/test/unit_test/memory_manager/graphics_allocation_tests.cpp index 9c1d4f1ea9..ecbe361f16 100644 --- a/opencl/test/unit_test/memory_manager/graphics_allocation_tests.cpp +++ b/opencl/test/unit_test/memory_manager/graphics_allocation_tests.cpp @@ -179,8 +179,8 @@ TEST(GraphicsAllocationTest, whenAllocationTypeIsGpuTimestampDeviceBufferThenAll EXPECT_TRUE(GraphicsAllocation::isLockable(GraphicsAllocation::AllocationType::GPU_TIMESTAMP_DEVICE_BUFFER)); } -TEST(GraphicsAllocationTest, whenAllocationTypeIsSvmGpuThenAllocationIsNotLockable) { - EXPECT_FALSE(GraphicsAllocation::isLockable(GraphicsAllocation::AllocationType::SVM_GPU)); +TEST(GraphicsAllocationTest, whenAllocationTypeIsSvmGpuThenAllocationIsLockable) { + EXPECT_TRUE(GraphicsAllocation::isLockable(GraphicsAllocation::AllocationType::SVM_GPU)); } TEST(GraphicsAllocationTest, whenAllocationTypeIsSharedResourceCopyThenAllocationIsLockable) { diff --git a/shared/source/helpers/hw_helper_base.inl b/shared/source/helpers/hw_helper_base.inl index 8bd75811cc..7cd3e584aa 100644 --- a/shared/source/helpers/hw_helper_base.inl +++ b/shared/source/helpers/hw_helper_base.inl @@ -452,7 +452,7 @@ inline bool HwHelperHw::allowRenderCompression(const HardwareInfo &hw template inline bool HwHelperHw::isBlitCopyRequiredForLocalMemory(const HardwareInfo &hwInfo, const GraphicsAllocation &allocation) const { return allocation.isAllocatedInLocalMemoryPool() && - (getLocalMemoryAccessMode(hwInfo) == LocalMemoryAccessMode::CpuAccessDisallowed || !GraphicsAllocation::isLockable(allocation.getAllocationType())) && + (getLocalMemoryAccessMode(hwInfo) == LocalMemoryAccessMode::CpuAccessDisallowed) && hwInfo.capabilityTable.blitterOperationsSupported; } diff --git a/shared/source/memory_manager/graphics_allocation.h b/shared/source/memory_manager/graphics_allocation.h index 7cfd81bf59..807bb07731 100644 --- a/shared/source/memory_manager/graphics_allocation.h +++ b/shared/source/memory_manager/graphics_allocation.h @@ -235,6 +235,7 @@ class GraphicsAllocation : public IDNode { isIsaAllocationType(allocationType) || allocationType == AllocationType::BUFFER_HOST_MEMORY || allocationType == AllocationType::GPU_TIMESTAMP_DEVICE_BUFFER || + allocationType == AllocationType::SVM_GPU || allocationType == AllocationType::SHARED_RESOURCE_COPY; }