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:
Dominik Dabek
2022-11-18 14:29:50 +00:00
committed by Compute-Runtime-Automation
parent 3b97ca8709
commit 9b9b0f10ef
6 changed files with 39 additions and 9 deletions

View File

@ -50,6 +50,8 @@ class Context : public BaseObject<_cl_context> {
static constexpr auto startingOffset = chunkAlignment;
static_assert(aggregatedSmallBuffersPoolSize > smallBufferThreshold, "Largest allowed buffer needs to fit in pool");
static_assert(aggregatedSmallBuffersPoolSize <= GraphicsAllocation::largestLockableBufferSize, "Pool buffer should be lockable");
Buffer *allocateBufferFromPool(const MemoryProperties &memoryProperties,
cl_mem_flags flags,
cl_mem_flags_intel flagsIntel,

View File

@ -84,6 +84,12 @@ TEST_F(aggregatedSmallBuffersDisabledTest, givenAggregatedSmallBuffersDisabledWh
using aggregatedSmallBuffersEnabledTest = AggregatedSmallBuffersTestTemplate<1>;
TEST_F(aggregatedSmallBuffersEnabledTest, givenAggregatedSmallBuffersEnabledWhenCheckingMainStorageAllocationStorageInfoThenItIsLockable) {
ASSERT_TRUE(poolAllocator->isAggregatedSmallBuffersEnabled());
ASSERT_NE(poolAllocator->mainStorage, nullptr);
EXPECT_TRUE(poolAllocator->mainStorage->getGraphicsAllocation(mockRootDeviceIndex)->isAllocationLockable());
}
TEST_F(aggregatedSmallBuffersEnabledTest, givenAggregatedSmallBuffersEnabledAndSizeLargerThanThresholdWhenBufferCreateCalledThenDoNotUsePool) {
ASSERT_TRUE(poolAllocator->isAggregatedSmallBuffersEnabled());
ASSERT_NE(poolAllocator->mainStorage, nullptr);