mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-24 21:18:24 +08:00
Refactor graphics memory allocation scheme
- replace createGraphicsAllocationWithRequiredBitness with more general methodallocateGraphicsMemoryInPreferredPool based on passed AllocationData - proper flags for allocation selected based on AllocationType - remove allocateGraphicsMemory(size_t size, size_t alignment) and use allocateGraphicsMemory(size_t size) instead where default alignment is sufficient, otherwise use full options version: allocateGraphicsMemory(size_t size, size_t alignment, bool forcePin, bool uncacheable) Change-Id: I2da891f372ee181253cb840568a61b33c0d71fc9
This commit is contained in:
committed by
sys_ocldev
parent
4993a94b5b
commit
55a045ebe1
@@ -175,7 +175,7 @@ TEST(MemObj, givenNotReadyGraphicsAllocationWhenMemObjDestroysAllocationAsyncThe
|
||||
context.setMemoryManager(&memoryManager);
|
||||
memoryManager.setDevice(context.getDevice(0));
|
||||
|
||||
auto allocation = memoryManager.allocateGraphicsMemory(MemoryConstants::pageSize, MemoryConstants::pageSize);
|
||||
auto allocation = memoryManager.allocateGraphicsMemory(MemoryConstants::pageSize);
|
||||
allocation->taskCount = 2;
|
||||
*memoryManager.device->getTagAddress() = 1;
|
||||
MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, CL_MEM_COPY_HOST_PTR,
|
||||
@@ -194,7 +194,7 @@ TEST(MemObj, givenReadyGraphicsAllocationWhenMemObjDestroysAllocationAsyncThenAl
|
||||
context.setMemoryManager(&memoryManager);
|
||||
memoryManager.setDevice(context.getDevice(0));
|
||||
|
||||
auto allocation = memoryManager.allocateGraphicsMemory(MemoryConstants::pageSize, MemoryConstants::pageSize);
|
||||
auto allocation = memoryManager.allocateGraphicsMemory(MemoryConstants::pageSize);
|
||||
allocation->taskCount = 1;
|
||||
*memoryManager.device->getTagAddress() = 1;
|
||||
MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, CL_MEM_COPY_HOST_PTR,
|
||||
@@ -213,7 +213,7 @@ TEST(MemObj, givenNotUsedGraphicsAllocationWhenMemObjDestroysAllocationAsyncThen
|
||||
context.setMemoryManager(&memoryManager);
|
||||
memoryManager.setDevice(context.getDevice(0));
|
||||
|
||||
auto allocation = memoryManager.allocateGraphicsMemory(MemoryConstants::pageSize, MemoryConstants::pageSize);
|
||||
auto allocation = memoryManager.allocateGraphicsMemory(MemoryConstants::pageSize);
|
||||
allocation->taskCount = ObjectNotUsed;
|
||||
MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, CL_MEM_COPY_HOST_PTR,
|
||||
MemoryConstants::pageSize, nullptr, nullptr, nullptr, true, false, false);
|
||||
@@ -230,7 +230,7 @@ TEST(MemObj, givenMemoryManagerWithoutDeviceWhenMemObjDestroysAllocationAsyncThe
|
||||
|
||||
context.setMemoryManager(&memoryManager);
|
||||
|
||||
auto allocation = memoryManager.allocateGraphicsMemory(MemoryConstants::pageSize, MemoryConstants::pageSize);
|
||||
auto allocation = memoryManager.allocateGraphicsMemory(MemoryConstants::pageSize);
|
||||
|
||||
MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, CL_MEM_COPY_HOST_PTR,
|
||||
MemoryConstants::pageSize, nullptr, nullptr, nullptr, true, false, false);
|
||||
@@ -336,7 +336,7 @@ TEST(MemObj, givenRenderCompressedGmmWhenAskingForMappingOnCpuThenDisallow) {
|
||||
|
||||
context.setMemoryManager(&memoryManager);
|
||||
|
||||
auto allocation = memoryManager.allocateGraphicsMemory(1, 1);
|
||||
auto allocation = memoryManager.allocateGraphicsMemory(1);
|
||||
allocation->gmm = new Gmm(nullptr, 1, false);
|
||||
|
||||
MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, CL_MEM_READ_WRITE,
|
||||
@@ -354,7 +354,7 @@ TEST(MemObj, givenDefaultWhenAskedForCpuMappingThenReturnTrue) {
|
||||
|
||||
context.setMemoryManager(&memoryManager);
|
||||
|
||||
auto allocation = memoryManager.allocateGraphicsMemory(64, 1);
|
||||
auto allocation = memoryManager.allocateGraphicsMemory(64);
|
||||
|
||||
MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, CL_MEM_COPY_HOST_PTR,
|
||||
64, allocation->getUnderlyingBuffer(), nullptr, allocation, true, false, false);
|
||||
|
||||
Reference in New Issue
Block a user