mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-30 09:58:55 +08:00
fix: configure UsmMemAllocPool params based on productHelper
When is2MBLocalMemAlignmentEnabled() returns true, increase device USM pool parameters: - Pool size from 2MB to 16MB - Max serviced size from 1MB to 2MB Host USM pool parameters remain unchanged. Related-To: NEO-12287 Signed-off-by: Fabian Zwoliński <fabian.zwolinski@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
9d353b5e9b
commit
4b0473718e
@@ -515,6 +515,29 @@ bool Context::isSingleDeviceContext() {
|
||||
return getNumDevices() == 1 && devices[0]->getNumGenericSubDevices() == 0;
|
||||
}
|
||||
|
||||
Context::UsmPoolParams Context::getUsmHostPoolParams() const {
|
||||
return {
|
||||
.poolSize = 2 * MemoryConstants::megaByte,
|
||||
.minServicedSize = 0u,
|
||||
.maxServicedSize = 1 * MemoryConstants::megaByte};
|
||||
}
|
||||
|
||||
Context::UsmPoolParams Context::getUsmDevicePoolParams() const {
|
||||
const auto &productHelper = devices[0]->getDevice().getProductHelper();
|
||||
|
||||
if (productHelper.is2MBLocalMemAlignmentEnabled()) {
|
||||
return {
|
||||
.poolSize = 16 * MemoryConstants::megaByte,
|
||||
.minServicedSize = 0u,
|
||||
.maxServicedSize = 2 * MemoryConstants::megaByte};
|
||||
}
|
||||
|
||||
return {
|
||||
.poolSize = 2 * MemoryConstants::megaByte,
|
||||
.minServicedSize = 0u,
|
||||
.maxServicedSize = 1 * MemoryConstants::megaByte};
|
||||
}
|
||||
|
||||
void Context::initializeUsmAllocationPools() {
|
||||
if (this->usmPoolInitialized) {
|
||||
return;
|
||||
@@ -531,10 +554,11 @@ void Context::initializeUsmAllocationPools() {
|
||||
|
||||
auto &productHelper = getDevices()[0]->getProductHelper();
|
||||
bool enabled = ApiSpecificConfig::isDeviceUsmPoolingEnabled() && productHelper.isUsmPoolAllocatorSupported();
|
||||
size_t poolSize = 2 * MemoryConstants::megaByte;
|
||||
|
||||
auto usmDevicePoolParams = getUsmDevicePoolParams();
|
||||
if (debugManager.flags.EnableDeviceUsmAllocationPool.get() != -1) {
|
||||
enabled = debugManager.flags.EnableDeviceUsmAllocationPool.get() > 0;
|
||||
poolSize = debugManager.flags.EnableDeviceUsmAllocationPool.get() * MemoryConstants::megaByte;
|
||||
usmDevicePoolParams.poolSize = debugManager.flags.EnableDeviceUsmAllocationPool.get() * MemoryConstants::megaByte;
|
||||
}
|
||||
if (enabled) {
|
||||
auto subDeviceBitfields = getDeviceBitfields();
|
||||
@@ -543,14 +567,14 @@ void Context::initializeUsmAllocationPools() {
|
||||
SVMAllocsManager::UnifiedMemoryProperties memoryProperties(InternalMemoryType::deviceUnifiedMemory, MemoryConstants::pageSize2M,
|
||||
getRootDeviceIndices(), subDeviceBitfields);
|
||||
memoryProperties.device = &neoDevice;
|
||||
usmDeviceMemAllocPool.initialize(svmMemoryManager, memoryProperties, poolSize, 0u, 1 * MemoryConstants::megaByte);
|
||||
usmDeviceMemAllocPool.initialize(svmMemoryManager, memoryProperties, usmDevicePoolParams.poolSize, usmDevicePoolParams.minServicedSize, usmDevicePoolParams.maxServicedSize);
|
||||
}
|
||||
|
||||
enabled = ApiSpecificConfig::isHostUsmPoolingEnabled() && productHelper.isUsmPoolAllocatorSupported();
|
||||
poolSize = 2 * MemoryConstants::megaByte;
|
||||
auto usmHostPoolParams = getUsmHostPoolParams();
|
||||
if (debugManager.flags.EnableHostUsmAllocationPool.get() != -1) {
|
||||
enabled = debugManager.flags.EnableHostUsmAllocationPool.get() > 0;
|
||||
poolSize = debugManager.flags.EnableHostUsmAllocationPool.get() * MemoryConstants::megaByte;
|
||||
usmHostPoolParams.poolSize = debugManager.flags.EnableHostUsmAllocationPool.get() * MemoryConstants::megaByte;
|
||||
}
|
||||
if (enabled) {
|
||||
auto subDeviceBitfields = getDeviceBitfields();
|
||||
@@ -558,7 +582,7 @@ void Context::initializeUsmAllocationPools() {
|
||||
subDeviceBitfields[neoDevice.getRootDeviceIndex()] = neoDevice.getDeviceBitfield();
|
||||
SVMAllocsManager::UnifiedMemoryProperties memoryProperties(InternalMemoryType::hostUnifiedMemory, MemoryConstants::pageSize2M,
|
||||
getRootDeviceIndices(), subDeviceBitfields);
|
||||
usmHostMemAllocPool.initialize(svmMemoryManager, memoryProperties, poolSize, 0u, 1 * MemoryConstants::megaByte);
|
||||
usmHostMemAllocPool.initialize(svmMemoryManager, memoryProperties, usmHostPoolParams.poolSize, usmHostPoolParams.minServicedSize, usmHostPoolParams.maxServicedSize);
|
||||
}
|
||||
this->usmPoolInitialized = true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user