mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-03 14:55:24 +08:00
performance: reorder checks for staging buffer
defer registerHostPtr call to the last check. Signed-off-by: Szymon Morek <szymon.morek@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
dd6ee5bd7a
commit
e030086cf2
@@ -395,12 +395,12 @@ bool StagingBufferManager::isValidForCopy(const Device &device, void *dstPtr, co
|
||||
if (usmDstData) {
|
||||
isUsedByOsContext = usmDstData->gpuAllocations.getGraphicsAllocation(device.getRootDeviceIndex())->isUsedByOsContext(osContextId);
|
||||
}
|
||||
return this->isValidForStaging(device, srcPtr, size, hasDependencies) && hostToUsmCopy && (isUsedByOsContext || size <= chunkSize);
|
||||
return hostToUsmCopy && (isUsedByOsContext || size <= chunkSize) && this->isValidForStaging(device, srcPtr, size, hasDependencies);
|
||||
}
|
||||
|
||||
bool StagingBufferManager::isValidForStagingTransfer(const Device &device, const void *ptr, size_t size, bool hasDependencies) {
|
||||
auto nonUsmPtr = ptr != nullptr && svmAllocsManager->getSVMAlloc(ptr) == nullptr;
|
||||
return this->isValidForStaging(device, ptr, size, hasDependencies) && nonUsmPtr;
|
||||
return nonUsmPtr && this->isValidForStaging(device, ptr, size, hasDependencies);
|
||||
}
|
||||
|
||||
// Common checks for usm, buffers and images
|
||||
@@ -412,8 +412,7 @@ bool StagingBufferManager::isValidForStaging(const Device &device, const void *p
|
||||
auto isIntegrated = device.getRootDeviceEnvironment().getHardwareInfo()->capabilityTable.isIntegratedDevice;
|
||||
auto osInterface = device.getRootDeviceEnvironment().osInterface.get();
|
||||
bool sizeWithinThreshold = osInterface ? osInterface->isSizeWithinThresholdForStaging(size, isIntegrated) : true;
|
||||
auto detectedHostPtr = this->registerHostPtr(ptr);
|
||||
return stagingCopyEnabled && !hasDependencies && !detectedHostPtr && sizeWithinThreshold;
|
||||
return stagingCopyEnabled && !hasDependencies && sizeWithinThreshold && !this->registerHostPtr(ptr);
|
||||
}
|
||||
|
||||
void StagingBufferManager::clearTrackedChunks() {
|
||||
|
||||
Reference in New Issue
Block a user