Update mechanism for getting subdeviceId and onSubdevice for memory

Earlier sysman memory module was using logical subdeviceId
exposed by core to retrieve memory telmetry data, replace
the logical subdeviceId with actual subdeviceId for collecting
telemetry data.

Related-To: LOCI-2828

Signed-off-by: Mayank Raghuwanshi <mayank.raghuwanshi@intel.com>
This commit is contained in:
Mayank Raghuwanshi
2022-01-11 11:10:46 +05:30
committed by Compute-Runtime-Automation
parent ae77bd1bd2
commit 90963b95ad
8 changed files with 134 additions and 16 deletions

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/debug_settings/debug_settings_manager.h"
#include "level_zero/tools/source/sysman/sysman_imp.h"
#include <algorithm>
#include <errno.h>
#include <fcntl.h>
@@ -184,12 +186,12 @@ void PlatformMonitoringTech::create(const std::vector<ze_device_handle_t> &devic
std::map<uint32_t, L0::PlatformMonitoringTech *> &mapOfSubDeviceIdToPmtObject) {
if (ZE_RESULT_SUCCESS == PlatformMonitoringTech::enumerateRootTelemIndex(pFsAccess, rootPciPathOfGpuDevice)) {
for (const auto &deviceHandle : deviceHandles) {
ze_device_properties_t deviceProperties = {ZE_STRUCTURE_TYPE_DEVICE_PROPERTIES};
Device::fromHandle(deviceHandle)->getProperties(&deviceProperties);
auto pPmt = new PlatformMonitoringTech(pFsAccess, deviceProperties.flags & ZE_DEVICE_PROPERTY_FLAG_SUBDEVICE,
deviceProperties.subdeviceId);
uint32_t subdeviceId = 0;
ze_bool_t onSubdevice = false;
SysmanDeviceImp::getSysmanDeviceInfo(deviceHandle, subdeviceId, onSubdevice);
auto pPmt = new PlatformMonitoringTech(pFsAccess, onSubdevice, subdeviceId);
UNRECOVERABLE_IF(nullptr == pPmt);
PlatformMonitoringTech::doInitPmtObject(pFsAccess, deviceProperties.subdeviceId, pPmt,
PlatformMonitoringTech::doInitPmtObject(pFsAccess, subdeviceId, pPmt,
rootPciPathOfGpuDevice, mapOfSubDeviceIdToPmtObject);
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2020-2021 Intel Corporation
* Copyright (C) 2020-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -7,6 +7,8 @@
#include "level_zero/tools/source/sysman/memory/memory_imp.h"
#include "level_zero/tools/source/sysman/sysman_imp.h"
namespace L0 {
ze_result_t MemoryImp::memoryGetBandwidth(zes_mem_bandwidth_t *pBandwidth) {
@@ -29,10 +31,11 @@ void MemoryImp::init() {
}
}
MemoryImp::MemoryImp(OsSysman *pOsSysman, ze_device_handle_t handle) : deviceHandle(handle) {
ze_device_properties_t deviceProperties = {ZE_STRUCTURE_TYPE_DEVICE_PROPERTIES};
Device::fromHandle(deviceHandle)->getProperties(&deviceProperties);
pOsMemory = OsMemory::create(pOsSysman, deviceProperties.flags & ZE_DEVICE_PROPERTY_FLAG_SUBDEVICE, deviceProperties.subdeviceId);
MemoryImp::MemoryImp(OsSysman *pOsSysman, ze_device_handle_t handle) {
uint32_t subdeviceId = 0;
ze_bool_t onSubdevice = false;
SysmanDeviceImp::getSysmanDeviceInfo(handle, subdeviceId, onSubdevice);
pOsMemory = OsMemory::create(pOsSysman, onSubdevice, subdeviceId);
init();
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2020 Intel Corporation
* Copyright (C) 2020-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -29,7 +29,6 @@ class MemoryImp : public Memory, NEO::NonCopyableOrMovableClass {
private:
zes_mem_properties_t memoryProperties = {};
ze_device_handle_t deviceHandle = nullptr;
};
} // namespace L0

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2020-2021 Intel Corporation
* Copyright (C) 2020-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -72,6 +72,20 @@ void SysmanDeviceImp::updateSubDeviceHandlesLocally() {
}
}
void SysmanDeviceImp::getSysmanDeviceInfo(zes_device_handle_t hDevice, uint32_t &subdeviceId, ze_bool_t &onSubdevice) {
NEO::Device *neoDevice = Device::fromHandle(hDevice)->getNEODevice();
onSubdevice = static_cast<ze_bool_t>(false);
if (NEO::HwHelper::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
subdeviceId = Math::log2(static_cast<uint32_t>(neoDevice->getDeviceBitfield().to_ulong()));
} else {
subdeviceId = static_cast<NEO::SubDevice *>(neoDevice)->getSubDeviceIndex();
}
}
ze_result_t SysmanDeviceImp::init() {
// We received a device handle. Check for subdevices in this device
updateSubDeviceHandlesLocally();

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2020-2021 Intel Corporation
* Copyright (C) 2020-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -67,6 +67,7 @@ struct SysmanDeviceImp : SysmanDevice, NEO::NonCopyableOrMovableClass {
ze_result_t firmwareGet(uint32_t *pCount, zes_firmware_handle_t *phFirmware) override;
ze_result_t deviceEventRegister(zes_event_type_flags_t events) 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);
void updateSubDeviceHandlesLocally();