HostPtr allocation with life time of buffer object for CL_MEM_USE_HOST_PTR

Related-To: NEO-3231

Change-Id: Ic112819c793482844aa712b4a8a1827ec9408812
Signed-off-by: Milczarek, Slawomir <slawomir.milczarek@intel.com>
This commit is contained in:
Milczarek, Slawomir
2019-06-12 15:05:57 +02:00
committed by sys_ocldev
parent a5c4956bbd
commit 474c25eca6
2 changed files with 30 additions and 1 deletions

View File

@@ -268,8 +268,15 @@ Buffer *Buffer::create(Context *context,
return nullptr;
}
pBuffer->setHostPtrMinSize(size);
if (properties.flags & CL_MEM_USE_HOST_PTR) {
if (!zeroCopyAllowed && !isHostPtrSVM) {
AllocationProperties properties{false, size, GraphicsAllocation::AllocationType::EXTERNAL_HOST_PTR, false};
properties.flags.flushL3RequiredForRead = properties.flags.flushL3RequiredForWrite = true;
mapAllocation = memoryManager->allocateGraphicsMemoryWithProperties(properties, hostPtr);
}
}
pBuffer->mapAllocation = mapAllocation;
pBuffer->setHostPtrMinSize(size);
if (copyMemoryFromHostPtr) {
auto gmm = memory->getDefaultGmm();