mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-11 16:45:25 +08:00
performance(usm): l0, add usm host memory pooling
Disabled by default. Related-To: NEO-11356 Signed-off-by: Dominik Dabek <dominik.dabek@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
ae8c7589dc
commit
b4d839fe29
@@ -13,6 +13,7 @@
|
||||
#include "shared/source/execution_environment/execution_environment.h"
|
||||
#include "shared/source/execution_environment/root_device_environment.h"
|
||||
#include "shared/source/helpers/api_specific_config.h"
|
||||
#include "shared/source/helpers/device_bitfield.h"
|
||||
#include "shared/source/helpers/gfx_core_helper.h"
|
||||
#include "shared/source/helpers/hw_info.h"
|
||||
#include "shared/source/helpers/string.h"
|
||||
@@ -182,6 +183,7 @@ DriverHandleImp::~DriverHandleImp() {
|
||||
memoryManager->peekExecutionEnvironment().prepareForCleanup();
|
||||
if (this->svmAllocsManager) {
|
||||
this->svmAllocsManager->trimUSMDeviceAllocCache();
|
||||
this->usmHostMemAllocPool.cleanup();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -278,6 +280,7 @@ ze_result_t DriverHandleImp::initialize(std::vector<std::unique_ptr<NEO::Device>
|
||||
return ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY;
|
||||
}
|
||||
this->svmAllocsManager->initUsmAllocationsCaches(*this->devices[0]->getNEODevice());
|
||||
this->initHostUsmAllocPool();
|
||||
|
||||
this->numDevices = static_cast<uint32_t>(this->devices.size());
|
||||
|
||||
@@ -402,6 +405,20 @@ ze_result_t DriverHandleImp::parseAffinityMaskCombined(uint32_t *pCount, ze_devi
|
||||
return ZE_RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
void DriverHandleImp::initHostUsmAllocPool() {
|
||||
auto usmHostAllocPoolingEnabled = NEO::ApiSpecificConfig::isHostUsmPoolingEnabled();
|
||||
auto poolSize = 2 * MemoryConstants::megaByte;
|
||||
if (NEO::debugManager.flags.EnableHostUsmAllocationPool.get() != -1) {
|
||||
usmHostAllocPoolingEnabled = NEO::debugManager.flags.EnableHostUsmAllocationPool.get() > 0;
|
||||
poolSize = NEO::debugManager.flags.EnableHostUsmAllocationPool.get() * MemoryConstants::megaByte;
|
||||
}
|
||||
if (usmHostAllocPoolingEnabled) {
|
||||
NEO::SVMAllocsManager::UnifiedMemoryProperties memoryProperties(InternalMemoryType::hostUnifiedMemory, MemoryConstants::pageSize2M,
|
||||
rootDeviceIndices, deviceBitfields);
|
||||
usmHostMemAllocPool.initialize(svmAllocsManager, memoryProperties, poolSize);
|
||||
}
|
||||
}
|
||||
|
||||
ze_result_t DriverHandleImp::getDevice(uint32_t *pCount, ze_device_handle_t *phDevices) {
|
||||
bool exposeSubDevices = false;
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
|
||||
#include "shared/source/debugger/debugger.h"
|
||||
#include "shared/source/memory_manager/graphics_allocation.h"
|
||||
#include "shared/source/memory_manager/unified_memory_pooling.h"
|
||||
#include "shared/source/os_interface/os_library.h"
|
||||
|
||||
#include "level_zero/api/extensions/public/ze_exp_ext.h"
|
||||
@@ -33,6 +34,7 @@ enum L0DeviceHierarchyMode {
|
||||
#pragma pack(1)
|
||||
struct IpcMemoryData {
|
||||
uint64_t handle = 0;
|
||||
uint64_t poolOffset = 0;
|
||||
uint8_t type = 0;
|
||||
};
|
||||
#pragma pack()
|
||||
@@ -122,6 +124,7 @@ struct DriverHandleImp : public DriverHandle {
|
||||
ze_result_t parseAffinityMaskCombined(uint32_t *pCount, ze_device_handle_t *phDevices);
|
||||
std::map<uint64_t, IpcHandleTracking *> &getIPCHandleMap() { return this->ipcHandles; };
|
||||
[[nodiscard]] std::unique_lock<std::mutex> lockIPCHandleMap() { return std::unique_lock<std::mutex>(this->ipcHandleMapMutex); };
|
||||
void initHostUsmAllocPool();
|
||||
|
||||
std::unique_ptr<HostPointerManager> hostPointerManager;
|
||||
|
||||
@@ -142,6 +145,7 @@ struct DriverHandleImp : public DriverHandle {
|
||||
|
||||
NEO::MemoryManager *memoryManager = nullptr;
|
||||
NEO::SVMAllocsManager *svmAllocsManager = nullptr;
|
||||
NEO::UsmMemAllocPool usmHostMemAllocPool;
|
||||
|
||||
std::unique_ptr<NEO::OsLibrary> rtasLibraryHandle;
|
||||
bool rtasLibraryUnavailable = false;
|
||||
|
||||
Reference in New Issue
Block a user