Avoid adding subdevice flag if ReturnSubDevicesAsApiDevices is set

Related-To: LOCI-3656

Signed-off-by: Joshua Santosh Ranjan <joshua.santosh.ranjan@intel.com>
This commit is contained in:
Joshua Santosh Ranjan
2022-11-28 11:55:07 +00:00
committed by Compute-Runtime-Automation
parent ad072b4d5d
commit 522076cf82
18 changed files with 160 additions and 37 deletions

View File

@@ -39,7 +39,7 @@ void EngineHandleContext::init(std::vector<ze_device_handle_t> &deviceHandles) {
for (const auto &deviceHandle : deviceHandles) {
uint32_t subDeviceId = 0;
ze_bool_t onSubdevice = false;
SysmanDeviceImp::getSysmanDeviceInfo(deviceHandle, subDeviceId, onSubdevice);
SysmanDeviceImp::getSysmanDeviceInfo(deviceHandle, subDeviceId, onSubdevice, true);
if (subDeviceId == itr->second.second) {
createHandle(itr->first, itr->second.first, subDeviceId, onSubdevice);
}

View File

@@ -118,7 +118,7 @@ void FrequencyImp::init() {
FrequencyImp::FrequencyImp(OsSysman *pOsSysman, ze_device_handle_t handle, zes_freq_domain_t frequencyDomainNumber) : deviceHandle(handle) {
uint32_t subdeviceId = 0;
ze_bool_t onSubdevice = false;
SysmanDeviceImp::getSysmanDeviceInfo(deviceHandle, subdeviceId, onSubdevice);
SysmanDeviceImp::getSysmanDeviceInfo(deviceHandle, subdeviceId, onSubdevice, true);
pOsFrequency = OsFrequency::create(pOsSysman, onSubdevice, subdeviceId, frequencyDomainNumber);
UNRECOVERABLE_IF(nullptr == pOsFrequency);
init();

View File

@@ -191,7 +191,7 @@ void PlatformMonitoringTech::create(const std::vector<ze_device_handle_t> &devic
for (const auto &deviceHandle : deviceHandles) {
uint32_t subdeviceId = 0;
ze_bool_t onSubdevice = false;
SysmanDeviceImp::getSysmanDeviceInfo(deviceHandle, subdeviceId, onSubdevice);
SysmanDeviceImp::getSysmanDeviceInfo(deviceHandle, subdeviceId, onSubdevice, true);
auto productFamily = SysmanDeviceImp::getProductFamily(Device::fromHandle(deviceHandle));
auto pPmt = new PlatformMonitoringTech(pFsAccess, onSubdevice, subdeviceId);
UNRECOVERABLE_IF(nullptr == pPmt);

View File

@@ -34,7 +34,7 @@ void MemoryImp::init() {
MemoryImp::MemoryImp(OsSysman *pOsSysman, ze_device_handle_t handle) {
uint32_t subdeviceId = 0;
ze_bool_t onSubdevice = false;
SysmanDeviceImp::getSysmanDeviceInfo(handle, subdeviceId, onSubdevice);
SysmanDeviceImp::getSysmanDeviceInfo(handle, subdeviceId, onSubdevice, true);
pOsMemory = OsMemory::create(pOsSysman, onSubdevice, subdeviceId);
init();
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2021 Intel Corporation
* Copyright (C) 2021-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -9,6 +9,8 @@
#include "shared/source/helpers/debug_helpers.h"
#include "level_zero/tools/source/sysman/sysman_imp.h"
namespace L0 {
ze_result_t PerformanceImp::performanceGetProperties(zes_perf_properties_t *pProperties) {
@@ -32,10 +34,12 @@ void PerformanceImp::init() {
}
PerformanceImp::PerformanceImp(OsSysman *pOsSysman, ze_device_handle_t handle, zes_engine_type_flag_t domain) {
ze_device_properties_t deviceProperties = {ZE_STRUCTURE_TYPE_DEVICE_PROPERTIES};
Device::fromHandle(handle)->getProperties(&deviceProperties);
pOsPerformance = OsPerformance::create(pOsSysman, deviceProperties.flags & ZE_DEVICE_PROPERTY_FLAG_SUBDEVICE,
deviceProperties.subdeviceId, domain);
uint32_t subdeviceId = std::numeric_limits<uint32_t>::max();
ze_bool_t onSubdevice = false;
SysmanDeviceImp::getSysmanDeviceInfo(handle, subdeviceId, onSubdevice, false);
pOsPerformance = OsPerformance::create(pOsSysman, onSubdevice,
subdeviceId, domain);
UNRECOVERABLE_IF(nullptr == pOsPerformance);
init();
}

View File

@@ -9,6 +9,8 @@
#include "shared/source/helpers/debug_helpers.h"
#include "level_zero/tools/source/sysman/sysman_imp.h"
namespace L0 {
ze_result_t PowerImp::powerGetProperties(zes_power_properties_t *pProperties) {
@@ -58,10 +60,13 @@ ze_result_t PowerImp::powerSetEnergyThreshold(double threshold) {
}
PowerImp::PowerImp(OsSysman *pOsSysman, ze_device_handle_t handle) : deviceHandle(handle) {
ze_device_properties_t deviceProperties = {};
Device::fromHandle(deviceHandle)->getProperties(&deviceProperties);
pOsPower = OsPower::create(pOsSysman, deviceProperties.flags & ZE_DEVICE_PROPERTY_FLAG_SUBDEVICE, deviceProperties.subdeviceId);
uint32_t subdeviceId = std::numeric_limits<uint32_t>::max();
ze_bool_t onSubdevice = false;
SysmanDeviceImp::getSysmanDeviceInfo(deviceHandle, subdeviceId, onSubdevice, false);
pOsPower = OsPower::create(pOsSysman, onSubdevice, subdeviceId);
UNRECOVERABLE_IF(nullptr == pOsPower);
init();
}

View File

@@ -76,7 +76,7 @@ ze_result_t LinuxRasSourceFabric::getSupportedRasErrorTypes(std::set<zes_ras_err
LinuxSysmanImp *pLinuxSysmanImp = static_cast<LinuxSysmanImp *>(pOsSysman);
ze_bool_t onSubDevice = false;
uint32_t subDeviceIndex = 0;
SysmanDeviceImp::getSysmanDeviceInfo(deviceHandle, subDeviceIndex, onSubDevice);
SysmanDeviceImp::getSysmanDeviceInfo(deviceHandle, subDeviceIndex, onSubDevice, true);
std::vector<std::string> nodes;
getNodes(nodes, subDeviceIndex, pLinuxSysmanImp, ZES_RAS_ERROR_TYPE_UNCORRECTABLE);
if (nodes.size()) {

View File

@@ -132,7 +132,7 @@ static uint64_t convertHexToUint64(std::string strVal) {
static bool getErrorType(std::map<zes_ras_error_cat_t, std::vector<std::string>> categoryToListOfEvents, std::vector<std::string> &eventList, ze_device_handle_t deviceHandle) {
ze_bool_t onSubDevice = false;
uint32_t subDeviceId = 0;
SysmanDeviceImp::getSysmanDeviceInfo(deviceHandle, subDeviceId, onSubDevice);
SysmanDeviceImp::getSysmanDeviceInfo(deviceHandle, subDeviceId, onSubDevice, true);
// Naming convention of files containing config values for errors
// error--<Name of error> Ex:- error--engine-reset (config file with no subdevice)
// error-gt<N>--<Name of error> Ex:- error-gt0--engine-reset (config file with subdevices)

View File

@@ -40,7 +40,7 @@ void RasImp::init() {
RasImp::RasImp(OsSysman *pOsSysman, zes_ras_error_type_t type, ze_device_handle_t handle) : deviceHandle(handle) {
uint32_t subdeviceId = 0;
ze_bool_t onSubdevice = false;
SysmanDeviceImp::getSysmanDeviceInfo(deviceHandle, subdeviceId, onSubdevice);
SysmanDeviceImp::getSysmanDeviceInfo(deviceHandle, subdeviceId, onSubdevice, true);
pOsRas = OsRas::create(pOsSysman, type, onSubdevice, subdeviceId);
init();
}

View File

@@ -508,10 +508,11 @@ ze_result_t OsScheduler::getNumEngineTypeAndInstances(
LinuxSysmanImp *pLinuxSysmanImp = static_cast<LinuxSysmanImp *>(pOsSysman);
auto pDrm = &pLinuxSysmanImp->getDrm();
auto pSysfsAccess = &pLinuxSysmanImp->getSysfsAccess();
ze_device_properties_t deviceProperties = {};
Device::fromHandle(subdeviceHandle)->getProperties(&deviceProperties);
if (deviceProperties.flags & ZE_DEVICE_PROPERTY_FLAG_SUBDEVICE) {
return getNumEngineTypeAndInstancesForSubDevices(mapOfEngines, pDrm, deviceProperties.subdeviceId);
uint32_t subdeviceId = std::numeric_limits<uint32_t>::max();
ze_bool_t onSubdevice = false;
SysmanDeviceImp::getSysmanDeviceInfo(subdeviceHandle, subdeviceId, onSubdevice, true);
if (onSubdevice) {
return getNumEngineTypeAndInstancesForSubDevices(mapOfEngines, pDrm, subdeviceId);
}
return getNumEngineTypeAndInstancesForDevice(mapOfEngines, pSysfsAccess);

View File

@@ -10,6 +10,7 @@
#include "shared/source/helpers/debug_helpers.h"
#include "level_zero/tools/source/sysman/sysman_const.h"
#include "level_zero/tools/source/sysman/sysman_imp.h"
namespace L0 {
@@ -51,10 +52,10 @@ void SchedulerImp::init() {
}
SchedulerImp::SchedulerImp(OsSysman *pOsSysman, zes_engine_type_flag_t engineType, std::vector<std::string> &listOfEngines, ze_device_handle_t deviceHandle) {
ze_device_properties_t deviceProperties = {ZE_STRUCTURE_TYPE_DEVICE_PROPERTIES};
Device::fromHandle(deviceHandle)->getProperties(&deviceProperties);
pOsScheduler = OsScheduler::create(pOsSysman, engineType, listOfEngines,
deviceProperties.flags & ZE_DEVICE_PROPERTY_FLAG_SUBDEVICE, deviceProperties.subdeviceId);
uint32_t subdeviceId = std::numeric_limits<uint32_t>::max();
ze_bool_t onSubdevice = false;
SysmanDeviceImp::getSysmanDeviceInfo(deviceHandle, subdeviceId, onSubdevice, true);
pOsScheduler = OsScheduler::create(pOsSysman, engineType, listOfEngines, onSubdevice, subdeviceId);
UNRECOVERABLE_IF(nullptr == pOsScheduler);
init();
};

View File

@@ -34,7 +34,7 @@ void StandbyImp::init() {
StandbyImp::StandbyImp(OsSysman *pOsSysman, ze_device_handle_t handle) : deviceHandle(handle) {
uint32_t subdeviceId = 0;
ze_bool_t onSubdevice = false;
SysmanDeviceImp::getSysmanDeviceInfo(deviceHandle, subdeviceId, onSubdevice);
SysmanDeviceImp::getSysmanDeviceInfo(deviceHandle, subdeviceId, onSubdevice, true);
pOsStandby = OsStandby::create(pOsSysman, onSubdevice, subdeviceId);
UNRECOVERABLE_IF(nullptr == pOsStandby);
init();

View File

@@ -79,17 +79,19 @@ void SysmanDeviceImp::updateSubDeviceHandlesLocally() {
}
}
void SysmanDeviceImp::getSysmanDeviceInfo(zes_device_handle_t hDevice, uint32_t &subdeviceId, ze_bool_t &onSubdevice) {
void SysmanDeviceImp::getSysmanDeviceInfo(zes_device_handle_t hDevice, uint32_t &subdeviceId, ze_bool_t &onSubdevice, ze_bool_t useMultiArchEnabled) {
NEO::Device *neoDevice = Device::fromHandle(hDevice)->getNEODevice();
onSubdevice = static_cast<ze_bool_t>(false);
if (NEO::GfxCoreHelper::getSubDevicesCount(&neoDevice->getHardwareInfo()) > 1) {
onSubdevice = static_cast<ze_bool_t>(true);
}
if (!neoDevice->isSubDevice()) { // To get physical device or subdeviceIndex Index in case when the device does not support tile architecture is single tile device
UNRECOVERABLE_IF(neoDevice->getDeviceBitfield().count() != 1) // or the device is single tile device or AFFINITY_MASK only exposes single tile
onSubdevice = false;
// Check for root device with 1 sub-device case
if (!neoDevice->isSubDevice() && neoDevice->getDeviceBitfield().count() == 1) {
subdeviceId = Math::log2(static_cast<uint32_t>(neoDevice->getDeviceBitfield().to_ulong()));
} else {
if ((NEO::GfxCoreHelper::getSubDevicesCount(&neoDevice->getHardwareInfo()) > 1) && useMultiArchEnabled) {
onSubdevice = true;
}
} else if (neoDevice->isSubDevice()) {
subdeviceId = static_cast<NEO::SubDevice *>(neoDevice)->getSubDeviceIndex();
onSubdevice = true;
}
}

View File

@@ -73,7 +73,7 @@ struct SysmanDeviceImp : SysmanDevice, NEO::NonCopyableOrMovableClass {
ze_result_t deviceGetEccState(zes_device_ecc_properties_t *pState) override;
ze_result_t deviceSetEccState(const zes_device_ecc_desc_t *newState, zes_device_ecc_properties_t *pState) override;
bool deviceEventListen(zes_event_type_flags_t &pEvent, uint64_t timeout) override;
static void getSysmanDeviceInfo(zes_device_handle_t hDevice, uint32_t &subdeviceId, ze_bool_t &onSubdevice);
static void getSysmanDeviceInfo(zes_device_handle_t hDevice, uint32_t &subdeviceId, ze_bool_t &onSubdevice, ze_bool_t useMultiArchEnabled);
static PRODUCT_FAMILY getProductFamily(Device *pDevice);
void updateSubDeviceHandlesLocally();

View File

@@ -39,7 +39,7 @@ void TemperatureImp::init() {
TemperatureImp::TemperatureImp(const ze_device_handle_t &deviceHandle, OsSysman *pOsSysman, zes_temp_sensors_t type) {
uint32_t subdeviceId = 0;
ze_bool_t onSubdevice = false;
SysmanDeviceImp::getSysmanDeviceInfo(deviceHandle, subdeviceId, onSubdevice);
SysmanDeviceImp::getSysmanDeviceInfo(deviceHandle, subdeviceId, onSubdevice, true);
pOsTemperature = OsTemperature::create(pOsSysman, onSubdevice,
subdeviceId, type);
init();