mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-08 05:56:36 +08:00
Create helper for memory properties
-Move logics from mem_obj_helper Related-To: NEO-3374 Change-Id: I167cdcc8fcb08cb1fa6d19640fd266f0004f4c6b Signed-off-by: Krzysztof Gibala <krzysztof.gibala@intel.com>
This commit is contained in:
committed by
sys_ocldev
parent
f21e5e85e0
commit
b5020eac81
@@ -144,7 +144,7 @@ bool SVMAllocsManager::freeSVMAlloc(void *ptr) {
|
||||
|
||||
void *SVMAllocsManager::createZeroCopySvmAllocation(size_t size, const SvmAllocationProperties &svmProperties) {
|
||||
AllocationProperties properties{true, size, GraphicsAllocation::AllocationType::SVM_ZERO_COPY, false};
|
||||
MemObjHelper::fillCachePolicyInProperties(properties, false, svmProperties.readOnly, false);
|
||||
MemoryPropertiesParser::fillCachePolicyInProperties(properties, false, svmProperties.readOnly, false);
|
||||
GraphicsAllocation *allocation = memoryManager->allocateGraphicsMemoryWithProperties(properties);
|
||||
if (!allocation) {
|
||||
return nullptr;
|
||||
@@ -164,7 +164,7 @@ void *SVMAllocsManager::createUnifiedAllocationWithDeviceStorage(size_t size, co
|
||||
size_t alignedSize = alignUp<size_t>(size, 2 * MemoryConstants::megaByte);
|
||||
AllocationProperties cpuProperties{true, alignedSize, GraphicsAllocation::AllocationType::SVM_CPU, false};
|
||||
cpuProperties.alignment = 2 * MemoryConstants::megaByte;
|
||||
MemObjHelper::fillCachePolicyInProperties(cpuProperties, false, svmProperties.readOnly, false);
|
||||
MemoryPropertiesParser::fillCachePolicyInProperties(cpuProperties, false, svmProperties.readOnly, false);
|
||||
GraphicsAllocation *allocationCpu = memoryManager->allocateGraphicsMemoryWithProperties(cpuProperties);
|
||||
if (!allocationCpu) {
|
||||
return nullptr;
|
||||
@@ -175,7 +175,7 @@ void *SVMAllocsManager::createUnifiedAllocationWithDeviceStorage(size_t size, co
|
||||
|
||||
AllocationProperties gpuProperties{false, alignedSize, GraphicsAllocation::AllocationType::SVM_GPU, false};
|
||||
gpuProperties.alignment = 2 * MemoryConstants::megaByte;
|
||||
MemObjHelper::fillCachePolicyInProperties(gpuProperties, false, svmProperties.readOnly, false);
|
||||
MemoryPropertiesParser::fillCachePolicyInProperties(gpuProperties, false, svmProperties.readOnly, false);
|
||||
GraphicsAllocation *allocationGpu = memoryManager->allocateGraphicsMemoryWithProperties(gpuProperties, svmPtr);
|
||||
if (!allocationGpu) {
|
||||
memoryManager->freeGraphicsMemory(allocationCpu);
|
||||
|
||||
Reference in New Issue
Block a user