By default, only consider AMD GPU's in RSMI device list

With newly added initialization parameters that can be
passed to rsmi_init(), you can tell RSMI to consider other
devices.

Also:
-fixed incorrect header file name that would break in C
builds
-modified rsmi_init() and rsmi_shut_down() to reinitialize and
clear static structures
Esse commit está contido em:
Chris Freehill
2019-05-09 18:55:15 -05:00
commit 1dfef717bb
9 arquivos alterados com 120 adições e 23 exclusões
+13 -3
Ver Arquivo
@@ -47,7 +47,7 @@
extern "C" {
#include <cstdint>
#else
#include <stdinit.h>
#include <stdint.h>
#endif // __cplusplus
#include <stdint.h>
@@ -113,6 +113,15 @@ typedef enum {
RSMI_STATUS_UNKNOWN_ERROR = 0xFFFFFFFF, //!< An unknown error occurred
} rsmi_status_t;
typedef enum {
RSMI_INIT_FLAG_ALL_GPUS = 0x1, //!< Attempt to add all GPUs found
//!< (including non-AMD) to the list
//!< of devices from which SMI
//!< information can be retrieved. By
//!< default, only AMD devices are
//!< ennumerated by RSMI.
} rsmi_init_flags_t;
/**
* @brief PowerPlay performance levels
*/
@@ -493,8 +502,9 @@ typedef struct {
* @details When called, this initializes internal data structures,
* including those corresponding to sources of information that SMI provides.
*
* @param[in] init_flags Bit flags that tell SMI how to initialze. Not
* currently used.
* @param[in] init_flags Bit flags that tell SMI how to initialze. Values of
* ::rsmi_init_flags_t may be OR'd together and passed through @p init_flags
* to modify how RSMI initializes.
*
* @retval ::RSMI_STATUS_SUCCESS is returned upon successful call.
*/
+9 -4
Ver Arquivo
@@ -62,12 +62,13 @@ namespace smi {
class RocmSMI {
public:
RocmSMI(void); // direct use of this constructor is deprecated; use
// getInstance()
RocmSMI(uint64_t flags);
~RocmSMI(void);
static RocmSMI& getInstance(void);
static RocmSMI& getInstance(uint64_t flags = 0);
void Initialize(uint64_t flags);
void Cleanup(void);
static std::vector<std::shared_ptr<amd::smi::Device>>&
monitor_devices() {return s_monitor_devices;}
uint32_t DiscoverDevices(void);
@@ -78,6 +79,9 @@ class RocmSMI {
uint32_t IterateSMIDevices(
std::function<uint32_t(std::shared_ptr<Device>&, void *)> func, void *);
void set_init_options(uint64_t options) {init_options_ = options;}
uint64_t init_options() const {return init_options_;}
private:
std::vector<std::shared_ptr<Device>> devices_;
std::vector<std::shared_ptr<Monitor>> monitors_;
@@ -90,6 +94,7 @@ class RocmSMI {
static std::vector<std::shared_ptr<amd::smi::Device>> s_monitor_devices;
RocmSMI_env_vars env_vars_;
uint64_t init_options_;
};
} // namespace smi