mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-30 01:35:20 +08:00
Adjust dev memory available based on impl scaling
Signed-off-by: John Falkowski <john.falkowski@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
6d510240e6
commit
a6bb897a7c
@@ -7,6 +7,7 @@
|
||||
|
||||
#include "level_zero/core/source/context/context_imp.h"
|
||||
|
||||
#include "shared/source/command_container/implicit_scaling.h"
|
||||
#include "shared/source/memory_manager/memory_operations_handler.h"
|
||||
#include "shared/source/memory_manager/unified_memory_manager.h"
|
||||
|
||||
@@ -135,18 +136,27 @@ ze_result_t ContextImp::allocDeviceMem(ze_device_handle_t hDevice,
|
||||
return ZE_RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
neoDevice = this->driverHandle->devices[0]->getNEODevice();
|
||||
|
||||
if (lookupTable.relaxedSizeAllowed == false &&
|
||||
(size > this->driverHandle->devices[0]->getNEODevice()->getDeviceInfo().maxMemAllocSize)) {
|
||||
(size > neoDevice->getDeviceInfo().maxMemAllocSize)) {
|
||||
*ptr = nullptr;
|
||||
return ZE_RESULT_ERROR_UNSUPPORTED_SIZE;
|
||||
}
|
||||
|
||||
if (lookupTable.relaxedSizeAllowed &&
|
||||
(size > this->driverHandle->devices[0]->getNEODevice()->getDeviceInfo().globalMemSize)) {
|
||||
uint64_t globalMemSize = neoDevice->getDeviceInfo().globalMemSize;
|
||||
|
||||
uint32_t numSubDevices = neoDevice->getNumSubDevices();
|
||||
if ((!(NEO::ImplicitScalingHelper::isImplicitScalingEnabled(neoDevice->getDeviceBitfield(), true))) && (numSubDevices > 1)) {
|
||||
globalMemSize = globalMemSize / numSubDevices;
|
||||
}
|
||||
if (lookupTable.relaxedSizeAllowed && (size > globalMemSize)) {
|
||||
*ptr = nullptr;
|
||||
return ZE_RESULT_ERROR_UNSUPPORTED_SIZE;
|
||||
}
|
||||
|
||||
neoDevice = Device::fromHandle(hDevice)->getNEODevice();
|
||||
|
||||
deviceBitfields[rootDeviceIndex] = neoDevice->getDeviceBitfield();
|
||||
|
||||
NEO::SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::DEVICE_UNIFIED_MEMORY, this->driverHandle->rootDeviceIndices, deviceBitfields);
|
||||
@@ -186,20 +196,27 @@ ze_result_t ContextImp::allocSharedMem(ze_device_handle_t hDevice,
|
||||
}
|
||||
}
|
||||
|
||||
if (relaxedSizeAllowed == false &&
|
||||
(size > this->devices.begin()->second->getNEODevice()->getDeviceInfo().maxMemAllocSize)) {
|
||||
*ptr = nullptr;
|
||||
return ZE_RESULT_ERROR_UNSUPPORTED_SIZE;
|
||||
}
|
||||
|
||||
if (relaxedSizeAllowed &&
|
||||
(size > this->driverHandle->devices[0]->getNEODevice()->getDeviceInfo().globalMemSize)) {
|
||||
*ptr = nullptr;
|
||||
return ZE_RESULT_ERROR_UNSUPPORTED_SIZE;
|
||||
}
|
||||
|
||||
auto neoDevice = this->devices.begin()->second->getNEODevice();
|
||||
if (relaxedSizeAllowed == false &&
|
||||
(size > neoDevice->getDeviceInfo().maxMemAllocSize)) {
|
||||
*ptr = nullptr;
|
||||
return ZE_RESULT_ERROR_UNSUPPORTED_SIZE;
|
||||
}
|
||||
|
||||
neoDevice = this->driverHandle->devices[0]->getNEODevice();
|
||||
uint64_t globalMemSize = neoDevice->getDeviceInfo().globalMemSize;
|
||||
|
||||
uint32_t numSubDevices = neoDevice->getNumSubDevices();
|
||||
if ((!(NEO::ImplicitScalingHelper::isImplicitScalingEnabled(neoDevice->getDeviceBitfield(), true))) && (numSubDevices > 1)) {
|
||||
globalMemSize = globalMemSize / numSubDevices;
|
||||
}
|
||||
if (relaxedSizeAllowed &&
|
||||
(size > globalMemSize)) {
|
||||
*ptr = nullptr;
|
||||
return ZE_RESULT_ERROR_UNSUPPORTED_SIZE;
|
||||
}
|
||||
|
||||
neoDevice = this->devices.begin()->second->getNEODevice();
|
||||
auto deviceBitfields = this->deviceBitfields;
|
||||
NEO::Device *unifiedMemoryPropertiesDevice = nullptr;
|
||||
if (hDevice) {
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#include "level_zero/core/source/device/device_imp.h"
|
||||
|
||||
#include "shared/source/built_ins/sip.h"
|
||||
#include "shared/source/command_container/implicit_scaling.h"
|
||||
#include "shared/source/debug_settings/debug_settings_manager.h"
|
||||
#include "shared/source/device/device_info.h"
|
||||
#include "shared/source/device/sub_device.h"
|
||||
@@ -275,7 +276,12 @@ ze_result_t DeviceImp::getMemoryProperties(uint32_t *pCount, ze_device_memory_pr
|
||||
auto &hwInfoConfig = *NEO::HwInfoConfig::get(hwInfo.platform.eProductFamily);
|
||||
pMemProperties->maxClockRate = hwInfoConfig.getDeviceMemoryMaxClkRate(&hwInfo);
|
||||
pMemProperties->maxBusWidth = deviceInfo.addressBits;
|
||||
pMemProperties->totalSize = deviceInfo.globalMemSize;
|
||||
if (NEO::ImplicitScalingHelper::isImplicitScalingEnabled(this->getNEODevice()->getDeviceBitfield(), true) ||
|
||||
this->numSubDevices == 0) {
|
||||
pMemProperties->totalSize = deviceInfo.globalMemSize;
|
||||
} else {
|
||||
pMemProperties->totalSize = deviceInfo.globalMemSize / this->numSubDevices;
|
||||
}
|
||||
|
||||
return ZE_RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user