mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-04 07:14:10 +08:00
fix: add infrastructure to limit device usm reuse max memory used
Related-To: NEO-12924 Signed-off-by: Dominik Dabek <dominik.dabek@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
81644a46cc
commit
741101551e
@@ -8,6 +8,7 @@
|
||||
#include "shared/source/helpers/api_specific_config.h"
|
||||
#include "shared/test/common/helpers/debug_manager_state_restore.h"
|
||||
#include "shared/test/common/helpers/raii_product_helper.h"
|
||||
#include "shared/test/common/mocks/mock_ail_configuration.h"
|
||||
#include "shared/test/common/mocks/mock_device.h"
|
||||
#include "shared/test/common/mocks/mock_graphics_allocation.h"
|
||||
#include "shared/test/common/mocks/mock_memory_manager.h"
|
||||
@@ -136,6 +137,8 @@ HWTEST_F(SvmDeviceAllocationCacheTest, givenOclApiSpecificConfigWhenCheckingIfEn
|
||||
std::unique_ptr<UltDeviceFactory> deviceFactory(new UltDeviceFactory(1, 1));
|
||||
auto device = deviceFactory->rootDevices[0];
|
||||
RAIIProductHelperFactory<MockProductHelper> raii(*device->getExecutionEnvironment()->rootDeviceEnvironments[0]);
|
||||
MockAILConfiguration mockAilConfigurationHelper;
|
||||
device->mockAilConfigurationHelper = &mockAilConfigurationHelper;
|
||||
{
|
||||
raii.mockProductHelper->isDeviceUsmAllocationReuseSupportedResult = false;
|
||||
auto svmManager = std::make_unique<MockSVMAllocsManager>(device->getMemoryManager(), false);
|
||||
@@ -152,6 +155,16 @@ HWTEST_F(SvmDeviceAllocationCacheTest, givenOclApiSpecificConfigWhenCheckingIfEn
|
||||
const auto expectedMaxSize = static_cast<size_t>(0.08 * device->getGlobalMemorySize(static_cast<uint32_t>(device->getDeviceBitfield().to_ullong())));
|
||||
EXPECT_EQ(expectedMaxSize, svmManager->usmDeviceAllocationsCache.maxSize);
|
||||
}
|
||||
{
|
||||
raii.mockProductHelper->isDeviceUsmAllocationReuseSupportedResult = true;
|
||||
mockAilConfigurationHelper.limitAmountOfDeviceMemoryForRecyclingReturn = true;
|
||||
auto svmManager = std::make_unique<MockSVMAllocsManager>(device->getMemoryManager(), false);
|
||||
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())));
|
||||
EXPECT_EQ(expectedMaxSize, svmManager->usmDeviceAllocationsCache.maxSize);
|
||||
}
|
||||
}
|
||||
|
||||
struct SvmDeviceAllocationCacheSimpleTestDataType {
|
||||
|
||||
Reference in New Issue
Block a user