Add support for junction, edge and memory temperature sensors (#42)

* If vendor/device/subsystem name is not found, use device ID string

* Update documentation for get-name functions

* Add support for junction, edge and memory temperature sensors


[ROCm/amdsmi commit: 11f714326b]
This commit is contained in:
Chris Freehill
2019-05-24 15:24:49 -05:00
committed by GitHub
parent 9fa8519b38
commit 3beb502a69
6 changed files with 128 additions and 42 deletions
+22 -7
View File
@@ -238,6 +238,21 @@ typedef enum {
typedef rsmi_temperature_metric_t rsmi_temperature_metric;
/// \endcond
/**
* @brief This ennumeration is used to indicate from which part of the device a
* temperature reading should be obtained.
*/
typedef enum {
RSMI_TEMP_TYPE_FIRST = 0,
RSMI_TEMP_TYPE_EDGE = RSMI_TEMP_TYPE_FIRST, //!< Edge GPU temperature
RSMI_TEMP_TYPE_JUNCTION, //!< Junction/hotspot
//!< temperature
RSMI_TEMP_TYPE_MEMORY, //!< VRAM temperature
RSMI_TEMP_TYPE_LAST = RSMI_TEMP_TYPE_MEMORY
} rsmi_temperature_type_t;
/**
* @brief Pre-set Profile Selections. These bitmasks can be AND'd with the
* ::rsmi_power_profile_status_t.available_profiles returned from
@@ -1096,15 +1111,15 @@ rsmi_status_t rsmi_dev_fan_speed_max_get(uint32_t dv_ind,
* @brief Get the temperature metric value for the specified metric, from the
* specified temperature sensor on the specified device.
*
* @details Given a device index @p dv_ind, a 0-based sensor index
* @p sensor_ind, a ::rsmi_temperature_metric_t @p metric and a pointer to an
* int64_t @p temperature, this function will write the value of the metric
* indicated by @p metric to the memory location @p temperature.
* @details Given a device index @p dv_ind, a sensor type @p sensor_type, a
* ::rsmi_temperature_metric_t @p metric and a pointer to an int64_t @p
* temperature, this function will write the value of the metric indicated by
* @p metric and @p sensor_type to the memory location @p temperature.
*
* @param[in] dv_ind a device index
*
* @param[in] sensor_ind a 0-based sensor index. Normally, this will be 0.
* If a device has more than one sensor, it could be greater than 0.
* @param[in] sensor_type part of device from which temperature should be
* obtained. This should come from the enum ::rsmi_temperature_type_t
*
* @param[in] metric enum indicated which temperature value should be
* retrieved
@@ -1115,7 +1130,7 @@ rsmi_status_t rsmi_dev_fan_speed_max_get(uint32_t dv_ind,
* @retval ::RSMI_STATUS_SUCCESS is returned upon successful call.
*
*/
rsmi_status_t rsmi_dev_temp_metric_get(uint32_t dv_ind, uint32_t sensor_ind,
rsmi_status_t rsmi_dev_temp_metric_get(uint32_t dv_ind, uint32_t sensor_type,
rsmi_temperature_metric_t metric, int64_t *temperature);
/** @} */ // end of PhysQuer
@@ -47,8 +47,10 @@
#include <string>
#include <cstdint>
#include <map>
#include "rocm_smi/rocm_smi_common.h"
#include "rocm_smi/rocm_smi.h"
namespace amd {
namespace smi {
@@ -77,6 +79,7 @@ enum MonitorTypes {
kMonTempOffset,
kMonTempLowest,
kMonTempHighest,
kMonTempLabel,
kMonInvalid = 0xFFFFFFFF,
};
@@ -89,10 +92,14 @@ class Monitor {
const std::string path(void) const {return path_;}
int readMonitor(MonitorTypes type, uint32_t sensor_ind, std::string *val);
int writeMonitor(MonitorTypes type, uint32_t sensor_ind, std::string val);
uint32_t setSensorLabelMap(void);
uint32_t getSensorIndex(rsmi_temperature_type_t type);
private:
std::string MakeMonitorPath(MonitorTypes type, int32_t sensor_id);
std::string path_;
const RocmSMI_env_vars *env_;
std::map<rsmi_temperature_type_t, uint32_t> temp_type_index_map_;
};
} // namespace smi