Change AMDSmiDevice to AMDSmiProcessor

grep -rli 'AMDSmiDevice' * | xargs -i@ sed -i 's/AMDSmiDevice/AMDSmiProcessor/g' @

Change-Id: Ib71e11d7122699cc62df3c4e9711ce3fc51e6fdf
This commit is contained in:
Suma Hegde authored and Naveen Krishna Chatradhi committed 2023-05-11 10:08:40 -04:00
1 szülő 6cce103fba
commit c4aa7d2c03
6 files changed
+22 -22

No files matched your search

@@ -41,18 +41,18 @@
* *
*/ */
#ifndef AMD_SMI_INCLUDE_AMD_SMI_DEVICE_H_ #ifndef AMD_SMI_INCLUDE_AMD_SMI_PROCESSOR_H_
#define AMD_SMI_INCLUDE_AMD_SMI_DEVICE_H_ #define AMD_SMI_INCLUDE_AMD_SMI_PROCESSOR_H_
#include "amd_smi/amdsmi.h" #include "amd_smi/amdsmi.h"
namespace amd { namespace amd {
namespace smi { namespace smi {
class AMDSmiDevice { class AMDSmiProcessor {
public: public:
explicit AMDSmiDevice(device_type_t device) : device_type_(device) {} explicit AMDSmiProcessor(device_type_t device) : device_type_(device) {}
virtual ~AMDSmiDevice() {} virtual ~AMDSmiProcessor() {}
device_type_t get_device_type() const { return device_type_;} device_type_t get_device_type() const { return device_type_;}
private: private:
device_type_t device_type_; device_type_t device_type_;
@@ -62,4 +62,4 @@ class AMDSmiDevice {
} // namespace smi } // namespace smi
} // namespace amd } // namespace amd
#endif // AMD_SMI_INCLUDE_AMD_SMI_DEVICE_H_ #endif // AMD_SMI_INCLUDE_AMD_SMI_PROCESSOR_H_
@@ -52,13 +52,13 @@
namespace amd { namespace amd {
namespace smi { namespace smi {
class AMDSmiGPUDevice: public AMDSmiDevice { class AMDSmiGPUDevice: public AMDSmiProcessor {
public: public:
AMDSmiGPUDevice(uint32_t gpu_id, uint32_t fd, std::string path, amdsmi_bdf_t bdf, AMDSmiDrm& drm): AMDSmiGPUDevice(uint32_t gpu_id, uint32_t fd, std::string path, amdsmi_bdf_t bdf, AMDSmiDrm& drm):
AMDSmiDevice(AMD_GPU), gpu_id_(gpu_id), fd_(fd), path_(path), bdf_(bdf), drm_(drm) {} AMDSmiProcessor(AMD_GPU), gpu_id_(gpu_id), fd_(fd), path_(path), bdf_(bdf), drm_(drm) {}
AMDSmiGPUDevice(uint32_t gpu_id, AMDSmiDrm& drm): AMDSmiGPUDevice(uint32_t gpu_id, AMDSmiDrm& drm):
AMDSmiDevice(AMD_GPU), gpu_id_(gpu_id), drm_(drm) { AMDSmiProcessor(AMD_GPU), gpu_id_(gpu_id), drm_(drm) {
if (check_if_drm_is_supported()) this->get_drm_data(); if (check_if_drm_is_supported()) this->get_drm_data();
} }
~AMDSmiGPUDevice() { ~AMDSmiGPUDevice() {
@@ -58,12 +58,12 @@ class AMDSmiSocket {
explicit AMDSmiSocket(const std::string& id) : socket_identifier_(id) {} explicit AMDSmiSocket(const std::string& id) : socket_identifier_(id) {}
~AMDSmiSocket(); ~AMDSmiSocket();
const std::string& get_socket_id() const { return socket_identifier_;} const std::string& get_socket_id() const { return socket_identifier_;}
void add_device(AMDSmiDevice* device) { devices_.push_back(device); } void add_device(AMDSmiProcessor* device) { devices_.push_back(device); }
std::vector<AMDSmiDevice*>& get_devices() { return devices_;} std::vector<AMDSmiProcessor*>& get_devices() { return devices_;}
amdsmi_status_t get_device_count(uint32_t* device_count) const; amdsmi_status_t get_device_count(uint32_t* device_count) const;
private: private:
std::string socket_identifier_; std::string socket_identifier_;
std::vector<AMDSmiDevice*> devices_; std::vector<AMDSmiProcessor*> devices_;
}; };
} // namespace smi } // namespace smi
@@ -70,7 +70,7 @@ class AMDSmiSystem {
AMDSmiSocket** socket); AMDSmiSocket** socket);
amdsmi_status_t handle_to_device(amdsmi_device_handle device_handle, amdsmi_status_t handle_to_device(amdsmi_device_handle device_handle,
AMDSmiDevice** device); AMDSmiProcessor** device);
amdsmi_status_t gpu_index_to_handle(uint32_t gpu_index, amdsmi_status_t gpu_index_to_handle(uint32_t gpu_index,
amdsmi_device_handle* device_handle); amdsmi_device_handle* device_handle);
@@ -82,7 +82,7 @@ class AMDSmiSystem {
uint64_t init_flag_; uint64_t init_flag_;
AMDSmiDrm drm_; AMDSmiDrm drm_;
std::vector<AMDSmiSocket*> sockets_; std::vector<AMDSmiSocket*> sockets_;
std::set<AMDSmiDevice*> devices_; // Track valid devices std::set<AMDSmiProcessor*> devices_; // Track valid devices
}; };
+5 -5
Fájl megtekintése
@@ -84,7 +84,7 @@ static amdsmi_status_t get_gpu_device_from_handle(amdsmi_device_handle device_ha
if (device_handle == nullptr || gpudevice == nullptr) if (device_handle == nullptr || gpudevice == nullptr)
return AMDSMI_STATUS_INVAL; return AMDSMI_STATUS_INVAL;
amd::smi::AMDSmiDevice* device = nullptr; amd::smi::AMDSmiProcessor* device = nullptr;
amdsmi_status_t r = amd::smi::AMDSmiSystem::getInstance() amdsmi_status_t r = amd::smi::AMDSmiSystem::getInstance()
.handle_to_device(device_handle, &device); .handle_to_device(device_handle, &device);
if (r != AMDSMI_STATUS_SUCCESS) return r; if (r != AMDSMI_STATUS_SUCCESS) return r;
@@ -230,7 +230,7 @@ amdsmi_status_t amdsmi_get_device_handles(amdsmi_socket_handle socket_handle,
if (r != AMDSMI_STATUS_SUCCESS) return r; if (r != AMDSMI_STATUS_SUCCESS) return r;
std::vector<amd::smi::AMDSmiDevice*>& devices = socket->get_devices(); std::vector<amd::smi::AMDSmiProcessor*>& devices = socket->get_devices();
uint32_t device_size = static_cast<uint32_t>(devices.size()); uint32_t device_size = static_cast<uint32_t>(devices.size());
// Get the device count only // Get the device count only
if (device_handles == nullptr) { if (device_handles == nullptr) {
@@ -257,7 +257,7 @@ amdsmi_status_t amdsmi_get_device_type(amdsmi_device_handle device_handle ,
if (device_type == nullptr) { if (device_type == nullptr) {
return AMDSMI_STATUS_INVAL; return AMDSMI_STATUS_INVAL;
} }
amd::smi::AMDSmiDevice* device = nullptr; amd::smi::AMDSmiProcessor* device = nullptr;
amdsmi_status_t r = amd::smi::AMDSmiSystem::getInstance() amdsmi_status_t r = amd::smi::AMDSmiSystem::getInstance()
.handle_to_device(device_handle, &device); .handle_to_device(device_handle, &device);
if (r != AMDSMI_STATUS_SUCCESS) return r; if (r != AMDSMI_STATUS_SUCCESS) return r;
@@ -355,7 +355,7 @@ amdsmi_status_t amdsmi_get_vram_usage(amdsmi_device_handle device_handle,
return AMDSMI_STATUS_INVAL; return AMDSMI_STATUS_INVAL;
} }
amd::smi::AMDSmiDevice* device = nullptr; amd::smi::AMDSmiProcessor* device = nullptr;
amdsmi_status_t ret = amd::smi::AMDSmiSystem::getInstance() amdsmi_status_t ret = amd::smi::AMDSmiSystem::getInstance()
.handle_to_device(device_handle, &device); .handle_to_device(device_handle, &device);
if (ret != AMDSMI_STATUS_SUCCESS) return ret; if (ret != AMDSMI_STATUS_SUCCESS) return ret;
@@ -397,7 +397,7 @@ amdsmi_status_t amdsmi_get_caps_info(amdsmi_device_handle device_handle,
return AMDSMI_STATUS_INVAL; return AMDSMI_STATUS_INVAL;
} }
amd::smi::AMDSmiDevice* amd_device = nullptr; amd::smi::AMDSmiProcessor* amd_device = nullptr;
amdsmi_status_t ret = amd::smi::AMDSmiSystem::getInstance() amdsmi_status_t ret = amd::smi::AMDSmiSystem::getInstance()
.handle_to_device(device_handle, &amd_device); .handle_to_device(device_handle, &amd_device);
if (ret != AMDSMI_STATUS_SUCCESS) return ret; if (ret != AMDSMI_STATUS_SUCCESS) return ret;
+3 -3
Fájl megtekintése
@@ -104,7 +104,7 @@ amdsmi_status_t AMDSmiSystem::populate_amd_gpu_devices() {
sockets_.push_back(socket); sockets_.push_back(socket);
} }
AMDSmiDevice* device = new AMDSmiGPUDevice(i, drm_); AMDSmiProcessor* device = new AMDSmiGPUDevice(i, drm_);
socket->add_device(device); socket->add_device(device);
devices_.insert(device); devices_.insert(device);
} }
@@ -166,11 +166,11 @@ amdsmi_status_t AMDSmiSystem::handle_to_socket(
amdsmi_status_t AMDSmiSystem::handle_to_device( amdsmi_status_t AMDSmiSystem::handle_to_device(
amdsmi_device_handle device_handle, amdsmi_device_handle device_handle,
AMDSmiDevice** device) { AMDSmiProcessor** device) {
if (device_handle == nullptr || device == nullptr) { if (device_handle == nullptr || device == nullptr) {
return AMDSMI_STATUS_INVAL; return AMDSMI_STATUS_INVAL;
} }
*device = static_cast<AMDSmiDevice*>(device_handle); *device = static_cast<AMDSmiProcessor*>(device_handle);
// double check handlers is here // double check handlers is here
if (std::find(devices_.begin(), devices_.end(), *device) if (std::find(devices_.begin(), devices_.end(), *device)