Mark SVM_GPU allocation as not lockable

use blitter if available and allocation is not lockable

Related-To: NEO-5733

Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
Mateusz Jablonski
2021-04-29 14:21:43 +00:00
committed by Compute-Runtime-Automation
parent 5403289d73
commit 5341d0663c
4 changed files with 35 additions and 5 deletions

View File

@ -937,13 +937,15 @@ HWTEST_F(HwHelperTest, givenDefaultHwHelperHwWhenMinimalSIMDSizeIsQueriedThen8Is
EXPECT_EQ(8u, helper.getMinimalSIMDSize()); EXPECT_EQ(8u, helper.getMinimalSIMDSize());
} }
HWTEST_F(HwHelperTest, whenGettingIsBlitCopyRequiredForLocalMemoryThenCorrectValuesAreReturned) { HWTEST_F(HwHelperTest, givenLockableAllocationWhenGettingIsBlitCopyRequiredForLocalMemoryThenCorrectValuesAreReturned) {
DebugManagerStateRestore restore{}; DebugManagerStateRestore restore{};
auto &helper = HwHelper::get(renderCoreFamily); auto &helper = HwHelper::get(renderCoreFamily);
HardwareInfo hwInfo = *defaultHwInfo; HardwareInfo hwInfo = *defaultHwInfo;
hwInfo.capabilityTable.blitterOperationsSupported = true; hwInfo.capabilityTable.blitterOperationsSupported = true;
MockGraphicsAllocation graphicsAllocation; MockGraphicsAllocation graphicsAllocation;
graphicsAllocation.setAllocationType(GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY);
EXPECT_TRUE(GraphicsAllocation::isLockable(graphicsAllocation.getAllocationType()));
graphicsAllocation.overrideMemoryPool(MemoryPool::LocalMemory); graphicsAllocation.overrideMemoryPool(MemoryPool::LocalMemory);
auto expectedDefaultValue = (helper.getLocalMemoryAccessMode(hwInfo) == LocalMemoryAccessMode::CpuAccessDisallowed); auto expectedDefaultValue = (helper.getLocalMemoryAccessMode(hwInfo) == LocalMemoryAccessMode::CpuAccessDisallowed);
@ -965,6 +967,35 @@ HWTEST_F(HwHelperTest, whenGettingIsBlitCopyRequiredForLocalMemoryThenCorrectVal
EXPECT_FALSE(helper.isBlitCopyRequiredForLocalMemory(hwInfo, graphicsAllocation)); 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) { HWTEST_F(HwHelperTest, givenVariousDebugKeyValuesWhenGettingLocalMemoryAccessModeThenCorrectValueIsReturned) {
struct MockHwHelper : HwHelperHw<FamilyType> { struct MockHwHelper : HwHelperHw<FamilyType> {
using HwHelper::getDefaultLocalMemoryAccessMode; using HwHelper::getDefaultLocalMemoryAccessMode;

View File

@ -179,8 +179,8 @@ TEST(GraphicsAllocationTest, whenAllocationTypeIsGpuTimestampDeviceBufferThenAll
EXPECT_TRUE(GraphicsAllocation::isLockable(GraphicsAllocation::AllocationType::GPU_TIMESTAMP_DEVICE_BUFFER)); EXPECT_TRUE(GraphicsAllocation::isLockable(GraphicsAllocation::AllocationType::GPU_TIMESTAMP_DEVICE_BUFFER));
} }
TEST(GraphicsAllocationTest, whenAllocationTypeIsSvmGpuThenAllocationIsLockable) { TEST(GraphicsAllocationTest, whenAllocationTypeIsSvmGpuThenAllocationIsNotLockable) {
EXPECT_TRUE(GraphicsAllocation::isLockable(GraphicsAllocation::AllocationType::SVM_GPU)); EXPECT_FALSE(GraphicsAllocation::isLockable(GraphicsAllocation::AllocationType::SVM_GPU));
} }
TEST(GraphicsAllocationTest, whenAllocationTypeIsSharedResourceCopyThenAllocationIsLockable) { TEST(GraphicsAllocationTest, whenAllocationTypeIsSharedResourceCopyThenAllocationIsLockable) {

View File

@ -452,7 +452,7 @@ inline bool HwHelperHw<GfxFamily>::allowRenderCompression(const HardwareInfo &hw
template <typename GfxFamily> template <typename GfxFamily>
inline bool HwHelperHw<GfxFamily>::isBlitCopyRequiredForLocalMemory(const HardwareInfo &hwInfo, const GraphicsAllocation &allocation) const { inline bool HwHelperHw<GfxFamily>::isBlitCopyRequiredForLocalMemory(const HardwareInfo &hwInfo, const GraphicsAllocation &allocation) const {
return allocation.isAllocatedInLocalMemoryPool() && return allocation.isAllocatedInLocalMemoryPool() &&
(getLocalMemoryAccessMode(hwInfo) == LocalMemoryAccessMode::CpuAccessDisallowed) && (getLocalMemoryAccessMode(hwInfo) == LocalMemoryAccessMode::CpuAccessDisallowed || !GraphicsAllocation::isLockable(allocation.getAllocationType())) &&
hwInfo.capabilityTable.blitterOperationsSupported; hwInfo.capabilityTable.blitterOperationsSupported;
} }

View File

@ -235,7 +235,6 @@ class GraphicsAllocation : public IDNode<GraphicsAllocation> {
isIsaAllocationType(allocationType) || isIsaAllocationType(allocationType) ||
allocationType == AllocationType::BUFFER_HOST_MEMORY || allocationType == AllocationType::BUFFER_HOST_MEMORY ||
allocationType == AllocationType::GPU_TIMESTAMP_DEVICE_BUFFER || allocationType == AllocationType::GPU_TIMESTAMP_DEVICE_BUFFER ||
allocationType == AllocationType::SVM_GPU ||
allocationType == AllocationType::SHARED_RESOURCE_COPY; allocationType == AllocationType::SHARED_RESOURCE_COPY;
} }