amd-smi: fix cpu specific apis and header
1. provide prototype and documentation for esmi specific api.
define structures and update classes as required
2. update cmake files as required and add esmi api to the
amdsmi esmi integration example.
Change-Id: I753ec176f9b381e74c9646525dfd9075237bf8d9
[ROCm/amdsmi commit: 65eed73f4d]
Tento commit je obsažen v:
odevzdal
khashaik
rodič
4f502e5dab
revize
4bd015f945
@@ -86,7 +86,7 @@ int main(int argc, char **argv) {
|
||||
// Get all sockets
|
||||
uint32_t socket_count = 0;
|
||||
|
||||
ret = amdsmi_get_cpusocket_handles(&socket_count, nullptr);
|
||||
/*ret = amdsmi_get_cpusocket_handles(&socket_count, nullptr);
|
||||
CHK_AMDSMI_RET(ret)
|
||||
|
||||
// Allocate the memory for the sockets
|
||||
@@ -94,528 +94,170 @@ int main(int argc, char **argv) {
|
||||
|
||||
// Get the sockets of the system
|
||||
ret = amdsmi_get_cpusocket_handles(&socket_count, &sockets[0]);
|
||||
CHK_AMDSMI_RET(ret)*/
|
||||
ret = amdsmi_get_socket_handles(&socket_count, nullptr);
|
||||
CHK_AMDSMI_RET(ret)
|
||||
// Allocate the memory for the sockets
|
||||
vector<amdsmi_socket_handle> sockets(socket_count);
|
||||
// Get the sockets of the system
|
||||
ret = amdsmi_get_socket_handles(&socket_count, &sockets[0]);
|
||||
CHK_AMDSMI_RET(ret)
|
||||
|
||||
cout << "Total Socket: " << socket_count << endl;
|
||||
|
||||
// For each socket, get identifier and cores
|
||||
for (uint8_t i = 0; i < socket_count; i++) {
|
||||
// Get Socket info
|
||||
uint32_t socket_info = 0;
|
||||
ret = amdsmi_get_cpusocket_info(sockets[i], socket_info);
|
||||
CHK_AMDSMI_RET(ret)
|
||||
cout << "Socket " << socket_info << endl;
|
||||
|
||||
// Get the core count available for the socket.
|
||||
uint32_t cpu_count = 0;
|
||||
uint32_t core_count = 0;
|
||||
ret = amdsmi_get_cpucore_handles(sockets[i], &core_count, nullptr);
|
||||
processor_type_t processor_type = AMD_CPU;
|
||||
ret = amdsmi_get_processor_handles_by_type(sockets[i], processor_type, nullptr, &cpu_count);
|
||||
CHK_AMDSMI_RET(ret)
|
||||
|
||||
// Allocate the memory for the cpu core handles on the socket
|
||||
vector<amdsmi_processor_handle> processor_handles(core_count);
|
||||
// Get all cores of the socket
|
||||
ret = amdsmi_get_cpucore_handles(sockets[i],
|
||||
&core_count, &processor_handles[0]);
|
||||
vector<amdsmi_processor_handle> plist(cpu_count);
|
||||
ret = amdsmi_get_processor_handles_by_type(sockets[i], processor_type, &plist[0], &cpu_count);
|
||||
CHK_AMDSMI_RET(ret)
|
||||
cout << "core_count=" << core_count << endl;
|
||||
|
||||
ret = amdsmi_get_cpu_hsmp_proto_ver(sockets[i], &proto_ver);
|
||||
cout << endl;
|
||||
// Read core count for each sockets
|
||||
processor_type = AMD_CPU_CORE;
|
||||
ret = amdsmi_get_processor_handles_by_type(sockets[i], processor_type, nullptr, &core_count);
|
||||
CHK_AMDSMI_RET(ret)
|
||||
|
||||
cout<<"\n------------------------------------------";
|
||||
cout<<"\n| HSMP Proto Version | "<< proto_ver <<"\t\t |"<< endl;
|
||||
cout<<"------------------------------------------\n";
|
||||
|
||||
ret = amdsmi_get_cpu_smu_fw_version(sockets[i], &smu_fw);
|
||||
vector<amdsmi_processor_handle> core_list(core_count);
|
||||
ret = amdsmi_get_processor_handles_by_type(sockets[i], processor_type, &core_list[0], &core_count);
|
||||
CHK_AMDSMI_RET(ret)
|
||||
for (int index = 0; index < plist.size(); index++) {
|
||||
socket_count = plist.size();
|
||||
ret = amdsmi_get_cpu_hsmp_proto_ver(plist[i], &proto_ver);
|
||||
CHK_AMDSMI_RET(ret)
|
||||
|
||||
cout<<"\n------------------------------------------";
|
||||
cout<<"\n| SMU FW Version | "
|
||||
<<(unsigned)smu_fw.major<<"."
|
||||
<<(unsigned)smu_fw.minor<<"."
|
||||
<<(unsigned)smu_fw.debug
|
||||
<<"\t\t |"<<endl;
|
||||
cout<<"------------------------------------------\n";
|
||||
cout<<"\n------------------------------------------";
|
||||
cout<<"\n| HSMP Proto Version | "<< proto_ver <<"\t\t |"<< endl;
|
||||
cout<<"------------------------------------------\n";
|
||||
|
||||
uint32_t err_bits = 0;
|
||||
ret = amdsmi_get_cpu_smu_fw_version(plist[i], &smu_fw);
|
||||
CHK_AMDSMI_RET(ret)
|
||||
|
||||
uint32_t prochot;
|
||||
cout<<"\n-------------------------------------------------";
|
||||
cout<<"\n| Sensor Name\t\t\t |";
|
||||
for (uint32_t i = 0; i < socket_count; i++) {
|
||||
cout<<setprecision(3)<<" Socket "<<i<<"\t|";
|
||||
}
|
||||
cout<<"\n-------------------------------------------------";
|
||||
cout<<"\n| ProchotStatus:\t\t |";
|
||||
ret = amdsmi_get_cpu_prochot_status(sockets[i], i, &prochot);
|
||||
CHK_AMDSMI_RET(ret)
|
||||
if (!ret) {
|
||||
cout<<setprecision(7)<< (prochot ? "active" : "inactive")<<"\t|";
|
||||
} else {
|
||||
err_bits |= 1 << ret;
|
||||
cout<<" NA (Err:" <<ret<<" |";
|
||||
}
|
||||
cout<<"\n-------------------------------------------------\n";
|
||||
cout<<"\n------------------------------------------";
|
||||
cout<<"\n| SMU FW Version | "
|
||||
<<(unsigned)smu_fw.major<<"."
|
||||
<<(unsigned)smu_fw.minor<<"."
|
||||
<<(unsigned)smu_fw.debug
|
||||
<<"\t\t |"<<endl;
|
||||
cout<<"------------------------------------------\n";
|
||||
|
||||
size_t len;
|
||||
char str[SHOWLINESZ] = {};
|
||||
int retVal = 0;
|
||||
cout<<"\n-------------------------------------------------";
|
||||
cout<<"\n| Sensor Name\t\t\t |";
|
||||
for (uint32_t i = 0; i < socket_count; i++) {
|
||||
cout<<setprecision(3)<<" Socket "<<i<<"\t|";
|
||||
}
|
||||
cout<<"\n-------------------------------------------------";
|
||||
cout<<"\n| fclk (Mhz)\t\t\t |";
|
||||
retVal = snprintf(str, SHOWLINESZ, "\n| mclk (Mhz)\t\t\t |");
|
||||
uint32_t err_bits = 0;
|
||||
|
||||
len = strlen(str);
|
||||
uint32_t fclk, mclk, cclk;
|
||||
err_bits = 0;
|
||||
ret = amdsmi_get_cpu_fclk_mclk(sockets[i], i, &fclk, &mclk);
|
||||
CHK_AMDSMI_RET(ret)
|
||||
if (!ret) {
|
||||
cout<<setprecision(7)<<" "<<fclk<<"\t\t|";
|
||||
retVal = snprintf(str + len, SHOWLINESZ - len, " %d\t\t|", mclk);
|
||||
} else {
|
||||
err_bits |= 1 << ret;
|
||||
cout<<" NA (Err: "<<setprecision(2)<<ret<<" |";
|
||||
retVal = snprintf(str + len, SHOWLINESZ - len, " NA (Err: %-2d) |", ret);
|
||||
}
|
||||
if (retVal > 0 && retVal < SHOWLINESZ)
|
||||
cout << str;
|
||||
else
|
||||
cout <<"error writing to buffer" << endl;
|
||||
uint32_t prochot;
|
||||
cout<<"\n-------------------------------------------------";
|
||||
cout<<"\n| Sensor Name\t\t\t |";
|
||||
for (uint32_t i = 0; i < socket_count; i++) {
|
||||
cout<<setprecision(3)<<" Socket "<<i<<"\t|";
|
||||
}
|
||||
cout<<"\n-------------------------------------------------";
|
||||
cout<<"\n| ProchotStatus:\t\t |";
|
||||
ret = amdsmi_get_cpu_prochot_status(plist[i], &prochot);
|
||||
CHK_AMDSMI_RET(ret)
|
||||
if (!ret) {
|
||||
cout<<setprecision(7)<< (prochot ? "active" : "inactive")<<"\t|";
|
||||
} else {
|
||||
err_bits |= 1 << ret;
|
||||
cout<<" NA (Err:" <<ret<<" |";
|
||||
}
|
||||
cout<<"\n-------------------------------------------------\n";
|
||||
|
||||
cout<<"\n-------------------------------------------------\n";
|
||||
cout<<"-----------------------------------------------------------------";
|
||||
ret = amdsmi_get_cpu_cclk_limit(sockets[i], i, &cclk);
|
||||
CHK_AMDSMI_RET(ret)
|
||||
cout<<"\n| SOCKET["<<i<<"] core clock current frequency limit (MHz) : "<<cclk<<"\t|\n";
|
||||
cout<<"-----------------------------------------------------------------\n";
|
||||
size_t len;
|
||||
char str[SHOWLINESZ] = {};
|
||||
int retVal = 0;
|
||||
cout<<"\n-------------------------------------------------";
|
||||
cout<<"\n| Sensor Name\t\t\t |";
|
||||
for (uint32_t i = 0; i < socket_count; i++) {
|
||||
cout<<setprecision(3)<<" Socket "<<i<<"\t|";
|
||||
}
|
||||
cout<<"\n-------------------------------------------------";
|
||||
cout<<"\n| fclk (Mhz)\t\t\t |";
|
||||
retVal = snprintf(str, SHOWLINESZ, "\n| mclk (Mhz)\t\t\t |");
|
||||
|
||||
uint32_t c_clk = 0;
|
||||
ret = amdsmi_get_cpu_core_current_freq_limit(processor_handles[i], i, &c_clk);
|
||||
CHK_AMDSMI_RET(ret)
|
||||
len = strlen(str);
|
||||
uint32_t fclk, mclk, cclk;
|
||||
err_bits = 0;
|
||||
ret = amdsmi_get_cpu_fclk_mclk(plist[i], &fclk, &mclk);
|
||||
CHK_AMDSMI_RET(ret)
|
||||
if (!ret) {
|
||||
cout<<setprecision(7)<<" "<<fclk<<"\t\t|";
|
||||
retVal = snprintf(str + len, SHOWLINESZ - len, " %d\t\t|", mclk);
|
||||
} else {
|
||||
err_bits |= 1 << ret;
|
||||
cout<<" NA (Err: "<<setprecision(2)<<ret<<" |";
|
||||
retVal = snprintf(str + len, SHOWLINESZ - len, " NA (Err: %-2d) |", ret);
|
||||
}
|
||||
if (retVal > 0 && retVal < SHOWLINESZ)
|
||||
cout << str;
|
||||
else
|
||||
cout <<"error writing to buffer" << endl;
|
||||
|
||||
cout<<"--------------------------------------------------------------";
|
||||
cout<<"\n| CPU["<<i<<"] core clock current frequency limit (MHz) : "<<c_clk<<"\t|\n";
|
||||
cout<<"--------------------------------------------------------------\n";
|
||||
cout<<"\n-------------------------------------------------\n";
|
||||
|
||||
uint32_t socket_power;
|
||||
cout<<"\n-------------------------------------------------";
|
||||
cout<<"\n| Sensor Name\t\t\t |";
|
||||
for (uint32_t i = 0; i < socket_count; i++) {
|
||||
cout<<setprecision(3)<<" Socket "<<i<<"\t|";
|
||||
}
|
||||
cout<<"\n-------------------------------------------------";
|
||||
cout<<"\n| Power (Watts)\t\t\t | ";
|
||||
uint32_t socket_power;
|
||||
cout<<"\n-------------------------------------------------";
|
||||
cout<<"\n| Sensor Name\t\t\t |";
|
||||
for (uint32_t i = 0; i < socket_count; i++) {
|
||||
cout<<setprecision(3)<<" Socket "<<i<<"\t|";
|
||||
}
|
||||
cout<<"\n-------------------------------------------------";
|
||||
cout<<"\n| Power (Watts)\t\t\t | ";
|
||||
|
||||
ret = amdsmi_get_cpu_socket_power(sockets[i], i, &socket_power);
|
||||
CHK_AMDSMI_RET(ret)
|
||||
ret = amdsmi_get_cpu_socket_power(plist[i], &socket_power);
|
||||
CHK_AMDSMI_RET(ret)
|
||||
|
||||
if (!ret) {
|
||||
cout<<fixed<<setprecision(3)<<static_cast<double>(socket_power)/1000<<"\t|";
|
||||
} else {
|
||||
err_bits |= 1 << ret;
|
||||
cout<<" NA (Err:" <<ret<<" |";
|
||||
}
|
||||
|
||||
uint32_t power_limit;
|
||||
cout<<"\n| PowerLimit (Watts)\t\t | ";
|
||||
|
||||
ret = amdsmi_get_cpu_socket_power_cap(sockets[i], i, &power_limit);
|
||||
CHK_AMDSMI_RET(ret)
|
||||
|
||||
if (!ret) {
|
||||
cout<<fixed<<setprecision(3)<<static_cast<double>(power_limit)/1000<<"\t|";
|
||||
} else {
|
||||
err_bits |= 1 << ret;
|
||||
cout<<" NA (Err:" <<ret<<" |";
|
||||
}
|
||||
|
||||
uint32_t power_max;
|
||||
cout<<"\n| PowerLimitMax (Watts)\t\t | ";
|
||||
|
||||
ret = amdsmi_get_cpu_socket_power_cap_max(sockets[i], i, &power_max);
|
||||
CHK_AMDSMI_RET(ret)
|
||||
|
||||
if (!ret) {
|
||||
cout<<fixed<<setprecision(3)<<static_cast<double>(power_max)/1000<<"\t|";
|
||||
} else {
|
||||
err_bits |= 1 << ret;
|
||||
cout<<" NA (Err:" <<ret<<" |";
|
||||
}
|
||||
cout<<"\n-------------------------------------------------\n";
|
||||
|
||||
uint32_t input_power;
|
||||
power_max = 0;
|
||||
cout<<"\nEnter the max power to be set:\n";
|
||||
cin>>input_power;
|
||||
ret = amdsmi_get_cpu_socket_power_cap_max(sockets[i], i, &power_max);
|
||||
CHK_AMDSMI_RET(ret)
|
||||
if ((ret == AMDSMI_STATUS_SUCCESS) && (input_power > power_max)) {
|
||||
cout<<"Input power is more than max power limit,"
|
||||
" limiting to "<<static_cast<double>(power_max)/1000<<"Watts\n";
|
||||
input_power = power_max;
|
||||
}
|
||||
ret = amdsmi_set_cpu_socket_power_cap(sockets[i], i, input_power);
|
||||
CHK_AMDSMI_RET(ret)
|
||||
if (!ret) {
|
||||
cout<<"Socket["<<i<<"] power_limit set to "
|
||||
<<fixed<<setprecision(3)<<static_cast<double>(input_power)/1000<<" Watts successfully\n";
|
||||
}
|
||||
cout<<"\n-------------------------------------------------\n";
|
||||
|
||||
uint8_t mode;
|
||||
const char *err_str;
|
||||
cout <<"Enter the power efficiency mode to be set[0, 1 or 2]:\n";
|
||||
cin>>mode;
|
||||
ret = amdsmi_set_cpu_pwr_efficiency_mode(sockets[i], i, mode);
|
||||
CHK_AMDSMI_RET(ret)
|
||||
|
||||
if (ret != AMDSMI_STATUS_SUCCESS) {
|
||||
cout<<"Failed to set power efficiency mode for socket["<<i<<"], Err["
|
||||
<<ret<<"]: "<<*amdsmi_get_esmi_err_msg(ret, &err_str)<<"\n";
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (!ret)
|
||||
cout<<"Power efficiency profile policy is set to "<<mode<<"successfully\n";
|
||||
|
||||
cout<<"\n-------------------------------------------------\n";
|
||||
|
||||
uint32_t svi_power;
|
||||
cout<<"\n| SVI Power Telemetry (mWatts) \t |";
|
||||
|
||||
ret = amdsmi_get_cpu_pwr_svi_telemetry_all_rails(sockets[i], i, &svi_power);
|
||||
CHK_AMDSMI_RET(ret)
|
||||
|
||||
if (!ret) {
|
||||
cout<<fixed<<setprecision(3)<<static_cast<double>(svi_power)/1000<<"\t|";
|
||||
} else {
|
||||
err_bits |= 1 << ret;
|
||||
cout<<" NA (Err:" <<ret<<" |";
|
||||
}
|
||||
cout<<"\n-------------------------------------------------\n";
|
||||
|
||||
uint32_t boost_limit = 0;
|
||||
const char *err_str1;
|
||||
ret = amdsmi_get_cpu_core_boostlimit(processor_handles[i], i, &boost_limit);
|
||||
CHK_AMDSMI_RET(ret)
|
||||
|
||||
if(ret)
|
||||
cout<<"Failed: to get core"<<"["<<i<<"] boostlimit, Err["<<ret<<"]: "
|
||||
<<*amdsmi_get_esmi_err_msg(ret, &err_str1)<<endl;
|
||||
else
|
||||
cout<<"| core["<<i<<"] boostlimit (MHz)\t | "<<boost_limit<<" \t |\n";
|
||||
|
||||
cout<<"\n-------------------------------------------------\n";
|
||||
|
||||
boost_limit = 0;
|
||||
cout<<"\nEnter the boost limit to be set:\n";
|
||||
cin>>boost_limit;
|
||||
ret = amdsmi_set_cpu_core_boostlimit(processor_handles[i], i, boost_limit);
|
||||
CHK_AMDSMI_RET(ret)
|
||||
|
||||
if(ret != AMDSMI_STATUS_SUCCESS)
|
||||
cout<<"Failed: to set core"<<"["<<i<<"] boostlimit, Err["<<ret<<"]: "
|
||||
<<*amdsmi_get_esmi_err_msg(ret, &err_str1)<<endl;
|
||||
|
||||
ret = amdsmi_get_cpu_core_boostlimit(processor_handles[i], i, &boost_limit);
|
||||
CHK_AMDSMI_RET(ret)
|
||||
|
||||
if(ret)
|
||||
cout<<"Failed: to get core"<<"["<<i<<"] boostlimit, Err["<<ret<<"]: "
|
||||
<<*amdsmi_get_esmi_err_msg(ret, &err_str1)<<endl;
|
||||
else
|
||||
cout<<"| core["<<i<<"] boostlimit (MHz)\t | "<<boost_limit<<" \t |\n";
|
||||
cout<<"\n-------------------------------------------------\n";
|
||||
|
||||
ret = amdsmi_set_cpu_socket_boostlimit(sockets[i], i, boost_limit);
|
||||
CHK_AMDSMI_RET(ret)
|
||||
|
||||
if(ret)
|
||||
cout<<"Failed: to set socket"<<"["<<i<<"] boostlimit, Err["<<ret<<"]: "
|
||||
<<*amdsmi_get_esmi_err_msg(ret, &err_str1)<<endl;
|
||||
|
||||
cout<<"\n-------------------------------------------------\n";
|
||||
|
||||
uint32_t residency = 0;
|
||||
ret = amdsmi_get_cpu_socket_c0_residency(sockets[i], i, &residency);
|
||||
CHK_AMDSMI_RET(ret)
|
||||
|
||||
if(ret != AMDSMI_STATUS_SUCCESS)
|
||||
cout<<"Failed: to get socket"<<"["<<i<<"] c0_residency, Err["<<ret<<"]: "
|
||||
<<*amdsmi_get_esmi_err_msg(ret, &err_str1)<<endl;
|
||||
else
|
||||
cout<<"| socket["<<i<<"] c0_residency(%) | "<<residency<<" |\n";
|
||||
|
||||
cout<<"\n-------------------------------------------------\n";
|
||||
|
||||
cout<<"\n| DDR Bandwidth\t\t\t\t |\n";
|
||||
amdsmi_ddr_bw_metrics_t ddr;
|
||||
ret = amdsmi_get_cpu_ddr_bw(sockets[i], &ddr);
|
||||
CHK_AMDSMI_RET(ret)
|
||||
|
||||
if(!ret) {
|
||||
cout<<"\n| \tDDR Max BW (GB/s)\t |"<<ddr.max_bw<<"\t|"<<endl;
|
||||
cout<<"\n| \tDDR Utilized BW (GB/s)\t |"<<ddr.utilized_bw<<"\t|"<<endl;
|
||||
cout<<"\n| \tDDR Utilized Percent(%)\t |"<<ddr.utilized_pct<<"\t|"<<endl;
|
||||
if (!ret) {
|
||||
cout<<fixed<<setprecision(3)<<static_cast<double>(socket_power)/1000<<"\t|";
|
||||
} else {
|
||||
err_bits |= 1 << ret;
|
||||
cout<<" NA (Err:" <<ret<<" |";
|
||||
}
|
||||
|
||||
cout<<"\n-------------------------------------------------\n";
|
||||
uint32_t power_limit;
|
||||
cout<<"\n| PowerLimit (Watts)\t\t | ";
|
||||
|
||||
uint32_t tmon;
|
||||
cout<<"\n| Socket temperature (°C)\t\t |";
|
||||
ret = amdsmi_get_cpu_socket_temperature(sockets[i], i, &tmon);
|
||||
CHK_AMDSMI_RET(ret)
|
||||
ret = amdsmi_get_cpu_socket_power_cap(plist[i], &power_limit);
|
||||
CHK_AMDSMI_RET(ret)
|
||||
|
||||
if (!ret) {
|
||||
cout<<fixed<<setprecision(3)<<""<<(double)tmon/1000<<"|";
|
||||
} else {
|
||||
err_bits |= 1 << ret;
|
||||
cout<<" NA (Err: "<<ret<<") |";
|
||||
}
|
||||
if (!ret) {
|
||||
cout<<fixed<<setprecision(3)<<static_cast<double>(power_limit)/1000<<"\t|";
|
||||
} else {
|
||||
err_bits |= 1 << ret;
|
||||
cout<<" NA (Err:" <<ret<<" |";
|
||||
}
|
||||
|
||||
cout<<"\n-------------------------------------------------\n";
|
||||
uint32_t power_max;
|
||||
cout<<"\n| PowerLimitMax (Watts)\t\t | ";
|
||||
|
||||
amdsmi_temp_range_refresh_rate_t rate;
|
||||
uint8_t dimm_addr = 0x80;
|
||||
cout<<"\n| Socket DIMM temp range and refresh rate\t\t |\n";
|
||||
ret = amdsmi_get_cpu_dimm_temp_range_and_refresh_rate(sockets[i], i, dimm_addr, &rate);
|
||||
CHK_AMDSMI_RET(ret)
|
||||
ret = amdsmi_get_cpu_socket_power_cap_max(plist[i], &power_max);
|
||||
CHK_AMDSMI_RET(ret)
|
||||
|
||||
if(ret) {
|
||||
cout<<"\n| \tDIMM temp range\t |"<<rate.range<<"\t|"<<endl;
|
||||
cout<<"\n| \tRefresh rate\t |"<<rate.ref_rate<<"\t|"<<endl;
|
||||
} else
|
||||
cout<<"Failed: to get socket"<<"["<<i<<"] DIMM temperature range and refresh rate, Err["<<ret<<"]: "
|
||||
<<*amdsmi_get_esmi_err_msg(ret, &err_str1)<<endl;
|
||||
if (!ret) {
|
||||
cout<<fixed<<setprecision(3)<<static_cast<double>(power_max)/1000<<"\t|";
|
||||
} else {
|
||||
err_bits |= 1 << ret;
|
||||
cout<<" NA (Err:" <<ret<<" |";
|
||||
}
|
||||
cout<<"\n-------------------------------------------------\n";
|
||||
|
||||
cout<<"\n-------------------------------------------------\n";
|
||||
|
||||
amdsmi_dimm_power_t dimm_power;
|
||||
cout<<"\n| Socket DIMM power consumption\t\t |\n";
|
||||
ret = amdsmi_get_cpu_dimm_power_consumption(sockets[i], i, dimm_addr, &dimm_power);
|
||||
CHK_AMDSMI_RET(ret)
|
||||
|
||||
if(ret) {
|
||||
cout<<"\n| Power(mWatts)\t\t |"<<dimm_power.power<<"\t|"<<endl;
|
||||
cout<<"\n| Power update rate(ms)\t |"<<dimm_power.update_rate<<"\t|"<<endl;
|
||||
cout<<"\n| Dimm address \t\t |"<<dimm_power.dimm_addr<<"\t|"<<endl;
|
||||
} else
|
||||
cout<<"Failed: to get socket"<<"["<<i<<"] DIMM power and update rate, Err["<<ret<<"]: "
|
||||
<<*amdsmi_get_esmi_err_msg(ret, &err_str1)<<endl;
|
||||
|
||||
cout<<"\n-------------------------------------------------\n";
|
||||
|
||||
amdsmi_dimm_thermal_t d_sensor;
|
||||
cout<<"\n| Socket DIMM thermal sensor\t\t |\n";
|
||||
ret = amdsmi_get_cpu_dimm_thermal_sensor(sockets[i], i, dimm_addr, &d_sensor);
|
||||
CHK_AMDSMI_RET(ret)
|
||||
|
||||
if(ret) {
|
||||
cout<<"\n| Temperature(°C)\t |"<<d_sensor.temp<<"\t|"<<endl;
|
||||
cout<<"\n| Update rate(ms)\t |"<<d_sensor.update_rate<<"\t|"<<endl;
|
||||
cout<<"\n| Dimm address returned\t |"<<d_sensor.dimm_addr<<"\t|"<<endl;
|
||||
} else
|
||||
cout<<"Failed: to get socket"<<"["<<i<<"] DIMM temperature and update rate, Err["<<ret<<"]: "
|
||||
<<*amdsmi_get_esmi_err_msg(ret, &err_str1)<<endl;
|
||||
|
||||
cout<<"\n-------------------------------------------------\n";
|
||||
|
||||
uint8_t min, max;
|
||||
cout<<"\nEnter the XGMI min value to be set:\n";
|
||||
cin>>min;
|
||||
cout<<"\nEnter the XGMI max value to be set:\n";
|
||||
cin>>max;
|
||||
|
||||
ret = amdsmi_set_cpu_xgmi_width(sockets[i], min, max);
|
||||
CHK_AMDSMI_RET(ret)
|
||||
|
||||
if(ret)
|
||||
cout<<"Failed: to set xGMI link width, Err["<<ret<<"]: "
|
||||
<<*amdsmi_get_esmi_err_msg(ret, &err_str1)<<endl;
|
||||
else
|
||||
cout<<"xGMI link width (min:"<<min<< "max:"<<max<<") is set successfully\n";
|
||||
|
||||
cout<<"\n-------------------------------------------------\n";
|
||||
|
||||
uint8_t min_link_width, max_link_width;
|
||||
cout<<"\nEnter the GMI3 link width min value to be set:\n";
|
||||
cin>>min_link_width;
|
||||
cout<<"\nEnter the GMI3 link width max value to be set:\n";
|
||||
cin>>max_link_width;
|
||||
|
||||
ret = amdsmi_set_cpu_gmi3_link_width_range(sockets[i], i, min_link_width, max_link_width);
|
||||
CHK_AMDSMI_RET(ret)
|
||||
|
||||
if(ret)
|
||||
cout<<"Failed to set gmi3 link width for socket["<<i<<"] Err["<<ret<<"]:"
|
||||
<<*amdsmi_get_esmi_err_msg(ret, &err_str1)<<endl;
|
||||
else
|
||||
cout<<"Gmi3 link width range is set successfully\n";
|
||||
|
||||
cout<<"\n-------------------------------------------------\n";
|
||||
|
||||
ret = amdsmi_cpu_apb_enable(sockets[i], i);
|
||||
CHK_AMDSMI_RET(ret)
|
||||
|
||||
if(ret)
|
||||
cout<<"Failed: to enable DF performance boost algo on socket["<<i<<"] Err["<<ret<<"]:"
|
||||
<<*amdsmi_get_esmi_err_msg(ret, &err_str1)<<endl;
|
||||
else
|
||||
cout<<"APB is enabled successfully on socket["<<i<<"]\n";
|
||||
|
||||
cout<<"\n-------------------------------------------------\n";
|
||||
|
||||
int8_t pstate;
|
||||
cout<<"\nEnter the pstate to be set:\n";
|
||||
cin>>pstate;
|
||||
ret = amdsmi_cpu_apb_disable(sockets[i], i, pstate);
|
||||
CHK_AMDSMI_RET(ret)
|
||||
|
||||
if(ret)
|
||||
cout<<"Failed: to set socket["<<i<<"] DF pstate, Err["<<ret<<"]:"
|
||||
<<*amdsmi_get_esmi_err_msg(ret, &err_str1)<<endl;
|
||||
else
|
||||
cout<<"APB is disabled, P-state is set to ["<<pstate<<"] on socket["<<i<<"] successfully\n";
|
||||
|
||||
cout<<"\n-------------------------------------------------\n";
|
||||
|
||||
uint8_t min_val=0, max_val=2;
|
||||
uint8_t nbio_id=1;
|
||||
|
||||
ret = amdsmi_set_cpu_socket_lclk_dpm_level(sockets[i], i, nbio_id, min_val, max_val);
|
||||
CHK_AMDSMI_RET(ret)
|
||||
|
||||
if(ret != AMDSMI_STATUS_SUCCESS)
|
||||
cout<<"Failed: to set lclk dpm level for socket["<<i<<"], nbioid["<<unsigned(nbio_id)<<"], Err["<<ret<<"]:"
|
||||
<<*amdsmi_get_esmi_err_msg(ret, &err_str1)<<endl;
|
||||
else
|
||||
cout<<"Socket["<<i<<"] nbio["<<unsigned(nbio_id)<<"] LCLK frequency set successfully\n";
|
||||
|
||||
cout<<"\n-------------------------------------------------\n";
|
||||
|
||||
amdsmi_dpm_level_t nbio;
|
||||
ret = amdsmi_get_cpu_socket_lclk_dpm_level(sockets[i], i, nbio_id, &nbio);
|
||||
CHK_AMDSMI_RET(ret)
|
||||
|
||||
if(ret != AMDSMI_STATUS_SUCCESS)
|
||||
cout<<"Failed: to get lclk dpm level for socket["<<i<<"], nbioid["<<unsigned(nbio_id)<<"], Err["<<ret<<"]:"
|
||||
<<*amdsmi_get_esmi_err_msg(ret, &err_str1)<<endl;
|
||||
else {
|
||||
cout<<"| \tMIN\t | "<<unsigned(nbio.min_dpm_level)<<"\t |\n";
|
||||
cout<<"| \tMAX\t | "<<unsigned(nbio.max_dpm_level)<<"\t |\n";
|
||||
}
|
||||
|
||||
cout<<"\n-------------------------------------------------\n";
|
||||
|
||||
uint8_t rate_ctrl;
|
||||
uint8_t prev_mode;
|
||||
std::string pcie_strings[] = {
|
||||
"automatically detect based on bandwidth utilisation",
|
||||
"limited to Gen4 rate",
|
||||
"limited to Gen5 rate"
|
||||
};
|
||||
cout<<"\nEnter the rate ctrl to be set:\n";
|
||||
cin>>rate_ctrl;
|
||||
|
||||
ret = amdsmi_set_cpu_pcie_link_rate(sockets[i], i, rate_ctrl, &prev_mode);
|
||||
CHK_AMDSMI_RET(ret)
|
||||
|
||||
if(ret != AMDSMI_STATUS_SUCCESS)
|
||||
cout<<"Failed to set pcie link rate control for socket["<<i<<"], Err["<<ret<<"]:"
|
||||
<<*amdsmi_get_esmi_err_msg(ret, &err_str1)<<endl;
|
||||
else {
|
||||
cout<<"Pcie link rate is set to "<<rate_ctrl<<" (i.e. "<<pcie_strings[rate_ctrl]<<") successfully.\n";
|
||||
cout<<"\nPrevious pcie link rate control was : "<<prev_mode<<"\n";
|
||||
}
|
||||
|
||||
cout<<"\n-------------------------------------------------\n";
|
||||
uint8_t max_pstate, min_pstate;
|
||||
cout<<"\nEnter the max_pstate to be set:\n";
|
||||
cin>>max_pstate;
|
||||
cout<<"\nEnter the min_pstate to be set:\n";
|
||||
cin>>min_pstate;
|
||||
|
||||
ret = amdsmi_set_cpu_df_pstate_range(sockets[i], i, max_pstate, min_pstate);
|
||||
CHK_AMDSMI_RET(ret)
|
||||
|
||||
if(ret != AMDSMI_STATUS_SUCCESS)
|
||||
cout<<"Failed to set df pstate range, Err["<<ret<<"]:"
|
||||
<<*amdsmi_get_esmi_err_msg(ret, &err_str1)<<endl;
|
||||
else
|
||||
cout<<"Data Fabric PState range(max:"<<unsigned(max_pstate)
|
||||
<<" min:"<<unsigned(min_pstate)<<") set successfully\n";
|
||||
|
||||
cout<<"\n-------------------------------------------------\n";
|
||||
|
||||
amdsmi_link_id_bw_type_t io_link;
|
||||
uint32_t bw;
|
||||
char* link = "P0";
|
||||
io_link.link_name = link;
|
||||
io_link.bw_type = static_cast<amdsmi_io_bw_encoding_t>(1) ;
|
||||
ret = amdsmi_get_cpu_current_io_bandwidth(sockets[i], i, io_link, &bw);
|
||||
CHK_AMDSMI_RET(ret)
|
||||
|
||||
if(ret != AMDSMI_STATUS_SUCCESS)
|
||||
cout<<"Failed to get io bandwidth width for socket ["<<i<<"], Err["<<ret<<"]:"
|
||||
<<*amdsmi_get_esmi_err_msg(ret, &err_str1)<<endl;
|
||||
else
|
||||
cout<<"| Current IO Aggregate bandwidth of link"<<io_link.link_name<<" | "<<bw<<" Mbps |\n";
|
||||
|
||||
cout<<"\n-------------------------------------------------\n";
|
||||
|
||||
amdsmi_link_id_bw_type_t xgmi_link;
|
||||
uint32_t bw1;
|
||||
int bw_ind = 1;
|
||||
char* link1 = "P1";
|
||||
xgmi_link.link_name = link1;
|
||||
xgmi_link.bw_type = static_cast<amdsmi_io_bw_encoding_t>(1<<bw_ind) ;
|
||||
ret = amdsmi_get_cpu_current_xgmi_bw(sockets[i], xgmi_link, &bw1);
|
||||
CHK_AMDSMI_RET(ret)
|
||||
|
||||
if(ret != AMDSMI_STATUS_SUCCESS)
|
||||
cout<<"Failed to get xgmi bandwidth width, Err["<<ret<<"]:"
|
||||
<<*amdsmi_get_esmi_err_msg(ret, &err_str1)<<endl;
|
||||
else
|
||||
cout<<"| Current "<<bw_string[bw_ind]<<"bandwidth of xGMI link "<<xgmi_link.link_name<<" | "<<bw<<" Mbps |\n";
|
||||
|
||||
cout<<"\n-------------------------------------------------\n";
|
||||
|
||||
uint32_t met_ver;
|
||||
ret = amdsmi_get_metrics_table_version(sockets[i], &met_ver);
|
||||
CHK_AMDSMI_RET(ret)
|
||||
|
||||
if (ret != AMDSMI_STATUS_SUCCESS) {
|
||||
cout<<"Failed to get Metrics Table Version, Err["<<ret<<"]:"
|
||||
<<*amdsmi_get_esmi_err_msg(ret, &err_str1)<<endl;
|
||||
} else
|
||||
cout<<"\n| METRICS TABLE Version | "<<met_ver<<" \t\t |\n";
|
||||
|
||||
cout<<"\n-------------------------------------------------\n";
|
||||
|
||||
double fraction_q10 = 1/pow(2,10);
|
||||
double fraction_uq10 = fraction_q10;
|
||||
|
||||
struct hsmp_metric_table mtbl;
|
||||
ret = amdsmi_get_metrics_table(sockets[i], i, &mtbl);
|
||||
CHK_AMDSMI_RET(ret)
|
||||
|
||||
if (ret != AMDSMI_STATUS_SUCCESS) {
|
||||
cout<<"Failed to get Metrics Table for socket["<<i<<"], Err["<<ret<<"]:"
|
||||
<<*amdsmi_get_esmi_err_msg(ret, &err_str1)<<endl;
|
||||
} else {
|
||||
cout<<"\n| METRICS TABLE \t\t |\n";
|
||||
cout<<"\n| ACCUMULATOR COUNTER | "<<mtbl.accumulation_counter<<"\t\t|\n";
|
||||
cout<<"\n| SOCKET POWER LIMIT | "<<(mtbl.socket_power_limit * fraction_uq10)<<" W\t\t|\n";
|
||||
cout<<"\n| MAX SOCKET POWER LIMIT | "<<(mtbl.max_socket_power_limit * fraction_uq10)<<" W\t\t|\n";
|
||||
cout<<"\n| SOCKET POWER | "<<(mtbl.socket_power * fraction_uq10)<<" W\t\t|\n";
|
||||
uint32_t input_power;
|
||||
power_max = 0;
|
||||
cout<<"\nEnter the max power to be set:\n";
|
||||
cin>>input_power;
|
||||
ret = amdsmi_get_cpu_socket_power_cap_max(plist[i], &power_max);
|
||||
CHK_AMDSMI_RET(ret)
|
||||
if ((ret == AMDSMI_STATUS_SUCCESS) && (input_power > power_max)) {
|
||||
cout<<"Input power is more than max power limit,"
|
||||
" limiting to "<<static_cast<double>(power_max)/1000<<"Watts\n";
|
||||
input_power = power_max;
|
||||
}
|
||||
ret = amdsmi_set_cpu_socket_power_cap(plist[i], input_power);
|
||||
CHK_AMDSMI_RET(ret)
|
||||
if (!ret) {
|
||||
cout<<"Socket["<<i<<"] power_limit set to "
|
||||
<<fixed<<setprecision(3)<<static_cast<double>(input_power)/1000<<" Watts successfully\n";
|
||||
}
|
||||
cout<<"\n-------------------------------------------------\n";
|
||||
}
|
||||
cout<<"\n-------------------------------------------------\n";
|
||||
|
||||
}
|
||||
// Clean up resources allocated at amdsmi_init
|
||||
ret = amdsmi_shut_down();
|
||||
|
||||
@@ -71,7 +71,8 @@ typedef enum {
|
||||
AMDSMI_INIT_AMD_CPUS = (1 << 0),
|
||||
AMDSMI_INIT_AMD_GPUS = (1 << 1),
|
||||
AMDSMI_INIT_NON_AMD_CPUS = (1 << 2),
|
||||
AMDSMI_INIT_NON_AMD_GPUS = (1 << 3)
|
||||
AMDSMI_INIT_NON_AMD_GPUS = (1 << 3),
|
||||
AMDSMI_INIT_AMD_APUS = (AMDSMI_INIT_AMD_CPUS | AMDSMI_INIT_AMD_GPUS)
|
||||
} amdsmi_init_flags_t;
|
||||
|
||||
/* Maximum size definitions AMDSMI */
|
||||
@@ -1626,32 +1627,67 @@ amdsmi_status_t amdsmi_get_socket_info(
|
||||
|
||||
#ifdef ENABLE_ESMI_LIB
|
||||
/**
|
||||
* @brief Get information about the given cpu socket
|
||||
* @brief Get information about the given processor
|
||||
*
|
||||
* @details This function retrieves cpu socket information. The @p socket_handle must
|
||||
* be provided to retrieve the Socket ID.
|
||||
* @details This function retrieves processor information. The @p processor_handle must
|
||||
* be provided to retrieve the processor ID.
|
||||
*
|
||||
* @param[in] socket_handle a socket handle
|
||||
* @param[in] processor_handle a processor handle
|
||||
*
|
||||
* @param[out] sockid The id of the socket.
|
||||
* @param[out] name The id of the processor.
|
||||
*
|
||||
* @param[in] len the length of the caller provided buffer @p name.
|
||||
*
|
||||
* @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
|
||||
*/
|
||||
amdsmi_status_t amdsmi_get_cpusocket_info(amdsmi_cpusocket_handle socket_handle, uint32_t sockid);
|
||||
amdsmi_status_t amdsmi_get_processor_info(
|
||||
amdsmi_processor_handle processor_handle,
|
||||
size_t len, char *name);
|
||||
|
||||
/**
|
||||
* @brief Get information about the given cpu core
|
||||
* @brief Get respective processor counts from the processor handles
|
||||
*
|
||||
* @details This function retrieves cpu core information. The @p core_handle must
|
||||
* be provided to retrieve the core ID.
|
||||
* @details This function retrieves respective processor counts information.
|
||||
* The @p processor_handle must be provided to retrieve the processor ID.
|
||||
*
|
||||
* @param[in] core_handle a processor handle
|
||||
* @param[in] processor_handles A pointer to a block of memory to which the
|
||||
* ::amdsmi_processor_handle values will be written. This value may be NULL.
|
||||
*
|
||||
* @param[out] coreid The id of the core.
|
||||
* @param[in] processor_count total processor count per socket
|
||||
*
|
||||
* @param[out] nr_cpusockets Total number of cpu sockets
|
||||
*
|
||||
* @param[out] nr_cpucores Total number of cpu cores
|
||||
*
|
||||
* @param[out] nr_gpus Total number of gpu devices
|
||||
*
|
||||
* @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
|
||||
*/
|
||||
amdsmi_status_t amdsmi_get_cpucore_info(amdsmi_processor_handle core_handle, uint32_t coreid);
|
||||
amdsmi_status_t amdsmi_get_processor_count_from_handles(amdsmi_processor_handle* processor_handles,
|
||||
uint32_t* processor_count, uint32_t* nr_cpusockets,
|
||||
uint32_t* nr_cpucores, uint32_t* nr_gpus);
|
||||
|
||||
/**
|
||||
* @brief Get processor list as per processor type
|
||||
*
|
||||
* @details This function retrieves processor list as per the processor type
|
||||
* from the total processor handles list.
|
||||
* The @p list of processor_handles and processor type must be provided.
|
||||
*
|
||||
* @param[in] socket_handle socket handle
|
||||
*
|
||||
* @param[in] processor_type processor type
|
||||
*
|
||||
* @param[out] processor_handles list of processor handles as per processor type
|
||||
*
|
||||
* @param[out] processor_count processor count as per processor type selected
|
||||
*
|
||||
* @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
|
||||
*/
|
||||
amdsmi_status_t amdsmi_get_processor_handles_by_type(amdsmi_socket_handle socket_handle,
|
||||
processor_type_t processor_type,
|
||||
amdsmi_processor_handle* processor_handles,
|
||||
uint32_t* processor_count);
|
||||
#endif
|
||||
|
||||
/**
|
||||
@@ -5340,27 +5376,25 @@ amdsmi_get_gpu_metrics_log(amdsmi_processor_handle processor_handle);
|
||||
* @brief Get the core energy for a given core.
|
||||
*
|
||||
* @param[in] processor_handle Cpu core which to query
|
||||
* @param[in] core_ind - cpu core index
|
||||
*
|
||||
* @param[in,out] penergy - Input buffer to return the core energy
|
||||
*
|
||||
* @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
|
||||
*/
|
||||
amdsmi_status_t amdsmi_get_cpu_core_energy(amdsmi_processor_handle processor_handle,
|
||||
uint32_t core_ind, uint64_t *penergy);
|
||||
uint64_t *penergy);
|
||||
|
||||
/**
|
||||
* @brief Get the socket energy for a given socket.
|
||||
*
|
||||
* @param[in] socket_handle Cpu socket which to query
|
||||
* @param[in] sock_ind - socket index
|
||||
* @param[in] processor_handle Cpu socket which to query
|
||||
*
|
||||
* @param[in,out] penergy - Input buffer to return the socket energy
|
||||
*
|
||||
* @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
|
||||
*/
|
||||
amdsmi_status_t amdsmi_get_cpu_socket_energy(amdsmi_cpusocket_handle socket_handle,
|
||||
uint32_t sock_ind, uint64_t *penergy);
|
||||
amdsmi_status_t amdsmi_get_cpu_socket_energy(amdsmi_processor_handle processor_handle,
|
||||
uint64_t *penergy);
|
||||
|
||||
/** @} */
|
||||
|
||||
@@ -5372,43 +5406,41 @@ amdsmi_status_t amdsmi_get_cpu_socket_energy(amdsmi_cpusocket_handle socket_hand
|
||||
/**
|
||||
* @brief Get SMU Firmware Version.
|
||||
*
|
||||
* @param[in] socket_handle Cpu socket which to query
|
||||
* @param[in] processor_handle Cpu socket which to query
|
||||
* @param[in,out] amdsmi_smu_fw - Input buffer to return the firmware version
|
||||
*
|
||||
* @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
|
||||
*/
|
||||
amdsmi_status_t amdsmi_get_cpu_smu_fw_version(amdsmi_cpusocket_handle socket_handle,
|
||||
amdsmi_smu_fw_version_t *amdsmi_smu_fw);
|
||||
amdsmi_status_t amdsmi_get_cpu_smu_fw_version(amdsmi_processor_handle processor_handle,
|
||||
amdsmi_smu_fw_version_t *amdsmi_smu_fw);
|
||||
|
||||
/**
|
||||
* @brief Get HSMP protocol Version.
|
||||
*
|
||||
* @param[in] socket_handle Cpu socket which to query
|
||||
* @param[in] processor_handle Cpu socket which to query
|
||||
* @param[in,out] proto_ver - Input buffer to return the protocol version
|
||||
*
|
||||
* @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
|
||||
*/
|
||||
amdsmi_status_t amdsmi_get_cpu_hsmp_proto_ver(amdsmi_cpusocket_handle socket_handle,
|
||||
uint32_t *proto_ver);
|
||||
amdsmi_status_t amdsmi_get_cpu_hsmp_proto_ver(amdsmi_processor_handle processor_handle,
|
||||
uint32_t *proto_ver);
|
||||
|
||||
/**
|
||||
* @brief Get normalized status of the processor's PROCHOT status.
|
||||
*
|
||||
* @param[in] socket_handle Cpu socket which to query
|
||||
* @param[in] sock_ind - socket index
|
||||
* @param[in] processor_handle Cpu socket which to query
|
||||
*
|
||||
* @param[in,out] prochot - Input buffer to return the procohot status.
|
||||
*
|
||||
* @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
|
||||
*/
|
||||
amdsmi_status_t amdsmi_get_cpu_prochot_status(amdsmi_cpusocket_handle socket_handle,
|
||||
uint32_t sock_ind, uint32_t *prochot);
|
||||
amdsmi_status_t amdsmi_get_cpu_prochot_status(amdsmi_processor_handle processor_handle,
|
||||
uint32_t *prochot);
|
||||
|
||||
/**
|
||||
* @brief Get Data fabric clock and Memory clock in MHz.
|
||||
*
|
||||
* @param[in] socket_handle Cpu socket which to query
|
||||
* @param[in] sock_ind - socket index
|
||||
* @param[in] processor_handle Cpu socket which to query
|
||||
*
|
||||
* @param[in,out] fclk - Input buffer to return fclk
|
||||
*
|
||||
@@ -5416,27 +5448,25 @@ amdsmi_status_t amdsmi_get_cpu_prochot_status(amdsmi_cpusocket_handle socket_han
|
||||
*
|
||||
* @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
|
||||
*/
|
||||
amdsmi_status_t amdsmi_get_cpu_fclk_mclk(amdsmi_cpusocket_handle socket_handle,
|
||||
uint32_t sock_ind, uint32_t *fclk, uint32_t *mclk);
|
||||
amdsmi_status_t amdsmi_get_cpu_fclk_mclk(amdsmi_processor_handle processor_handle,
|
||||
uint32_t *fclk, uint32_t *mclk);
|
||||
|
||||
/**
|
||||
* @brief Get core clock in MHz.
|
||||
*
|
||||
* @param[in] socket_handle Cpu socket which to query
|
||||
* @param[in] sock_ind - socket index
|
||||
* @param[in] processor_handle Cpu socket which to query
|
||||
*
|
||||
* @param[in,out] cclk - Input buffer to return core clock
|
||||
*
|
||||
* @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
|
||||
*/
|
||||
amdsmi_status_t amdsmi_get_cpu_cclk_limit(amdsmi_cpusocket_handle socket_handle,
|
||||
uint32_t sock_ind, uint32_t *cclk);
|
||||
amdsmi_status_t amdsmi_get_cpu_cclk_limit(amdsmi_processor_handle processor_handle,
|
||||
uint32_t *cclk);
|
||||
|
||||
/**
|
||||
* @brief Get current active frequency limit of the socket.
|
||||
*
|
||||
* @param[in] socket_handle Cpu socket which to query
|
||||
* @param[in] sock_ind - socket index
|
||||
* @param[in] processor_handle Cpu socket which to query
|
||||
*
|
||||
* @param[in,out] freq - Input buffer to return frequency value in MHz
|
||||
*
|
||||
@@ -5444,14 +5474,13 @@ amdsmi_status_t amdsmi_get_cpu_cclk_limit(amdsmi_cpusocket_handle socket_handle,
|
||||
*
|
||||
* @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
|
||||
*/
|
||||
amdsmi_status_t amdsmi_get_cpu_socket_current_active_freq_limit(amdsmi_cpusocket_handle socket_handle,
|
||||
uint32_t sock_ind, uint16_t *freq, char **src_type);
|
||||
amdsmi_status_t amdsmi_get_cpu_socket_current_active_freq_limit(amdsmi_processor_handle processor_handle,
|
||||
uint16_t *freq, char **src_type);
|
||||
|
||||
/**
|
||||
* @brief Get socket frequency range.
|
||||
*
|
||||
* @param[in] socket_handle Cpu socket which to query
|
||||
* @param[in] sock_ind - socket index
|
||||
* @param[in] processor_handle Cpu socket which to query
|
||||
*
|
||||
* @param[in,out] fmax - Input buffer to return maximum frequency
|
||||
*
|
||||
@@ -5459,21 +5488,20 @@ amdsmi_status_t amdsmi_get_cpu_socket_current_active_freq_limit(amdsmi_cpusocket
|
||||
*
|
||||
* @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
|
||||
*/
|
||||
amdsmi_status_t amdsmi_get_cpu_socket_freq_range(amdsmi_cpusocket_handle socket_handle,
|
||||
uint32_t sock_ind, uint16_t *fmax, uint16_t *fmin);
|
||||
amdsmi_status_t amdsmi_get_cpu_socket_freq_range(amdsmi_processor_handle processor_handle,
|
||||
uint16_t *fmax, uint16_t *fmin);
|
||||
|
||||
/**
|
||||
* @brief Get socket frequency limit of the core.
|
||||
*
|
||||
* @param[in] processor_handle Cpu core which to query
|
||||
* @param[in] core_ind - core index
|
||||
*
|
||||
* @param[in,out] freq - Input buffer to return frequency.
|
||||
*
|
||||
* @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
|
||||
*/
|
||||
amdsmi_status_t amdsmi_get_cpu_core_current_freq_limit(amdsmi_processor_handle processor_handle,
|
||||
uint32_t core_ind, uint32_t *freq);
|
||||
uint32_t *freq);
|
||||
|
||||
/** @} */
|
||||
|
||||
@@ -5485,80 +5513,74 @@ amdsmi_status_t amdsmi_get_cpu_core_current_freq_limit(amdsmi_processor_handle p
|
||||
/**
|
||||
* @brief Get the socket power.
|
||||
*
|
||||
* @param[in] socket_handle Cpu socket which to query
|
||||
* @param[in] sock_ind - socket index
|
||||
* @param[in] processor_handle Cpu socket which to query
|
||||
*
|
||||
* @param[in,out] ppower - Input buffer to return socket power
|
||||
*
|
||||
* @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
|
||||
*/
|
||||
amdsmi_status_t amdsmi_get_cpu_socket_power(amdsmi_cpusocket_handle socket_handle,
|
||||
uint32_t sock_ind, uint32_t *ppower);
|
||||
amdsmi_status_t amdsmi_get_cpu_socket_power(amdsmi_processor_handle processor_handle,
|
||||
uint32_t *ppower);
|
||||
|
||||
/**
|
||||
* @brief Get the socket power cap.
|
||||
*
|
||||
* @param[in] socket_handle Cpu socket which to query
|
||||
* @param[in] sock_ind - socket index
|
||||
* @param[in] processor_handle Cpu socket which to query
|
||||
*
|
||||
* @param[in,out] pcap - Input buffer to return power cap.
|
||||
*
|
||||
* @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
|
||||
*/
|
||||
amdsmi_status_t amdsmi_get_cpu_socket_power_cap(amdsmi_cpusocket_handle socket_handle,
|
||||
uint32_t sock_ind, uint32_t *pcap);
|
||||
amdsmi_status_t amdsmi_get_cpu_socket_power_cap(amdsmi_processor_handle processor_handle,
|
||||
uint32_t *pcap);
|
||||
|
||||
/**
|
||||
* @brief Get the maximum power cap value for a given socket.
|
||||
*
|
||||
* @param[in] socket_handle Cpu socket which to query
|
||||
* @param[in] sock_ind - socket index
|
||||
* @param[in] processor_handle Cpu socket which to query
|
||||
*
|
||||
* @param[in,out] pmax - Input buffer to return maximum power limit value
|
||||
*
|
||||
* @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
|
||||
*/
|
||||
amdsmi_status_t amdsmi_get_cpu_socket_power_cap_max(amdsmi_cpusocket_handle socket_handle,
|
||||
uint32_t sock_ind, uint32_t *pmax);
|
||||
amdsmi_status_t amdsmi_get_cpu_socket_power_cap_max(amdsmi_processor_handle processor_handle,
|
||||
uint32_t *pmax);
|
||||
|
||||
/**
|
||||
* @brief Get the SVI based power telemetry for all rails.
|
||||
*
|
||||
* @param[in] socket_handle Cpu socket which to query
|
||||
* @param[in] sock_ind - socket index
|
||||
* @param[in] processor_handle Cpu socket which to query
|
||||
*
|
||||
* @param[in,out] power - Input buffer to return svi based power value
|
||||
*
|
||||
* @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
|
||||
*/
|
||||
amdsmi_status_t amdsmi_get_cpu_pwr_svi_telemetry_all_rails(amdsmi_cpusocket_handle socket_handle,
|
||||
uint32_t sock_ind, uint32_t *power);
|
||||
amdsmi_status_t amdsmi_get_cpu_pwr_svi_telemetry_all_rails(amdsmi_processor_handle processor_handle,
|
||||
uint32_t *power);
|
||||
|
||||
/**
|
||||
* @brief Set the power cap value for a given socket.
|
||||
*
|
||||
* @param[in] socket_handle Cpu socket which to query
|
||||
* @param[in] sock_ind - socket index
|
||||
* @param[in] processor_handle Cpu socket which to query
|
||||
*
|
||||
* @param[in] power - Input power limit value
|
||||
*
|
||||
* @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
|
||||
*/
|
||||
amdsmi_status_t amdsmi_set_cpu_socket_power_cap(amdsmi_cpusocket_handle socket_handle,
|
||||
uint32_t sock_ind, uint32_t pcap);
|
||||
amdsmi_status_t amdsmi_set_cpu_socket_power_cap(amdsmi_processor_handle processor_handle,
|
||||
uint32_t pcap);
|
||||
|
||||
/**
|
||||
* @brief Set the power efficiency profile policy.
|
||||
*
|
||||
* @param[in] socket_handle Cpu socket which to query
|
||||
* @param[in] sock_ind - socket index
|
||||
* @param[in] processor_handle Cpu socket which to query
|
||||
*
|
||||
* @param[in] mode - mode to be set
|
||||
*
|
||||
* @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
|
||||
*/
|
||||
amdsmi_status_t amdsmi_set_cpu_pwr_efficiency_mode(amdsmi_cpusocket_handle socket_handle,
|
||||
uint8_t sock_ind, uint8_t mode);
|
||||
amdsmi_status_t amdsmi_set_cpu_pwr_efficiency_mode(amdsmi_processor_handle processor_handle,
|
||||
uint8_t mode);
|
||||
|
||||
/** @} */
|
||||
|
||||
@@ -5571,53 +5593,49 @@ amdsmi_status_t amdsmi_set_cpu_pwr_efficiency_mode(amdsmi_cpusocket_handle socke
|
||||
* @brief Get the core boost limit.
|
||||
*
|
||||
* @param[in] processor_handle Cpu core which to query
|
||||
* @param[in] core_ind - core index
|
||||
*
|
||||
* @param[in,out] pboostlimit - Input buffer to fill the boostlimit value
|
||||
*
|
||||
* @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
|
||||
*/
|
||||
amdsmi_status_t amdsmi_get_cpu_core_boostlimit(amdsmi_processor_handle processor_handle,
|
||||
uint32_t core_ind, uint32_t *pboostlimit);
|
||||
uint32_t *pboostlimit);
|
||||
|
||||
/**
|
||||
* @brief Get the socket c0 residency.
|
||||
*
|
||||
* @param[in] socket_handle Cpu socket which to query
|
||||
* @param[in] sock_ind - socket index
|
||||
* @param[in] processor_handle Cpu socket which to query
|
||||
*
|
||||
* @param[in,out] pc0_residency - Input buffer to fill the c0 residency value
|
||||
*
|
||||
* @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
|
||||
*/
|
||||
amdsmi_status_t amdsmi_get_cpu_socket_c0_residency(amdsmi_cpusocket_handle socket_handle,
|
||||
uint32_t sock_ind, uint32_t *pc0_residency);
|
||||
amdsmi_status_t amdsmi_get_cpu_socket_c0_residency(amdsmi_processor_handle processor_handle,
|
||||
uint32_t *pc0_residency);
|
||||
|
||||
/**
|
||||
* @brief Set the core boostlimit value.
|
||||
*
|
||||
* @param[in] processor_handle Cpu core which to query
|
||||
* @param[in] core_ind - core index
|
||||
*
|
||||
* @param[in] boostlimit - boostlimit value to be set
|
||||
*
|
||||
* @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
|
||||
*/
|
||||
amdsmi_status_t amdsmi_set_cpu_core_boostlimit(amdsmi_processor_handle processor_handle,
|
||||
uint32_t core_ind, uint32_t boostlimit);
|
||||
uint32_t boostlimit);
|
||||
|
||||
/**
|
||||
* @brief Set the socket boostlimit value.
|
||||
*
|
||||
* @param[in] socket_handle Cpu socket which to query
|
||||
* @param[in] sock_ind - socket index
|
||||
* @param[in] processor_handle Cpu socket which to query
|
||||
*
|
||||
* @param[in] boostlimit - boostlimit value to be set
|
||||
*
|
||||
* @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
|
||||
*/
|
||||
amdsmi_status_t amdsmi_set_cpu_socket_boostlimit(amdsmi_cpusocket_handle socket_handle,
|
||||
uint32_t sock_ind, uint32_t boostlimit);
|
||||
amdsmi_status_t amdsmi_set_cpu_socket_boostlimit(amdsmi_processor_handle processor_handle,
|
||||
uint32_t boostlimit);
|
||||
|
||||
/** @} */
|
||||
|
||||
@@ -5629,13 +5647,13 @@ amdsmi_status_t amdsmi_set_cpu_socket_boostlimit(amdsmi_cpusocket_handle socket_
|
||||
/**
|
||||
* @brief Get the DDR bandwidth data.
|
||||
*
|
||||
* @param[in] socket_handle Cpu socket which to query
|
||||
* @param[in] processor_handle Cpu socket which to query
|
||||
* @param[in,out] ddr_bw - Input buffer to fill ddr bandwidth data
|
||||
*
|
||||
* @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
|
||||
*/
|
||||
amdsmi_status_t amdsmi_get_cpu_ddr_bw(amdsmi_cpusocket_handle socket_handle,
|
||||
amdsmi_ddr_bw_metrics_t *ddr_bw);
|
||||
amdsmi_status_t amdsmi_get_cpu_ddr_bw(amdsmi_processor_handle processor_handle,
|
||||
amdsmi_ddr_bw_metrics_t *ddr_bw);
|
||||
|
||||
/** @} */
|
||||
|
||||
@@ -5647,15 +5665,14 @@ amdsmi_status_t amdsmi_get_cpu_ddr_bw(amdsmi_cpusocket_handle socket_handle,
|
||||
/**
|
||||
* @brief Get socket temperature.
|
||||
*
|
||||
* @param[in] socket_handle Cpu socket which to query
|
||||
* @param[in] sock_ind - socket index
|
||||
* @param[in] processor_handle Cpu socket which to query
|
||||
*
|
||||
* @param[in,out] ptmon - Input buffer to fill temperature value
|
||||
*
|
||||
* @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
|
||||
*/
|
||||
amdsmi_status_t amdsmi_get_cpu_socket_temperature(amdsmi_cpusocket_handle socket_handle,
|
||||
uint32_t sock_ind, uint32_t *ptmon);
|
||||
amdsmi_status_t amdsmi_get_cpu_socket_temperature(amdsmi_processor_handle processor_handle,
|
||||
uint32_t *ptmon);
|
||||
|
||||
/** @} */
|
||||
|
||||
@@ -5667,41 +5684,41 @@ amdsmi_status_t amdsmi_get_cpu_socket_temperature(amdsmi_cpusocket_handle socket
|
||||
/**
|
||||
* @brief Get DIMM temperature range and refresh rate.
|
||||
*
|
||||
* @param[in] socket_handle Cpu socket which to query
|
||||
* @param[in] sock_ind - socket index
|
||||
* @param[in] processor_handle Cpu socket which to query
|
||||
* @param[in] dimm_addr - DIMM address
|
||||
* @param[in,out] rate - Input buffer to fill temperature range and refresh rate value
|
||||
*
|
||||
* @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
|
||||
*/
|
||||
amdsmi_status_t amdsmi_get_cpu_dimm_temp_range_and_refresh_rate(amdsmi_cpusocket_handle socket_handle,
|
||||
uint8_t sock_ind, uint8_t dimm_addr, amdsmi_temp_range_refresh_rate_t *rate);
|
||||
amdsmi_status_t amdsmi_get_cpu_dimm_temp_range_and_refresh_rate(amdsmi_processor_handle processor_handle,
|
||||
uint8_t dimm_addr,
|
||||
amdsmi_temp_range_refresh_rate_t *rate);
|
||||
|
||||
/**
|
||||
* @brief Get DIMM power consumption.
|
||||
*
|
||||
* @param[in] socket_handle Cpu socket which to query
|
||||
* @param[in] sock_ind - socket index
|
||||
* @param[in] processor_handle Cpu socket which to query
|
||||
* @param[in] dimm_addr - DIMM address
|
||||
* @param[in,out] rate - Input buffer to fill power consumption value
|
||||
*
|
||||
* @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
|
||||
*/
|
||||
amdsmi_status_t amdsmi_get_cpu_dimm_power_consumption(amdsmi_cpusocket_handle socket_handle,
|
||||
uint8_t sock_ind, uint8_t dimm_addr, amdsmi_dimm_power_t *dimm_pow);
|
||||
amdsmi_status_t amdsmi_get_cpu_dimm_power_consumption(amdsmi_processor_handle processor_handle,
|
||||
uint8_t dimm_addr,
|
||||
amdsmi_dimm_power_t *dimm_pow);
|
||||
|
||||
/**
|
||||
* @brief Get DIMM thermal sensor value.
|
||||
*
|
||||
* @param[in] socket_handle Cpu socket which to query
|
||||
* @param[in] sock_ind - socket index
|
||||
* @param[in] processor_handle Cpu socket which to query
|
||||
* @param[in] dimm_addr - DIMM address
|
||||
* @param[in,out] dimm_temp - Input buffer to fill temperature value
|
||||
*
|
||||
* @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
|
||||
*/
|
||||
amdsmi_status_t amdsmi_get_cpu_dimm_thermal_sensor(amdsmi_cpusocket_handle socket_handle,
|
||||
uint8_t sock_ind, uint8_t dimm_addr, amdsmi_dimm_thermal_t *dimm_temp);
|
||||
amdsmi_status_t amdsmi_get_cpu_dimm_thermal_sensor(amdsmi_processor_handle processor_handle,
|
||||
uint8_t dimm_addr,
|
||||
amdsmi_dimm_thermal_t *dimm_temp);
|
||||
|
||||
/** @} */
|
||||
|
||||
@@ -5713,13 +5730,13 @@ amdsmi_status_t amdsmi_get_cpu_dimm_thermal_sensor(amdsmi_cpusocket_handle socke
|
||||
/**
|
||||
* @brief Set xgmi width.
|
||||
*
|
||||
* @param[in] socket_handle Cpu socket which to query
|
||||
* @param[in] processor_handle Cpu socket which to query
|
||||
* @param[in] min - Minimum xgmi width to be set
|
||||
* @param[in] max - maximum xgmi width to be set
|
||||
* @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
|
||||
*/
|
||||
amdsmi_status_t amdsmi_set_cpu_xgmi_width(amdsmi_cpusocket_handle socket_handle,
|
||||
uint8_t min, uint8_t max);
|
||||
amdsmi_status_t amdsmi_set_cpu_xgmi_width(amdsmi_processor_handle processor_handle,
|
||||
uint8_t min, uint8_t max);
|
||||
|
||||
/** @} */
|
||||
|
||||
@@ -5731,15 +5748,14 @@ amdsmi_status_t amdsmi_set_cpu_xgmi_width(amdsmi_cpusocket_handle socket_handle,
|
||||
/**
|
||||
* @brief Set gmi3 link width range.
|
||||
*
|
||||
* @param[in] socket_handle Cpu socket which to query
|
||||
* @param[in] sock_ind - socket index
|
||||
* @param[in] processor_handle Cpu socket which to query
|
||||
* @param[in] min_link_width - minimum link width to be set.
|
||||
* @param[in] max_link_width - maximum link width to be set.
|
||||
*
|
||||
* @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
|
||||
*/
|
||||
amdsmi_status_t amdsmi_set_cpu_gmi3_link_width_range(amdsmi_cpusocket_handle socket_handle,
|
||||
uint8_t sock_ind, uint8_t min_link_width, uint8_t max_link_width);
|
||||
amdsmi_status_t amdsmi_set_cpu_gmi3_link_width_range(amdsmi_processor_handle processor_handle,
|
||||
uint8_t min_link_width, uint8_t max_link_width);
|
||||
|
||||
/** @} */
|
||||
|
||||
@@ -5751,78 +5767,72 @@ amdsmi_status_t amdsmi_set_cpu_gmi3_link_width_range(amdsmi_cpusocket_handle soc
|
||||
/**
|
||||
* @brief Enable APB.
|
||||
*
|
||||
* @param[in] socket_handle Cpu socket which to query
|
||||
* @param[in] sock_ind - socket index
|
||||
* @param[in] processor_handle Cpu socket which to query
|
||||
*
|
||||
* @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
|
||||
*/
|
||||
amdsmi_status_t amdsmi_cpu_apb_enable(amdsmi_cpusocket_handle socket_handle, uint32_t sock_ind);
|
||||
amdsmi_status_t amdsmi_cpu_apb_enable(amdsmi_processor_handle processor_handle);
|
||||
|
||||
/**
|
||||
* @brief Disable APB.
|
||||
*
|
||||
* @param[in] socket_handle Cpu socket which to query
|
||||
* @param[in] sock_ind - socket index
|
||||
* @param[in] processor_handle Cpu socket which to query
|
||||
*
|
||||
* @param[in] pstate - pstate value to be set
|
||||
*
|
||||
* @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
|
||||
*/
|
||||
amdsmi_status_t amdsmi_cpu_apb_disable(amdsmi_cpusocket_handle socket_handle,
|
||||
uint32_t sock_ind, uint8_t pstate);
|
||||
amdsmi_status_t amdsmi_cpu_apb_disable(amdsmi_processor_handle processor_handle,
|
||||
uint8_t pstate);
|
||||
|
||||
/**
|
||||
* @brief Set NBIO lclk dpm level value.
|
||||
*
|
||||
* @param[in] socket_handle Cpu socket which to query
|
||||
* @param[in] sock_ind - socket index
|
||||
* @param[in] processor_handle Cpu socket which to query
|
||||
* @param[in] nbio_id - nbio index
|
||||
* @param[in] min - minimum value to be set
|
||||
* @param[in] max - maximum value to be set
|
||||
*
|
||||
* @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
|
||||
*/
|
||||
amdsmi_status_t amdsmi_set_cpu_socket_lclk_dpm_level(amdsmi_cpusocket_handle socket_handle,
|
||||
uint32_t sock_ind, uint8_t nbio_id, uint8_t min, uint8_t max);
|
||||
amdsmi_status_t amdsmi_set_cpu_socket_lclk_dpm_level(amdsmi_processor_handle processor_handle,
|
||||
uint8_t nbio_id, uint8_t min, uint8_t max);
|
||||
|
||||
/**
|
||||
* @brief Get NBIO LCLK dpm level.
|
||||
*
|
||||
* @param[in] socket_handle Cpu socket which to query
|
||||
* @param[in] sock_ind - socket index
|
||||
* @param[in] processor_handle Cpu socket which to query
|
||||
* @param[in] nbio_id - nbio index
|
||||
* @param[in,out] nbio - Input buffer to fill lclk dpm level
|
||||
*
|
||||
* @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
|
||||
*/
|
||||
amdsmi_status_t amdsmi_get_cpu_socket_lclk_dpm_level(amdsmi_cpusocket_handle socket_handle,
|
||||
uint8_t sock_ind, uint8_t nbio_id, amdsmi_dpm_level_t *nbio);
|
||||
amdsmi_status_t amdsmi_get_cpu_socket_lclk_dpm_level(amdsmi_processor_handle processor_handle,
|
||||
uint8_t nbio_id, amdsmi_dpm_level_t *nbio);
|
||||
|
||||
/**
|
||||
* @brief Set pcie link rate.
|
||||
*
|
||||
* @param[in] socket_handle Cpu socket which to query
|
||||
* @param[in] sock_ind - socket index
|
||||
* @param[in] processor_handle Cpu socket which to query
|
||||
* @param[in] rate_ctrl - rate control value to be set.
|
||||
* @param[in,out] prev_mode - Input buffer to fill previous rate control value.
|
||||
*
|
||||
* @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
|
||||
*/
|
||||
amdsmi_status_t amdsmi_set_cpu_pcie_link_rate(amdsmi_cpusocket_handle socket_handle,
|
||||
uint8_t sock_ind, uint8_t rate_ctrl, uint8_t *prev_mode);
|
||||
amdsmi_status_t amdsmi_set_cpu_pcie_link_rate(amdsmi_processor_handle processor_handle,
|
||||
uint8_t rate_ctrl, uint8_t *prev_mode);
|
||||
|
||||
/**
|
||||
* @brief Set df pstate range.
|
||||
*
|
||||
* @param[in] socket_handle Cpu socket which to query
|
||||
* @param[in] sock_ind - socket index
|
||||
* @param[in] processor_handle Cpu socket which to query
|
||||
* @param[in] max_pstate - maximum pstate value to be set
|
||||
* @param[in] min_pstate - minimum pstate value to be set
|
||||
*
|
||||
* @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
|
||||
*/
|
||||
amdsmi_status_t amdsmi_set_cpu_df_pstate_range(amdsmi_cpusocket_handle socket_handle,
|
||||
uint8_t sock_ind, uint8_t max_pstate, uint8_t min_pstate);
|
||||
amdsmi_status_t amdsmi_set_cpu_df_pstate_range(amdsmi_processor_handle processor_handle,
|
||||
uint8_t max_pstate, uint8_t min_pstate);
|
||||
|
||||
/** @} */
|
||||
|
||||
@@ -5834,27 +5844,26 @@ amdsmi_status_t amdsmi_set_cpu_df_pstate_range(amdsmi_cpusocket_handle socket_ha
|
||||
/**
|
||||
* @brief Get current input output bandwidth.
|
||||
*
|
||||
* @param[in] socket_handle Cpu socket which to query
|
||||
* @param[in] sock_ind - socket index
|
||||
* @param[in] processor_handle Cpu socket which to query
|
||||
* @param[in] link - link id and bw type to which io bandwidth to be obtained
|
||||
* @param[in,out] io_bw - Input buffer to fill bandwidth data
|
||||
*
|
||||
* @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
|
||||
*/
|
||||
amdsmi_status_t amdsmi_get_cpu_current_io_bandwidth(amdsmi_cpusocket_handle socket_handle,
|
||||
uint8_t sock_ind, amdsmi_link_id_bw_type_t link, uint32_t *io_bw);
|
||||
amdsmi_status_t amdsmi_get_cpu_current_io_bandwidth(amdsmi_processor_handle processor_handle,
|
||||
amdsmi_link_id_bw_type_t link, uint32_t *io_bw);
|
||||
|
||||
/**
|
||||
* @brief Get current input output bandwidth.
|
||||
*
|
||||
* @param[in] socket_handle Cpu socket which to query
|
||||
* @param[in] processor_handle Cpu socket which to query
|
||||
* @param[in] link - link id and bw type to which xgmi bandwidth to be obtained
|
||||
* @param[in,out] xgmi_bw - Input buffer to fill bandwidth data
|
||||
*
|
||||
* @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
|
||||
*/
|
||||
amdsmi_status_t amdsmi_get_cpu_current_xgmi_bw(amdsmi_cpusocket_handle socket_handle,
|
||||
amdsmi_link_id_bw_type_t link, uint32_t *xgmi_bw);
|
||||
amdsmi_status_t amdsmi_get_cpu_current_xgmi_bw(amdsmi_processor_handle processor_handle,
|
||||
amdsmi_link_id_bw_type_t link, uint32_t *xgmi_bw);
|
||||
|
||||
/** @} */
|
||||
|
||||
@@ -5866,25 +5875,24 @@ amdsmi_status_t amdsmi_get_cpu_current_xgmi_bw(amdsmi_cpusocket_handle socket_ha
|
||||
/**
|
||||
* @brief Get metrics table version
|
||||
*
|
||||
* @param[in] socket_handle Cpu socket which to query
|
||||
* @param[in] processor_handle Cpu socket which to query
|
||||
* @param[in,out] metrics_version input buffer to return the metrics table version.
|
||||
*
|
||||
* @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
|
||||
*/
|
||||
amdsmi_status_t amdsmi_get_metrics_table_version(amdsmi_cpusocket_handle socket_handle,
|
||||
uint32_t *metrics_version);
|
||||
amdsmi_status_t amdsmi_get_metrics_table_version(amdsmi_processor_handle processor_handle,
|
||||
uint32_t *metrics_version);
|
||||
|
||||
/**
|
||||
* @brief Get metrics table
|
||||
*
|
||||
* @param[in] socket_handle Cpu socket which to query
|
||||
* @param[in] sock_ind - socket index
|
||||
* @param[in] processor_handle Cpu socket which to query
|
||||
* @param[in,out] metrics_table input buffer to return the metrics table.
|
||||
*
|
||||
* @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
|
||||
*/
|
||||
amdsmi_status_t amdsmi_get_metrics_table(amdsmi_cpusocket_handle socket_handle, uint8_t sock_ind,
|
||||
struct hsmp_metric_table *metrics_table);
|
||||
amdsmi_status_t amdsmi_get_metrics_table(amdsmi_processor_handle processor_handle,
|
||||
struct hsmp_metric_table *metrics_table);
|
||||
|
||||
/** @} */
|
||||
|
||||
@@ -5896,15 +5904,14 @@ amdsmi_status_t amdsmi_get_metrics_table(amdsmi_cpusocket_handle socket_handle,
|
||||
/**
|
||||
* @brief Get first online core on socket.
|
||||
*
|
||||
* @param[in] socket_handle Cpu socket which to query
|
||||
* @param[in] sock_ind - socket index.
|
||||
* @param[in] processor_handle Cpu socket which to query
|
||||
*
|
||||
* @param[in,out] sockets - Input buffer to fill first online core on socket data
|
||||
* @param[in,out] pcore_ind - Input buffer to fill first online core on socket data
|
||||
*
|
||||
* @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
|
||||
*/
|
||||
amdsmi_status_t amdsmi_first_online_core_on_cpu_socket(amdsmi_cpusocket_handle socket_handle,
|
||||
uint32_t sock_ind, uint32_t *pcore_ind);
|
||||
amdsmi_status_t amdsmi_first_online_core_on_cpu_socket(amdsmi_processor_handle processor_handle,
|
||||
uint32_t *pcore_ind);
|
||||
|
||||
/**
|
||||
* @brief Get a description of provided AMDSMI error status for esmi errors.
|
||||
|
||||
@@ -1,76 +0,0 @@
|
||||
/*
|
||||
* =============================================================================
|
||||
* The University of Illinois/NCSA
|
||||
* Open Source License (NCSA)
|
||||
*
|
||||
* Copyright (c) 2023, Advanced Micro Devices, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Developed by:
|
||||
*
|
||||
* AMD Research and AMD ROC Software Development
|
||||
*
|
||||
* Advanced Micro Devices, Inc.
|
||||
*
|
||||
* www.amd.com
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal with 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:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimers.
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimers in
|
||||
* the documentation and/or other materials provided with the distribution.
|
||||
* - Neither the names of <Name of Development Group, Name of Institution>,
|
||||
* nor the names of its contributors may be used to endorse or promote
|
||||
* products derived from this Software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* 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 CONTRIBUTORS 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 WITH THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef AMD_SMI_INCLUDE_AMD_SMI_CPU_CORE_H_
|
||||
#define AMD_SMI_INCLUDE_AMD_SMI_CPU_CORE_H_
|
||||
|
||||
#include <string>
|
||||
#include <algorithm>
|
||||
#include <vector>
|
||||
#include "amd_smi/amdsmi.h"
|
||||
#include "amd_smi/impl/amd_smi_processor.h"
|
||||
|
||||
namespace amd {
|
||||
namespace smi {
|
||||
|
||||
/*Subclass CPU Core*/
|
||||
class AMDSmiCpuCore : public AMDSmiProcessor {
|
||||
public:
|
||||
explicit AMDSmiCpuCore(const uint32_t& core_idx):AMDSmiProcessor(AMD_CPU_CORE),core_idx_(core_idx) {}
|
||||
|
||||
virtual ~AMDSmiCpuCore() {}
|
||||
|
||||
const uint32_t& get_core_id() const { return core_idx_; }
|
||||
void add_processor(AMDSmiProcessor* processor) { processors_.push_back(processor); }
|
||||
std::vector<AMDSmiProcessor*>& get_processors() { return processors_;}
|
||||
amdsmi_status_t get_processor_count(uint32_t* processor_count) const;
|
||||
|
||||
private:
|
||||
uint32_t core_idx_;
|
||||
std::vector<AMDSmiProcessor*> processors_;
|
||||
};
|
||||
|
||||
} // namespace smi
|
||||
} // namespace amd
|
||||
|
||||
#endif // AMD_SMI_INCLUDE_AMD_SMI_CPU_CORE_H_
|
||||
@@ -1,81 +0,0 @@
|
||||
/*
|
||||
* =============================================================================
|
||||
* The University of Illinois/NCSA
|
||||
* Open Source License (NCSA)
|
||||
*
|
||||
* Copyright (c) 2023, Advanced Micro Devices, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Developed by:
|
||||
*
|
||||
* AMD Research and AMD ROC Software Development
|
||||
*
|
||||
* Advanced Micro Devices, Inc.
|
||||
*
|
||||
* www.amd.com
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal with 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:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimers.
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimers in
|
||||
* the documentation and/or other materials provided with the distribution.
|
||||
* - Neither the names of <Name of Development Group, Name of Institution>,
|
||||
* nor the names of its contributors may be used to endorse or promote
|
||||
* products derived from this Software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* 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 CONTRIBUTORS 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 WITH THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef AMD_SMI_INCLUDE_AMD_SMI_CPU_SOCKET_H_
|
||||
#define AMD_SMI_INCLUDE_AMD_SMI_CPU_SOCKET_H_
|
||||
|
||||
#include <string>
|
||||
#include <algorithm>
|
||||
#include <vector>
|
||||
#include "amd_smi/amdsmi.h"
|
||||
#include "amd_smi/impl/amd_smi_processor.h"
|
||||
#include "amd_smi/impl/amd_smi_cpu_core.h"
|
||||
|
||||
namespace amd {
|
||||
namespace smi {
|
||||
|
||||
/*Subclass CPU Socket*/
|
||||
class AMDSmiCpuSocket : public AMDSmiProcessor {
|
||||
public:
|
||||
explicit AMDSmiCpuSocket(const uint32_t& id):AMDSmiProcessor(AMD_CPU),socket_identifier_(id) {}
|
||||
|
||||
virtual ~AMDSmiCpuSocket() {}
|
||||
|
||||
amdsmi_status_t get_cpu_vendor() { return AMDSMI_STATUS_SUCCESS; }
|
||||
uint32_t get_cpu_id() const { return cpu_id_; }
|
||||
const uint32_t& get_socket_id() const { return socket_identifier_; }
|
||||
|
||||
void add_processor(AMDSmiProcessor* processor) { processors_.push_back(processor); }
|
||||
std::vector<AMDSmiProcessor*>& get_processors() { return processors_;}
|
||||
amdsmi_status_t get_processor_count(uint32_t* processor_count) const;
|
||||
|
||||
private:
|
||||
uint32_t cpu_id_;
|
||||
uint32_t socket_identifier_;
|
||||
std::vector<AMDSmiProcessor*> processors_;
|
||||
};
|
||||
|
||||
} // namespace smi
|
||||
} // namespace amd
|
||||
|
||||
#endif // AMD_SMI_INCLUDE_AMD_SMI_CPU_SOCKET_H_
|
||||
@@ -44,6 +44,7 @@
|
||||
#ifndef AMD_SMI_INCLUDE_AMD_SMI_PROCESSOR_H_
|
||||
#define AMD_SMI_INCLUDE_AMD_SMI_PROCESSOR_H_
|
||||
|
||||
#include <string>
|
||||
#include "amd_smi/amdsmi.h"
|
||||
|
||||
namespace amd {
|
||||
@@ -51,14 +52,18 @@ namespace smi {
|
||||
|
||||
class AMDSmiProcessor {
|
||||
public:
|
||||
explicit AMDSmiProcessor(processor_type_t processor) : processor_type_(processor) {}
|
||||
explicit AMDSmiProcessor(processor_type_t type) : processor_type_(type) {}
|
||||
explicit AMDSmiProcessor(processor_type_t type, uint32_t index) : processor_type_(type), pindex_(index) {}
|
||||
explicit AMDSmiProcessor(const std::string& id) : processor_identifier_(id) {}
|
||||
virtual ~AMDSmiProcessor() {}
|
||||
processor_type_t get_processor_type() const { return processor_type_;}
|
||||
const std::string& get_processor_id() const { return processor_identifier_;}
|
||||
uint32_t get_processor_index() const { return pindex_;}
|
||||
private:
|
||||
processor_type_t processor_type_;
|
||||
uint32_t pindex_;
|
||||
std::string processor_identifier_;
|
||||
};
|
||||
|
||||
|
||||
} // namespace smi
|
||||
} // namespace amd
|
||||
|
||||
|
||||
@@ -56,14 +56,46 @@ namespace smi {
|
||||
class AMDSmiSocket {
|
||||
public:
|
||||
explicit AMDSmiSocket(const std::string& id) : socket_identifier_(id) {}
|
||||
explicit AMDSmiSocket(uint32_t index) : sindex_(index) {}
|
||||
~AMDSmiSocket();
|
||||
const std::string& get_socket_id() const { return socket_identifier_;}
|
||||
void add_processor(AMDSmiProcessor* processor) { processors_.push_back(processor); }
|
||||
uint32_t get_socket_index() { return sindex_;}
|
||||
void add_processor(AMDSmiProcessor* processor) {
|
||||
switch (processor->get_processor_type()) {
|
||||
case AMD_GPU:
|
||||
processors_.push_back(processor);
|
||||
break;
|
||||
case AMD_CPU:
|
||||
cpu_processors_.push_back(processor);
|
||||
break;
|
||||
case AMD_CPU_CORE:
|
||||
cpu_core_processors_.push_back(processor);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
std::vector<AMDSmiProcessor*>& get_processors() { return processors_;}
|
||||
std::vector<AMDSmiProcessor*>& get_processors(processor_type_t type) {
|
||||
switch (type) {
|
||||
case AMD_GPU:
|
||||
return processors_;
|
||||
case AMD_CPU:
|
||||
return cpu_processors_;
|
||||
case AMD_CPU_CORE:
|
||||
return cpu_core_processors_;
|
||||
default:
|
||||
return processors_;
|
||||
}
|
||||
}
|
||||
amdsmi_status_t get_processor_count(uint32_t* processor_count) const;
|
||||
amdsmi_status_t get_processor_count(processor_type_t type, uint32_t* processor_count) const;
|
||||
private:
|
||||
uint32_t sindex_;
|
||||
std::string socket_identifier_;
|
||||
std::vector<AMDSmiProcessor*> processors_;
|
||||
std::vector<AMDSmiProcessor*> cpu_processors_;
|
||||
std::vector<AMDSmiProcessor*> cpu_core_processors_;
|
||||
};
|
||||
|
||||
} // namespace smi
|
||||
|
||||
@@ -50,9 +50,6 @@
|
||||
#include "amd_smi/impl/amd_smi_socket.h"
|
||||
#include "amd_smi/impl/amd_smi_processor.h"
|
||||
#include "amd_smi/impl/amd_smi_drm.h"
|
||||
#ifdef ENABLE_ESMI_LIB
|
||||
#include "amd_smi/impl/amd_smi_cpu_socket.h"
|
||||
#endif
|
||||
|
||||
namespace amd {
|
||||
namespace smi {
|
||||
@@ -78,25 +75,6 @@ class AMDSmiSystem {
|
||||
amdsmi_status_t gpu_index_to_handle(uint32_t gpu_index,
|
||||
amdsmi_processor_handle* processor_handle);
|
||||
|
||||
#ifdef ENABLE_ESMI_LIB
|
||||
std::vector<AMDSmiCpuSocket*>& get_cpu_sockets() {return cpu_sockets_;}
|
||||
|
||||
amdsmi_status_t handle_to_cpusocket(amdsmi_cpusocket_handle cpusock_handle,
|
||||
AMDSmiCpuSocket** cpu_socket);
|
||||
|
||||
amdsmi_status_t cpu_index_to_handle(uint32_t cpu_index,
|
||||
amdsmi_cpusocket_handle* cpusock_handle);
|
||||
|
||||
amdsmi_status_t get_cpu_sockets(uint32_t *socks);
|
||||
|
||||
amdsmi_status_t get_cpu_cores(uint32_t *cpus);
|
||||
|
||||
amdsmi_status_t get_threads_per_core(uint32_t *threads);
|
||||
|
||||
amdsmi_status_t get_cpu_family(uint32_t *family);
|
||||
|
||||
amdsmi_status_t get_cpu_model(uint32_t *model);
|
||||
#endif
|
||||
private:
|
||||
AMDSmiSystem() : init_flag_(AMDSMI_INIT_AMD_GPUS) {}
|
||||
|
||||
@@ -106,23 +84,12 @@ class AMDSmiSystem {
|
||||
*/
|
||||
amdsmi_status_t get_gpu_socket_id(uint32_t index, std::string& socketid);
|
||||
amdsmi_status_t populate_amd_gpu_devices();
|
||||
amdsmi_status_t populate_amd_cpus();
|
||||
uint64_t init_flag_;
|
||||
AMDSmiDrm drm_;
|
||||
std::vector<AMDSmiSocket*> sockets_;
|
||||
std::set<AMDSmiProcessor*> processors_; // Track valid processors
|
||||
#ifdef ENABLE_ESMI_LIB
|
||||
amdsmi_status_t populate_amd_cpus();
|
||||
std::vector<AMDSmiCpuSocket*> cpu_sockets_;
|
||||
static uint32_t sockets;
|
||||
static uint32_t cpus;
|
||||
static uint32_t threads;
|
||||
static uint32_t family;
|
||||
static uint32_t model;
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
|
||||
} // namespace smi
|
||||
} // namespace amd
|
||||
|
||||
|
||||
Rozdílový obsah nebyl zobrazen, protože je příliš veliký
Načíst rozdílové porovnání
@@ -1,62 +0,0 @@
|
||||
/*
|
||||
* =============================================================================
|
||||
* The University of Illinois/NCSA
|
||||
* Open Source License (NCSA)
|
||||
*
|
||||
* Copyright (c) 2023, Advanced Micro Devices, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Developed by:
|
||||
*
|
||||
* AMD Research and AMD ROC Software Development
|
||||
*
|
||||
* Advanced Micro Devices, Inc.
|
||||
*
|
||||
* www.amd.com
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal with 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:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimers.
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimers in
|
||||
* the documentation and/or other materials provided with the distribution.
|
||||
* - Neither the names of <Name of Development Group, Name of Institution>,
|
||||
* nor the names of its contributors may be used to endorse or promote
|
||||
* products derived from this Software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* 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 CONTRIBUTORS 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 WITH THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <functional>
|
||||
#include "amd_smi/impl/amd_smi_cpu_core.h"
|
||||
|
||||
namespace amd {
|
||||
namespace smi {
|
||||
AMDSmiCpuCore::~AMDSmiCpuCore() {
|
||||
for (uint32_t i = 0; i < processors_.size(); i++) {
|
||||
delete processors_[i];
|
||||
}
|
||||
processors_.clear();
|
||||
}
|
||||
|
||||
amdsmi_status_t AMDSmiCpuCore::get_processor_count(uint32_t* processor_count) const {
|
||||
*processor_count = static_cast<uint32_t>(processors_.size());
|
||||
return AMDSMI_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
} // namespace smi
|
||||
} // namespace amd
|
||||
@@ -1,72 +0,0 @@
|
||||
/*
|
||||
* =============================================================================
|
||||
* The University of Illinois/NCSA
|
||||
* Open Source License (NCSA)
|
||||
*
|
||||
* Copyright (c) 2023, Advanced Micro Devices, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Developed by:
|
||||
*
|
||||
* AMD Research and AMD ROC Software Development
|
||||
*
|
||||
* Advanced Micro Devices, Inc.
|
||||
*
|
||||
* www.amd.com
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal with 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:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimers.
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimers in
|
||||
* the documentation and/or other materials provided with the distribution.
|
||||
* - Neither the names of <Name of Development Group, Name of Institution>,
|
||||
* nor the names of its contributors may be used to endorse or promote
|
||||
* products derived from this Software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* 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 CONTRIBUTORS 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 WITH THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <functional>
|
||||
#include "amd_smi/impl/amd_smi_cpu_socket.h"
|
||||
#include <cpuid.h>
|
||||
|
||||
namespace amd {
|
||||
namespace smi {
|
||||
|
||||
AMDSmiCpuSocket::~AMDSmiCpuSocket() {}
|
||||
|
||||
amdsmi_status_t AMDSmiCpuSocket::set_socket_id(uint32_t idx, uint32_t socket_id) {
|
||||
socket_id = idx;
|
||||
return AMDSMI_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
amdsmi_status_t AMDSmiCpuSocket::get_cpu_vendor() {
|
||||
uint32_t eax, ebx, ecx, edx;
|
||||
|
||||
if (!__get_cpuid(0, &eax, &ebx, &ecx, &edx))
|
||||
return AMDSMI_STATUS_IO;
|
||||
|
||||
/* check if the value in ebx, ecx, edx matches "AuthenticAMD" string */
|
||||
if (ebx != 0x68747541 || ecx != 0x444d4163 || edx != 0x69746e65)
|
||||
return AMDSMI_STATUS_NON_AMD_CPU;
|
||||
|
||||
return AMDSMI_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
} // namespace smi
|
||||
} // namespace amd
|
||||
@@ -53,6 +53,14 @@ AMDSmiSocket::~AMDSmiSocket() {
|
||||
delete processors_[i];
|
||||
}
|
||||
processors_.clear();
|
||||
for (uint32_t i = 0; i < cpu_processors_.size(); i++) {
|
||||
delete cpu_processors_[i];
|
||||
}
|
||||
cpu_processors_.clear();
|
||||
for (uint32_t i = 0; i < cpu_core_processors_.size(); i++) {
|
||||
delete cpu_core_processors_[i];
|
||||
}
|
||||
cpu_core_processors_.clear();
|
||||
}
|
||||
|
||||
amdsmi_status_t AMDSmiSocket::get_processor_count(uint32_t* processor_count) const {
|
||||
@@ -60,6 +68,26 @@ amdsmi_status_t AMDSmiSocket::get_processor_count(uint32_t* processor_count) con
|
||||
return AMDSMI_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
amdsmi_status_t AMDSmiSocket::get_processor_count(processor_type_t type, uint32_t* processor_count) const {
|
||||
amdsmi_status_t ret = AMDSMI_STATUS_SUCCESS;
|
||||
switch (type) {
|
||||
case AMD_GPU:
|
||||
*processor_count = static_cast<uint32_t>(processors_.size());
|
||||
break;
|
||||
case AMD_CPU:
|
||||
*processor_count = static_cast<uint32_t>(cpu_processors_.size());
|
||||
break;
|
||||
case AMD_CPU_CORE:
|
||||
*processor_count = static_cast<uint32_t>(cpu_core_processors_.size());
|
||||
break;
|
||||
default:
|
||||
*processor_count = 0;
|
||||
ret = AMDSMI_STATUS_INVAL;
|
||||
break;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
} // namespace smi
|
||||
} // namespace amd
|
||||
|
||||
|
||||
@@ -53,16 +53,65 @@
|
||||
namespace amd {
|
||||
namespace smi {
|
||||
|
||||
#ifdef ENABLE_ESMI_LIB
|
||||
uint32_t AMDSmiSystem::sockets = 0;
|
||||
uint32_t AMDSmiSystem::cpus = 0;
|
||||
uint32_t AMDSmiSystem::threads = 0;
|
||||
uint32_t AMDSmiSystem::family = 0;
|
||||
uint32_t AMDSmiSystem::model = 0;
|
||||
#endif
|
||||
|
||||
#define AMD_SMI_INIT_FLAG_RESRV_TEST1 0x800000000000000 //!< Reserved for test
|
||||
|
||||
static amdsmi_status_t get_cpu_family(uint32_t *cpu_family) {
|
||||
amdsmi_status_t ret;
|
||||
ret = static_cast<amdsmi_status_t>(esmi_cpu_family_get(cpu_family));
|
||||
|
||||
if (ret != AMDSMI_STATUS_SUCCESS) {
|
||||
std::cout << "Failed to get cpu family, Err["<<ret<<"]" << std::endl;
|
||||
return ret;
|
||||
}
|
||||
return AMDSMI_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
static amdsmi_status_t get_cpu_model(uint32_t *cpu_model) {
|
||||
amdsmi_status_t ret;
|
||||
ret = static_cast<amdsmi_status_t>(esmi_cpu_model_get(cpu_model));
|
||||
|
||||
if (ret != AMDSMI_STATUS_SUCCESS) {
|
||||
std::cout << "Failed to get cpu model, Err["<<ret<<"]" << std::endl;
|
||||
return ret;
|
||||
}
|
||||
return AMDSMI_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static amdsmi_status_t get_nr_cpu_cores(uint32_t *num_cpus) {
|
||||
amdsmi_status_t ret;
|
||||
ret = static_cast<amdsmi_status_t>(esmi_number_of_cpus_get(num_cpus));
|
||||
|
||||
if (ret != AMDSMI_STATUS_SUCCESS) {
|
||||
std::cout << "Failed to get number of cpus, Err["<<ret<<"]" << std::endl;
|
||||
return ret;
|
||||
}
|
||||
return AMDSMI_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static amdsmi_status_t get_nr_threads_per_core(uint32_t *threads_per_core) {
|
||||
amdsmi_status_t ret;
|
||||
ret = static_cast<amdsmi_status_t>(esmi_threads_per_core_get(threads_per_core));
|
||||
|
||||
if (ret != AMDSMI_STATUS_SUCCESS) {
|
||||
std::cout << "Failed to get threads per core, Err["<<ret<<"]" << std::endl;
|
||||
return ret;
|
||||
}
|
||||
return AMDSMI_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static amdsmi_status_t get_nr_cpu_sockets(uint32_t *num_socks) {
|
||||
amdsmi_status_t ret;
|
||||
ret = static_cast<amdsmi_status_t>(esmi_number_of_sockets_get(num_socks));
|
||||
|
||||
if (ret != AMDSMI_STATUS_SUCCESS) {
|
||||
std::cout << "Failed to get number of sockets, Err["<<ret<<"]" << std::endl;
|
||||
return ret;
|
||||
}
|
||||
return AMDSMI_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
amdsmi_status_t AMDSmiSystem::init(uint64_t flags) {
|
||||
init_flag_ = flags;
|
||||
amdsmi_status_t amd_smi_status;
|
||||
@@ -73,137 +122,61 @@ amdsmi_status_t AMDSmiSystem::init(uint64_t flags) {
|
||||
return amd_smi_status;
|
||||
#ifdef ENABLE_ESMI_LIB
|
||||
}
|
||||
else if(flags & AMDSMI_INIT_AMD_CPUS) {
|
||||
|
||||
if (flags & AMDSMI_INIT_AMD_CPUS) {
|
||||
amd_smi_status = populate_amd_cpus();
|
||||
if (amd_smi_status != AMDSMI_STATUS_SUCCESS)
|
||||
return amd_smi_status;
|
||||
#endif
|
||||
} else {
|
||||
return AMDSMI_STATUS_NOT_SUPPORTED;
|
||||
}
|
||||
#endif
|
||||
return AMDSMI_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
#ifdef ENABLE_ESMI_LIB
|
||||
amdsmi_status_t AMDSmiSystem::populate_amd_cpus() {
|
||||
uint32_t sockets, cpus, threads;
|
||||
amdsmi_status_t amd_smi_status;
|
||||
amd::smi::AMDSmiCpuSocket *cpu_instance = nullptr;
|
||||
|
||||
/* detect if its an AMD cpu */
|
||||
amd_smi_status = cpu_instance->get_cpu_vendor();
|
||||
/* esmi is for AMD cpus, if its not AMD CPU, we are not going to initialise esmi */
|
||||
if (!amd_smi_status) {
|
||||
amd_smi_status = static_cast<amdsmi_status_t>(esmi_init());
|
||||
if (amd_smi_status != AMDSMI_STATUS_SUCCESS){
|
||||
std::cout<<"\tESMI Not initialized, drivers not found " << std::endl;
|
||||
return amd_smi_status;
|
||||
}
|
||||
amd_smi_status = static_cast<amdsmi_status_t>(esmi_init());
|
||||
if (amd_smi_status != AMDSMI_STATUS_SUCCESS){
|
||||
std::cout<<"\tESMI Not initialized, drivers not found " << std::endl;
|
||||
return amd_smi_status;
|
||||
}
|
||||
|
||||
amd_smi_status = get_cpu_sockets(&sockets);
|
||||
amd_smi_status = get_cpu_cores(&cpus);
|
||||
amd_smi_status = get_threads_per_core(&threads);
|
||||
amd_smi_status = get_cpu_family(&family);
|
||||
amd_smi_status = get_cpu_model(&model);
|
||||
std::cout << "\n***********************EPYC METRICS***********************" << std::endl;
|
||||
std::cout <<"| NR_SOCKETS | "<<sockets<<"\t\t|" << std::endl;
|
||||
std::cout <<"| NR_CPUS | "<<cpus<<"\t\t|" << std::endl;
|
||||
|
||||
if (threads > 1) {
|
||||
std::cout <<"| THREADS PER CORE | "<<threads<<" (SMT ON)\t|" << std::endl;
|
||||
} else {
|
||||
std::cout <<"| THREADS PER CORE | "<<threads<<" (SMT OFF)\t|" << std::endl;
|
||||
}
|
||||
std::cout <<"| CPU Family | 0x"<<std::hex<<family<<"("<<std::dec<<family<<")\t|" << std::endl;
|
||||
std::cout <<"| CPU Model | 0x"<<std::hex<<model<<"("<<std::dec<<model<<")\t|" << std::endl;
|
||||
std::cout << std::endl;
|
||||
amd_smi_status = get_nr_cpu_sockets(&sockets);
|
||||
amd_smi_status = get_nr_cpu_cores(&cpus);
|
||||
amd_smi_status = get_nr_threads_per_core(&threads);
|
||||
|
||||
for(uint32_t i = 0; i < sockets; i++) {
|
||||
uint32_t cpu_socket_id = i;
|
||||
|
||||
std::string cpu_socket_id = std::to_string(i);
|
||||
// Multiple cores may share the same socket
|
||||
AMDSmiCpuSocket* socket = nullptr;
|
||||
for (uint32_t j = 0; j < cpu_sockets_.size(); j++) {
|
||||
if (cpu_sockets_[j]->get_socket_id() == cpu_socket_id) {
|
||||
socket = cpu_sockets_[j];
|
||||
AMDSmiSocket* socket = nullptr;
|
||||
for (uint32_t j = 0; j < sockets_.size(); j++) {
|
||||
if (sockets_[j]->get_socket_id() == cpu_socket_id) {
|
||||
socket = sockets_[j];
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (socket == nullptr) {
|
||||
socket = new AMDSmiCpuSocket(cpu_socket_id);
|
||||
cpu_sockets_.push_back(socket);
|
||||
socket = new AMDSmiSocket(cpu_socket_id);
|
||||
sockets_.push_back(socket);
|
||||
}
|
||||
AMDSmiProcessor* cpusocket = new AMDSmiProcessor(AMD_CPU, i);
|
||||
socket->add_processor(cpusocket);
|
||||
processors_.insert(cpusocket);
|
||||
|
||||
for (uint32_t k = 0; k < cpus/threads; k++) {
|
||||
AMDSmiCpuCore* core = new AMDSmiCpuCore(k);
|
||||
for (uint32_t k = 0; k < (cpus/threads)/sockets; k++) {
|
||||
AMDSmiProcessor* core = new AMDSmiProcessor(AMD_CPU_CORE, k);
|
||||
socket->add_processor(core);
|
||||
processors_.insert(core);
|
||||
}
|
||||
}
|
||||
|
||||
std::cout << std::endl;
|
||||
return AMDSMI_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
amdsmi_status_t AMDSmiSystem::get_cpu_sockets(uint32_t *num_socks) {
|
||||
amdsmi_status_t ret;
|
||||
ret = static_cast<amdsmi_status_t>(esmi_number_of_sockets_get(num_socks));
|
||||
sockets = *num_socks;
|
||||
|
||||
if (ret != AMDSMI_STATUS_SUCCESS) {
|
||||
std::cout << "Failed to get number of sockets, Err["<<ret<<"]" << std::endl;
|
||||
return ret;
|
||||
}
|
||||
return AMDSMI_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
amdsmi_status_t AMDSmiSystem::get_cpu_cores(uint32_t *num_cpus) {
|
||||
amdsmi_status_t ret;
|
||||
ret = static_cast<amdsmi_status_t>(esmi_number_of_cpus_get(num_cpus));
|
||||
cpus = *num_cpus;
|
||||
|
||||
if (ret != AMDSMI_STATUS_SUCCESS) {
|
||||
std::cout << "Failed to get number of cpus, Err["<<ret<<"]" << std::endl;
|
||||
return ret;
|
||||
}
|
||||
return AMDSMI_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
amdsmi_status_t AMDSmiSystem::get_threads_per_core(uint32_t *threads_per_core) {
|
||||
amdsmi_status_t ret;
|
||||
ret = static_cast<amdsmi_status_t>(esmi_threads_per_core_get(threads_per_core));
|
||||
threads = *threads_per_core;
|
||||
|
||||
if (ret != AMDSMI_STATUS_SUCCESS) {
|
||||
std::cout << "Failed to get threads per core, Err["<<ret<<"]" << std::endl;
|
||||
return ret;
|
||||
}
|
||||
return AMDSMI_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
amdsmi_status_t AMDSmiSystem::get_cpu_family(uint32_t *cpu_family) {
|
||||
amdsmi_status_t ret;
|
||||
ret = static_cast<amdsmi_status_t>(esmi_cpu_family_get(cpu_family));
|
||||
family = *cpu_family;
|
||||
|
||||
if (ret != AMDSMI_STATUS_SUCCESS) {
|
||||
std::cout << "Failed to get cpu family, Err["<<ret<<"]" << std::endl;
|
||||
return ret;
|
||||
}
|
||||
return AMDSMI_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
amdsmi_status_t AMDSmiSystem::get_cpu_model(uint32_t *cpu_model) {
|
||||
amdsmi_status_t ret;
|
||||
ret = static_cast<amdsmi_status_t>(esmi_cpu_model_get(cpu_model));
|
||||
model = *cpu_model;
|
||||
|
||||
if (ret != AMDSMI_STATUS_SUCCESS) {
|
||||
std::cout << "Failed to get cpu model, Err["<<ret<<"]" << std::endl;
|
||||
return ret;
|
||||
}
|
||||
return AMDSMI_STATUS_SUCCESS;
|
||||
}
|
||||
#endif
|
||||
|
||||
amdsmi_status_t AMDSmiSystem::populate_amd_gpu_devices() {
|
||||
@@ -281,29 +254,31 @@ amdsmi_status_t AMDSmiSystem::get_gpu_socket_id(uint32_t index,
|
||||
|
||||
amdsmi_status_t AMDSmiSystem::cleanup() {
|
||||
#ifdef ENABLE_ESMI_LIB
|
||||
if(init_flag_ == AMDSMI_INIT_AMD_CPUS){
|
||||
for (uint32_t i = 0; i < cpu_sockets_.size(); i++) {
|
||||
delete cpu_sockets_[i];
|
||||
if (init_flag_ & AMDSMI_INIT_AMD_CPUS) {
|
||||
for (uint32_t i = 0; i < sockets_.size(); i++) {
|
||||
delete sockets_[i];
|
||||
}
|
||||
cpu_sockets_.clear();
|
||||
processors_.clear();
|
||||
sockets_.clear();
|
||||
esmi_exit();
|
||||
init_flag_ = AMDSMI_INIT_ALL_PROCESSORS;
|
||||
return AMDSMI_STATUS_SUCCESS;
|
||||
}
|
||||
#endif
|
||||
for (uint32_t i = 0; i < sockets_.size(); i++) {
|
||||
delete sockets_[i];
|
||||
}
|
||||
processors_.clear();
|
||||
sockets_.clear();
|
||||
init_flag_ = AMDSMI_INIT_ALL_PROCESSORS;
|
||||
rsmi_status_t ret = rsmi_shut_down();
|
||||
if (ret != RSMI_STATUS_SUCCESS) {
|
||||
return amd::smi::rsmi_to_amdsmi_status(ret);
|
||||
if (init_flag_ & AMDSMI_INIT_AMD_GPUS) {
|
||||
for (uint32_t i = 0; i < sockets_.size(); i++) {
|
||||
delete sockets_[i];
|
||||
}
|
||||
processors_.clear();
|
||||
sockets_.clear();
|
||||
init_flag_ = AMDSMI_INIT_ALL_PROCESSORS;
|
||||
rsmi_status_t ret = rsmi_shut_down();
|
||||
if (ret != RSMI_STATUS_SUCCESS) {
|
||||
return amd::smi::rsmi_to_amdsmi_status(ret);
|
||||
}
|
||||
|
||||
drm_.cleanup();
|
||||
}
|
||||
|
||||
drm_.cleanup();
|
||||
return AMDSMI_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -323,24 +298,6 @@ amdsmi_status_t AMDSmiSystem::handle_to_socket(
|
||||
return AMDSMI_STATUS_INVAL;
|
||||
}
|
||||
|
||||
#ifdef ENABLE_ESMI_LIB
|
||||
amdsmi_status_t AMDSmiSystem::handle_to_cpusocket(
|
||||
amdsmi_cpusocket_handle socket_handle,
|
||||
AMDSmiCpuSocket** socket) {
|
||||
if (socket_handle == nullptr || socket == nullptr) {
|
||||
return AMDSMI_STATUS_INVAL;
|
||||
}
|
||||
*socket = static_cast<AMDSmiCpuSocket*>(socket_handle);
|
||||
|
||||
// double check handlers is here
|
||||
if (std::find(cpu_sockets_.begin(), cpu_sockets_.end(), *socket)
|
||||
!= cpu_sockets_.end()) {
|
||||
return AMDSMI_STATUS_SUCCESS;
|
||||
}
|
||||
return AMDSMI_STATUS_INVAL;
|
||||
}
|
||||
#endif
|
||||
|
||||
amdsmi_status_t AMDSmiSystem::handle_to_processor(
|
||||
amdsmi_processor_handle processor_handle,
|
||||
AMDSmiProcessor** processor) {
|
||||
@@ -378,28 +335,6 @@ amdsmi_status_t AMDSmiSystem::gpu_index_to_handle(uint32_t gpu_index,
|
||||
return AMDSMI_STATUS_INVAL;
|
||||
}
|
||||
|
||||
#ifdef ENABLE_ESMI_LIB
|
||||
amdsmi_status_t AMDSmiSystem::cpu_index_to_handle(uint32_t cpu_index,
|
||||
amdsmi_cpusocket_handle* cpu_handle) {
|
||||
if (cpu_handle == nullptr)
|
||||
return AMDSMI_STATUS_INVAL;
|
||||
|
||||
auto iter = cpu_sockets_.begin();
|
||||
for (; iter != cpu_sockets_.end(); iter++) {
|
||||
auto cur_socket = (*iter);
|
||||
if (cur_socket->get_processor_type() != AMD_CPU)
|
||||
continue;
|
||||
amd::smi::AMDSmiCpuSocket* cpu_socket =
|
||||
static_cast<amd::smi::AMDSmiCpuSocket*>(cur_socket);
|
||||
uint32_t cur_cpu_index = cpu_socket->get_cpu_id();
|
||||
if (cpu_index == cur_cpu_index) {
|
||||
*cpu_handle = cur_socket;
|
||||
return AMDSMI_STATUS_SUCCESS;
|
||||
}
|
||||
}
|
||||
return AMDSMI_STATUS_INVAL;
|
||||
}
|
||||
#endif
|
||||
|
||||
} // namespace smi
|
||||
} // namespace amd
|
||||
|
||||
Odkázat v novém úkolu
Zablokovat Uživatele