mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-03 14:55:24 +08:00
fix: adjust limiting device usm reuse
if limiting, disable device usm reuse (set max size to 0) do not reserve vector for allocation infos if reuse is disabled Related-To: NEO-12924 Signed-off-by: Dominik Dabek <dominik.dabek@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
e363c871c7
commit
471615926f
@@ -722,25 +722,29 @@ void SVMAllocsManager::freeZeroCopySvmAllocation(SvmAllocationData *svmData) {
|
||||
}
|
||||
|
||||
void SVMAllocsManager::initUsmDeviceAllocationsCache(Device &device) {
|
||||
this->usmDeviceAllocationsCache.allocations.reserve(128u);
|
||||
const auto totalDeviceMemory = device.getGlobalMemorySize(static_cast<uint32_t>(device.getDeviceBitfield().to_ulong()));
|
||||
auto ailConfiguration = device.getAilConfigurationHelper();
|
||||
const bool limitDeviceMemoryForReuse = ailConfiguration && ailConfiguration->limitAmountOfDeviceMemoryForRecycling();
|
||||
auto fractionOfTotalMemoryForRecycling = limitDeviceMemoryForReuse ? 0.02 : 0.08;
|
||||
auto fractionOfTotalMemoryForRecycling = limitDeviceMemoryForReuse ? 0 : 0.08;
|
||||
if (debugManager.flags.ExperimentalEnableDeviceAllocationCache.get() != -1) {
|
||||
fractionOfTotalMemoryForRecycling = 0.01 * std::min(100, debugManager.flags.ExperimentalEnableDeviceAllocationCache.get());
|
||||
}
|
||||
this->usmDeviceAllocationsCache.maxSize = static_cast<size_t>(fractionOfTotalMemoryForRecycling * totalDeviceMemory);
|
||||
if (this->usmDeviceAllocationsCache.maxSize > 0u) {
|
||||
this->usmDeviceAllocationsCache.allocations.reserve(128u);
|
||||
}
|
||||
}
|
||||
|
||||
void SVMAllocsManager::initUsmHostAllocationsCache() {
|
||||
this->usmHostAllocationsCache.allocations.reserve(128u);
|
||||
const auto totalSystemMemory = this->memoryManager->getSystemSharedMemory(0u);
|
||||
auto fractionOfTotalMemoryForRecycling = 0.02;
|
||||
if (debugManager.flags.ExperimentalEnableHostAllocationCache.get() != -1) {
|
||||
fractionOfTotalMemoryForRecycling = 0.01 * std::min(100, debugManager.flags.ExperimentalEnableHostAllocationCache.get());
|
||||
}
|
||||
this->usmHostAllocationsCache.maxSize = static_cast<size_t>(fractionOfTotalMemoryForRecycling * totalSystemMemory);
|
||||
if (this->usmHostAllocationsCache.maxSize > 0u) {
|
||||
this->usmHostAllocationsCache.allocations.reserve(128u);
|
||||
}
|
||||
}
|
||||
|
||||
void SVMAllocsManager::initUsmAllocationsCaches(Device &device) {
|
||||
|
||||
@@ -162,7 +162,7 @@ HWTEST_F(SvmDeviceAllocationCacheTest, givenOclApiSpecificConfigWhenCheckingIfEn
|
||||
EXPECT_FALSE(svmManager->usmDeviceAllocationsCacheEnabled);
|
||||
svmManager->initUsmAllocationsCaches(*device);
|
||||
EXPECT_TRUE(svmManager->usmDeviceAllocationsCacheEnabled);
|
||||
const auto expectedMaxSize = static_cast<size_t>(0.02 * device->getGlobalMemorySize(static_cast<uint32_t>(device->getDeviceBitfield().to_ullong())));
|
||||
const auto expectedMaxSize = 0u;
|
||||
EXPECT_EQ(expectedMaxSize, svmManager->usmDeviceAllocationsCache.maxSize);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user