RDC module framework

The framework is required for RAS integration. When the RAS fields
need to be retrieved, the framework will load the RAS library at run time,
and then call the RAS function to retrieve RAS metrics.

* The RdcModuleMgr will be used to manage different modules. RDC
  only has the telemetry module now.
* When RDCTelemetryModule is loaded, it will load the RAS library.
  It will also call rdc_telemetry_fields_query() defined in the RAS
  library for the list of fields RAS supported.
* The RdcSmiLib is a wrapper for the rocm_msi_lib to provide the
  interface required by the RDCTelemetryModule.
* The RdcWatchTable will use the RdcModuleMgr to get the
  RDCTelemetryModule to bulk fetch mulitple fields.
* The RdcTelemetryModule will dispatch those fields to different
  library: RdcSmiLib or RdcRasLib.

The watch() and unwatch() in the RDCTelemetryModule will been implemented
at the next task.

Change-Id: I81b01d5b52d1ea3cdcec7c09af86b6622dd5899e


[ROCm/rdc commit: ba35cdcfe2]
This commit is contained in:
Bill(Shuzhou) Liu
2020-08-31 09:48:02 -04:00
parent dbfc169a4e
commit 32e91cf8d2
19 changed files with 934 additions and 72 deletions
@@ -29,11 +29,11 @@ THE SOFTWARE.
#include <memory>
#include <mutex> // NOLINT
#include <atomic>
#include <map>
#include "rdc_lib/RdcWatchTable.h"
#include "rdc_lib/RdcGroupSettings.h"
#include "rdc_lib/RdcCacheManager.h"
#include "rdc_lib/RdcMetricFetcher.h"
#include "rdc_lib/RdcModuleMgr.h"
#include "rocm_smi/rocm_smi.h"
namespace amd {
@@ -83,9 +83,11 @@ class RdcWatchTableImpl : public RdcWatchTable {
//!< once per second.
rdc_status_t rdc_field_update_all() override;
// TODO(bill_liu): Remove the RdcMetricFetcherPtr
RdcWatchTableImpl(const RdcGroupSettingsPtr& group_settings,
const RdcCacheManagerPtr& cache_mgr,
const RdcMetricFetcherPtr& metric_fetcher);
const RdcMetricFetcherPtr& metric_fetcher,
const RdcModuleMgrPtr& module_mgr);
private:
//!< Helper function to Update the fields_in_table when unwatch tables
@@ -108,9 +110,14 @@ class RdcWatchTableImpl : public RdcWatchTable {
rdc_status_t initialize_rsmi_handles(RdcFieldKey fk);
//!< The function will be pass as the callback for bulk fetch
static rdc_status_t handle_fields(rdc_gpu_field_value_t* values,
uint32_t num_values, void* user_data);
RdcGroupSettingsPtr group_settings_;
RdcCacheManagerPtr cache_mgr_;
RdcMetricFetcherPtr metric_fetcher_;
RdcModuleMgrPtr rdc_module_mgr_;
//!< The watch table to store the watch settings.
std::map<RdcFieldGroupKey, FieldSettings> watch_table_;