mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-08 22:12:59 +08:00
Skip adding allocations to remote devices if not allocated there
When making graphics allocations resident in multi-GPU scenarios, we should make them resident only if there's an allocation for that device. So return appropriate null pointer and skip it. Signed-off-by: Jaime Arteaga <jaime.a.arteaga.molina@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
05a150f49f
commit
c0e2251ceb
@@ -14,6 +14,9 @@ namespace NEO {
|
||||
|
||||
MultiGraphicsAllocation::MultiGraphicsAllocation(uint32_t maxRootDeviceIndex) {
|
||||
graphicsAllocations.resize(maxRootDeviceIndex + 1);
|
||||
for (auto &allocation : graphicsAllocations) {
|
||||
allocation = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
MultiGraphicsAllocation::MultiGraphicsAllocation(const MultiGraphicsAllocation &multiGraphicsAllocation) {
|
||||
@@ -56,6 +59,9 @@ void MultiGraphicsAllocation::removeAllocation(uint32_t rootDeviceIndex) {
|
||||
}
|
||||
|
||||
GraphicsAllocation *MultiGraphicsAllocation::getGraphicsAllocation(uint32_t rootDeviceIndex) const {
|
||||
if (rootDeviceIndex >= graphicsAllocations.size()) {
|
||||
return nullptr;
|
||||
}
|
||||
return graphicsAllocations[rootDeviceIndex];
|
||||
}
|
||||
|
||||
|
||||
@@ -94,7 +94,9 @@ void SVMAllocsManager::makeInternalAllocationsResident(CommandStreamReceiver &co
|
||||
for (auto &allocation : this->SVMAllocs.allocations) {
|
||||
if (allocation.second.memoryType & requestedTypesMask) {
|
||||
auto gpuAllocation = allocation.second.gpuAllocations.getGraphicsAllocation(commandStreamReceiver.getRootDeviceIndex());
|
||||
UNRECOVERABLE_IF(nullptr == gpuAllocation);
|
||||
if (gpuAllocation == nullptr) {
|
||||
continue;
|
||||
}
|
||||
commandStreamReceiver.makeResident(*gpuAllocation);
|
||||
}
|
||||
}
|
||||
@@ -520,7 +522,9 @@ void SVMAllocsManager::makeIndirectAllocationsResident(CommandStreamReceiver &co
|
||||
if (parseAllAllocations) {
|
||||
for (auto &allocation : this->SVMAllocs.allocations) {
|
||||
auto gpuAllocation = allocation.second.gpuAllocations.getGraphicsAllocation(commandStreamReceiver.getRootDeviceIndex());
|
||||
UNRECOVERABLE_IF(nullptr == gpuAllocation);
|
||||
if (gpuAllocation == nullptr) {
|
||||
continue;
|
||||
}
|
||||
commandStreamReceiver.makeResident(*gpuAllocation);
|
||||
gpuAllocation->updateResidencyTaskCount(GraphicsAllocation::objectAlwaysResident, commandStreamReceiver.getOsContext().getContextId());
|
||||
gpuAllocation->setEvictable(false);
|
||||
@@ -534,6 +538,9 @@ void SVMAllocsManager::prepareIndirectAllocationForDestruction(SvmAllocationData
|
||||
for (auto &internalAllocationsHandling : this->indirectAllocationsResidency) {
|
||||
auto commandStreamReceiver = internalAllocationsHandling.first;
|
||||
auto gpuAllocation = allocationData->gpuAllocations.getGraphicsAllocation(commandStreamReceiver->getRootDeviceIndex());
|
||||
if (gpuAllocation == nullptr) {
|
||||
continue;
|
||||
}
|
||||
auto desiredTaskCount = std::max(internalAllocationsHandling.second.latestSentTaskCount, gpuAllocation->getTaskCount(commandStreamReceiver->getOsContext().getContextId()));
|
||||
if (gpuAllocation->isAlwaysResident(commandStreamReceiver->getOsContext().getContextId())) {
|
||||
gpuAllocation->updateResidencyTaskCount(GraphicsAllocation::objectNotResident, commandStreamReceiver->getOsContext().getContextId());
|
||||
|
||||
Reference in New Issue
Block a user