mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-03 06:49:52 +08:00
Don't copy memory to allocation if allocation has no storage
Change-Id: I3238bec02e5c1ec5877537318bb563e3d0f3799d Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
committed by
sys_ocldev
parent
74f1896c03
commit
c0325b5d19
@@ -708,16 +708,18 @@ void Kernel::substituteKernelHeap(void *newKernelHeap, size_t newKernelHeapSize)
|
||||
SKernelBinaryHeaderCommon *pHeader = const_cast<SKernelBinaryHeaderCommon *>(pKernelInfo->heapInfo.pKernelHeader);
|
||||
pHeader->KernelHeapSize = static_cast<uint32_t>(newKernelHeapSize);
|
||||
pKernelInfo->isKernelHeapSubstituted = true;
|
||||
auto memoryManager = device.getMemoryManager();
|
||||
|
||||
auto currentAllocationSize = pKernelInfo->kernelAllocation->getUnderlyingBufferSize();
|
||||
bool status = false;
|
||||
if (currentAllocationSize >= newKernelHeapSize) {
|
||||
memcpy_s(pKernelInfo->kernelAllocation->getUnderlyingBuffer(), newKernelHeapSize, newKernelHeap, newKernelHeapSize);
|
||||
status = memoryManager->copyMemoryToAllocation(pKernelInfo->kernelAllocation, newKernelHeap, static_cast<uint32_t>(newKernelHeapSize));
|
||||
} else {
|
||||
auto memoryManager = device.getMemoryManager();
|
||||
memoryManager->checkGpuUsageAndDestroyGraphicsAllocations(pKernelInfo->kernelAllocation);
|
||||
pKernelInfo->kernelAllocation = nullptr;
|
||||
pKernelInfo->createKernelAllocation(memoryManager);
|
||||
status = pKernelInfo->createKernelAllocation(memoryManager);
|
||||
}
|
||||
UNRECOVERABLE_IF(!status);
|
||||
}
|
||||
|
||||
bool Kernel::isKernelHeapSubstituted() const {
|
||||
|
||||
Reference in New Issue
Block a user