Change AMDSmiDevice to AMDSmiProcessor

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

Change-Id: Ib71e11d7122699cc62df3c4e9711ce3fc51e6fdf


[ROCm/amdsmi commit: c4aa7d2c03]
Этот коммит содержится в:
Suma Hegde
2023-02-25 05:24:03 -05:00
коммит произвёл Naveen Krishna Chatradhi
родитель 77728c48f3
Коммит 86a4cc3d11
6 изменённых файлов: 22 добавлений и 22 удалений
+6 -6
Просмотреть файл
@@ -41,18 +41,18 @@
*
*/
#ifndef AMD_SMI_INCLUDE_AMD_SMI_DEVICE_H_
#define AMD_SMI_INCLUDE_AMD_SMI_DEVICE_H_
#ifndef AMD_SMI_INCLUDE_AMD_SMI_PROCESSOR_H_
#define AMD_SMI_INCLUDE_AMD_SMI_PROCESSOR_H_
#include "amd_smi/amdsmi.h"
namespace amd {
namespace smi {
class AMDSmiDevice {
class AMDSmiProcessor {
public:
explicit AMDSmiDevice(device_type_t device) : device_type_(device) {}
virtual ~AMDSmiDevice() {}
explicit AMDSmiProcessor(device_type_t device) : device_type_(device) {}
virtual ~AMDSmiProcessor() {}
device_type_t get_device_type() const { return device_type_;}
private:
device_type_t device_type_;
@@ -62,4 +62,4 @@ class AMDSmiDevice {
} // namespace smi
} // namespace amd
#endif // AMD_SMI_INCLUDE_AMD_SMI_DEVICE_H_
#endif // AMD_SMI_INCLUDE_AMD_SMI_PROCESSOR_H_
+3 -3
Просмотреть файл
@@ -52,13 +52,13 @@
namespace amd {
namespace smi {
class AMDSmiGPUDevice: public AMDSmiDevice {
class AMDSmiGPUDevice: public AMDSmiProcessor {
public:
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):
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();
}
~AMDSmiGPUDevice() {
+3 -3
Просмотреть файл
@@ -58,12 +58,12 @@ class AMDSmiSocket {
explicit AMDSmiSocket(const std::string& id) : socket_identifier_(id) {}
~AMDSmiSocket();
const std::string& get_socket_id() const { return socket_identifier_;}
void add_device(AMDSmiDevice* device) { devices_.push_back(device); }
std::vector<AMDSmiDevice*>& get_devices() { return devices_;}
void add_device(AMDSmiProcessor* device) { devices_.push_back(device); }
std::vector<AMDSmiProcessor*>& get_devices() { return devices_;}
amdsmi_status_t get_device_count(uint32_t* device_count) const;
private:
std::string socket_identifier_;
std::vector<AMDSmiDevice*> devices_;
std::vector<AMDSmiProcessor*> devices_;
};
} // namespace smi
+2 -2
Просмотреть файл
@@ -70,7 +70,7 @@ class AMDSmiSystem {
AMDSmiSocket** socket);
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_device_handle* device_handle);
@@ -82,7 +82,7 @@ class AMDSmiSystem {
uint64_t init_flag_;
AMDSmiDrm drm_;
std::vector<AMDSmiSocket*> sockets_;
std::set<AMDSmiDevice*> devices_; // Track valid devices
std::set<AMDSmiProcessor*> devices_; // Track valid devices
};
+5 -5
Просмотреть файл
@@ -84,7 +84,7 @@ static amdsmi_status_t get_gpu_device_from_handle(amdsmi_device_handle device_ha
if (device_handle == nullptr || gpudevice == nullptr)
return AMDSMI_STATUS_INVAL;
amd::smi::AMDSmiDevice* device = nullptr;
amd::smi::AMDSmiProcessor* device = nullptr;
amdsmi_status_t r = amd::smi::AMDSmiSystem::getInstance()
.handle_to_device(device_handle, &device);
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;
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());
// Get the device count only
if (device_handles == nullptr) {
@@ -257,7 +257,7 @@ amdsmi_status_t amdsmi_get_device_type(amdsmi_device_handle device_handle ,
if (device_type == nullptr) {
return AMDSMI_STATUS_INVAL;
}
amd::smi::AMDSmiDevice* device = nullptr;
amd::smi::AMDSmiProcessor* device = nullptr;
amdsmi_status_t r = amd::smi::AMDSmiSystem::getInstance()
.handle_to_device(device_handle, &device);
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;
}
amd::smi::AMDSmiDevice* device = nullptr;
amd::smi::AMDSmiProcessor* device = nullptr;
amdsmi_status_t ret = amd::smi::AMDSmiSystem::getInstance()
.handle_to_device(device_handle, &device);
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;
}
amd::smi::AMDSmiDevice* amd_device = nullptr;
amd::smi::AMDSmiProcessor* amd_device = nullptr;
amdsmi_status_t ret = amd::smi::AMDSmiSystem::getInstance()
.handle_to_device(device_handle, &amd_device);
if (ret != AMDSMI_STATUS_SUCCESS) return ret;
+3 -3
Просмотреть файл
@@ -104,7 +104,7 @@ amdsmi_status_t AMDSmiSystem::populate_amd_gpu_devices() {
sockets_.push_back(socket);
}
AMDSmiDevice* device = new AMDSmiGPUDevice(i, drm_);
AMDSmiProcessor* device = new AMDSmiGPUDevice(i, drm_);
socket->add_device(device);
devices_.insert(device);
}
@@ -166,11 +166,11 @@ amdsmi_status_t AMDSmiSystem::handle_to_socket(
amdsmi_status_t AMDSmiSystem::handle_to_device(
amdsmi_device_handle device_handle,
AMDSmiDevice** device) {
AMDSmiProcessor** device) {
if (device_handle == nullptr || device == nullptr) {
return AMDSMI_STATUS_INVAL;
}
*device = static_cast<AMDSmiDevice*>(device_handle);
*device = static_cast<AMDSmiProcessor*>(device_handle);
// double check handlers is here
if (std::find(devices_.begin(), devices_.end(), *device)