mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-03 14:55:24 +08:00
update Memory Location for zesMemoryGetProperties
Change-Id: I2698352d89ed2351e6fa8ec0b58b277387650bc0 Signed-off-by: SaiKishore Konda <saikishore.konda@intel.com>
This commit is contained in:
committed by
sys_ocldev
parent
65690ccb21
commit
8c75080d9e
@@ -22,10 +22,36 @@ LinuxMemoryImp::LinuxMemoryImp(OsSysman *pOsSysman, ze_bool_t onSubdevice, uint3
|
||||
bool LinuxMemoryImp::isMemoryModuleSupported() {
|
||||
return pDevice->getDriverHandle()->getMemoryManager()->isLocalMemorySupported(pDevice->getRootDeviceIndex());
|
||||
}
|
||||
static ze_result_t queryMemoryRegions(NEO::Drm *pDrm, drm_i915_memory_region_info &memRegions) {
|
||||
if (pDrm->queryMemoryInfo() == false) {
|
||||
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
|
||||
}
|
||||
|
||||
auto memoryInfo = static_cast<NEO::MemoryInfoImpl *>(pDrm->getMemoryInfo());
|
||||
auto regions = std::find_if(memoryInfo->regions.begin(), memoryInfo->regions.end(), [](auto tempRegion) {
|
||||
return (tempRegion.region.memory_class == I915_MEMORY_CLASS_DEVICE);
|
||||
});
|
||||
if (regions == memoryInfo->regions.end()) {
|
||||
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
|
||||
}
|
||||
memRegions = *regions;
|
||||
return ZE_RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
ze_result_t LinuxMemoryImp::getProperties(zes_mem_properties_t *pProperties) {
|
||||
|
||||
drm_i915_memory_region_info memRegions = {};
|
||||
ze_result_t result = queryMemoryRegions(pDrm, memRegions);
|
||||
|
||||
if (result == ZE_RESULT_SUCCESS) {
|
||||
if (memRegions.region.memory_class == I915_MEMORY_CLASS_DEVICE)
|
||||
pProperties->location = ZES_MEM_LOC_DEVICE;
|
||||
} else {
|
||||
// by default failure case also it will be DEVICE
|
||||
pProperties->location = ZES_MEM_LOC_DEVICE;
|
||||
}
|
||||
|
||||
pProperties->type = ZES_MEM_TYPE_DDR;
|
||||
pProperties->location = ZES_MEM_LOC_DEVICE;
|
||||
pProperties->onSubdevice = isSubdevice;
|
||||
pProperties->subdeviceId = subdeviceId;
|
||||
pProperties->busWidth = -1;
|
||||
@@ -40,22 +66,17 @@ ze_result_t LinuxMemoryImp::getBandwidth(zes_mem_bandwidth_t *pBandwidth) {
|
||||
}
|
||||
|
||||
ze_result_t LinuxMemoryImp::getState(zes_mem_state_t *pState) {
|
||||
if (pDrm->queryMemoryInfo() == false) {
|
||||
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
|
||||
|
||||
drm_i915_memory_region_info memRegions = {};
|
||||
ze_result_t result = queryMemoryRegions(pDrm, memRegions);
|
||||
|
||||
if (result != ZE_RESULT_SUCCESS) {
|
||||
return result;
|
||||
}
|
||||
|
||||
pState->health = ZES_MEM_HEALTH_OK;
|
||||
|
||||
auto memoryInfo = static_cast<NEO::MemoryInfoImpl *>(pDrm->getMemoryInfo());
|
||||
auto region = std::find_if(memoryInfo->regions.begin(), memoryInfo->regions.end(), [](auto tempRegion) {
|
||||
return (tempRegion.region.memory_class == I915_MEMORY_CLASS_DEVICE);
|
||||
});
|
||||
if (region == memoryInfo->regions.end()) {
|
||||
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
|
||||
}
|
||||
|
||||
pState->free = region->unallocated_size;
|
||||
pState->size = region->probed_size;
|
||||
pState->free = memRegions.unallocated_size;
|
||||
pState->size = memRegions.probed_size;
|
||||
|
||||
return ZE_RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user