mirror of
https://github.com/intel/compute-runtime.git
synced 2025-09-15 13:01:45 +08:00
Fallback to cpu copy when filling work partition allocation
move some command stream receiver tests to shared Related-To: NEO-6325 Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:

committed by
Compute-Runtime-Automation

parent
3a2b018eb6
commit
93e3d948f5
@ -18,6 +18,7 @@
|
||||
#include "shared/source/helpers/heap_assigner.h"
|
||||
#include "shared/source/helpers/hw_helper.h"
|
||||
#include "shared/source/helpers/ptr_math.h"
|
||||
#include "shared/source/helpers/string.h"
|
||||
#include "shared/source/helpers/surface_format_info.h"
|
||||
#include "shared/source/memory_manager/deferrable_deletion.h"
|
||||
#include "shared/source/memory_manager/deferred_deleter.h"
|
||||
@ -857,4 +858,30 @@ bool WddmMemoryManager::isCpuCopyRequired(const void *ptr) {
|
||||
return inputPointerReadDelta > slownessFactor * fastestLocalRead;
|
||||
}
|
||||
|
||||
bool WddmMemoryManager::copyMemoryToAllocation(GraphicsAllocation *graphicsAllocation, size_t destinationOffset, const void *memoryToCopy, size_t sizeToCopy) {
|
||||
if (graphicsAllocation->getUnderlyingBuffer()) {
|
||||
return MemoryManager::copyMemoryToAllocation(graphicsAllocation, destinationOffset, memoryToCopy, sizeToCopy);
|
||||
}
|
||||
return copyMemoryToAllocationBanks(graphicsAllocation, destinationOffset, memoryToCopy, sizeToCopy, graphicsAllocation->storageInfo.memoryBanks);
|
||||
}
|
||||
|
||||
bool WddmMemoryManager::copyMemoryToAllocationBanks(GraphicsAllocation *graphicsAllocation, size_t destinationOffset, const void *memoryToCopy, size_t sizeToCopy, DeviceBitfield dstMemoryBanks) {
|
||||
if (MemoryPool::isSystemMemoryPool(graphicsAllocation->getMemoryPool())) {
|
||||
return false;
|
||||
}
|
||||
auto wddmAllocation = static_cast<WddmAllocation *>(graphicsAllocation);
|
||||
for (auto handleId = 0u; handleId < graphicsAllocation->storageInfo.getTotalBanksCnt(); handleId++) {
|
||||
if (!dstMemoryBanks.test(handleId)) {
|
||||
continue;
|
||||
}
|
||||
auto ptr = getWddm(graphicsAllocation->getRootDeviceIndex()).lockResource(wddmAllocation->getHandles()[handleId], wddmAllocation->needsMakeResidentBeforeLock, wddmAllocation->getAlignedSize());
|
||||
if (!ptr) {
|
||||
return false;
|
||||
}
|
||||
memcpy_s(ptrOffset(ptr, destinationOffset), graphicsAllocation->getUnderlyingBufferSize() - destinationOffset, memoryToCopy, sizeToCopy);
|
||||
getWddm(graphicsAllocation->getRootDeviceIndex()).unlockResource(wddmAllocation->getHandles()[handleId]);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace NEO
|
||||
|
Reference in New Issue
Block a user