Add support for new performance levels

Also added tests for new performance levels and clean up some
formatting/style issues.
This commit is contained in:
Chris Freehill
2018-10-25 14:13:55 -05:00
bovenliggende b9c6a5a443
commit 767fa53d8c
13 gewijzigde bestanden met toevoegingen van 122 en 69 verwijderingen
+17 -10
Bestand weergeven
@@ -42,8 +42,8 @@
* DEALINGS WITH THE SOFTWARE.
*
*/
#ifndef ROCM_SMI_LIB_INCLUDE_ROCM_SMI_ROCM_SMI_H_
#define ROCM_SMI_LIB_INCLUDE_ROCM_SMI_ROCM_SMI_H_
#ifndef INCLUDE_ROCM_SMI_ROCM_SMI_H_
#define INCLUDE_ROCM_SMI_ROCM_SMI_H_
#ifdef __cplusplus
extern "C" {
@@ -94,14 +94,21 @@ typedef enum {
RSMI_DEV_PERF_LEVEL_AUTO = 0, //!< Performance level is "auto"
RSMI_DEV_PERF_LEVEL_FIRST = RSMI_DEV_PERF_LEVEL_AUTO,
RSMI_DEV_PERF_LEVEL_LOW, //!< Keep PowerPlay levels "low",
//!< regardless of workload
RSMI_DEV_PERF_LEVEL_HIGH, //!< Keep PowerPlay levels "high",
//!< regardless of workload
RSMI_DEV_PERF_LEVEL_MANUAL, //!< Only use values defined by manually
//!< setting the RSMI_CLK_TYPE_SYS speed
RSMI_DEV_PERF_LEVEL_LOW, //!< Keep PowerPlay levels "low",
//!< regardless of workload
RSMI_DEV_PERF_LEVEL_HIGH, //!< Keep PowerPlay levels "high",
//!< regardless of workload
RSMI_DEV_PERF_LEVEL_MANUAL, //!< Only use values defined by manually
//!< setting the RSMI_CLK_TYPE_SYS speed
RSMI_DEV_PERF_LEVEL_STABLE_STD, //!< Stable power state with profiling
//!< clocks
RSMI_DEV_PERF_LEVEL_STABLE_PEAK, //!< Stable power state with peak clocks
RSMI_DEV_PERF_LEVEL_STABLE_MIN_MCLK, //!< Stable power state with minimum
//!< memory clock
RSMI_DEV_PERF_LEVEL_STABLE_MIN_SCLK, //!< Stable power state with minimum
//!< system clock
RSMI_DEV_PERF_LEVEL_LAST = RSMI_DEV_PERF_LEVEL_MANUAL,
RSMI_DEV_PERF_LEVEL_LAST = RSMI_DEV_PERF_LEVEL_STABLE_MIN_SCLK,
RSMI_DEV_PERF_LEVEL_UNKNOWN = 0x100 //!< Unknown performance level
} rsmi_dev_perf_level;
@@ -762,4 +769,4 @@ rsmi_status_string(rsmi_status_t status, const char **status_string);
#ifdef __cplusplus
}
#endif // __cplusplus
#endif // ROCM_SMI_LIB_INCLUDE_ROCM_SMI_ROCM_SMI_H_
#endif // INCLUDE_ROCM_SMI_ROCM_SMI_H_
+3 -3
Bestand weergeven
@@ -42,8 +42,8 @@
* DEALINGS WITH THE SOFTWARE.
*
*/
#ifndef ROCM_SMI_LIB_INCLUDE_ROCM_SMI_ROCM_SMI_COMMON_H_
#define ROCM_SMI_LIB_INCLUDE_ROCM_SMI_ROCM_SMI_COMMON_H_
#ifndef INCLUDE_ROCM_SMI_ROCM_SMI_COMMON_H_
#define INCLUDE_ROCM_SMI_ROCM_SMI_COMMON_H_
#define DBG_FILE_ERROR(STR) \
if (env_->debug_output_bitfield & RSMI_DEBUG_SYSFS_FILE_PATHS) { \
@@ -60,4 +60,4 @@ struct RocmSMI_env_vars {
uint32_t debug_output_bitfield;
};
#endif // ROCM_SMI_LIB_INCLUDE_ROCM_SMI_ROCM_SMI_COMMON_H_
#endif // INCLUDE_ROCM_SMI_ROCM_SMI_COMMON_H_
+5 -3
Bestand weergeven
@@ -42,8 +42,8 @@
* DEALINGS WITH THE SOFTWARE.
*
*/
#ifndef ROCM_SMI_LIB_INCLUDE_ROCM_SMI_ROCM_SMI_DEVICE_H_
#define ROCM_SMI_LIB_INCLUDE_ROCM_SMI_ROCM_SMI_DEVICE_H_
#ifndef INCLUDE_ROCM_SMI_ROCM_SMI_DEVICE_H_
#define INCLUDE_ROCM_SMI_ROCM_SMI_DEVICE_H_
#include <string>
#include <memory>
#include <utility>
@@ -53,6 +53,7 @@
#include "rocm_smi/rocm_smi_monitor.h"
#include "rocm_smi/rocm_smi_power_mon.h"
#include "rocm_smi/rocm_smi_common.h"
#include "rocm_smi/rocm_smi.h"
namespace amd {
namespace smi {
@@ -84,6 +85,7 @@ class Device {
int writeDevInfo(DevInfoTypes type, std::string val);
uint32_t index(void) const {return index_;}
void set_index(uint32_t index) {index_ = index;}
static rsmi_dev_perf_level perfLvlStrToEnum(std::string s);
private:
std::shared_ptr<Monitor> monitor_;
@@ -100,4 +102,4 @@ class Device {
} // namespace smi
} // namespace amd
#endif // ROCM_SMI_LIB_INCLUDE_ROCM_SMI_ROCM_SMI_DEVICE_H_
#endif // INCLUDE_ROCM_SMI_ROCM_SMI_DEVICE_H_
+3 -3
Bestand weergeven
@@ -42,8 +42,8 @@
* DEALINGS WITH THE SOFTWARE.
*
*/
#ifndef ROCM_SMI_LIB_INCLUDE_ROCM_SMI_ROCM_SMI_MAIN_H_
#define ROCM_SMI_LIB_INCLUDE_ROCM_SMI_ROCM_SMI_MAIN_H_
#ifndef INCLUDE_ROCM_SMI_ROCM_SMI_MAIN_H_
#define INCLUDE_ROCM_SMI_ROCM_SMI_MAIN_H_
#include <vector>
#include <memory>
@@ -95,4 +95,4 @@ class RocmSMI {
} // namespace smi
} // namespace amd
#endif // ROCM_SMI_LIB_INCLUDE_ROCM_SMI_ROCM_SMI_MAIN_H_
#endif // INCLUDE_ROCM_SMI_ROCM_SMI_MAIN_H_
+3 -3
Bestand weergeven
@@ -42,8 +42,8 @@
* DEALINGS WITH THE SOFTWARE.
*
*/
#ifndef ROCM_SMI_LIB_INCLUDE_ROCM_SMI_ROCM_SMI_MONITOR_H_
#define ROCM_SMI_LIB_INCLUDE_ROCM_SMI_ROCM_SMI_MONITOR_H_
#ifndef INCLUDE_ROCM_SMI_ROCM_SMI_MONITOR_H_
#define INCLUDE_ROCM_SMI_ROCM_SMI_MONITOR_H_
#include <string>
#include <cstdint>
@@ -97,4 +97,4 @@ class Monitor {
} // namespace smi
} // namespace amd
#endif // ROCM_SMI_LIB_INCLUDE_ROCM_SMI_ROCM_SMI_MONITOR_H_
#endif // INCLUDE_ROCM_SMI_ROCM_SMI_MONITOR_H_
@@ -42,8 +42,8 @@
* DEALINGS WITH THE SOFTWARE.
*
*/
#ifndef ROCM_SMI_LIB_INCLUDE_ROCM_SMI_ROCM_SMI_POWER_MON_H_
#define ROCM_SMI_LIB_INCLUDE_ROCM_SMI_ROCM_SMI_POWER_MON_H_
#ifndef INCLUDE_ROCM_SMI_ROCM_SMI_POWER_MON_H_
#define INCLUDE_ROCM_SMI_ROCM_SMI_POWER_MON_H_
#include <string>
#include <cstdint>
@@ -78,4 +78,4 @@ class PowerMon {
} // namespace smi
} // namespace amd
#endif // ROCM_SMI_LIB_INCLUDE_ROCM_SMI_ROCM_SMI_POWER_MON_H_
#endif // INCLUDE_ROCM_SMI_ROCM_SMI_POWER_MON_H_
+3 -3
Bestand weergeven
@@ -42,8 +42,8 @@
* DEALINGS WITH THE SOFTWARE.
*
*/
#ifndef ROCM_SMI_LIB_INCLUDE_ROCM_SMI_ROCM_SMI_UTILS_H_
#define ROCM_SMI_LIB_INCLUDE_ROCM_SMI_ROCM_SMI_UTILS_H_
#ifndef INCLUDE_ROCM_SMI_ROCM_SMI_UTILS_H_
#define INCLUDE_ROCM_SMI_ROCM_SMI_UTILS_H_
#include <string>
#include <cstdint>
@@ -68,4 +68,4 @@ int WriteSysfsStr(std::string path, std::string val);
} // namespace smi
} // namespace amd
#endif // ROCM_SMI_LIB_INCLUDE_ROCM_SMI_ROCM_SMI_UTILS_H_
#endif // INCLUDE_ROCM_SMI_ROCM_SMI_UTILS_H_