Enable RDC topology feature
1.Add topology APIs 2.Add topology example for topology API usage Change-Id: Ib79c06d0bac85119672f194ba685ebf25029979c
This commit is contained in:
@@ -45,7 +45,8 @@ class RdcHandler {
|
||||
uint32_t* count) = 0;
|
||||
virtual rdc_status_t rdc_device_get_attributes(uint32_t gpu_index,
|
||||
rdc_device_attributes_t* p_rdc_attr) = 0;
|
||||
virtual rdc_status_t rdc_device_get_component_version(rdc_component_t component, rdc_component_version_t* p_rdc_compv) = 0;
|
||||
virtual rdc_status_t rdc_device_get_component_version(rdc_component_t component,
|
||||
rdc_component_version_t* p_rdc_compv) = 0;
|
||||
|
||||
// Group API
|
||||
virtual rdc_status_t rdc_group_gpu_create(rdc_group_type_t type, const char* group_name,
|
||||
@@ -111,6 +112,10 @@ class RdcHandler {
|
||||
virtual rdc_status_t rdc_health_get(rdc_gpu_group_t group_id, unsigned int* components) = 0;
|
||||
virtual rdc_status_t rdc_health_check(rdc_gpu_group_t group_id, rdc_health_response_t *response) = 0;
|
||||
virtual rdc_status_t rdc_health_clear(rdc_gpu_group_t group_id) = 0;
|
||||
// topology API
|
||||
virtual rdc_status_t rdc_device_topology_get(uint32_t gpu_index,
|
||||
rdc_device_topology_t* results) = 0;
|
||||
virtual rdc_status_t rdc_link_status_get(rdc_link_status_t* results) = 0;
|
||||
|
||||
virtual ~RdcHandler() {}
|
||||
};
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
/*
|
||||
Copyright (c) 2024 - present Advanced Micro Devices, Inc. All rights reserved.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
*/
|
||||
#ifndef INCLUDE_RDC_LIB_RDCTOPOLOGYLINK_H_
|
||||
#define INCLUDE_RDC_LIB_RDCTOPOLOGYLINK_H_
|
||||
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
#include "rdc/rdc.h"
|
||||
#include "rdc_lib/rdc_common.h"
|
||||
|
||||
namespace amd {
|
||||
namespace rdc {
|
||||
|
||||
class RdcTopologyLink {
|
||||
public:
|
||||
virtual rdc_status_t rdc_device_topology_get(uint32_t gpu_index,
|
||||
rdc_device_topology_t* results) = 0;
|
||||
virtual rdc_status_t rdc_link_status_get(rdc_link_status_t* results) = 0;
|
||||
|
||||
virtual ~RdcTopologyLink() {}
|
||||
};
|
||||
|
||||
typedef std::shared_ptr<RdcTopologyLink> RdcTopologyLinkPtr;
|
||||
|
||||
} // namespace rdc
|
||||
} // namespace amd
|
||||
|
||||
#endif // INCLUDE_RDC_LIB_RDCTOPOLOGYLINK_H_
|
||||
@@ -32,6 +32,7 @@ THE SOFTWARE.
|
||||
#include "rdc_lib/RdcModuleMgr.h"
|
||||
#include "rdc_lib/RdcNotification.h"
|
||||
#include "rdc_lib/RdcPolicy.h"
|
||||
#include "rdc_lib/RdcTopologyLink.h"
|
||||
#include "rdc_lib/RdcWatchTable.h"
|
||||
|
||||
namespace amd {
|
||||
@@ -52,7 +53,8 @@ class RdcEmbeddedHandler final : public RdcHandler {
|
||||
uint32_t* count) override;
|
||||
rdc_status_t rdc_device_get_attributes(uint32_t gpu_index,
|
||||
rdc_device_attributes_t* p_rdc_attr) override;
|
||||
rdc_status_t rdc_device_get_component_version(rdc_component_t component, rdc_component_version_t* p_rdc_compv) override;
|
||||
rdc_status_t rdc_device_get_component_version(rdc_component_t component,
|
||||
rdc_component_version_t* p_rdc_compv) override;
|
||||
|
||||
// Group API
|
||||
rdc_status_t rdc_group_gpu_create(rdc_group_type_t type, const char* group_name,
|
||||
@@ -113,6 +115,9 @@ class RdcEmbeddedHandler final : public RdcHandler {
|
||||
rdc_status_t rdc_health_get(rdc_gpu_group_t group_id, unsigned int* components) override;
|
||||
rdc_status_t rdc_health_check(rdc_gpu_group_t group_id, rdc_health_response_t *response) override;
|
||||
rdc_status_t rdc_health_clear(rdc_gpu_group_t group_id) override;
|
||||
rdc_status_t rdc_device_topology_get(uint32_t gpu_index, rdc_device_topology_t* results) override;
|
||||
|
||||
rdc_status_t rdc_link_status_get(rdc_link_status_t* results) override;
|
||||
|
||||
explicit RdcEmbeddedHandler(rdc_operation_mode_t op_mode);
|
||||
~RdcEmbeddedHandler() final;
|
||||
@@ -128,6 +133,7 @@ class RdcEmbeddedHandler final : public RdcHandler {
|
||||
RdcMetricsUpdaterPtr metrics_updater_;
|
||||
RdcPolicyPtr policy_;
|
||||
std::future<void> updater_;
|
||||
RdcTopologyLinkPtr topologylink_;
|
||||
};
|
||||
|
||||
} // namespace rdc
|
||||
|
||||
@@ -49,7 +49,8 @@ class RdcStandaloneHandler : public RdcHandler {
|
||||
uint32_t* count) override;
|
||||
rdc_status_t rdc_device_get_attributes(uint32_t gpu_index,
|
||||
rdc_device_attributes_t* p_rdc_attr) override;
|
||||
rdc_status_t rdc_device_get_component_version(rdc_component_t component, rdc_component_version_t* p_rdc_compv) override;
|
||||
rdc_status_t rdc_device_get_component_version(rdc_component_t component,
|
||||
rdc_component_version_t* p_rdc_compv) override;
|
||||
|
||||
// Group RdcAPI
|
||||
rdc_status_t rdc_group_gpu_create(rdc_group_type_t type, const char* group_name,
|
||||
@@ -110,6 +111,9 @@ class RdcStandaloneHandler : public RdcHandler {
|
||||
rdc_status_t rdc_health_get(rdc_gpu_group_t group_id, unsigned int* components) override;
|
||||
rdc_status_t rdc_health_check(rdc_gpu_group_t group_id, rdc_health_response_t *response) override;
|
||||
rdc_status_t rdc_health_clear(rdc_gpu_group_t group_id) override;
|
||||
rdc_status_t rdc_device_topology_get(uint32_t gpu_index, rdc_device_topology_t* results) override;
|
||||
|
||||
rdc_status_t rdc_link_status_get(rdc_link_status_t* results) override;
|
||||
|
||||
explicit RdcStandaloneHandler(const char* ip_and_port, const char* root_ca,
|
||||
const char* client_cert, const char* client_key);
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
/*
|
||||
Copyright (c) 2024 - present Advanced Micro Devices, Inc. All rights reserved.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
*/
|
||||
#ifndef INCLUDE_RDC_LIB_IMPL_RDCTOPOLINKYIMPL_H_
|
||||
#define INCLUDE_RDC_LIB_IMPL_RDCTOPOLINKYIMPL_H_
|
||||
|
||||
#include <atomic>
|
||||
#include <future>
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <mutex> // NOLINT
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include "amd_smi/amdsmi.h"
|
||||
#include "rdc_lib/RdcGroupSettings.h"
|
||||
#include "rdc_lib/RdcMetricFetcher.h"
|
||||
#include "rdc_lib/RdcTopologyLink.h"
|
||||
|
||||
namespace amd {
|
||||
namespace rdc {
|
||||
|
||||
class RdcTopologyLinkImpl : public RdcTopologyLink {
|
||||
public:
|
||||
RdcTopologyLinkImpl(const RdcGroupSettingsPtr& group_settings,
|
||||
RdcMetricFetcherPtr metric_fetcher);
|
||||
~RdcTopologyLinkImpl();
|
||||
|
||||
rdc_status_t rdc_device_topology_get(uint32_t gpu_index, rdc_device_topology_t* results) override;
|
||||
rdc_status_t rdc_link_status_get(rdc_link_status_t* results) override;
|
||||
|
||||
private:
|
||||
RdcGroupSettingsPtr group_settings_;
|
||||
RdcMetricFetcherPtr metric_fetcher_;
|
||||
|
||||
};
|
||||
|
||||
} // namespace rdc
|
||||
} // namespace amd
|
||||
|
||||
#endif // INCLUDE_RDC_LIB_IMPL_RDCTOPOLINKYIMPL_H_
|
||||
Reference in New Issue
Block a user