Change device_handle to processor_handle

grep -rli 'device_handle' * | xargs -i@ sed -i
's/device_handle/processor_handle/g' @

Change-Id: Ifc8b7fa3b5488ce1fa8d8cf9eb3981a09450de11
Cette révision appartient à :
Suma Hegde
2023-02-25 05:28:40 -05:00
révisé par Naveen Krishna Chatradhi
Parent 3963036a05
révision 3f9e4d95d4
44 fichiers modifiés avec 1381 ajouts et 1377 suppressions
+8 -8
Voir le fichier
@@ -76,7 +76,7 @@ Many of the functions in the library take a "socket handle" or "device handle".
GPU device and CPU device on the same socket. Moreover, for MI200, it may have multiple GCDs.
To discover the sockets in the system, `amdsmi_get_socket_handles()` is called to get list of sockets
handles, which in turn can be used to query the devices in that socket using `amdsmi_get_device_handles()`. The device handler is used to distinguish the detected devices from one another. It is important to note that a device may end up with a different device handles after restart application, so a device handle should not be relied upon to be constant over process.
handles, which in turn can be used to query the devices in that socket using `amdsmi_get_processor_handles()`. The device handler is used to distinguish the detected devices from one another. It is important to note that a device may end up with a different device handles after restart application, so a device handle should not be relied upon to be constant over process.
## Hello AMD SMI
@@ -116,20 +116,20 @@ int main() {
// Get the device count for the socket.
uint32_t device_count = 0;
ret = amdsmi_get_device_handles(sockets[i], &device_count, nullptr);
ret = amdsmi_get_processor_handles(sockets[i], &device_count, nullptr);
// Allocate the memory for the device handlers on the socket
std::vector<amdsmi_processor_handle> device_handles(device_count);
std::vector<amdsmi_processor_handle> processor_handles(device_count);
// Get all devices of the socket
ret = amdsmi_get_device_handles(sockets[i],
&device_count, &device_handles[0]);
ret = amdsmi_get_processor_handles(sockets[i],
&device_count, &processor_handles[0]);
// For each device of the socket, get name and temperature.
for (uint32_t j=0; j < device_count; j++) {
// Get device type. Since the amdsmi is initialized with
// AMD_SMI_INIT_AMD_GPUS, the device_type must be AMD_GPU.
device_type_t device_type;
ret = amdsmi_get_device_type(device_handles[j], &device_type);
ret = amdsmi_get_device_type(processor_handles[j], &device_type);
if (device_type != AMD_GPU) {
std::cout << "Expect AMD_GPU device type!\n";
return 1;
@@ -137,13 +137,13 @@ int main() {
// Get device name
amdsmi_board_info_t board_info;
ret = amdsmi_get_board_info(device_handles[j], &board_info);
ret = amdsmi_get_board_info(processor_handles[j], &board_info);
std::cout << "\tdevice "
<< j <<"\n\t\tName:" << board_info.product_name << std::endl;
// Get temperature
int64_t val_i64 = 0;
ret = amdsmi_dev_get_temp_metric(device_handles[j], TEMPERATURE_TYPE_EDGE,
ret = amdsmi_dev_get_temp_metric(processor_handles[j], TEMPERATURE_TYPE_EDGE,
AMDSMI_TEMP_CURRENT, &val_i64);
std::cout << "\t\tTemperature: " << val_i64 << "C" << std::endl;
}
+34 -34
Voir le fichier
@@ -244,14 +244,14 @@ int main() {
// Get the device count available for the socket.
uint32_t device_count = 0;
ret = amdsmi_get_device_handles(sockets[i], &device_count, nullptr);
ret = amdsmi_get_processor_handles(sockets[i], &device_count, nullptr);
CHK_AMDSMI_RET(ret)
// Allocate the memory for the device handlers on the socket
std::vector<amdsmi_processor_handle> device_handles(device_count);
std::vector<amdsmi_processor_handle> processor_handles(device_count);
// Get all devices of the socket
ret = amdsmi_get_device_handles(sockets[i],
&device_count, &device_handles[0]);
ret = amdsmi_get_processor_handles(sockets[i],
&device_count, &processor_handles[0]);
CHK_AMDSMI_RET(ret)
// For each device of the socket, get name and temperature.
@@ -259,7 +259,7 @@ int main() {
// Get device type. Since the amdsmi is initialized with
// AMD_SMI_INIT_AMD_GPUS, the device_type must be AMD_GPU.
device_type_t device_type = {};
ret = amdsmi_get_device_type(device_handles[j], &device_type);
ret = amdsmi_get_device_type(processor_handles[j], &device_type);
CHK_AMDSMI_RET(ret)
if (device_type != AMD_GPU) {
std::cout << "Expect AMD_GPU device type!\n";
@@ -268,7 +268,7 @@ int main() {
// Get BDF info
amdsmi_bdf_t bdf = {};
ret = amdsmi_get_device_bdf(device_handles[j], &bdf);
ret = amdsmi_get_device_bdf(processor_handles[j], &bdf);
CHK_AMDSMI_RET(ret)
printf(" Output of amdsmi_get_device_bdf:\n");
printf("\tDevice[%d] BDF %04lx:%02x:%02x.%d\n\n", i,
@@ -277,12 +277,12 @@ int main() {
// Get handle from BDF
amdsmi_processor_handle dev_handle;
ret = amdsmi_get_device_handle_from_bdf(bdf, &dev_handle);
ret = amdsmi_get_processor_handle_from_bdf(bdf, &dev_handle);
CHK_AMDSMI_RET(ret)
// Get ASIC info
amdsmi_asic_info_t asic_info = {};
ret = amdsmi_get_asic_info(device_handles[j], &asic_info);
ret = amdsmi_get_asic_info(processor_handles[j], &asic_info);
CHK_AMDSMI_RET(ret)
printf(" Output of amdsmi_get_asic_info:\n");
printf("\tMarket Name: %s\n", asic_info.market_name);
@@ -294,7 +294,7 @@ int main() {
// Get VBIOS info
amdsmi_vbios_info_t vbios_info = {};
ret = amdsmi_get_vbios_info(device_handles[j], &vbios_info);
ret = amdsmi_get_vbios_info(processor_handles[j], &vbios_info);
CHK_AMDSMI_RET(ret)
printf(" Output of amdsmi_get_vbios_info:\n");
printf("\tVBios Name: %s\n", vbios_info.name);
@@ -306,7 +306,7 @@ int main() {
// Get power measure
amdsmi_power_measure_t power_measure = {};
ret = amdsmi_get_power_measure(device_handles[j], &power_measure);
ret = amdsmi_get_power_measure(processor_handles[j], &power_measure);
CHK_AMDSMI_RET(ret)
printf(" Output of amdsmi_get_power_measure:\n");
printf("\tCurrent GFX Voltage: %d\n",
@@ -320,7 +320,7 @@ int main() {
// Get driver version
char version[AMDSMI_MAX_DRIVER_VERSION_LENGTH];
int version_length = AMDSMI_MAX_DRIVER_VERSION_LENGTH;
ret = amdsmi_get_driver_version(device_handles[j], &version_length, version);
ret = amdsmi_get_driver_version(processor_handles[j], &version_length, version);
CHK_AMDSMI_RET(ret)
printf(" Output of amdsmi_get_driver_version:\n");
printf("\tDriver version: %s\n\n", version);
@@ -328,14 +328,14 @@ int main() {
// Get device uuid
unsigned int uuid_length = AMDSMI_GPU_UUID_SIZE;
char uuid[AMDSMI_GPU_UUID_SIZE];
ret = amdsmi_get_device_uuid(device_handles[j], &uuid_length, uuid);
ret = amdsmi_get_device_uuid(processor_handles[j], &uuid_length, uuid);
CHK_AMDSMI_RET(ret)
printf(" Output of amdsmi_get_device_uuid:\n");
printf("\tDevice uuid: %s\n\n", uuid);
// Get engine usage info
amdsmi_engine_usage_t engine_usage = {};
ret = amdsmi_get_gpu_activity(device_handles[j], &engine_usage);
ret = amdsmi_get_gpu_activity(processor_handles[j], &engine_usage);
CHK_AMDSMI_RET(ret)
printf(" Output of amdsmi_get_gpu_activity:\n");
printf("\tAverage GFX Activity: %d\n",
@@ -348,7 +348,7 @@ int main() {
// Get firmware info
amdsmi_fw_info_t fw_information = {};
char ucode_name[AMDSMI_MAX_STRING_LENGTH];
ret = amdsmi_get_fw_info(device_handles[j], &fw_information);
ret = amdsmi_get_fw_info(processor_handles[j], &fw_information);
CHK_AMDSMI_RET(ret)
printf(" Output of amdsmi_get_fw_info:\n");
printf("Number of Microcodes: %d\n", fw_information.num_fw_info);
@@ -359,7 +359,7 @@ int main() {
// Get GFX clock measurements
amdsmi_clk_measure_t gfx_clk_values = {};
ret = amdsmi_get_clock_measure(device_handles[j], CLK_TYPE_GFX,
ret = amdsmi_get_clock_measure(processor_handles[j], CLK_TYPE_GFX,
&gfx_clk_values);
CHK_AMDSMI_RET(ret)
printf(" Output of amdsmi_get_clock_measure:\n");
@@ -369,7 +369,7 @@ int main() {
// Get MEM clock measurements
amdsmi_clk_measure_t mem_clk_values = {};
ret = amdsmi_get_clock_measure(device_handles[j], CLK_TYPE_MEM,
ret = amdsmi_get_clock_measure(processor_handles[j], CLK_TYPE_MEM,
&mem_clk_values);
CHK_AMDSMI_RET(ret)
printf("\tGPU MEM Max Clock: %d\n", mem_clk_values.max_clk);
@@ -378,7 +378,7 @@ int main() {
// Get PCIe status
amdsmi_pcie_info_t pcie_info = {};
ret = amdsmi_get_pcie_link_status(device_handles[j], &pcie_info);
ret = amdsmi_get_pcie_link_status(processor_handles[j], &pcie_info);
CHK_AMDSMI_RET(ret)
printf(" Output of amdsmi_get_pcie_link_status:\n");
printf("\tPCIe lanes: %d\n", pcie_info.pcie_lanes);
@@ -386,7 +386,7 @@ int main() {
// Get PCIe caps
amdsmi_pcie_info_t pcie_caps_info = {};
ret = amdsmi_get_pcie_link_caps(device_handles[j], &pcie_caps_info);
ret = amdsmi_get_pcie_link_caps(processor_handles[j], &pcie_caps_info);
CHK_AMDSMI_RET(ret)
printf(" Output of amdsmi_get_pcie_link_caps:\n");
printf("\tPCIe max lanes: %d\n", pcie_caps_info.pcie_lanes);
@@ -395,7 +395,7 @@ int main() {
// Get VRAM temperature limit
int64_t temperature = 0;
ret = amdsmi_dev_get_temp_metric(
device_handles[j], TEMPERATURE_TYPE_VRAM,
processor_handles[j], TEMPERATURE_TYPE_VRAM,
AMDSMI_TEMP_CRITICAL, &temperature);
CHK_AMDSMI_RET(ret)
printf(" Output of amdsmi_dev_get_temp_metric:\n");
@@ -403,7 +403,7 @@ int main() {
// Get GFX temperature limit
ret = amdsmi_dev_get_temp_metric(
device_handles[j], TEMPERATURE_TYPE_EDGE,
processor_handles[j], TEMPERATURE_TYPE_EDGE,
AMDSMI_TEMP_CRITICAL, &temperature);
CHK_AMDSMI_RET(ret)
printf("\tGPU GFX temp limit: %ld\n\n", temperature);
@@ -417,7 +417,7 @@ int main() {
TEMPERATURE_TYPE_VRAM, TEMPERATURE_TYPE_PLX};
for (const auto &temp_type : temp_types) {
ret = amdsmi_dev_get_temp_metric(
device_handles[j], temp_type,
processor_handles[j], temp_type,
AMDSMI_TEMP_CURRENT,
&temp_measurements[(int)(temp_type)]);
CHK_AMDSMI_RET(ret)
@@ -446,7 +446,7 @@ int main() {
for (auto block = AMDSMI_GPU_BLOCK_FIRST;
block <= AMDSMI_GPU_BLOCK_LAST;
block = (amdsmi_gpu_block_t)(block * 2)) {
ret = amdsmi_get_ras_block_features_enabled(device_handles[j], block,
ret = amdsmi_get_ras_block_features_enabled(processor_handles[j], block,
&state);
CHK_AMDSMI_RET(ret)
printf("\tBlock: %s\n", block_names[index]);
@@ -459,7 +459,7 @@ int main() {
char bad_page_status_names[3][15] = {"RESERVED", "PENDING",
"UNRESERVABLE"};
uint32_t num_pages = 0;
ret = amdsmi_get_bad_page_info(device_handles[j], &num_pages,
ret = amdsmi_get_bad_page_info(processor_handles[j], &num_pages,
nullptr);
CHK_AMDSMI_RET(ret)
printf(" Output of amdsmi_get_bad_page_info:\n");
@@ -467,7 +467,7 @@ int main() {
printf("\tNo bad pages found.\n");
} else {
std::vector<amdsmi_retired_page_record_t> bad_page_info(num_pages);
ret = amdsmi_get_bad_page_info(device_handles[j], &num_pages,
ret = amdsmi_get_bad_page_info(processor_handles[j], &num_pages,
bad_page_info.data());
CHK_AMDSMI_RET(ret)
for (uint32_t page_it = 0; page_it < num_pages; page_it += 1) {
@@ -484,7 +484,7 @@ int main() {
// Get ECC error counts
amdsmi_error_count_t err_cnt_info = {};
ret = amdsmi_get_ecc_error_count(device_handles[j], &err_cnt_info);
ret = amdsmi_get_ecc_error_count(processor_handles[j], &err_cnt_info);
CHK_AMDSMI_RET(ret)
printf(" Output of amdsmi_get_ecc_error_count:\n");
printf("\tCorrectable errors: %lu\n", err_cnt_info.correctable_count);
@@ -501,7 +501,7 @@ int main() {
// Get frequency ranges
amdsmi_frequency_range_t freq_ranges = {};
ret = amdsmi_get_target_frequency_range(
device_handles[j], CLK_TYPE_GFX, &freq_ranges);
processor_handles[j], CLK_TYPE_GFX, &freq_ranges);
CHK_AMDSMI_RET(ret)
printf(" Output of amdsmi_get_target_frequency_range:\n");
printf("\tSupported min freq: %lu\n",
@@ -514,7 +514,7 @@ int main() {
freq_ranges.current_freq_range.upper_bound);
uint32_t num_process = 0;
ret = amdsmi_get_process_list(device_handles[j], nullptr,
ret = amdsmi_get_process_list(processor_handles[j], nullptr,
&num_process);
CHK_AMDSMI_RET(ret)
if (!num_process) {
@@ -529,14 +529,14 @@ int main() {
sprintf(bdf_str, "%04lx:%02x:%02x.%d", bdf.domain_number,
bdf.bus_number, bdf.device_number, bdf.function_number);
int num = 0;
ret = amdsmi_get_process_list(device_handles[j], process_list,
ret = amdsmi_get_process_list(processor_handles[j], process_list,
&num_process);
CHK_AMDSMI_RET(ret)
for (uint32_t it = 0; it < num_process; it += 1) {
if (getpid() == process_list[it]) {
continue;
}
ret = amdsmi_get_process_info(device_handles[j],
ret = amdsmi_get_process_info(processor_handles[j],
process_list[it], &process);
if (ret != AMDSMI_STATUS_SUCCESS) {
printf("amdsmi_get_process_info() failed for "
@@ -623,7 +623,7 @@ int main() {
// Get device name
amdsmi_board_info_t board_info = {};
ret = amdsmi_get_board_info(device_handles[j], &board_info);
ret = amdsmi_get_board_info(processor_handles[j], &board_info);
CHK_AMDSMI_RET(ret)
printf(" Output of amdsmi_get_board_info:\n");
std::cout << "\tdevice [" << j
@@ -636,7 +636,7 @@ int main() {
// Get temperature
int64_t val_i64 = 0;
ret = amdsmi_dev_get_temp_metric(device_handles[j], TEMPERATURE_TYPE_EDGE,
ret = amdsmi_dev_get_temp_metric(processor_handles[j], TEMPERATURE_TYPE_EDGE,
AMDSMI_TEMP_CURRENT, &val_i64);
CHK_AMDSMI_RET(ret)
printf(" Output of amdsmi_dev_get_temp_metric:\n");
@@ -645,7 +645,7 @@ int main() {
// Get frame buffer
amdsmi_vram_info_t vram_usage = {};
ret = amdsmi_get_vram_usage(device_handles[j], &vram_usage);
ret = amdsmi_get_vram_usage(processor_handles[j], &vram_usage);
CHK_AMDSMI_RET(ret)
printf(" Output of amdsmi_get_vram_usage:\n");
std::cout << "\t\tFrame buffer usage (MB): " << vram_usage.vram_used
@@ -653,7 +653,7 @@ int main() {
// Get Cap info
amdsmi_gpu_caps_t caps_info = {};
ret = amdsmi_get_caps_info(device_handles[j], &caps_info);
ret = amdsmi_get_caps_info(processor_handles[j], &caps_info);
CHK_AMDSMI_RET(ret)
printf(" Output of amdsmi_get_caps_info:\n");
std::cout << "\t\tGFX IP Major: " << caps_info.gfx.gfxip_major
@@ -668,7 +668,7 @@ int main() {
<< "\n\n";
amdsmi_power_cap_info_t cap_info = {};
ret = amdsmi_get_power_cap_info(device_handles[j], 0, &cap_info);
ret = amdsmi_get_power_cap_info(processor_handles[j], 0, &cap_info);
CHK_AMDSMI_RET(ret)
printf(" Output of amdsmi_get_power_cap_info:\n");
std::cout << "\t\t Power Cap: " << cap_info.power_cap
+19 -19
Voir le fichier
@@ -96,14 +96,14 @@ int main() {
// Get the device count available for the socket.
uint32_t device_count = 0;
ret = amdsmi_get_device_handles(sockets[i], &device_count, nullptr);
ret = amdsmi_get_processor_handles(sockets[i], &device_count, nullptr);
CHK_AMDSMI_RET(ret)
// Allocate the memory for the device handlers on the socket
std::vector<amdsmi_processor_handle> device_handles(device_count);
std::vector<amdsmi_processor_handle> processor_handles(device_count);
// Get all devices of the socket
ret = amdsmi_get_device_handles(sockets[i],
&device_count, &device_handles[0]);
ret = amdsmi_get_processor_handles(sockets[i],
&device_count, &processor_handles[0]);
CHK_AMDSMI_RET(ret)
// For each device of the socket, get name and temperature.
@@ -111,7 +111,7 @@ int main() {
// Get device type. Since the amdsmi is initialized with
// AMD_SMI_INIT_AMD_GPUS, the device_type must be AMD_GPU.
device_type_t device_type = {};
ret = amdsmi_get_device_type(device_handles[j], &device_type);
ret = amdsmi_get_device_type(processor_handles[j], &device_type);
CHK_AMDSMI_RET(ret)
if (device_type != AMD_GPU) {
std::cout << "Expect AMD_GPU device type!\n";
@@ -119,7 +119,7 @@ int main() {
}
amdsmi_bdf_t bdf = {};
ret = amdsmi_get_device_bdf(device_handles[j], &bdf);
ret = amdsmi_get_device_bdf(processor_handles[j], &bdf);
CHK_AMDSMI_RET(ret)
printf(" Output of amdsmi_get_device_bdf:\n");
printf("\tDevice[%d] BDF %04lx:%02x:%02x.%d\n\n", i,
@@ -127,7 +127,7 @@ int main() {
bdf.function_number);
amdsmi_asic_info_t asic_info = {};
ret = amdsmi_get_asic_info(device_handles[j], &asic_info);
ret = amdsmi_get_asic_info(processor_handles[j], &asic_info);
CHK_AMDSMI_RET(ret)
printf(" Output of amdsmi_get_asic_info:\n");
printf("\tMarket Name: %s\n", asic_info.market_name);
@@ -139,7 +139,7 @@ int main() {
// Get VBIOS info
amdsmi_vbios_info_t vbios_info = {};
ret = amdsmi_get_vbios_info(device_handles[j], &vbios_info);
ret = amdsmi_get_vbios_info(processor_handles[j], &vbios_info);
CHK_AMDSMI_RET(ret)
printf(" Output of amdsmi_get_vbios_info:\n");
printf("\tVBios Name: %s\n", vbios_info.name);
@@ -151,7 +151,7 @@ int main() {
// Get engine usage info
amdsmi_engine_usage_t engine_usage = {};
ret = amdsmi_get_gpu_activity(device_handles[j], &engine_usage);
ret = amdsmi_get_gpu_activity(processor_handles[j], &engine_usage);
CHK_AMDSMI_RET(ret)
printf(" Output of amdsmi_get_gpu_activity:\n");
printf("\tAverage GFX Activity: %d\n",
@@ -163,7 +163,7 @@ int main() {
// Get firmware info
amdsmi_fw_info_t fw_information = {};
ret = amdsmi_get_fw_info(device_handles[j], &fw_information);
ret = amdsmi_get_fw_info(processor_handles[j], &fw_information);
CHK_AMDSMI_RET(ret)
printf(" Output of amdsmi_get_fw_info:\n");
printf("\tFirmware version: %d\n", fw_information.num_fw_info);
@@ -227,7 +227,7 @@ int main() {
TEMPERATURE_TYPE_VRAM, TEMPERATURE_TYPE_PLX};
for (const auto &temp_type : temp_types) {
ret = amdsmi_dev_get_temp_metric(
device_handles[j], temp_type,
processor_handles[j], temp_type,
AMDSMI_TEMP_CURRENT,
&temp_measurements[(int)(temp_type)]);
CHK_AMDSMI_RET(ret)
@@ -246,7 +246,7 @@ int main() {
char bad_page_status_names[3][15] = {"RESERVED", "PENDING",
"UNRESERVABLE"};
uint32_t num_pages = 0;
ret = amdsmi_get_bad_page_info(device_handles[j], &num_pages,
ret = amdsmi_get_bad_page_info(processor_handles[j], &num_pages,
nullptr);
CHK_AMDSMI_RET(ret)
printf(" Output of amdsmi_get_bad_page_info:\n");
@@ -254,7 +254,7 @@ int main() {
printf("\tNo bad pages found.\n");
} else {
std::vector<amdsmi_retired_page_record_t> bad_page_info(num_pages);
ret = amdsmi_get_bad_page_info(device_handles[j], &num_pages,
ret = amdsmi_get_bad_page_info(processor_handles[j], &num_pages,
bad_page_info.data());
CHK_AMDSMI_RET(ret)
for (uint32_t page_it = 0; page_it < num_pages; page_it += 1) {
@@ -271,7 +271,7 @@ int main() {
// Get ECC error counts
amdsmi_error_count_t err_cnt_info = {};
ret = amdsmi_get_ecc_error_count(device_handles[j], &err_cnt_info);
ret = amdsmi_get_ecc_error_count(processor_handles[j], &err_cnt_info);
CHK_AMDSMI_RET(ret)
printf(" Output of amdsmi_get_ecc_error_count:\n");
printf("\tCorrectable errors: %lu\n", err_cnt_info.correctable_count);
@@ -287,7 +287,7 @@ int main() {
// Get device name
amdsmi_board_info_t board_info = {};
ret = amdsmi_get_board_info(device_handles[j], &board_info);
ret = amdsmi_get_board_info(processor_handles[j], &board_info);
CHK_AMDSMI_RET(ret)
printf(" Output of amdsmi_get_board_info:\n");
std::cout << "\tdevice [" << j
@@ -300,7 +300,7 @@ int main() {
// Get temperature
int64_t val_i64 = 0;
ret = amdsmi_dev_get_temp_metric(device_handles[j], TEMPERATURE_TYPE_EDGE,
ret = amdsmi_dev_get_temp_metric(processor_handles[j], TEMPERATURE_TYPE_EDGE,
AMDSMI_TEMP_CURRENT, &val_i64);
CHK_AMDSMI_RET(ret)
printf(" Output of amdsmi_dev_get_temp_metric:\n");
@@ -309,7 +309,7 @@ int main() {
// Get frame buffer
amdsmi_vram_info_t vram_usage = {};
ret = amdsmi_get_vram_usage(device_handles[j], &vram_usage);
ret = amdsmi_get_vram_usage(processor_handles[j], &vram_usage);
CHK_AMDSMI_RET(ret)
printf(" Output of amdsmi_get_vram_usage:\n");
std::cout << "\t\tFrame buffer usage (MB): " << vram_usage.vram_used
@@ -317,7 +317,7 @@ int main() {
// Get Cap info
amdsmi_gpu_caps_t caps_info = {};
ret = amdsmi_get_caps_info(device_handles[j], &caps_info);
ret = amdsmi_get_caps_info(processor_handles[j], &caps_info);
CHK_AMDSMI_RET(ret)
printf(" Output of amdsmi_get_caps_info:\n");
std::cout << "\t\tGFX IP Major: " << caps_info.gfx.gfxip_major
@@ -332,7 +332,7 @@ int main() {
<< "\n\n";
amdsmi_power_cap_info_t cap_info = {};
ret = amdsmi_get_power_cap_info(device_handles[j], 0, &cap_info);
ret = amdsmi_get_power_cap_info(processor_handles[j], 0, &cap_info);
CHK_AMDSMI_RET(ret)
printf(" Output of amdsmi_get_power_cap_info:\n");
std::cout << "\t\t Power Cap: " << cap_info.power_cap / 1000000
+280 -280
Voir le fichier
Fichier diff supprimé car celui-ci est trop grand Voir la Diff
+2 -2
Voir le fichier
@@ -69,11 +69,11 @@ class AMDSmiSystem {
amdsmi_status_t handle_to_socket(amdsmi_socket_handle socket_handle,
AMDSmiSocket** socket);
amdsmi_status_t handle_to_device(amdsmi_processor_handle device_handle,
amdsmi_status_t handle_to_device(amdsmi_processor_handle processor_handle,
AMDSmiProcessor** device);
amdsmi_status_t gpu_index_to_handle(uint32_t gpu_index,
amdsmi_processor_handle* device_handle);
amdsmi_processor_handle* processor_handle);
private:
AMDSmiSystem() : init_flag_(AMDSMI_INIT_AMD_GPUS) {}
+190 -190
Voir le fichier
Fichier diff supprimé car celui-ci est trop grand Voir la Diff
+2 -2
Voir le fichier
@@ -25,13 +25,13 @@ from .amdsmi_interface import amdsmi_shut_down
# Device Descovery
from .amdsmi_interface import amdsmi_get_device_type
from .amdsmi_interface import amdsmi_get_device_handles
from .amdsmi_interface import amdsmi_get_processor_handles
from .amdsmi_interface import amdsmi_get_socket_handles
from .amdsmi_interface import amdsmi_get_socket_info
from .amdsmi_interface import amdsmi_get_device_bdf
from .amdsmi_interface import amdsmi_get_device_uuid
from .amdsmi_interface import amdsmi_get_device_handle_from_bdf
from .amdsmi_interface import amdsmi_get_processor_handle_from_bdf
# # SW Version Information
from .amdsmi_interface import amdsmi_get_driver_version
+375 -375
Voir le fichier
Fichier diff supprimé car celui-ci est trop grand Voir la Diff
+8 -8
Voir le fichier
@@ -899,7 +899,7 @@ class struct_c__SA_amdsmi_evt_notification_data_t(Structure):
struct_c__SA_amdsmi_evt_notification_data_t._pack_ = 1 # source:False
struct_c__SA_amdsmi_evt_notification_data_t._fields_ = [
('device_handle', ctypes.POINTER(None)),
('processor_handle', ctypes.POINTER(None)),
('event', amdsmi_evt_notification_type_t),
('message', ctypes.c_char * 64),
('PADDING_0', ctypes.c_ubyte * 4),
@@ -1411,15 +1411,15 @@ size_t = ctypes.c_uint64
amdsmi_get_socket_info = _libraries['libamd_smi.so'].amdsmi_get_socket_info
amdsmi_get_socket_info.restype = amdsmi_status_t
amdsmi_get_socket_info.argtypes = [amdsmi_socket_handle, ctypes.POINTER(ctypes.c_char), size_t]
amdsmi_get_device_handles = _libraries['libamd_smi.so'].amdsmi_get_device_handles
amdsmi_get_device_handles.restype = amdsmi_status_t
amdsmi_get_device_handles.argtypes = [amdsmi_socket_handle, ctypes.POINTER(ctypes.c_uint32), ctypes.POINTER(ctypes.POINTER(None))]
amdsmi_get_processor_handles = _libraries['libamd_smi.so'].amdsmi_get_processor_handles
amdsmi_get_processor_handles.restype = amdsmi_status_t
amdsmi_get_processor_handles.argtypes = [amdsmi_socket_handle, ctypes.POINTER(ctypes.c_uint32), ctypes.POINTER(ctypes.POINTER(None))]
amdsmi_get_device_type = _libraries['libamd_smi.so'].amdsmi_get_device_type
amdsmi_get_device_type.restype = amdsmi_status_t
amdsmi_get_device_type.argtypes = [amdsmi_processor_handle, ctypes.POINTER(c__EA_device_type_t)]
amdsmi_get_device_handle_from_bdf = _libraries['libamd_smi.so'].amdsmi_get_device_handle_from_bdf
amdsmi_get_device_handle_from_bdf.restype = amdsmi_status_t
amdsmi_get_device_handle_from_bdf.argtypes = [amdsmi_bdf_t, ctypes.POINTER(ctypes.POINTER(None))]
amdsmi_get_processor_handle_from_bdf = _libraries['libamd_smi.so'].amdsmi_get_processor_handle_from_bdf
amdsmi_get_processor_handle_from_bdf.restype = amdsmi_status_t
amdsmi_get_processor_handle_from_bdf.argtypes = [amdsmi_bdf_t, ctypes.POINTER(ctypes.POINTER(None))]
amdsmi_dev_get_id = _libraries['libamd_smi.so'].amdsmi_dev_get_id
amdsmi_dev_get_id.restype = amdsmi_status_t
amdsmi_dev_get_id.argtypes = [amdsmi_processor_handle, ctypes.POINTER(ctypes.c_uint16)]
@@ -1899,7 +1899,7 @@ __all__ = \
'amdsmi_get_compute_process_gpus',
'amdsmi_get_compute_process_info',
'amdsmi_get_compute_process_info_by_pid', 'amdsmi_get_device_bdf',
'amdsmi_get_device_handle_from_bdf', 'amdsmi_get_device_handles',
'amdsmi_get_processor_handle_from_bdf', 'amdsmi_get_processor_handles',
'amdsmi_get_device_type', 'amdsmi_get_device_uuid',
'amdsmi_get_driver_version', 'amdsmi_get_ecc_error_count',
'amdsmi_get_event_notification', 'amdsmi_get_func_iter_value',
+29 -29
Voir le fichier
@@ -100,16 +100,16 @@ class CmdLineParser:
return True
return False
def _get_device_handle_from_id(self, gpu_id, vf_id=None):
devices = smi_api.amdsmi_get_device_handles()
def _get_processor_handle_from_id(self, gpu_id, vf_id=None):
devices = smi_api.amdsmi_get_processor_handles()
self._check_range("gpu id", gpu_id, 0, len(devices) - 1)
device_handle = devices[gpu_id]
processor_handle = devices[gpu_id]
if vf_id is not None:
partitions = smi_api.amdsmi_get_vf_partition_info(device_handle)
partitions = smi_api.amdsmi_get_vf_partition_info(processor_handle)
self._check_range("vf id", vf_id, 0, len(partitions) - 1)
device_handle = smi_api.amdsmi_get_vf_handle_from_vf_index(device_handle, vf_id)
return device_handle
processor_handle = smi_api.amdsmi_get_vf_handle_from_vf_index(processor_handle, vf_id)
return processor_handle
def _parse_vf_id_if_exists(self):
gpu_id = None
@@ -156,32 +156,32 @@ class CmdLineParser:
return self.command_entry[0]
def get_device_handle(self):
device_handles = []
def get_processor_handle(self):
processor_handles = []
def parse_device_handle(position):
self._check_if_arg_exists("Device identifier", "device bdf or device id", position)
def parse_processor_handle(possition):
self._check_if_arg_exists("Device identifier", "device bdf or device id", possition)
ids = self._parse_vf_id_if_exists()
if ids["gpu_id"] is not None and ids["vf_id"] is not None:
device_handle = self._get_device_handle_from_id(ids["gpu_id"], ids["vf_id"])
processor_handle = self._get_processor_handle_from_id(ids["gpu_id"], ids["vf_id"])
else:
gpu_arg = self.cmd_args[position]
if gpu_arg.isdigit():
device_handle = self._get_device_handle_from_id(int(gpu_arg))
processor_handle = self._get_processor_handle_from_id(int(gpu_arg))
else:
self._check_bdf(gpu_arg)
device_handle = smi_api.amdsmi_get_device_handle_from_bdf(gpu_arg)
device_handles.append(device_handle)
processor_handle = smi_api.amdsmi_get_processor_handle_from_bdf(gpu_arg)
processor_handles.append(processor_handle)
for i in range(len(self.command_entry)):
if f"device_identifier{i + 1}" in self.command_entry[1]:
parse_device_handle(i + 2)
parse_processor_handle(i + 2)
if len(device_handles) == 0:
if len(processor_handles) == 0:
return None
return device_handles
return processor_handles
def get_command_args(self):
offset = 2 + self.extra_args
@@ -336,7 +336,7 @@ class Formatter:
| """ + self.style.text("47 Get topo get link type. Api: amdsmi_topo_get_link_type <bdf><bdf>") + """ |
| """ + self.style.text("48 Get is P2P accessible. Api: amdsmi_is_P2P_accessible <bdf><bdf>") + """ |
| """ + self.style.text("49 Get asic info. Api: amdsmi_get_asic_info <bdf>") + """ |
| """ + self.style.text("50 Get device_handles. Api: amdsmi_get_device_handles <None>") + """ |
| """ + self.style.text("50 Get processor_handles. Api: amdsmi_get_processor_handles <None>") + """ |
| """ + self.style.text("51 Get event notification. Api: amdsmi_get_event_notification <bdf>") + """ |
| """ + self.style.text("52 Init event notification. Api: amdsmi_init_event_notification <bdf>") + """ |
| """ + self.style.text("53 Set event notification mask. Api: amdsmi_set_event_notification_mask <bdf><mask>") + """ |
@@ -874,7 +874,7 @@ commands = {
49: [smi_api.amdsmi_get_asic_info, {
"device_identifier1": [None, True]
}],
50: [smi_api.amdsmi_get_device_handles, {}],
50: [smi_api.amdsmi_get_processor_handles, {}],
51: [amdsmi_tool_event_notification_get, {
"device_identifier1": [None, True]
}],
@@ -994,22 +994,22 @@ if __name__ == "__main__":
smi_api.amdsmi_init()
command = parser.get_command_handle()
device_handles = parser.get_device_handle()
processor_handles = parser.get_processor_handle()
command_args = parser.get_command_args()
result = None
if not device_handles and not command_args:
if not processor_handles and not command_args:
result = command()
elif not device_handles and command_args:
elif not processor_handles and command_args:
result = command(command_args)
elif len(device_handles) == 1 and not command_args:
result = command(device_handles[0])
elif len(device_handles) > 1 and not command_args:
result = command(device_handles)
elif len(device_handles) == 1 and command_args:
result = command(device_handles[0], command_args)
elif len(processor_handles) == 1 and not command_args:
result = command(processor_handles[0])
elif len(processor_handles) > 1 and not command_args:
result = command(processor_handles)
elif len(processor_handles) == 1 and command_args:
result = command(processor_handles[0], command_args)
else:
result = command(device_handles, command_args)
result = command(processor_handles, command_args)
formatter.print_output(result)
+220 -216
Voir le fichier
Fichier diff supprimé car celui-ci est trop grand Voir la Diff
+6 -6
Voir le fichier
@@ -165,12 +165,12 @@ amdsmi_status_t AMDSmiSystem::handle_to_socket(
}
amdsmi_status_t AMDSmiSystem::handle_to_device(
amdsmi_processor_handle device_handle,
amdsmi_processor_handle processor_handle,
AMDSmiProcessor** device) {
if (device_handle == nullptr || device == nullptr) {
if (processor_handle == nullptr || device == nullptr) {
return AMDSMI_STATUS_INVAL;
}
*device = static_cast<AMDSmiProcessor*>(device_handle);
*device = static_cast<AMDSmiProcessor*>(processor_handle);
// double check handlers is here
if (std::find(devices_.begin(), devices_.end(), *device)
@@ -181,8 +181,8 @@ amdsmi_status_t AMDSmiSystem::handle_to_device(
}
amdsmi_status_t AMDSmiSystem::gpu_index_to_handle(uint32_t gpu_index,
amdsmi_processor_handle* device_handle) {
if (device_handle == nullptr)
amdsmi_processor_handle* processor_handle) {
if (processor_handle == nullptr)
return AMDSMI_STATUS_INVAL;
auto iter = devices_.begin();
@@ -194,7 +194,7 @@ amdsmi_status_t AMDSmiSystem::gpu_index_to_handle(uint32_t gpu_index,
static_cast<amd::smi::AMDSmiGPUDevice*>(cur_device);
uint32_t cur_gpu_index = gpu_device->get_gpu_id();
if (gpu_index == cur_gpu_index) {
*device_handle = cur_device;
*processor_handle = cur_device;
return AMDSMI_STATUS_SUCCESS;
}
}
+2 -2
Voir le fichier
@@ -102,11 +102,11 @@ void TestAPISupportRead::Run(void) {
for (uint32_t x = 0; x < num_iterations(); ++x) {
for (uint32_t i = 0; i < num_monitor_devs(); ++i) {
IF_VERB(STANDARD) {
PrintDeviceHeader(device_handles_[i]);
PrintDeviceHeader(processor_handles_[i]);
std::cout << "Supported AMDSMI Functions:" << std::endl;
std::cout << "\tVariants (Monitors)" << std::endl;
}
err = amdsmi_dev_open_supported_func_iterator(device_handles_[i], &iter_handle);
err = amdsmi_dev_open_supported_func_iterator(processor_handles_[i], &iter_handle);
CHK_ERR_ASRT(err)
while (1) {
+9 -9
Voir le fichier
@@ -98,9 +98,9 @@ void TestErrCntRead::Run(void) {
for (uint32_t x = 0; x < num_iterations(); ++x) {
for (uint32_t i = 0; i < num_monitor_devs(); ++i) {
PrintDeviceHeader(device_handles_[i]);
PrintDeviceHeader(processor_handles_[i]);
err = amdsmi_dev_get_ecc_enabled(device_handles_[i], &enabled_mask);
err = amdsmi_dev_get_ecc_enabled(processor_handles_[i], &enabled_mask);
if (err == AMDSMI_STATUS_NOT_SUPPORTED) {
IF_VERB(STANDARD) {
std::cout <<
@@ -108,7 +108,7 @@ void TestErrCntRead::Run(void) {
<< std::endl;
}
// Verify api support checking functionality is working
err = amdsmi_dev_get_ecc_enabled(device_handles_[i], nullptr);
err = amdsmi_dev_get_ecc_enabled(processor_handles_[i], nullptr);
ASSERT_EQ(err, AMDSMI_STATUS_INVAL);
continue;
@@ -116,7 +116,7 @@ void TestErrCntRead::Run(void) {
CHK_ERR_ASRT(err)
// Verify api support checking functionality is working
err = amdsmi_dev_get_ecc_enabled(device_handles_[i], nullptr);
err = amdsmi_dev_get_ecc_enabled(processor_handles_[i], nullptr);
ASSERT_EQ(err, AMDSMI_STATUS_INVAL);
IF_VERB(STANDARD) {
@@ -126,7 +126,7 @@ void TestErrCntRead::Run(void) {
}
for (uint32_t b = AMDSMI_GPU_BLOCK_FIRST;
b <= AMDSMI_GPU_BLOCK_LAST; b = b*2) {
err = amdsmi_dev_get_ecc_status(device_handles_[i], static_cast<amdsmi_gpu_block_t>(b),
err = amdsmi_dev_get_ecc_status(processor_handles_[i], static_cast<amdsmi_gpu_block_t>(b),
&err_state);
CHK_ERR_ASRT(err)
IF_VERB(STANDARD) {
@@ -135,11 +135,11 @@ void TestErrCntRead::Run(void) {
" block: " << GetErrStateNameStr(err_state) << std::endl;
}
// Verify api support checking functionality is working
err = amdsmi_dev_get_ecc_status(device_handles_[i], static_cast<amdsmi_gpu_block_t>(b),
err = amdsmi_dev_get_ecc_status(processor_handles_[i], static_cast<amdsmi_gpu_block_t>(b),
nullptr);
ASSERT_EQ(err, AMDSMI_STATUS_INVAL);
err = amdsmi_dev_get_ecc_count(device_handles_[i], static_cast<amdsmi_gpu_block_t>(b), &ec);
err = amdsmi_dev_get_ecc_count(processor_handles_[i], static_cast<amdsmi_gpu_block_t>(b), &ec);
if (err == AMDSMI_STATUS_NOT_SUPPORTED) {
IF_VERB(STANDARD) {
@@ -148,7 +148,7 @@ void TestErrCntRead::Run(void) {
": Not supported for this device" << std::endl;
}
// Verify api support checking functionality is working
err = amdsmi_dev_get_ecc_count(device_handles_[i], static_cast<amdsmi_gpu_block_t>(b),
err = amdsmi_dev_get_ecc_count(processor_handles_[i], static_cast<amdsmi_gpu_block_t>(b),
nullptr);
ASSERT_EQ(err, AMDSMI_STATUS_INVAL);
@@ -164,7 +164,7 @@ void TestErrCntRead::Run(void) {
<< std::endl;
}
// Verify api support checking functionality is working
err = amdsmi_dev_get_ecc_count(device_handles_[i], static_cast<amdsmi_gpu_block_t>(b),
err = amdsmi_dev_get_ecc_count(processor_handles_[i], static_cast<amdsmi_gpu_block_t>(b),
nullptr);
ASSERT_EQ(err, AMDSMI_STATUS_INVAL);
}
+5 -5
Voir le fichier
@@ -109,7 +109,7 @@ void TestEvtNotifReadWrite::Run(void) {
}
for (dv_ind = 0; dv_ind < num_monitor_devs(); ++dv_ind) {
ret = amdsmi_init_event_notification(device_handles_[dv_ind]);
ret = amdsmi_init_event_notification(processor_handles_[dv_ind]);
if (ret == AMDSMI_STATUS_NOT_SUPPORTED) {
IF_VERB(STANDARD) {
std::cout <<
@@ -119,7 +119,7 @@ void TestEvtNotifReadWrite::Run(void) {
return;
}
ASSERT_EQ(ret, AMDSMI_STATUS_SUCCESS);
ret = amdsmi_set_event_notification_mask(device_handles_[dv_ind], mask);
ret = amdsmi_set_event_notification_mask(processor_handles_[dv_ind], mask);
ASSERT_EQ(ret, AMDSMI_STATUS_SUCCESS);
}
@@ -133,7 +133,7 @@ void TestEvtNotifReadWrite::Run(void) {
"Expected the number of elements found to be <= buffer size (10)";
IF_VERB(STANDARD) {
for (uint32_t i = 0; i < num_elem; ++i) {
std::cout << "\tdv_handle=" << data[i].device_handle <<
std::cout << "\tdv_handle=" << data[i].processor_handle <<
" Type: " << NameFromEvtNotifType(data[i].event) <<
" Mesg: " << data[i].message << std::endl;
if (data[i].event == AMDSMI_EVT_NOTIF_GPU_PRE_RESET) {
@@ -167,7 +167,7 @@ void TestEvtNotifReadWrite::Run(void) {
"Expected the number of elements found to be <= buffer size (10)";
IF_VERB(STANDARD) {
for (uint32_t i = 0; i < num_elem; ++i) {
std::cout << "\tdv_handle=" << data[i].device_handle <<
std::cout << "\tdv_handle=" << data[i].processor_handle <<
" Type: " << NameFromEvtNotifType(data[i].event) <<
" Mesg: " << data[i].message << std::endl;
}
@@ -191,7 +191,7 @@ void TestEvtNotifReadWrite::Run(void) {
}
for (uint32_t dv_ind = 0; dv_ind < num_monitor_devs(); ++dv_ind) {
ret = amdsmi_stop_event_notification(device_handles_[dv_ind]);
ret = amdsmi_stop_event_notification(processor_handles_[dv_ind]);
ASSERT_EQ(ret, AMDSMI_STATUS_SUCCESS);
}
}
+7 -7
Voir le fichier
@@ -96,12 +96,12 @@ void TestFanRead::Run(void) {
}
for (uint32_t x = 0; x < num_iterations(); ++x) {
for (uint32_t i = 0; i < num_monitor_devs(); ++i) {
PrintDeviceHeader(device_handles_[i]);
PrintDeviceHeader(processor_handles_[i]);
IF_VERB(STANDARD) {
std::cout << "\t**Current Fan Speed: ";
}
err = amdsmi_dev_get_fan_speed(device_handles_[i], 0, &val_i64);
err = amdsmi_dev_get_fan_speed(processor_handles_[i], 0, &val_i64);
if (err == AMDSMI_STATUS_NOT_SUPPORTED) {
IF_VERB(STANDARD) {
std::cout << "\t**" << ": " <<
@@ -114,30 +114,30 @@ void TestFanRead::Run(void) {
// Verify api support checking functionality is working
err = amdsmi_dev_get_fan_speed(device_handles_[i], 0, nullptr);
err = amdsmi_dev_get_fan_speed(processor_handles_[i], 0, nullptr);
ASSERT_EQ(err, AMDSMI_STATUS_INVAL);
err = amdsmi_dev_get_fan_speed_max(device_handles_[i], 0, &val_ui64);
err = amdsmi_dev_get_fan_speed_max(processor_handles_[i], 0, &val_ui64);
CHK_ERR_ASRT(err)
IF_VERB(STANDARD) {
std::cout << val_i64/static_cast<float>(val_ui64)*100;
std::cout << "% ("<< val_i64 << "/" << val_ui64 << ")" << std::endl;
}
// Verify api support checking functionality is working
err = amdsmi_dev_get_fan_speed_max(device_handles_[i], 0, nullptr);
err = amdsmi_dev_get_fan_speed_max(processor_handles_[i], 0, nullptr);
ASSERT_EQ(err, AMDSMI_STATUS_INVAL);
IF_VERB(STANDARD) {
std::cout << "\t**Current fan RPMs: ";
}
err = amdsmi_dev_get_fan_rpms(device_handles_[i], 0, &val_i64);
err = amdsmi_dev_get_fan_rpms(processor_handles_[i], 0, &val_i64);
CHK_ERR_ASRT(err)
IF_VERB(STANDARD) {
std::cout << val_i64 << std::endl;
}
// Verify api support checking functionality is working
err = amdsmi_dev_get_fan_rpms(device_handles_[i], 0, nullptr);
err = amdsmi_dev_get_fan_rpms(processor_handles_[i], 0, nullptr);
ASSERT_EQ(err, AMDSMI_STATUS_INVAL);
}
}
+7 -7
Voir le fichier
@@ -98,9 +98,9 @@ void TestFanReadWrite::Run(void) {
}
for (uint32_t dv_ind = 0; dv_ind < num_monitor_devs(); ++dv_ind) {
PrintDeviceHeader(device_handles_[dv_ind]);
PrintDeviceHeader(processor_handles_[dv_ind]);
ret = amdsmi_dev_get_fan_speed(device_handles_[dv_ind], 0, &orig_speed);
ret = amdsmi_dev_get_fan_speed(processor_handles_[dv_ind], 0, &orig_speed);
if (ret == AMDSMI_STATUS_NOT_SUPPORTED) {
IF_VERB(STANDARD) {
std::cout << "\t**" << ": " <<
@@ -120,7 +120,7 @@ void TestFanReadWrite::Run(void) {
return;
}
ret = amdsmi_dev_get_fan_speed_max(device_handles_[dv_ind], 0, &max_speed);
ret = amdsmi_dev_get_fan_speed_max(processor_handles_[dv_ind], 0, &max_speed);
CHK_ERR_ASRT(ret)
new_speed = 1.1 * orig_speed;
@@ -136,12 +136,12 @@ void TestFanReadWrite::Run(void) {
std::cout << "Setting fan speed to " << new_speed << std::endl;
}
ret = amdsmi_dev_set_fan_speed(device_handles_[dv_ind], 0, new_speed);
ret = amdsmi_dev_set_fan_speed(processor_handles_[dv_ind], 0, new_speed);
CHK_ERR_ASRT(ret)
sleep(4);
ret = amdsmi_dev_get_fan_speed(device_handles_[dv_ind], 0, &cur_speed);
ret = amdsmi_dev_get_fan_speed(processor_handles_[dv_ind], 0, &cur_speed);
CHK_ERR_ASRT(ret)
IF_VERB(STANDARD) {
@@ -163,12 +163,12 @@ void TestFanReadWrite::Run(void) {
std::cout << "Resetting fan control to auto..." << std::endl;
}
ret = amdsmi_dev_reset_fan(device_handles_[dv_ind], 0);
ret = amdsmi_dev_reset_fan(processor_handles_[dv_ind], 0);
CHK_ERR_ASRT(ret)
sleep(3);
ret = amdsmi_dev_get_fan_speed(device_handles_[dv_ind], 0, &cur_speed);
ret = amdsmi_dev_get_fan_speed(processor_handles_[dv_ind], 0, &cur_speed);
CHK_ERR_ASRT(ret)
IF_VERB(STANDARD) {
+7 -7
Voir le fichier
@@ -116,12 +116,12 @@ void TestFrequenciesRead::Run(void) {
for (uint32_t x = 0; x < num_iterations(); ++x) {
for (uint32_t i = 0; i < num_monitor_devs(); ++i) {
auto freq_output = [&](amdsmi_clk_type_t t, const char *name) {
err = amdsmi_dev_get_gpu_clk_freq(device_handles_[i], t, &f);
err = amdsmi_dev_get_gpu_clk_freq(processor_handles_[i], t, &f);
if (err == AMDSMI_STATUS_NOT_SUPPORTED) {
std::cout << "\t**Get " << name <<
": Not supported on this machine" << std::endl;
// Verify api support checking functionality is working
err = amdsmi_dev_get_gpu_clk_freq(device_handles_[i], t, nullptr);
err = amdsmi_dev_get_gpu_clk_freq(processor_handles_[i], t, nullptr);
ASSERT_EQ(err, AMDSMI_STATUS_INVAL);
} else if (err == AMDSMI_STATUS_NOT_YET_IMPLEMENTED) {
std::cout << "\t**Get " << name <<
@@ -133,13 +133,13 @@ void TestFrequenciesRead::Run(void) {
std::cout << f.num_supported << std::endl;
print_frequencies(&f);
// Verify api support checking functionality is working
err = amdsmi_dev_get_gpu_clk_freq(device_handles_[i], t, nullptr);
err = amdsmi_dev_get_gpu_clk_freq(processor_handles_[i], t, nullptr);
ASSERT_EQ(err, AMDSMI_STATUS_INVAL);
}
}
};
PrintDeviceHeader(device_handles_[i]);
PrintDeviceHeader(processor_handles_[i]);
freq_output(CLK_TYPE_MEM, "Supported GPU Memory");
freq_output(CLK_TYPE_SYS, "Supported GPU");
@@ -147,12 +147,12 @@ void TestFrequenciesRead::Run(void) {
freq_output(CLK_TYPE_DCEF, "Display Controller Engine Clock");
freq_output(CLK_TYPE_SOC, "SOC Clock");
err = amdsmi_dev_get_pci_bandwidth(device_handles_[i], &b);
err = amdsmi_dev_get_pci_bandwidth(processor_handles_[i], &b);
if (err == AMDSMI_STATUS_NOT_SUPPORTED) {
std::cout << "\t**Get PCIE Bandwidth: Not supported on this machine"
<< std::endl;
// Verify api support checking functionality is working
err = amdsmi_dev_get_pci_bandwidth(device_handles_[i], nullptr);
err = amdsmi_dev_get_pci_bandwidth(processor_handles_[i], nullptr);
ASSERT_EQ(err, AMDSMI_STATUS_NOT_SUPPORTED);
} else if (err == AMDSMI_STATUS_NOT_YET_IMPLEMENTED) {
std::cout << "\t**Get PCIE Bandwidth "
@@ -164,7 +164,7 @@ void TestFrequenciesRead::Run(void) {
std::cout << b.transfer_rate.num_supported << std::endl;
print_frequencies(&b.transfer_rate, b.lanes);
// Verify api support checking functionality is working
err = amdsmi_dev_get_pci_bandwidth(device_handles_[i], nullptr);
err = amdsmi_dev_get_pci_bandwidth(processor_handles_[i], nullptr);
ASSERT_EQ(err, AMDSMI_STATUS_INVAL);
}
}
+6 -6
Voir le fichier
@@ -102,7 +102,7 @@ void TestFrequenciesReadWrite::Run(void) {
}
for (uint32_t dv_ind = 0; dv_ind < num_monitor_devs(); ++dv_ind) {
PrintDeviceHeader(device_handles_[dv_ind]);
PrintDeviceHeader(processor_handles_[dv_ind]);
for (uint32_t clk = (uint32_t)CLK_TYPE_FIRST;
clk <= CLK_TYPE__MAX; ++clk) {
@@ -113,7 +113,7 @@ void TestFrequenciesReadWrite::Run(void) {
std::cout << amdsmi_clk << std::endl;
if (amdsmi_clk == CLK_TYPE_PCIE)
return false;
ret = amdsmi_dev_get_gpu_clk_freq(device_handles_[dv_ind], amdsmi_clk, &f);
ret = amdsmi_dev_get_gpu_clk_freq(processor_handles_[dv_ind], amdsmi_clk, &f);
std::cout << ret << std::endl;
if (ret == AMDSMI_STATUS_NOT_SUPPORTED ||
@@ -151,7 +151,7 @@ void TestFrequenciesReadWrite::Run(void) {
FreqEnumToStr(amdsmi_clk) << " to 0b" << freq_bm_str << " ..." <<
std::endl;
}
ret = amdsmi_dev_set_clk_freq(device_handles_[dv_ind], amdsmi_clk, freq_bitmask);
ret = amdsmi_dev_set_clk_freq(processor_handles_[dv_ind], amdsmi_clk, freq_bitmask);
//Certain ASICs does not allow to set particular clocks. If set function for a clock returns
//permission error despite root access, manually set ret value to success and return
if (ret == AMDSMI_STATUS_NO_PERM && geteuid() == 0) {
@@ -166,7 +166,7 @@ void TestFrequenciesReadWrite::Run(void) {
return;
}
CHK_ERR_ASRT(ret)
ret = amdsmi_dev_get_gpu_clk_freq(device_handles_[dv_ind], amdsmi_clk, &f);
ret = amdsmi_dev_get_gpu_clk_freq(processor_handles_[dv_ind], amdsmi_clk, &f);
if (ret != AMDSMI_STATUS_SUCCESS) {
return;
}
@@ -175,12 +175,12 @@ void TestFrequenciesReadWrite::Run(void) {
std::cout << "Frequency is now index " << f.current << std::endl;
std::cout << "Resetting mask to all frequencies." << std::endl;
}
ret = amdsmi_dev_set_clk_freq(device_handles_[dv_ind], amdsmi_clk, 0xFFFFFFFF);
ret = amdsmi_dev_set_clk_freq(processor_handles_[dv_ind], amdsmi_clk, 0xFFFFFFFF);
if (ret != AMDSMI_STATUS_SUCCESS) {
return;
}
ret = amdsmi_dev_set_perf_level(device_handles_[dv_ind], AMDSMI_DEV_PERF_LEVEL_AUTO);
ret = amdsmi_dev_set_perf_level(processor_handles_[dv_ind], AMDSMI_DEV_PERF_LEVEL_AUTO);
if (ret != AMDSMI_STATUS_SUCCESS) {
return;
}
+2 -2
Voir le fichier
@@ -97,9 +97,9 @@ void TestGPUBusyRead::Run(void) {
for (uint32_t x = 0; x < num_iterations(); ++x) {
for (uint32_t i = 0; i < num_monitor_devs(); ++i) {
PrintDeviceHeader(device_handles_[i]);
PrintDeviceHeader(processor_handles_[i]);
err = amdsmi_dev_get_busy_percent(device_handles_[i], &val_ui32);
err = amdsmi_dev_get_busy_percent(processor_handles_[i], &val_ui32);
if (err != AMDSMI_STATUS_SUCCESS) {
if (err == AMDSMI_STATUS_FILE_ERROR) {
IF_VERB(STANDARD) {
+3 -3
Voir le fichier
@@ -97,13 +97,13 @@ void TestGpuMetricsRead::Run(void) {
}
for (uint32_t i = 0; i < num_monitor_devs(); ++i) {
PrintDeviceHeader(device_handles_[i]);
PrintDeviceHeader(processor_handles_[i]);
IF_VERB(STANDARD) {
std::cout << "\t**GPU METRICS:\n";
}
amdsmi_gpu_metrics_t smu;
err = amdsmi_dev_get_gpu_metrics_info(device_handles_[i], &smu);
err = amdsmi_dev_get_gpu_metrics_info(processor_handles_[i], &smu);
if (err != AMDSMI_STATUS_SUCCESS) {
if (err == AMDSMI_STATUS_NOT_SUPPORTED) {
IF_VERB(STANDARD) {
@@ -188,7 +188,7 @@ void TestGpuMetricsRead::Run(void) {
}
// Verify api support checking functionality is working
err = amdsmi_dev_get_gpu_metrics_info(device_handles_[i], nullptr);
err = amdsmi_dev_get_gpu_metrics_info(processor_handles_[i], nullptr);
ASSERT_EQ(err, AMDSMI_STATUS_INVAL);
}
}
+7 -7
Voir le fichier
@@ -113,7 +113,7 @@ void TestHWTopologyRead::Run(void) {
std::vector<uint32_t> numa_numbers(num_devices);
for (uint32_t dv_ind = 0; dv_ind < num_devices; ++dv_ind) {
amdsmi_processor_handle dev_handle = device_handles_[dv_ind];
amdsmi_processor_handle dev_handle = processor_handles_[dv_ind];
err = amdsmi_topo_get_numa_node_number(dev_handle, &numa_numbers[dv_ind]);
if (err != AMDSMI_STATUS_SUCCESS) {
if (err == AMDSMI_STATUS_NOT_SUPPORTED) {
@@ -138,8 +138,8 @@ void TestHWTopologyRead::Run(void) {
gpu_links[dv_ind_src][dv_ind_dst].accessible = true;
} else {
AMDSMI_IO_LINK_TYPE type;
err = amdsmi_topo_get_link_type(device_handles_[dv_ind_src],
device_handles_[dv_ind_dst],
err = amdsmi_topo_get_link_type(processor_handles_[dv_ind_src],
processor_handles_[dv_ind_dst],
&gpu_links[dv_ind_src][dv_ind_dst].hops, &type);
if (err != AMDSMI_STATUS_SUCCESS) {
if (err == AMDSMI_STATUS_NOT_SUPPORTED) {
@@ -170,8 +170,8 @@ void TestHWTopologyRead::Run(void) {
}
}
}
err = amdsmi_topo_get_link_weight(device_handles_[dv_ind_src],
device_handles_[dv_ind_dst],
err = amdsmi_topo_get_link_weight(processor_handles_[dv_ind_src],
processor_handles_[dv_ind_dst],
&gpu_links[dv_ind_src][dv_ind_dst].weight);
if (err != AMDSMI_STATUS_SUCCESS) {
if (err == AMDSMI_STATUS_NOT_SUPPORTED) {
@@ -185,8 +185,8 @@ void TestHWTopologyRead::Run(void) {
CHK_ERR_ASRT(err)
}
}
err = amdsmi_is_P2P_accessible(device_handles_[dv_ind_src],
device_handles_[dv_ind_dst],
err = amdsmi_is_P2P_accessible(processor_handles_[dv_ind_src],
processor_handles_[dv_ind_dst],
&gpu_links[dv_ind_src][dv_ind_dst].accessible);
if (err != AMDSMI_STATUS_SUCCESS) {
if (err == AMDSMI_STATUS_NOT_SUPPORTED) {
+24 -24
Voir le fichier
@@ -105,11 +105,11 @@ void TestIdInfoRead::Run(void) {
}
// Get the device ID, name, vendor ID and vendor name for the device
err = amdsmi_dev_get_id(device_handles_[i], &id);
err = amdsmi_dev_get_id(processor_handles_[i], &id);
if (err == AMDSMI_STATUS_NOT_SUPPORTED) {
amdsmi_status_t ret;
// Verify api support checking functionality is working
ret = amdsmi_dev_get_id(device_handles_[i], nullptr);
ret = amdsmi_dev_get_id(processor_handles_[i], nullptr);
ASSERT_EQ(ret, AMDSMI_STATUS_NOT_SUPPORTED);
} else {
CHK_ERR_ASRT(err)
@@ -118,25 +118,25 @@ void TestIdInfoRead::Run(void) {
std::cout << "\t**Device ID: 0x" << std::hex << id << std::endl;
}
// Verify api support checking functionality is working
err = amdsmi_dev_get_id(device_handles_[i], nullptr);
err = amdsmi_dev_get_id(processor_handles_[i], nullptr);
ASSERT_EQ(err, AMDSMI_STATUS_INVAL);
}
// vendor_id, unique_id
amdsmi_asic_info_t asci_info;
err = amdsmi_get_asic_info(device_handles_[0], &asci_info);
err = amdsmi_get_asic_info(processor_handles_[0], &asci_info);
CHK_ERR_ASRT(err)
// device name, brand, serial_number
amdsmi_board_info_t board_info;
err = amdsmi_get_board_info(device_handles_[0], &board_info);
err = amdsmi_get_board_info(processor_handles_[0], &board_info);
CHK_ERR_ASRT(err)
err = amdsmi_dev_get_vram_vendor(device_handles_[i], buffer, kBufferLen);
err = amdsmi_dev_get_vram_vendor(processor_handles_[i], buffer, kBufferLen);
if (err == AMDSMI_STATUS_NOT_SUPPORTED) {
std::cout <<
"\t**Vram Vendor string not supported on this system." << std::endl;
err = amdsmi_dev_get_vram_vendor(device_handles_[i], nullptr, kBufferLen);
err = amdsmi_dev_get_vram_vendor(processor_handles_[i], nullptr, kBufferLen);
ASSERT_EQ(err, AMDSMI_STATUS_NOT_SUPPORTED);
} else {
CHK_ERR_ASRT(err)
@@ -145,10 +145,10 @@ void TestIdInfoRead::Run(void) {
}
}
err = amdsmi_dev_get_drm_render_minor(device_handles_[i], &drm_render_minor);
err = amdsmi_dev_get_drm_render_minor(processor_handles_[i], &drm_render_minor);
if (err == AMDSMI_STATUS_NOT_SUPPORTED) {
// Verify api support checking functionality is working
err = amdsmi_dev_get_drm_render_minor(device_handles_[i], nullptr);
err = amdsmi_dev_get_drm_render_minor(processor_handles_[i], nullptr);
ASSERT_EQ(err, AMDSMI_STATUS_NOT_SUPPORTED);
} else {
CHK_ERR_ASRT(err)
@@ -156,15 +156,15 @@ void TestIdInfoRead::Run(void) {
std::cout << "\t**DRM Render Minor: " << drm_render_minor << std::endl;
}
// Verify api support checking functionality is working
err = amdsmi_dev_get_drm_render_minor(device_handles_[i], nullptr);
err = amdsmi_dev_get_drm_render_minor(processor_handles_[i], nullptr);
ASSERT_EQ(err, AMDSMI_STATUS_INVAL);
}
err = amdsmi_dev_get_vendor_name(device_handles_[i], buffer, kBufferLen);
err = amdsmi_dev_get_vendor_name(processor_handles_[i], buffer, kBufferLen);
if (err == AMDSMI_STATUS_NOT_SUPPORTED) {
std::cout << "\t**Device Vendor name string not found on this system." <<
std::endl;
// Verify api support checking functionality is working
err = amdsmi_dev_get_vendor_name(device_handles_[i], nullptr, kBufferLen);
err = amdsmi_dev_get_vendor_name(processor_handles_[i], nullptr, kBufferLen);
ASSERT_EQ(err, AMDSMI_STATUS_NOT_SUPPORTED);
} else {
CHK_ERR_ASRT(err)
@@ -172,15 +172,15 @@ void TestIdInfoRead::Run(void) {
std::cout << "\t**Device Vendor name: " << buffer << std::endl;
}
// Verify api support checking functionality is working
err = amdsmi_dev_get_vendor_name(device_handles_[i], nullptr, kBufferLen);
err = amdsmi_dev_get_vendor_name(processor_handles_[i], nullptr, kBufferLen);
ASSERT_EQ(err, AMDSMI_STATUS_INVAL);
}
// Get the device ID, name, vendor ID and vendor name for the sub-device
err = amdsmi_dev_get_subsystem_id(device_handles_[i], &id);
err = amdsmi_dev_get_subsystem_id(processor_handles_[i], &id);
if (err == AMDSMI_STATUS_NOT_SUPPORTED) {
// Verify api support checking functionality is working
err = amdsmi_dev_get_subsystem_id(device_handles_[i], nullptr);
err = amdsmi_dev_get_subsystem_id(processor_handles_[i], nullptr);
ASSERT_EQ(err, AMDSMI_STATUS_NOT_SUPPORTED);
} else {
CHK_ERR_ASRT(err)
@@ -188,15 +188,15 @@ void TestIdInfoRead::Run(void) {
std::cout << "\t**Subsystem ID: 0x" << std::hex << id << std::endl;
}
// Verify api support checking functionality is working
err = amdsmi_dev_get_subsystem_id(device_handles_[i], nullptr);
err = amdsmi_dev_get_subsystem_id(processor_handles_[i], nullptr);
ASSERT_EQ(err, AMDSMI_STATUS_INVAL);
}
err = amdsmi_dev_get_subsystem_name(device_handles_[i], buffer, kBufferLen);
err = amdsmi_dev_get_subsystem_name(processor_handles_[i], buffer, kBufferLen);
if (err == AMDSMI_STATUS_NOT_SUPPORTED) {
std::cout << "\t**Subsystem name string not found on this system." <<
std::endl;
// Verify api support checking functionality is working
err = amdsmi_dev_get_subsystem_name(device_handles_[i], nullptr, kBufferLen);
err = amdsmi_dev_get_subsystem_name(processor_handles_[i], nullptr, kBufferLen);
ASSERT_EQ(err, AMDSMI_STATUS_NOT_SUPPORTED);
} else {
CHK_ERR_ASRT(err)
@@ -204,7 +204,7 @@ void TestIdInfoRead::Run(void) {
std::cout << "\t**Subsystem name: " << buffer << std::endl;
}
// Verify api support checking functionality is working
err = amdsmi_dev_get_subsystem_name(device_handles_[i], nullptr, kBufferLen);
err = amdsmi_dev_get_subsystem_name(processor_handles_[i], nullptr, kBufferLen);
ASSERT_EQ(err, AMDSMI_STATUS_INVAL);
}
@@ -213,13 +213,13 @@ void TestIdInfoRead::Run(void) {
asci_info.subvendor_id << std::endl;
}
err = amdsmi_dev_get_vendor_name(device_handles_[i], buffer, kBufferLen);
err = amdsmi_dev_get_vendor_name(processor_handles_[i], buffer, kBufferLen);
if (err == AMDSMI_STATUS_NOT_SUPPORTED) {
std::cout <<
"\t**Subsystem Vendor name string not found on this system." <<
std::endl;
// Verify api support checking functionality is working
err = amdsmi_dev_get_vendor_name(device_handles_[i], nullptr, kBufferLen);
err = amdsmi_dev_get_vendor_name(processor_handles_[i], nullptr, kBufferLen);
ASSERT_EQ(err, AMDSMI_STATUS_NOT_SUPPORTED);
} else {
CHK_ERR_ASRT(err)
@@ -227,11 +227,11 @@ void TestIdInfoRead::Run(void) {
std::cout << "\t**Subsystem Vendor name: " << buffer << std::endl;
}
// Verify api support checking functionality is working
err = amdsmi_dev_get_vendor_name(device_handles_[i], nullptr, kBufferLen);
err = amdsmi_dev_get_vendor_name(processor_handles_[i], nullptr, kBufferLen);
ASSERT_EQ(err, AMDSMI_STATUS_INVAL);
}
err = amdsmi_dev_get_pci_id(device_handles_[i], &val_ui64);
err = amdsmi_dev_get_pci_id(processor_handles_[i], &val_ui64);
// Don't check for AMDSMI_STATUS_NOT_SUPPORTED since this should always be
// supported. It is not based on a sysfs file.
CHK_ERR_ASRT(err)
@@ -240,7 +240,7 @@ void TestIdInfoRead::Run(void) {
std::cout << " (" << std::dec << val_ui64 << ")" << std::endl;
}
// Verify api support checking functionality is working
err = amdsmi_dev_get_pci_id(device_handles_[i], nullptr);
err = amdsmi_dev_get_pci_id(processor_handles_[i], nullptr);
ASSERT_EQ(err, AMDSMI_STATUS_INVAL);
}
}
+5 -5
Voir le fichier
@@ -94,9 +94,9 @@ void TestMemPageInfoRead::Run(void) {
}
for (uint32_t i = 0; i < num_monitor_devs(); ++i) {
PrintDeviceHeader(device_handles_[i]);
PrintDeviceHeader(processor_handles_[i]);
err = amdsmi_dev_get_memory_reserved_pages(device_handles_[i], &num_pages, nullptr);
err = amdsmi_dev_get_memory_reserved_pages(processor_handles_[i], &num_pages, nullptr);
if (err == AMDSMI_STATUS_NOT_SUPPORTED) {
std::cout <<
@@ -104,7 +104,7 @@ void TestMemPageInfoRead::Run(void) {
<< std::endl;
// Verify api support checking functionality is working
err = amdsmi_dev_get_memory_reserved_pages(device_handles_[i], nullptr, nullptr);
err = amdsmi_dev_get_memory_reserved_pages(processor_handles_[i], nullptr, nullptr);
ASSERT_EQ(err, AMDSMI_STATUS_NOT_SUPPORTED);
continue;
@@ -115,7 +115,7 @@ void TestMemPageInfoRead::Run(void) {
std::endl;
}
// Verify api support checking functionality is working
err = amdsmi_dev_get_memory_reserved_pages(device_handles_[i], nullptr, nullptr);
err = amdsmi_dev_get_memory_reserved_pages(processor_handles_[i], nullptr, nullptr);
ASSERT_EQ(err, AMDSMI_STATUS_INVAL);
}
@@ -124,7 +124,7 @@ void TestMemPageInfoRead::Run(void) {
assert(records != nullptr);
err = amdsmi_dev_get_memory_reserved_pages(device_handles_[i], &num_pages, records);
err = amdsmi_dev_get_memory_reserved_pages(processor_handles_[i], &num_pages, records);
if (err == AMDSMI_STATUS_NOT_SUPPORTED) {
std::cout << "\t**Getting Memory Page Retirement Status not "
"supported for this device" << std::endl;
+3 -3
Voir le fichier
@@ -116,7 +116,7 @@ void TestMemUtilRead::Run(void) {
for (uint32_t x = 0; x < num_iterations(); ++x) {
for (uint32_t i = 0; i < num_monitor_devs(); ++i) {
PrintDeviceHeader(device_handles_[i]);
PrintDeviceHeader(processor_handles_[i]);
#if 0
err = amdsmi_dev_get_memory_busy_percent(i, &mem_busy_percent);
@@ -131,14 +131,14 @@ void TestMemUtilRead::Run(void) {
#endif
for (uint32_t mem_type = AMDSMI_MEM_TYPE_FIRST;
mem_type <= AMDSMI_MEM_TYPE_LAST; ++mem_type) {
err = amdsmi_dev_get_memory_total(device_handles_[i],
err = amdsmi_dev_get_memory_total(processor_handles_[i],
static_cast<amdsmi_memory_type_t>(mem_type), &total);
err_chk("amdsmi_dev_get_memory_total()");
if (err != AMDSMI_STATUS_SUCCESS) {
return;
}
err = amdsmi_dev_get_memory_usage(device_handles_[i],
err = amdsmi_dev_get_memory_usage(processor_handles_[i],
static_cast<amdsmi_memory_type_t>(mem_type), &usage);
err_chk("amdsmi_dev_get_memory_usage()");
if (err != AMDSMI_STATUS_SUCCESS) {
+5 -5
Voir le fichier
@@ -97,7 +97,7 @@ void TestMetricsCounterRead::Run(void) {
}
for (uint32_t i = 0; i < num_monitor_devs(); ++i) {
PrintDeviceHeader(device_handles_[i]);
PrintDeviceHeader(processor_handles_[i]);
IF_VERB(STANDARD) {
std::cout << "\t**GPU METRICS ENERGY COUNTER:\n";
@@ -106,7 +106,7 @@ void TestMetricsCounterRead::Run(void) {
uint64_t power;
uint64_t timestamp;
float counter_resolution;
err = amdsmi_dev_get_energy_count(device_handles_[i], &power, &counter_resolution, &timestamp);
err = amdsmi_dev_get_energy_count(processor_handles_[i], &power, &counter_resolution, &timestamp);
if (err != AMDSMI_STATUS_SUCCESS) {
if (err == AMDSMI_STATUS_NOT_SUPPORTED) {
IF_VERB(STANDARD) {
@@ -128,14 +128,14 @@ void TestMetricsCounterRead::Run(void) {
}
// Verify api support checking functionality is working
err = amdsmi_dev_get_energy_count(device_handles_[i], nullptr, nullptr, nullptr);
err = amdsmi_dev_get_energy_count(processor_handles_[i], nullptr, nullptr, nullptr);
ASSERT_EQ(err, AMDSMI_STATUS_INVAL);
// Coarse Grain counters
amdsmi_utilization_counter_t utilization_counters[2];
utilization_counters[0].type = AMDSMI_COARSE_GRAIN_GFX_ACTIVITY;
utilization_counters[1].type = AMDSMI_COARSE_GRAIN_MEM_ACTIVITY;
err = amdsmi_get_utilization_count(device_handles_[i], utilization_counters,
err = amdsmi_get_utilization_count(processor_handles_[i], utilization_counters,
2, &timestamp);
if (err != AMDSMI_STATUS_SUCCESS) {
if (err == AMDSMI_STATUS_NOT_SUPPORTED) {
@@ -158,7 +158,7 @@ void TestMetricsCounterRead::Run(void) {
}
// Verify api support checking functionality is working
err = amdsmi_get_utilization_count(device_handles_[i], nullptr,
err = amdsmi_get_utilization_count(processor_handles_[i], nullptr,
1 , nullptr);
ASSERT_EQ(err, AMDSMI_STATUS_INVAL);
} // end for
+26 -26
Voir le fichier
@@ -197,63 +197,63 @@ void TestMutualExclusion::Run(void) {
std::cout << "at " << __FILE__ << ":" << __LINE__ << std::endl; \
} \
}
ret = amdsmi_dev_get_id(device_handles_[0], &dmy_ui16);
ret = amdsmi_dev_get_id(processor_handles_[0], &dmy_ui16);
// vendor_id, unique_id
amdsmi_asic_info_t asci_info;
ret = amdsmi_get_asic_info(device_handles_[0], &asci_info);
ret = amdsmi_get_asic_info(processor_handles_[0], &asci_info);
CHECK_RET(ret, AMDSMI_STATUS_BUSY);
// device name, brand, serial_number
amdsmi_board_info_t board_info;
ret = amdsmi_get_board_info(device_handles_[0], &board_info);
ret = amdsmi_get_board_info(processor_handles_[0], &board_info);
CHECK_RET(ret, AMDSMI_STATUS_BUSY);
ret = amdsmi_dev_get_vendor_name(device_handles_[0], dmy_str, 10);
ret = amdsmi_dev_get_vendor_name(processor_handles_[0], dmy_str, 10);
CHECK_RET(ret, AMDSMI_STATUS_BUSY);
ret = amdsmi_dev_get_vram_vendor(device_handles_[0], dmy_str, 10);
ret = amdsmi_dev_get_vram_vendor(processor_handles_[0], dmy_str, 10);
CHECK_RET(ret, AMDSMI_STATUS_BUSY);
ret = amdsmi_dev_get_subsystem_id(device_handles_[0], &dmy_ui16);
ret = amdsmi_dev_get_subsystem_id(processor_handles_[0], &dmy_ui16);
CHECK_RET(ret, AMDSMI_STATUS_BUSY);
ret = amdsmi_dev_get_pci_id(device_handles_[0], &dmy_ui64);
ret = amdsmi_dev_get_pci_id(processor_handles_[0], &dmy_ui64);
CHECK_RET(ret, AMDSMI_STATUS_BUSY);
ret = amdsmi_dev_get_pci_throughput(device_handles_[0], &dmy_ui64, &dmy_ui64, &dmy_ui64);
ret = amdsmi_dev_get_pci_throughput(processor_handles_[0], &dmy_ui64, &dmy_ui64, &dmy_ui64);
CHECK_RET(ret, AMDSMI_STATUS_BUSY);
ret = amdsmi_dev_get_pci_replay_counter(device_handles_[0], &dmy_ui64);
ret = amdsmi_dev_get_pci_replay_counter(processor_handles_[0], &dmy_ui64);
CHECK_RET(ret, AMDSMI_STATUS_BUSY);
ret = amdsmi_dev_set_pci_bandwidth(device_handles_[0], 0);
ret = amdsmi_dev_set_pci_bandwidth(processor_handles_[0], 0);
CHECK_RET(ret, AMDSMI_STATUS_BUSY);
ret = amdsmi_dev_get_fan_rpms(device_handles_[0], dmy_ui32, &dmy_i64);
ret = amdsmi_dev_get_fan_rpms(processor_handles_[0], dmy_ui32, &dmy_i64);
CHECK_RET(ret, AMDSMI_STATUS_BUSY);
ret = amdsmi_dev_get_fan_speed(device_handles_[0], 0, &dmy_i64);
ret = amdsmi_dev_get_fan_speed(processor_handles_[0], 0, &dmy_i64);
CHECK_RET(ret, AMDSMI_STATUS_BUSY);
ret = amdsmi_dev_get_fan_speed_max(device_handles_[0], 0, &dmy_ui64);
ret = amdsmi_dev_get_fan_speed_max(processor_handles_[0], 0, &dmy_ui64);
CHECK_RET(ret, AMDSMI_STATUS_BUSY);
ret = amdsmi_dev_get_temp_metric(device_handles_[0], TEMPERATURE_TYPE_EDGE, AMDSMI_TEMP_CURRENT, &dmy_i64);
ret = amdsmi_dev_get_temp_metric(processor_handles_[0], TEMPERATURE_TYPE_EDGE, AMDSMI_TEMP_CURRENT, &dmy_i64);
CHECK_RET(ret, AMDSMI_STATUS_BUSY);
ret = amdsmi_dev_reset_fan(device_handles_[0], 0);
ret = amdsmi_dev_reset_fan(processor_handles_[0], 0);
CHECK_RET(ret, AMDSMI_STATUS_BUSY);
ret = amdsmi_dev_set_fan_speed(device_handles_[0], dmy_ui32, 0);
ret = amdsmi_dev_set_fan_speed(processor_handles_[0], dmy_ui32, 0);
CHECK_RET(ret, AMDSMI_STATUS_BUSY);
ret = amdsmi_dev_get_perf_level(device_handles_[0], &dmy_perf_lvl);
ret = amdsmi_dev_get_perf_level(processor_handles_[0], &dmy_perf_lvl);
CHECK_RET(ret, AMDSMI_STATUS_BUSY);
ret = amdsmi_dev_get_overdrive_level(device_handles_[0], &dmy_ui32);
ret = amdsmi_dev_get_overdrive_level(processor_handles_[0], &dmy_ui32);
CHECK_RET(ret, AMDSMI_STATUS_BUSY);
ret = amdsmi_dev_get_gpu_clk_freq(device_handles_[0], CLK_TYPE_SYS, &dmy_freqs);
ret = amdsmi_dev_get_gpu_clk_freq(processor_handles_[0], CLK_TYPE_SYS, &dmy_freqs);
CHECK_RET(ret, AMDSMI_STATUS_BUSY);
ret = amdsmi_dev_get_od_volt_info(device_handles_[0], &dmy_od_volt);
ret = amdsmi_dev_get_od_volt_info(processor_handles_[0], &dmy_od_volt);
CHECK_RET(ret, AMDSMI_STATUS_BUSY);
ret = amdsmi_dev_get_od_volt_curve_regions(device_handles_[0], &dmy_ui32, &dmy_vlt_reg);
ret = amdsmi_dev_get_od_volt_curve_regions(processor_handles_[0], &dmy_ui32, &dmy_vlt_reg);
CHECK_RET(ret, AMDSMI_STATUS_BUSY);
ret = amdsmi_dev_set_overdrive_level_v1(device_handles_[0], dmy_i32);
ret = amdsmi_dev_set_overdrive_level_v1(processor_handles_[0], dmy_i32);
CHECK_RET(ret, AMDSMI_STATUS_BUSY);
ret = amdsmi_dev_set_clk_freq(device_handles_[0], CLK_TYPE_SYS, 0);
ret = amdsmi_dev_set_clk_freq(processor_handles_[0], CLK_TYPE_SYS, 0);
CHECK_RET(ret, AMDSMI_STATUS_BUSY);
ret = amdsmi_dev_get_ecc_count(device_handles_[0], AMDSMI_GPU_BLOCK_UMC, &dmy_err_cnt);
ret = amdsmi_dev_get_ecc_count(processor_handles_[0], AMDSMI_GPU_BLOCK_UMC, &dmy_err_cnt);
CHECK_RET(ret, AMDSMI_STATUS_BUSY);
ret = amdsmi_dev_get_ecc_enabled(device_handles_[0], &dmy_ui64);
ret = amdsmi_dev_get_ecc_enabled(processor_handles_[0], &dmy_ui64);
CHECK_RET(ret, AMDSMI_STATUS_BUSY);
ret = amdsmi_dev_get_ecc_status(device_handles_[0], AMDSMI_GPU_BLOCK_UMC, &dmy_ras_err_st);
ret = amdsmi_dev_get_ecc_status(processor_handles_[0], AMDSMI_GPU_BLOCK_UMC, &dmy_ras_err_st);
CHECK_RET(ret, AMDSMI_STATUS_BUSY);
/* Other functions holding device mutexes. Listed for reference.
+3 -3
Voir le fichier
@@ -96,14 +96,14 @@ void TestOverdriveRead::Run(void) {
}
for (uint32_t i = 0; i < num_monitor_devs(); ++i) {
PrintDeviceHeader(device_handles_[i]);
PrintDeviceHeader(processor_handles_[i]);
err = amdsmi_dev_get_overdrive_level(device_handles_[i], &val_ui32);
err = amdsmi_dev_get_overdrive_level(processor_handles_[i], &val_ui32);
CHK_ERR_ASRT(err)
IF_VERB(STANDARD) {
std::cout << "\t**OverDrive Level:" << val_ui32 << std::endl;
// Verify api support checking functionality is working
err = amdsmi_dev_get_overdrive_level(device_handles_[i], nullptr);
err = amdsmi_dev_get_overdrive_level(processor_handles_[i], nullptr);
ASSERT_EQ(err, AMDSMI_STATUS_INVAL);
}
}
+6 -6
Voir le fichier
@@ -95,27 +95,27 @@ void TestOverdriveReadWrite::Run(void) {
}
for (uint32_t dv_ind = 0; dv_ind < num_monitor_devs(); ++dv_ind) {
PrintDeviceHeader(device_handles_[dv_ind]);
PrintDeviceHeader(processor_handles_[dv_ind]);
IF_VERB(STANDARD) {
std::cout << "Set Overdrive level to 0%..." << std::endl;
}
ret = amdsmi_dev_set_overdrive_level(device_handles_[dv_ind], 0);
ret = amdsmi_dev_set_overdrive_level(processor_handles_[dv_ind], 0);
CHK_ERR_ASRT(ret)
IF_VERB(STANDARD) {
std::cout << "Set Overdrive level to 10%..." << std::endl;
}
ret = amdsmi_dev_set_overdrive_level(device_handles_[dv_ind], 10);
ret = amdsmi_dev_set_overdrive_level(processor_handles_[dv_ind], 10);
CHK_ERR_ASRT(ret)
ret = amdsmi_dev_get_overdrive_level(device_handles_[dv_ind], &val);
ret = amdsmi_dev_get_overdrive_level(processor_handles_[dv_ind], &val);
CHK_ERR_ASRT(ret)
IF_VERB(STANDARD) {
std::cout << "\t**New OverDrive Level:" << val << std::endl;
std::cout << "Reset Overdrive level to 0%..." << std::endl;
}
ret = amdsmi_dev_set_overdrive_level(device_handles_[dv_ind], 0);
ret = amdsmi_dev_set_overdrive_level(processor_handles_[dv_ind], 0);
CHK_ERR_ASRT(ret)
ret = amdsmi_dev_get_overdrive_level(device_handles_[dv_ind], &val);
ret = amdsmi_dev_get_overdrive_level(processor_handles_[dv_ind], &val);
CHK_ERR_ASRT(ret)
IF_VERB(STANDARD) {
std::cout << "\t**New OverDrive Level:" << val << std::endl;
+12 -12
Voir le fichier
@@ -98,9 +98,9 @@ void TestPciReadWrite::Run(void) {
}
for (uint32_t dv_ind = 0; dv_ind < num_monitor_devs(); ++dv_ind) {
PrintDeviceHeader(device_handles_[dv_ind]);
PrintDeviceHeader(processor_handles_[dv_ind]);
ret = amdsmi_dev_get_pci_replay_counter(device_handles_[dv_ind], &u64int);
ret = amdsmi_dev_get_pci_replay_counter(processor_handles_[dv_ind], &u64int);
if (ret == AMDSMI_STATUS_NOT_SUPPORTED) {
std::cout <<
@@ -108,7 +108,7 @@ void TestPciReadWrite::Run(void) {
" on this machine" << std::endl;
// Verify api support checking functionality is working
ret = amdsmi_dev_get_pci_replay_counter(device_handles_[dv_ind], nullptr);
ret = amdsmi_dev_get_pci_replay_counter(processor_handles_[dv_ind], nullptr);
ASSERT_EQ(ret, AMDSMI_STATUS_NOT_SUPPORTED);
} else {
CHK_ERR_ASRT(ret)
@@ -116,11 +116,11 @@ void TestPciReadWrite::Run(void) {
std::cout << "\tPCIe Replay Counter: " << u64int << std::endl;
}
// Verify api support checking functionality is working
ret = amdsmi_dev_get_pci_replay_counter(device_handles_[dv_ind], nullptr);
ret = amdsmi_dev_get_pci_replay_counter(processor_handles_[dv_ind], nullptr);
ASSERT_EQ(ret, AMDSMI_STATUS_INVAL);
}
ret = amdsmi_dev_get_pci_throughput(device_handles_[dv_ind], &sent, &received, &max_pkt_sz);
ret = amdsmi_dev_get_pci_throughput(processor_handles_[dv_ind], &sent, &received, &max_pkt_sz);
if (ret == AMDSMI_STATUS_NOT_SUPPORTED) {
std::cout << "TEST FAILURE: Current PCIe throughput is not detected. "
"This is likely because it is not indicated in the pcie_bw sysfs "
@@ -141,14 +141,14 @@ void TestPciReadWrite::Run(void) {
std::cout << std::endl;
}
ret = amdsmi_dev_get_pci_bandwidth(device_handles_[dv_ind], &bw);
ret = amdsmi_dev_get_pci_bandwidth(processor_handles_[dv_ind], &bw);
if (ret == AMDSMI_STATUS_NOT_SUPPORTED) {
std::cout << "TEST FAILURE: Current PCIe bandwidth is not detected. "
"This is likely because it is not indicated in the pp_dpm_pcie sysfs "
"file. Aborting test." << std::endl;
// Verify api support checking functionality is working
ret = amdsmi_dev_get_pci_bandwidth(device_handles_[dv_ind], nullptr);
ret = amdsmi_dev_get_pci_bandwidth(processor_handles_[dv_ind], nullptr);
ASSERT_EQ(ret, AMDSMI_STATUS_NOT_SUPPORTED);
return;
@@ -163,7 +163,7 @@ void TestPciReadWrite::Run(void) {
std::endl;
}
// Verify api support checking functionality is working
ret = amdsmi_dev_get_pci_bandwidth(device_handles_[dv_ind], nullptr);
ret = amdsmi_dev_get_pci_bandwidth(processor_handles_[dv_ind], nullptr);
ASSERT_EQ(ret, AMDSMI_STATUS_INVAL);
// First set the bitmask to all supported bandwidths
@@ -182,10 +182,10 @@ void TestPciReadWrite::Run(void) {
std::cout << "\tSetting bandwidth mask to " << "0b" << freq_bm_str <<
" ..." << std::endl;
}
ret = amdsmi_dev_set_pci_bandwidth(device_handles_[dv_ind], freq_bitmask);
ret = amdsmi_dev_set_pci_bandwidth(processor_handles_[dv_ind], freq_bitmask);
CHK_ERR_ASRT(ret)
ret = amdsmi_dev_get_pci_bandwidth(device_handles_[dv_ind], &bw);
ret = amdsmi_dev_get_pci_bandwidth(processor_handles_[dv_ind], &bw);
CHK_ERR_ASRT(ret)
IF_VERB(STANDARD) {
@@ -193,10 +193,10 @@ void TestPciReadWrite::Run(void) {
std::endl;
std::cout << "\tResetting mask to all bandwidths." << std::endl;
}
ret = amdsmi_dev_set_pci_bandwidth(device_handles_[dv_ind], 0xFFFFFFFF);
ret = amdsmi_dev_set_pci_bandwidth(processor_handles_[dv_ind], 0xFFFFFFFF);
CHK_ERR_ASRT(ret)
ret = amdsmi_dev_set_perf_level(device_handles_[dv_ind], AMDSMI_DEV_PERF_LEVEL_AUTO);
ret = amdsmi_dev_set_perf_level(processor_handles_[dv_ind], AMDSMI_DEV_PERF_LEVEL_AUTO);
CHK_ERR_ASRT(ret)
}
}
+1 -1
Voir le fichier
@@ -352,7 +352,7 @@ void TestPerfCntrReadWrite::Run(void) {
}
for (uint32_t dv_ind = 0; dv_ind < num_monitor_devs(); ++dv_ind) {
amdsmi_processor_handle dev_handle = device_handles_[dv_ind];
amdsmi_processor_handle dev_handle = processor_handles_[dv_ind];
PrintDeviceHeader(dev_handle);
try {
testEventsIndividually(dev_handle);
+6 -6
Voir le fichier
@@ -102,8 +102,8 @@ void TestPerfDeterminism::Run(void) {
}
for (uint32_t i = 0; i < num_monitor_devs(); ++i) {
PrintDeviceHeader(device_handles_[i]);
err = amdsmi_dev_get_od_volt_info(device_handles_[i], &odv);
PrintDeviceHeader(processor_handles_[i]);
err = amdsmi_dev_get_od_volt_info(processor_handles_[i], &odv);
if (err == AMDSMI_STATUS_NOT_SUPPORTED) {
IF_VERB(STANDARD) {
std::cout << "\t** Not supported on this machine" << std::endl;
@@ -114,14 +114,14 @@ void TestPerfDeterminism::Run(void) {
clkvalue = (odv.curr_sclk_range.lower_bound/1000000) + 50;
}
err = amdsmi_set_perf_determinism_mode(device_handles_[i], clkvalue);
err = amdsmi_set_perf_determinism_mode(processor_handles_[i], clkvalue);
if (err == AMDSMI_STATUS_NOT_SUPPORTED) {
IF_VERB(STANDARD) {
std::cout << "\t**Not supported on this machine" << std::endl;
}
return;
} else {
ret = amdsmi_dev_get_perf_level(device_handles_[i], &pfl);
ret = amdsmi_dev_get_perf_level(processor_handles_[i], &pfl);
CHK_ERR_ASRT(ret)
IF_VERB(STANDARD) {
std::cout << "\t**New Perf Level:" << GetPerfLevelStr(pfl) <<
@@ -130,9 +130,9 @@ void TestPerfDeterminism::Run(void) {
}
std::cout << "\t**Resetting performance determinism" << std::endl;
err = amdsmi_dev_set_perf_level(device_handles_[i], AMDSMI_DEV_PERF_LEVEL_AUTO);;
err = amdsmi_dev_set_perf_level(processor_handles_[i], AMDSMI_DEV_PERF_LEVEL_AUTO);;
CHK_ERR_ASRT(err)
ret = amdsmi_dev_get_perf_level(device_handles_[i], &pfl);
ret = amdsmi_dev_get_perf_level(processor_handles_[i], &pfl);
CHK_ERR_ASRT(ret)
IF_VERB(STANDARD) {
std::cout << "\t**New Perf Level:" << GetPerfLevelStr(pfl) <<
+3 -3
Voir le fichier
@@ -96,16 +96,16 @@ void TestPerfLevelRead::Run(void) {
}
for (uint32_t i = 0; i < num_monitor_devs(); ++i) {
PrintDeviceHeader(device_handles_[i]);
PrintDeviceHeader(processor_handles_[i]);
err = amdsmi_dev_get_perf_level(device_handles_[i], &pfl);
err = amdsmi_dev_get_perf_level(processor_handles_[i], &pfl);
CHK_ERR_ASRT(err)
IF_VERB(STANDARD) {
std::cout << "\t**Performance Level:" << std::dec << (uint32_t)pfl <<
std::endl;
}
// Verify api support checking functionality is working
err = amdsmi_dev_get_perf_level(device_handles_[i], nullptr);
err = amdsmi_dev_get_perf_level(processor_handles_[i], nullptr);
ASSERT_EQ(err, AMDSMI_STATUS_INVAL);
}
}
+6 -6
Voir le fichier
@@ -99,9 +99,9 @@ void TestPerfLevelReadWrite::Run(void) {
}
for (uint32_t dv_ind = 0; dv_ind < num_monitor_devs(); ++dv_ind) {
PrintDeviceHeader(device_handles_[dv_ind]);
PrintDeviceHeader(processor_handles_[dv_ind]);
ret = amdsmi_dev_get_perf_level(device_handles_[dv_ind], &orig_pfl);
ret = amdsmi_dev_get_perf_level(processor_handles_[dv_ind], &orig_pfl);
CHK_ERR_ASRT(ret)
IF_VERB(STANDARD) {
@@ -120,14 +120,14 @@ void TestPerfLevelReadWrite::Run(void) {
GetPerfLevelStr(static_cast<amdsmi_dev_perf_level_t>(pfl_i)) <<
" ..." << std::endl;
}
ret = amdsmi_dev_set_perf_level(device_handles_[dv_ind],
ret = amdsmi_dev_set_perf_level(processor_handles_[dv_ind],
static_cast<amdsmi_dev_perf_level_t>(pfl_i));
if (ret == AMDSMI_STATUS_NOT_SUPPORTED) {
std::cout << "\t**" << GetPerfLevelStr(static_cast<amdsmi_dev_perf_level_t>(pfl_i))
<< " returned AMDSMI_STATUS_NOT_SUPPORTED" << std::endl;
} else {
CHK_ERR_ASRT(ret)
ret = amdsmi_dev_get_perf_level(device_handles_[dv_ind], &pfl);
ret = amdsmi_dev_get_perf_level(processor_handles_[dv_ind], &pfl);
CHK_ERR_ASRT(ret)
IF_VERB(STANDARD) {
std::cout << "\t**New Perf Level:" << GetPerfLevelStr(pfl) <<
@@ -139,9 +139,9 @@ void TestPerfLevelReadWrite::Run(void) {
std::cout << "Reset Perf level to " << GetPerfLevelStr(orig_pfl) <<
" ..." << std::endl;
}
ret = amdsmi_dev_set_perf_level(device_handles_[dv_ind], orig_pfl);
ret = amdsmi_dev_set_perf_level(processor_handles_[dv_ind], orig_pfl);
CHK_ERR_ASRT(ret)
ret = amdsmi_dev_get_perf_level(device_handles_[dv_ind], &pfl);
ret = amdsmi_dev_get_perf_level(processor_handles_[dv_ind], &pfl);
CHK_ERR_ASRT(ret)
IF_VERB(STANDARD) {
+7 -7
Voir le fichier
@@ -100,13 +100,13 @@ void TestPowerCapReadWrite::Run(void) {
}
for (uint32_t dv_ind = 0; dv_ind < num_monitor_devs(); ++dv_ind) {
PrintDeviceHeader(device_handles_[dv_ind]);
PrintDeviceHeader(processor_handles_[dv_ind]);
amdsmi_power_cap_info_t info;
ret = amdsmi_get_power_cap_info(device_handles_[dv_ind], 0, &info);
ret = amdsmi_get_power_cap_info(processor_handles_[dv_ind], 0, &info);
CHK_ERR_ASRT(ret)
// Verify api support checking functionality is working
ret = amdsmi_get_power_cap_info(device_handles_[dv_ind], 0, nullptr);
ret = amdsmi_get_power_cap_info(processor_handles_[dv_ind], 0, nullptr);
ASSERT_EQ(ret, AMDSMI_STATUS_INVAL);
min = info.min_power_cap;
max = info.max_power_cap;
@@ -121,13 +121,13 @@ void TestPowerCapReadWrite::Run(void) {
std::cout << "Setting new cap to " << new_cap << "..." << std::endl;
}
start = clock();
ret = amdsmi_dev_set_power_cap(device_handles_[dv_ind], 0, new_cap);
ret = amdsmi_dev_set_power_cap(processor_handles_[dv_ind], 0, new_cap);
end = clock();
cpu_time_used = ((double) (end - start)) * 1000000UL / CLOCKS_PER_SEC;
CHK_ERR_ASRT(ret)
ret = amdsmi_get_power_cap_info(device_handles_[dv_ind], 0, &info);
ret = amdsmi_get_power_cap_info(processor_handles_[dv_ind], 0, &info);
CHK_ERR_ASRT(ret)
new_cap = info.default_power_cap;
@@ -139,10 +139,10 @@ void TestPowerCapReadWrite::Run(void) {
std::cout << "Resetting cap to " << orig << "..." << std::endl;
}
ret = amdsmi_dev_set_power_cap(device_handles_[dv_ind], 0, orig);
ret = amdsmi_dev_set_power_cap(processor_handles_[dv_ind], 0, orig);
CHK_ERR_ASRT(ret)
ret = amdsmi_get_power_cap_info(device_handles_[dv_ind], 0, &info);
ret = amdsmi_get_power_cap_info(processor_handles_[dv_ind], 0, &info);
CHK_ERR_ASRT(ret)
new_cap = info.default_power_cap;
+4 -4
Voir le fichier
@@ -97,10 +97,10 @@ void TestPowerRead::Run(void) {
for (uint32_t x = 0; x < num_iterations(); ++x) {
for (uint32_t i = 0; i < num_monitor_devs(); ++i) {
PrintDeviceHeader(device_handles_[i]);
PrintDeviceHeader(processor_handles_[i]);
amdsmi_power_cap_info_t info;
err = amdsmi_get_power_cap_info(device_handles_[i], 0, &info);
err = amdsmi_get_power_cap_info(processor_handles_[i], 0, &info);
CHK_ERR_ASRT(err)
IF_VERB(STANDARD) {
std::cout << "\t**Current Power Cap: " << info.power_cap << "uW" <<std::endl;
@@ -112,7 +112,7 @@ void TestPowerRead::Run(void) {
info.max_power_cap << " uW" << std::endl;
}
err = amdsmi_dev_get_power_ave(device_handles_[i], 0, &val_ui64);
err = amdsmi_dev_get_power_ave(processor_handles_[i], 0, &val_ui64);
IF_VERB(STANDARD) {
std::cout << "\t**Averge Power Usage: ";
CHK_AMDSMI_PERM_ERR(err)
@@ -120,7 +120,7 @@ void TestPowerRead::Run(void) {
std::cout << static_cast<float>(val_ui64)/1000 << " mW" << std::endl;
}
// Verify api support checking functionality is working
err = amdsmi_dev_get_power_ave(device_handles_[i], 0, nullptr);
err = amdsmi_dev_get_power_ave(processor_handles_[i], 0, nullptr);
ASSERT_EQ(err, AMDSMI_STATUS_INVAL);
}
}
+9 -9
Voir le fichier
@@ -120,9 +120,9 @@ void TestPowerReadWrite::Run(void) {
}
for (uint32_t dv_ind = 0; dv_ind < num_monitor_devs(); ++dv_ind) {
PrintDeviceHeader(device_handles_[dv_ind]);
PrintDeviceHeader(processor_handles_[dv_ind]);
ret = amdsmi_dev_get_power_profile_presets(device_handles_[dv_ind], 0, &status);
ret = amdsmi_dev_get_power_profile_presets(processor_handles_[dv_ind], 0, &status);
if (ret == AMDSMI_STATUS_NOT_SUPPORTED) {
std::cout << "The power profile presets settings is not supported. "
<< std::endl;
@@ -131,7 +131,7 @@ void TestPowerReadWrite::Run(void) {
CHK_ERR_ASRT(ret)
// Verify api support checking functionality is working
ret = amdsmi_dev_get_power_profile_presets(device_handles_[dv_ind], 0, nullptr);
ret = amdsmi_dev_get_power_profile_presets(processor_handles_[dv_ind], 0, nullptr);
ASSERT_EQ(ret, AMDSMI_STATUS_INVAL);
IF_VERB(STANDARD) {
@@ -172,27 +172,27 @@ void TestPowerReadWrite::Run(void) {
return;
}
ret = amdsmi_dev_set_power_profile(device_handles_[dv_ind], 0, new_prof);
ret = amdsmi_dev_set_power_profile(processor_handles_[dv_ind], 0, new_prof);
CHK_ERR_ASRT(ret)
amdsmi_dev_perf_level_t pfl;
ret = amdsmi_dev_get_perf_level(device_handles_[dv_ind], &pfl);
ret = amdsmi_dev_get_perf_level(processor_handles_[dv_ind], &pfl);
CHK_ERR_ASRT(ret)
ASSERT_EQ(pfl, AMDSMI_DEV_PERF_LEVEL_MANUAL);
ret = amdsmi_dev_get_power_profile_presets(device_handles_[dv_ind], 0, &status);
ret = amdsmi_dev_get_power_profile_presets(processor_handles_[dv_ind], 0, &status);
CHK_ERR_ASRT(ret)
ASSERT_EQ(status.current, new_prof);
ret = amdsmi_dev_set_perf_level(device_handles_[dv_ind], AMDSMI_DEV_PERF_LEVEL_AUTO);
ret = amdsmi_dev_set_perf_level(processor_handles_[dv_ind], AMDSMI_DEV_PERF_LEVEL_AUTO);
CHK_ERR_ASRT(ret)
ret = amdsmi_dev_get_perf_level(device_handles_[dv_ind], &pfl);
ret = amdsmi_dev_get_perf_level(processor_handles_[dv_ind], &pfl);
CHK_ERR_ASRT(ret)
ASSERT_EQ(pfl, AMDSMI_DEV_PERF_LEVEL_AUTO);
ret = amdsmi_dev_get_power_profile_presets(device_handles_[dv_ind], 0, &status);
ret = amdsmi_dev_get_power_profile_presets(processor_handles_[dv_ind], 0, &status);
CHK_ERR_ASRT(ret)
ASSERT_EQ(status.current, orig_profile);
+13 -13
Voir le fichier
@@ -100,10 +100,10 @@ void TestSysInfoRead::Run(void) {
}
for (uint32_t i = 0; i < num_monitor_devs(); ++i) {
PrintDeviceHeader(device_handles_[i]);
PrintDeviceHeader(processor_handles_[i]);
amdsmi_vbios_info_t info;
err = amdsmi_get_vbios_info(device_handles_[i], &info);
err = amdsmi_get_vbios_info(processor_handles_[i], &info);
if (err != AMDSMI_STATUS_SUCCESS) {
if (err == AMDSMI_STATUS_FILE_ERROR) {
@@ -112,11 +112,11 @@ void TestSysInfoRead::Run(void) {
<< std::endl;
}
// Verify api support checking functionality is working
err = amdsmi_get_vbios_info(device_handles_[i], nullptr);
err = amdsmi_get_vbios_info(processor_handles_[i], nullptr);
ASSERT_EQ(err, AMDSMI_STATUS_NOT_SUPPORTED);
} else {
// Verify api support checking functionality is working
err = amdsmi_get_vbios_info(device_handles_[i], nullptr);
err = amdsmi_get_vbios_info(processor_handles_[i], nullptr);
ASSERT_EQ(err, AMDSMI_STATUS_INVAL);
CHK_ERR_ASRT(err)
@@ -128,36 +128,36 @@ void TestSysInfoRead::Run(void) {
}
}
err = amdsmi_dev_get_pci_id(device_handles_[i], &val_ui64);
err = amdsmi_dev_get_pci_id(processor_handles_[i], &val_ui64);
CHK_ERR_ASRT(err)
IF_VERB(STANDARD) {
std::cout << "\t**PCI ID (BDFID): 0x" << std::hex << val_ui64;
std::cout << " (" << std::dec << val_ui64 << ")" << std::endl;
}
// Verify api support checking functionality is working
err = amdsmi_dev_get_pci_id(device_handles_[i], nullptr);
err = amdsmi_dev_get_pci_id(processor_handles_[i], nullptr);
ASSERT_EQ(err, AMDSMI_STATUS_INVAL);
err = amdsmi_topo_get_numa_affinity(device_handles_[i], &val_ui32);
err = amdsmi_topo_get_numa_affinity(processor_handles_[i], &val_ui32);
CHK_ERR_ASRT(err)
IF_VERB(STANDARD) {
std::cout << "\t**NUMA NODE: 0x" << std::hex << val_ui32;
std::cout << " (" << std::dec << val_ui32 << ")" << std::endl;
}
// Verify api support checking functionality is working
err = amdsmi_topo_get_numa_affinity(device_handles_[i], nullptr);
err = amdsmi_topo_get_numa_affinity(processor_handles_[i], nullptr);
ASSERT_EQ(err, AMDSMI_STATUS_INVAL);
// vendor_id, unique_id
amdsmi_asic_info_t asci_info;
err = amdsmi_get_asic_info(device_handles_[0], &asci_info);
err = amdsmi_get_asic_info(processor_handles_[0], &asci_info);
if (err == AMDSMI_STATUS_NOT_SUPPORTED) {
std::cout <<
"\t**amdsmi_dev_unique_id() is not supported"
" on this machine" << std::endl;
// Verify api support checking functionality is working
err = amdsmi_get_asic_info(device_handles_[i], nullptr);
err = amdsmi_get_asic_info(processor_handles_[i], nullptr);
ASSERT_EQ(err, AMDSMI_STATUS_NOT_SUPPORTED);
} else {
if (err == AMDSMI_STATUS_SUCCESS) {
@@ -169,7 +169,7 @@ void TestSysInfoRead::Run(void) {
*/
}
// Verify api support checking functionality is working
err = amdsmi_get_asic_info(device_handles_[i], nullptr);
err = amdsmi_get_asic_info(processor_handles_[i], nullptr);
ASSERT_EQ(err, AMDSMI_STATUS_INVAL);
} else {
std::cout << "amdsmi_dev_unique_id_get() failed with error " <<
@@ -190,11 +190,11 @@ void TestSysInfoRead::Run(void) {
std::cout << std::setbase(10);
amdsmi_fw_info_t fw_info;
err = amdsmi_get_fw_info(device_handles_[i], &fw_info);
err = amdsmi_get_fw_info(processor_handles_[i], &fw_info);
if (err == AMDSMI_STATUS_NOT_SUPPORTED) {
std::cout << "\t**No FW " <<
" available on this system" << std::endl;
err = amdsmi_get_fw_info(device_handles_[i], nullptr);
err = amdsmi_get_fw_info(processor_handles_[i], nullptr);
ASSERT_EQ(err, AMDSMI_STATUS_NOT_SUPPORTED);
} else {
CHK_ERR_ASRT(err)
+4 -4
Voir le fichier
@@ -110,11 +110,11 @@ void TestTempRead::Run(void) {
uint32_t type;
for (uint32_t x = 0; x < num_iterations(); ++x) {
for (uint32_t i = 0; i < num_monitor_devs(); ++i) {
PrintDeviceHeader(device_handles_[i]);
PrintDeviceHeader(processor_handles_[i]);
auto print_temp_metric = [&](amdsmi_temperature_metric_t met,
std::string label) {
err = amdsmi_dev_get_temp_metric(device_handles_[i], static_cast<amdsmi_temperature_type_t>(type), met, &val_i64);
err = amdsmi_dev_get_temp_metric(processor_handles_[i], static_cast<amdsmi_temperature_type_t>(type), met, &val_i64);
if (err != AMDSMI_STATUS_SUCCESS) {
if (err == AMDSMI_STATUS_NOT_SUPPORTED) {
@@ -124,7 +124,7 @@ void TestTempRead::Run(void) {
}
// Verify api support checking functionality is working
err = amdsmi_dev_get_temp_metric(device_handles_[i], static_cast<amdsmi_temperature_type_t>(type), met, nullptr);
err = amdsmi_dev_get_temp_metric(processor_handles_[i], static_cast<amdsmi_temperature_type_t>(type), met, nullptr);
ASSERT_EQ(err, AMDSMI_STATUS_INVAL);
return;
} else {
@@ -132,7 +132,7 @@ void TestTempRead::Run(void) {
}
}
// Verify api support checking functionality is working
err = amdsmi_dev_get_temp_metric(device_handles_[i], static_cast<amdsmi_temperature_type_t>(type), met, nullptr);
err = amdsmi_dev_get_temp_metric(processor_handles_[i], static_cast<amdsmi_temperature_type_t>(type), met, nullptr);
ASSERT_EQ(err, AMDSMI_STATUS_INVAL);
IF_VERB(STANDARD) {
+5 -5
Voir le fichier
@@ -155,9 +155,9 @@ void TestVoltCurvRead::Run(void) {
}
for (uint32_t i = 0; i < num_monitor_devs(); ++i) {
PrintDeviceHeader(device_handles_[i]);
PrintDeviceHeader(processor_handles_[i]);
err = amdsmi_dev_get_od_volt_info(device_handles_[i], &odv);
err = amdsmi_dev_get_od_volt_info(processor_handles_[i], &odv);
if (err == AMDSMI_STATUS_NOT_SUPPORTED) {
IF_VERB(STANDARD) {
std::cout <<
@@ -165,12 +165,12 @@ void TestVoltCurvRead::Run(void) {
<< std::endl;
}
// Verify api support checking functionality is working
err = amdsmi_dev_get_od_volt_info(device_handles_[i], nullptr);
err = amdsmi_dev_get_od_volt_info(processor_handles_[i], nullptr);
ASSERT_EQ(err, AMDSMI_STATUS_NOT_SUPPORTED);
} else {
CHK_ERR_ASRT(err)
// Verify api support checking functionality is working
err = amdsmi_dev_get_od_volt_info(device_handles_[i], nullptr);
err = amdsmi_dev_get_od_volt_info(processor_handles_[i], nullptr);
ASSERT_EQ(err, AMDSMI_STATUS_INVAL);
}
@@ -184,7 +184,7 @@ void TestVoltCurvRead::Run(void) {
ASSERT_TRUE(regions != nullptr);
num_regions = odv.num_regions;
err = amdsmi_dev_get_od_volt_curve_regions(device_handles_[i], &num_regions, regions);
err = amdsmi_dev_get_od_volt_curve_regions(processor_handles_[i], &num_regions, regions);
CHK_ERR_ASRT(err)
ASSERT_TRUE(num_regions == odv.num_regions);
+4 -4
Voir le fichier
@@ -100,11 +100,11 @@ void TestVoltRead::Run(void) {
amdsmi_voltage_type_t type = AMDSMI_VOLT_TYPE_VDDGFX;
for (uint32_t i = 0; i < num_monitor_devs(); ++i) {
PrintDeviceHeader(device_handles_[i]);
PrintDeviceHeader(processor_handles_[i]);
auto print_volt_metric = [&](amdsmi_voltage_metric_t met,
std::string label) {
err = amdsmi_dev_get_volt_metric(device_handles_[i], type, met, &val_i64);
err = amdsmi_dev_get_volt_metric(processor_handles_[i], type, met, &val_i64);
if (err != AMDSMI_STATUS_SUCCESS) {
if (err == AMDSMI_STATUS_NOT_SUPPORTED) {
@@ -113,7 +113,7 @@ void TestVoltRead::Run(void) {
"Not supported on this machine" << std::endl;
// Verify api support checking functionality is working
err = amdsmi_dev_get_volt_metric(device_handles_[i], type, met, nullptr);
err = amdsmi_dev_get_volt_metric(processor_handles_[i], type, met, nullptr);
ASSERT_EQ(err, AMDSMI_STATUS_NOT_SUPPORTED);
return;
}
@@ -122,7 +122,7 @@ void TestVoltRead::Run(void) {
}
}
// Verify api support checking functionality is working
err = amdsmi_dev_get_volt_metric(device_handles_[i], type, met, nullptr);
err = amdsmi_dev_get_volt_metric(processor_handles_[i], type, met, nullptr);
ASSERT_EQ(err, AMDSMI_STATUS_INVAL);
IF_VERB(STANDARD) {
+1 -1
Voir le fichier
@@ -98,7 +98,7 @@ void TestXGMIReadWrite::Run(void) {
}
for (uint32_t dv_ind = 0; dv_ind < num_monitor_devs(); ++dv_ind) {
auto device = device_handles_[dv_ind];
auto device = processor_handles_[dv_ind];
PrintDeviceHeader(device);
amdsmi_xgmi_info_t info;
+5 -5
Voir le fichier
@@ -124,16 +124,16 @@ void TestBase::SetUp(uint64_t init_flags) {
for (uint32_t i=0; i < socket_count_; i++) {
// Get all devices of the socket
uint32_t device_count = 0;
err = amdsmi_get_device_handles(sockets_[i],
err = amdsmi_get_processor_handles(sockets_[i],
&device_count, nullptr);
if (err != AMDSMI_STATUS_SUCCESS) {
setup_failed_ = true;
}
ASSERT_EQ(err, AMDSMI_STATUS_SUCCESS);
std::vector<amdsmi_processor_handle> device_handles(device_count);
err = amdsmi_get_device_handles(sockets_[i],
&device_count, &device_handles[0]);
std::vector<amdsmi_processor_handle> processor_handles(device_count);
err = amdsmi_get_processor_handles(sockets_[i],
&device_count, &processor_handles[0]);
if (err != AMDSMI_STATUS_SUCCESS) {
setup_failed_ = true;
}
@@ -144,7 +144,7 @@ void TestBase::SetUp(uint64_t init_flags) {
setup_failed_ = true;
ASSERT_EQ(AMDSMI_STATUS_INPUT_OUT_OF_BOUNDS, AMDSMI_STATUS_SUCCESS);
}
device_handles_[num_monitor_devs_] = device_handles[j];
processor_handles_[num_monitor_devs_] = processor_handles[j];
num_monitor_devs_++;
}
}
+1 -1
Voir le fichier
@@ -125,7 +125,7 @@ class TestBase {
bool setup_failed_; ///< Record that setup failed to return ierr in Run
uint32_t num_monitor_devs_; ///< Number of monitor devices found
///< device handles
amdsmi_processor_handle device_handles_[MAX_MONITOR_DEVICES];
amdsmi_processor_handle processor_handles_[MAX_MONITOR_DEVICES];
uint32_t socket_count_; ///< socket count
std::vector<amdsmi_socket_handle> sockets_; ///< sockets