mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-26 23:33:20 +08:00
feature: Implement appendMemoryPrefetch for Shared System USM allocations
Related-To: NEO-12989 Signed-off-by: John Falkowski <john.falkowski@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
cb68ada102
commit
4d281cf51d
@@ -16,20 +16,22 @@ std::unique_ptr<PrefetchManager> PrefetchManager::create() {
|
||||
return std::make_unique<PrefetchManager>();
|
||||
}
|
||||
|
||||
void PrefetchManager::insertAllocation(PrefetchContext &context, const void *usmPtr, SvmAllocationData &allocData) {
|
||||
void PrefetchManager::insertAllocation(PrefetchContext &context, SVMAllocsManager &unifiedMemoryManager, Device &device, const void *usmPtr, const size_t size) {
|
||||
std::unique_lock<SpinLock> lock{context.lock};
|
||||
if (allocData.memoryType == InternalMemoryType::sharedUnifiedMemory) {
|
||||
context.allocations.push_back(usmPtr);
|
||||
auto allocData = unifiedMemoryManager.getSVMAlloc(usmPtr);
|
||||
if (!allocData) {
|
||||
if (device.areSharedSystemAllocationsAllowed()) {
|
||||
context.allocations.push_back({usmPtr, size});
|
||||
}
|
||||
} else if (allocData->memoryType == InternalMemoryType::sharedUnifiedMemory) {
|
||||
context.allocations.push_back({usmPtr, size});
|
||||
}
|
||||
}
|
||||
|
||||
void PrefetchManager::migrateAllocationsToGpu(PrefetchContext &context, SVMAllocsManager &unifiedMemoryManager, Device &device, CommandStreamReceiver &csr) {
|
||||
std::unique_lock<SpinLock> lock{context.lock};
|
||||
for (auto &ptr : context.allocations) {
|
||||
auto allocData = unifiedMemoryManager.getSVMAlloc(ptr);
|
||||
if (allocData) {
|
||||
unifiedMemoryManager.prefetchMemory(device, csr, *allocData);
|
||||
}
|
||||
for (auto &allocation : context.allocations) {
|
||||
unifiedMemoryManager.prefetchMemory(device, csr, allocation.ptr, allocation.size);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user