mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-03 06:49:52 +08:00
Make small buffer allocations lockable
Allocations of buffers <= 64KB will be lockable, to allow copying through locked pointer. Related-To: NEO-7332 Signed-off-by: Dominik Dabek <dominik.dabek@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
3b97ca8709
commit
9b9b0f10ef
@@ -198,6 +198,18 @@ TEST(GraphicsAllocationTest, whenAllocationTypeIsImageThenAllocationIsNotLockabl
|
||||
EXPECT_FALSE(GraphicsAllocation::isLockable(AllocationType::IMAGE));
|
||||
}
|
||||
|
||||
TEST(GraphicsAllocationTest, whenAllocationTypeIsNotBufferThenAllocationIsNotSmallBuffer) {
|
||||
EXPECT_FALSE(GraphicsAllocation::isSmallBuffer(AllocationType::IMAGE, GraphicsAllocation::largestLockableBufferSize));
|
||||
}
|
||||
|
||||
TEST(GraphicsAllocationTest, whenAllocationSizeIsAboveThresholdThenAllocationIsNotSmallBuffer) {
|
||||
EXPECT_FALSE(GraphicsAllocation::isSmallBuffer(AllocationType::BUFFER, GraphicsAllocation::largestLockableBufferSize + 1));
|
||||
}
|
||||
|
||||
TEST(GraphicsAllocationTest, whenAllocationTypeIsBufferAndSizeIsAtMostThresholdThenAllocationIsSmallBuffer) {
|
||||
EXPECT_TRUE(GraphicsAllocation::isSmallBuffer(AllocationType::BUFFER, GraphicsAllocation::largestLockableBufferSize));
|
||||
}
|
||||
|
||||
TEST(GraphicsAllocationTest, givenNumMemoryBanksWhenGettingNumHandlesForKmdSharedAllocationThenReturnCorrectValue) {
|
||||
DebugManagerStateRestore restore;
|
||||
|
||||
|
||||
@@ -459,15 +459,19 @@ TEST_F(MultiDeviceStorageInfoTest, givenGraphicsAllocationWithCpuAccessRequiredW
|
||||
TEST_F(MultiDeviceStorageInfoTest, givenGraphicsAllocationThatIsLockableWhenCreatingStorageInfoThenIsLockableFlagIsEnabled) {
|
||||
auto firstAllocationIdx = static_cast<int>(AllocationType::UNKNOWN);
|
||||
auto lastAllocationIdx = static_cast<int>(AllocationType::COUNT);
|
||||
std::array<size_t, 2> allocationSizes = {1u, GraphicsAllocation::largestLockableBufferSize + 1};
|
||||
|
||||
for (int allocationIdx = firstAllocationIdx; allocationIdx != lastAllocationIdx; allocationIdx++) {
|
||||
auto allocationType = static_cast<AllocationType>(allocationIdx);
|
||||
AllocationProperties properties{mockRootDeviceIndex, false, 1u, allocationType, false, singleTileMask};
|
||||
auto storageInfo = memoryManager->createStorageInfoFromProperties(properties);
|
||||
if (GraphicsAllocation::isLockable(properties.allocationType)) {
|
||||
EXPECT_TRUE(storageInfo.isLockable);
|
||||
} else {
|
||||
EXPECT_FALSE(storageInfo.isLockable);
|
||||
for (auto allocationSize : allocationSizes) {
|
||||
for (int allocationIdx = firstAllocationIdx; allocationIdx != lastAllocationIdx; allocationIdx++) {
|
||||
auto allocationType = static_cast<AllocationType>(allocationIdx);
|
||||
AllocationProperties properties{mockRootDeviceIndex, false, allocationSize, allocationType, false, singleTileMask};
|
||||
auto storageInfo = memoryManager->createStorageInfoFromProperties(properties);
|
||||
if (GraphicsAllocation::isLockable(properties.allocationType) ||
|
||||
GraphicsAllocation::isSmallBuffer(properties.allocationType, allocationSize)) {
|
||||
EXPECT_TRUE(storageInfo.isLockable);
|
||||
} else {
|
||||
EXPECT_FALSE(storageInfo.isLockable);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user