Quiet address sanitizer warnings

Also,
* Fix some doxygen issues
* Fix address sanitizer issues in rsmitst

Change-Id: Ie6c6fd9af5c418210b7064e79650fb92cd4a5e2b


[ROCm/amdsmi commit: 63064b0000]
Cette révision appartient à :
Chris Freehill a révisé 2020-11-10 14:16:39 -06:00
1 Parent fa475d307a
révision c6a58d91cb
23 fichiers modifiés
+317 -181

Aucun fichier ne correspond à votre recherche

+88 -11
Voir le fichier
@@ -311,7 +311,7 @@ typedef enum {
RSMI_EVT_NOTIF_LAST = RSMI_EVT_NOTIF_GPU_POST_RESET
} rsmi_evt_notification_type_t;
/*
/**
* Macro to generate event bitmask from event id
*/
#define RSMI_EVENT_MASK_FROM_INDEX(i) (1ULL << ((i) - 1))
@@ -786,14 +786,25 @@ typedef rsmi_od_volt_freq_data_t rsmi_od_volt_freq_data;
* @brief The following structures hold the gpu metrics values for a device.
*/
struct metrics_table_header {
/**
* @brief Size and version information of metrics data
*/
struct metrics_table_header_t {
// TODO(amd) Doxygen documents
/// \cond Ignore in docs.
uint16_t structure_size;
uint8_t format_revision;
uint8_t content_revision;
/// \endcond
};
/**
* @brief The following structure holds the gpu metrics values for a device.
*/
typedef struct {
struct metrics_table_header common_header;
// TODO(amd) Doxygen documents
/// \cond Ignore in docs.
struct metrics_table_header_t common_header;
/* Driver attached timestamp (in ns) */
uint64_t system_clock_counter;
@@ -842,10 +853,8 @@ typedef struct {
/* Link width/speed */
uint8_t pcie_link_width;
uint8_t pcie_link_speed; // in 0.1 GT/s
}rsmi_gpu_metrics_t;
/// \cond Ignore in docs.
typedef rsmi_gpu_metrics_t rsmi_gpu_metrics;
/// \endcond
/// \endcond
} rsmi_gpu_metrics_t;
/**
* @brief This structure holds error counts.
@@ -1267,8 +1276,8 @@ rsmi_dev_subsystem_name_get(uint32_t dv_ind, char *name, size_t len);
* @param[inout] minor a pointer to a uint32_t into which minor number will
* be copied
*
* @retval :: RSMI_STATUS_SUCCESS is returned upon successful call.
* @retval :: RSMI_STATUS_INIT_ERROR if failed to get minor number during
* @retval ::RSMI_STATUS_SUCCESS is returned upon successful call.
* @retval ::RSMI_STATUS_INIT_ERROR if failed to get minor number during
* initialization.
* @retval ::RSMI_STATUS_INVALID_ARGS the provided arguments are not valid
*
@@ -1910,7 +1919,6 @@ rsmi_status_t rsmi_dev_fan_speed_max_get(uint32_t dv_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
/**
* @brief Get the voltage metric value for the specified metric, from the
@@ -2297,6 +2305,9 @@ rsmi_dev_power_profile_presets_get(uint32_t dv_ind, uint32_t sensor_ind,
* @brief Set the PowerPlay performance level associated with the device with
* provided device index with the provided value.
*
* @deprecated ::rsmi_dev_perf_level_set_v1() is preferred, with an
* interface that more closely matches the rest of the rocm_smi API.
*
* @details Given a device index @p dv_ind and an ::rsmi_dev_perf_level_t @p
* perf_level, this function will set the PowerPlay performance level for the
* device to the value @p perf_lvl.
@@ -2314,6 +2325,72 @@ rsmi_dev_power_profile_presets_get(uint32_t dv_ind, uint32_t sensor_ind,
rsmi_status_t
rsmi_dev_perf_level_set(int32_t dv_ind, rsmi_dev_perf_level_t perf_lvl);
/**
* @brief Set the PowerPlay performance level associated with the device with
* provided device index with the provided value.
*
* @details Given a device index @p dv_ind and an ::rsmi_dev_perf_level_t @p
* perf_level, this function will set the PowerPlay performance level for the
* device to the value @p perf_lvl.
*
* @param[in] dv_ind a device index
*
* @param[in] perf_lvl the value to which the performance level should be set
*
* @retval ::RSMI_STATUS_SUCCESS is returned upon successful call.
* @retval ::RSMI_STATUS_NOT_SUPPORTED installed software or hardware does not
* support this function with the given arguments
* @retval ::RSMI_STATUS_PERMISSION function requires root access
*
*/
rsmi_status_t
rsmi_dev_perf_level_set_v1(uint32_t dv_ind, rsmi_dev_perf_level_t perf_lvl);
/**
* @brief Set the overdrive percent associated with the device with provided
* device index with the provided value. See details for WARNING.
*
* @deprecated This function is deprecated. ::rsmi_dev_overdrive_level_set_v1
* has the same functionaltiy, with an interface that more closely
* matches the rest of the rocm_smi API.
*
* @details Given a device index @p dv_ind and an overdrive level @p od,
* this function will set the overdrive level for the device to the value
* @p od. The overdrive level is an integer value between 0 and 20, inclusive,
* which represents the overdrive percentage; e.g., a value of 5 specifies
* an overclocking of 5%.
*
* The overdrive level is specific to the gpu system clock.
*
* The overdrive level is the percentage above the maximum Performance Level
* to which overclocking will be limited. The overclocking percentage does
* not apply to clock speeds other than the maximum. This percentage is
* limited to 20%.
*
* ******WARNING******
* Operating your AMD GPU outside of official AMD specifications or outside of
* factory settings, including but not limited to the conducting of
* overclocking (including use of this overclocking software, even if such
* software has been directly or indirectly provided by AMD or otherwise
* affiliated in any way with AMD), may cause damage to your AMD GPU, system
* components and/or result in system failure, as well as cause other problems.
* DAMAGES CAUSED BY USE OF YOUR AMD GPU OUTSIDE OF OFFICIAL AMD SPECIFICATIONS
* OR OUTSIDE OF FACTORY SETTINGS ARE NOT COVERED UNDER ANY AMD PRODUCT
* WARRANTY AND MAY NOT BE COVERED BY YOUR BOARD OR SYSTEM MANUFACTURER'S
* WARRANTY. Please use this utility with caution.
*
* @param[in] dv_ind a device index
*
* @param[in] od the value to which the overdrive level should be set
*
* @retval ::RSMI_STATUS_SUCCESS call was successful
* @retval ::RSMI_STATUS_NOT_SUPPORTED installed software or hardware does not
* support this function with the given arguments
* @retval ::RSMI_STATUS_PERMISSION function requires root access
*
*/
rsmi_status_t rsmi_dev_overdrive_level_set(int32_t dv_ind, uint32_t od);
/**
* @brief Set the overdrive percent associated with the device with provided
* device index with the provided value. See details for WARNING.
@@ -2353,7 +2430,7 @@ rsmi_dev_perf_level_set(int32_t dv_ind, rsmi_dev_perf_level_t perf_lvl);
* @retval ::RSMI_STATUS_PERMISSION function requires root access
*
*/
rsmi_status_t rsmi_dev_overdrive_level_set(int32_t dv_ind, uint32_t od);
rsmi_status_t rsmi_dev_overdrive_level_set_v1(uint32_t dv_ind, uint32_t od);
/**
* @brief Control the set of allowed frequencies that can be used for the
+5 -5
Voir le fichier
@@ -92,9 +92,9 @@ class Event {
explicit Event(rsmi_event_type_t event, uint32_t dev_ind);
~Event(void);
uint32_t openPerfHandle();
uint32_t startCounter(void);
uint32_t stopCounter(void);
int32_t openPerfHandle();
int32_t startCounter(void);
int32_t stopCounter(void);
uint32_t getValue(rsmi_counter_value_t *val);
uint32_t dev_file_ind(void) const {return dev_file_ind_;}
uint32_t dev_ind(void) const {return dev_ind_;}
@@ -111,8 +111,8 @@ class Event {
int32_t fd_;
perf_event_attr attr_;
uint32_t get_event_file_info(void);
uint32_t get_event_type(uint32_t *ev_type);
int32_t get_event_file_info(void);
int32_t get_event_type(uint32_t *ev_type);
};
+2
Voir le fichier
@@ -199,6 +199,8 @@ class Device {
void set_evt_notif_anon_file_ptr(FILE *f) {evt_notif_anon_file_ptr_ = f;}
FILE *evt_notif_anon_file_ptr(void) const {return evt_notif_anon_file_ptr_;}
void set_evt_notif_anon_fd(int fd) {evt_notif_anon_fd_ = fd;}
void set_evt_notif_anon_fd(uint32_t fd) {
evt_notif_anon_fd_ = static_cast<int>(fd);}
int evt_notif_anon_fd(void) const {return evt_notif_anon_fd_;}
void fillSupportedFuncs(void);
void DumpSupportedFunctions(void);
+1 -1
Voir le fichier
@@ -78,7 +78,7 @@ class RocmSMI {
std::vector<std::shared_ptr<amd::smi::Device>>&
monitor_devices() {return monitor_devices_;}
uint32_t DiscoverAmdgpuDevices(void);
uint32_t DiscoverAMDPowerMonitors(bool force_update = false);
int DiscoverAMDPowerMonitors(bool force_update = false);
// Will execute "func" for every Device object known about, or until func
// returns non-zero;
+3 -3
Voir le fichier
@@ -101,16 +101,16 @@ 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 setTempSensorLabelMap(void);
int32_t setTempSensorLabelMap(void);
uint32_t getTempSensorIndex(rsmi_temperature_type_t type);
rsmi_temperature_type_t getTempSensorEnum(uint64_t ind);
uint32_t setVoltSensorLabelMap(void);
int32_t setVoltSensorLabelMap(void);
uint32_t getVoltSensorIndex(rsmi_voltage_type_t type);
rsmi_voltage_type_t getVoltSensorEnum(uint64_t ind);
void fillSupportedFuncs(SupportedFuncMap *supported_funcs);
private:
std::string MakeMonitorPath(MonitorTypes type, int32_t sensor_id);
std::string MakeMonitorPath(MonitorTypes type, uint32_t sensor_id);
std::string path_;
const RocmSMI_env_vars *env_;
std::map<rsmi_temperature_type_t, uint32_t> temp_type_index_map_;
+1 -1
Voir le fichier
@@ -83,7 +83,7 @@ GetDevValueVec(amd::smi::DevInfoTypes type,
rsmi_status_t
GetDevBinaryVec(amd::smi::DevInfoTypes type,
uint32_t dv_ind, std::vector<unsigned char> *val_vec);
rsmi_status_t ErrnoToRsmiStatus(uint32_t err);
rsmi_status_t ErrnoToRsmiStatus(int err);
struct pthread_wrap {
public: