Revert "Fix breaking changes introduced with CPU support"
This reverts commit e9ac9e4626e3e45ebdfafb39e251d073091429f1.
[ROCm/rdc commit: c96f5db52c]
This commit is contained in:
committed by
Galantsev, Dmitrii
vanhempi
3e8f56c430
commit
8afcedfc96
@@ -50,18 +50,11 @@ class smi_initializer {
|
||||
// Make sure smi will not be initialized multiple times
|
||||
amdsmi_shut_down();
|
||||
amdsmi_status_t ret;
|
||||
uint64_t init_flag_ = AMDSMI_INIT_AMD_GPUS;
|
||||
#ifdef ENABLE_ESMI_LIB
|
||||
init_flag_ = init_flag_ | AMDSMI_INIT_AMD_CPUS;
|
||||
#endif
|
||||
uint64_t init_flag_;
|
||||
//initialize CPU and GPU instances
|
||||
init_flag_ = AMDSMI_INIT_AMD_GPUS | AMDSMI_INIT_AMD_CPUS;
|
||||
ret = amdsmi_init(init_flag_);
|
||||
if (init_flag_ & AMDSMI_INIT_AMD_CPUS) {
|
||||
RDC_LOG(RDC_ERROR,
|
||||
"Failed to initalize amdsmi with CPUs and GPUs enabled.. trying GPUs only.");
|
||||
ret = amdsmi_init(AMDSMI_INIT_AMD_GPUS);
|
||||
}
|
||||
if (ret != AMDSMI_STATUS_SUCCESS) {
|
||||
RDC_LOG(RDC_ERROR, "SMI FAILED with" << ret);
|
||||
throw amd::rdc::RdcException(RDC_ST_FAIL_LOAD_MODULE, "SMI initialize fail");
|
||||
}
|
||||
}
|
||||
@@ -205,15 +198,14 @@ rdc_status_t RdcEmbeddedHandler::rdc_device_get_all(uint32_t gpu_index_list[RDC_
|
||||
}
|
||||
|
||||
// Discovery API
|
||||
rdc_status_t RdcEmbeddedHandler::rdc_device_get_all_cpu(
|
||||
uint32_t cpu_index_list[RDC_MAX_NUM_DEVICES], uint32_t* count) {
|
||||
rdc_status_t RdcEmbeddedHandler::rdc_device_get_all_cpu(uint32_t cpu_index_list[RDC_MAX_NUM_DEVICES],
|
||||
uint32_t* count) {
|
||||
if (!count) {
|
||||
return RDC_ST_BAD_PARAMETER;
|
||||
}
|
||||
|
||||
rdc_field_value device_count;
|
||||
rdc_status_t status =
|
||||
metric_fetcher_->fetch_smi_cpu_field(0, RDC_FI_DEV_CPU_COUNT, &device_count);
|
||||
rdc_status_t status = metric_fetcher_->fetch_smi_cpu_field(0, RDC_FI_DEV_CPU_COUNT, &device_count);
|
||||
if (status != RDC_ST_OK) {
|
||||
std::cout << "rdc_device_get_all_cpu failed to get cpu count";
|
||||
return status;
|
||||
@@ -224,9 +216,9 @@ rdc_status_t RdcEmbeddedHandler::rdc_device_get_all_cpu(
|
||||
for (uint32_t i = 0; i < *count; i++) {
|
||||
cpu_index_list[i] = i;
|
||||
}
|
||||
|
||||
return RDC_ST_OK;
|
||||
}
|
||||
|
||||
rdc_status_t RdcEmbeddedHandler::rdc_device_get_attributes(uint32_t gpu_index,
|
||||
rdc_device_attributes_t* p_rdc_attr) {
|
||||
if (!p_rdc_attr) {
|
||||
@@ -238,15 +230,14 @@ rdc_status_t RdcEmbeddedHandler::rdc_device_get_attributes(uint32_t gpu_index,
|
||||
return status;
|
||||
}
|
||||
|
||||
rdc_status_t RdcEmbeddedHandler::rdc_device_get_cpu_attributes(
|
||||
uint32_t cpu_index, rdc_device_attributes_t* p_rdc_attr) {
|
||||
rdc_status_t RdcEmbeddedHandler::rdc_device_get_cpu_attributes(uint32_t cpu_index,
|
||||
rdc_device_attributes_t* p_rdc_attr) {
|
||||
if (!p_rdc_attr) {
|
||||
return RDC_ST_BAD_PARAMETER;
|
||||
}
|
||||
rdc_field_value device_name;
|
||||
|
||||
rdc_status_t status =
|
||||
metric_fetcher_->fetch_smi_cpu_field(cpu_index, RDC_FI_DEV_CPU_MODEL, &device_name);
|
||||
rdc_status_t status = metric_fetcher_->fetch_smi_cpu_field(cpu_index, RDC_FI_DEV_CPU_MODEL, &device_name);
|
||||
strncpy_with_null(p_rdc_attr->device_name, device_name.value.str, RDC_MAX_STR_LENGTH);
|
||||
|
||||
return status;
|
||||
|
||||
@@ -1338,8 +1338,6 @@ rdc_status_t RdcMetricFetcherImpl::fetch_smi_cpu_field(uint32_t cpu_index, rdc_f
|
||||
value->status = Smi2RdcError(ret);
|
||||
break;
|
||||
}
|
||||
#ifdef ENABLE_ESMI_LIB
|
||||
// amdsmi_cpu_info_t is only defined if ENABLE_ESMI_LIB is set
|
||||
case RDC_FI_DEV_CPU_MODEL: {
|
||||
amdsmi_cpu_info_t cpu_info;
|
||||
value->status = amdsmi_get_cpu_model_name(processor_handle, &cpu_info);
|
||||
@@ -1349,7 +1347,6 @@ rdc_status_t RdcMetricFetcherImpl::fetch_smi_cpu_field(uint32_t cpu_index, rdc_f
|
||||
}
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
default: {
|
||||
RDC_LOG(RDC_ERROR, "field_id is not supported: " << field_id);
|
||||
break;
|
||||
|
||||
Viittaa uudesa ongelmassa
Block a user