diff --git a/projects/rocm-smi-lib/tests/rocm_smi_test/functional/gpu_metrics_read.cc b/projects/rocm-smi-lib/tests/rocm_smi_test/functional/gpu_metrics_read.cc index 7aae2451a8..d47e74a9a1 100644 --- a/projects/rocm-smi-lib/tests/rocm_smi_test/functional/gpu_metrics_read.cc +++ b/projects/rocm-smi-lib/tests/rocm_smi_test/functional/gpu_metrics_read.cc @@ -58,7 +58,8 @@ TestGpuMetricsRead::TestGpuMetricsRead() : TestBase() { set_title("RSMI GPU Metrics Read Test"); - set_description("The GPU Metrics tests verifies that the gpu metrics info can be read properly."); + set_description("The GPU Metrics tests verifies that " + "the gpu metrics info can be read properly."); } TestGpuMetricsRead::~TestGpuMetricsRead(void) { @@ -179,7 +180,6 @@ void TestGpuMetricsRead::Run(void) { // Verify api support checking functionality is working err = rsmi_dev_gpu_metrics_info_get(i, nullptr); ASSERT_EQ(err, RSMI_STATUS_INVALID_ARGS); - } } } diff --git a/projects/rocm-smi-lib/tests/rocm_smi_test/functional/perf_determinism.cc b/projects/rocm-smi-lib/tests/rocm_smi_test/functional/perf_determinism.cc index 0194f21e62..93c93b6df9 100644 --- a/projects/rocm-smi-lib/tests/rocm_smi_test/functional/perf_determinism.cc +++ b/projects/rocm-smi-lib/tests/rocm_smi_test/functional/perf_determinism.cc @@ -50,6 +50,7 @@ #include #include #include +#include #include "gtest/gtest.h" #include "rocm_smi/rocm_smi.h" @@ -74,8 +75,8 @@ static const std::map TestPerfDeterminism::TestPerfDeterminism() : TestBase() { set_title("RSMI Performance Determinism Test"); - set_description("The Performance Determinism tests verifies Enabling/Disabling " - "performance determinism mode."); + set_description("The Performance Determinism tests verifies " + "Enabling/Disabling performance determinism mode."); } TestPerfDeterminism::~TestPerfDeterminism(void) { diff --git a/projects/rocm-smi-lib/tests/rocm_smi_test/functional/perf_level_read_write.cc b/projects/rocm-smi-lib/tests/rocm_smi_test/functional/perf_level_read_write.cc index 7f35bb0dd6..7d91c0715d 100755 --- a/projects/rocm-smi-lib/tests/rocm_smi_test/functional/perf_level_read_write.cc +++ b/projects/rocm-smi-lib/tests/rocm_smi_test/functional/perf_level_read_write.cc @@ -54,21 +54,6 @@ #include "rocm_smi_test/functional/perf_level_read_write.h" #include "rocm_smi_test/test_common.h" -static const std::map - kDevPerfLvlNameMap = { - {RSMI_DEV_PERF_LEVEL_AUTO, "RSMI_DEV_PERF_LEVEL_AUTO"}, - {RSMI_DEV_PERF_LEVEL_LOW, "RSMI_DEV_PERF_LEVEL_LOW"}, - {RSMI_DEV_PERF_LEVEL_HIGH, "RSMI_DEV_PERF_LEVEL_HIGH"}, - {RSMI_DEV_PERF_LEVEL_MANUAL, "RSMI_DEV_PERF_LEVEL_MANUAL"}, - {RSMI_DEV_PERF_LEVEL_STABLE_STD, "RSMI_DEV_PERF_LEVEL_STABLE_STD"}, - {RSMI_DEV_PERF_LEVEL_STABLE_MIN_MCLK, - "RSMI_DEV_PERF_LEVEL_STABLE_MIN_MCLK"}, - {RSMI_DEV_PERF_LEVEL_STABLE_MIN_SCLK, - "RSMI_DEV_PERF_LEVEL_STABLE_MIN_SCLK"}, - {RSMI_DEV_PERF_LEVEL_STABLE_PEAK, "RSMI_DEV_PERF_LEVEL_STABLE_PEAK"}, - - {RSMI_DEV_PERF_LEVEL_UNKNOWN, "RSMI_DEV_PERF_LEVEL_UNKNOWN"}, -}; TestPerfLevelReadWrite::TestPerfLevelReadWrite() : TestBase() { set_title("RSMI Performance Level Read/Write Test"); @@ -121,7 +106,7 @@ void TestPerfLevelReadWrite::Run(void) { IF_VERB(STANDARD) { std::cout << "\t**Original Perf Level:" << - kDevPerfLvlNameMap.at(orig_pfl) << std::endl; + GetPerfLevelStr(orig_pfl) << std::endl; } uint32_t pfl_i = static_cast(RSMI_DEV_PERF_LEVEL_FIRST); @@ -132,7 +117,7 @@ void TestPerfLevelReadWrite::Run(void) { IF_VERB(STANDARD) { std::cout << "Set Performance Level to " << - kDevPerfLvlNameMap.at(static_cast(pfl_i)) << + GetPerfLevelStr(static_cast(pfl_i)) << " ..." << std::endl; } ret = rsmi_dev_perf_level_set(dv_ind, @@ -141,12 +126,12 @@ void TestPerfLevelReadWrite::Run(void) { ret = rsmi_dev_perf_level_get(dv_ind, &pfl); CHK_ERR_ASRT(ret) IF_VERB(STANDARD) { - std::cout << "\t**New Perf Level:" << kDevPerfLvlNameMap.at(pfl) << - std::endl; + std::cout << "\t**New Perf Level:" << GetPerfLevelStr(pfl) << + std::endl; } } IF_VERB(STANDARD) { - std::cout << "Reset Perf level to " << kDevPerfLvlNameMap.at(orig_pfl) << + std::cout << "Reset Perf level to " << GetPerfLevelStr(orig_pfl) << " ..." << std::endl; } ret = rsmi_dev_perf_level_set(dv_ind, orig_pfl); @@ -155,7 +140,7 @@ void TestPerfLevelReadWrite::Run(void) { CHK_ERR_ASRT(ret) IF_VERB(STANDARD) { - std::cout << "\t**New Perf Level:" << kDevPerfLvlNameMap.at(pfl) << + std::cout << "\t**New Perf Level:" << GetPerfLevelStr(pfl) << std::endl; } } diff --git a/projects/rocm-smi-lib/tests/rocm_smi_test/test_common.cc b/projects/rocm-smi-lib/tests/rocm_smi_test/test_common.cc index 9d4916d056..eabc6125b5 100755 --- a/projects/rocm-smi-lib/tests/rocm_smi_test/test_common.cc +++ b/projects/rocm-smi-lib/tests/rocm_smi_test/test_common.cc @@ -55,6 +55,27 @@ #include "rocm_smi_test/test_common.h" #include "rocm_smi/rocm_smi.h" +static const std::map + kDevPerfLvlNameMap = { + {RSMI_DEV_PERF_LEVEL_AUTO, "RSMI_DEV_PERF_LEVEL_AUTO"}, + {RSMI_DEV_PERF_LEVEL_LOW, "RSMI_DEV_PERF_LEVEL_LOW"}, + {RSMI_DEV_PERF_LEVEL_HIGH, "RSMI_DEV_PERF_LEVEL_HIGH"}, + {RSMI_DEV_PERF_LEVEL_MANUAL, "RSMI_DEV_PERF_LEVEL_MANUAL"}, + {RSMI_DEV_PERF_LEVEL_STABLE_STD, "RSMI_DEV_PERF_LEVEL_STABLE_STD"}, + {RSMI_DEV_PERF_LEVEL_STABLE_PEAK, "RSMI_DEV_PERF_LEVEL_STABLE_PEAK"}, + {RSMI_DEV_PERF_LEVEL_STABLE_MIN_MCLK, + "RSMI_DEV_PERF_LEVEL_STABLE_MIN_MCLK"}, + {RSMI_DEV_PERF_LEVEL_STABLE_MIN_SCLK, + "RSMI_DEV_PERF_LEVEL_STABLE_MIN_SCLK"}, + {RSMI_DEV_PERF_LEVEL_DETERMINISM, "RSMI_DEV_PERF_LEVEL_DETERMINISM"}, + + {RSMI_DEV_PERF_LEVEL_UNKNOWN, "RSMI_DEV_PERF_LEVEL_UNKNOWN"}, +}; +// If the assert below fails, the map above needs to be updated to match +// rsmi_dev_perf_level_t. +static_assert(RSMI_DEV_PERF_LEVEL_LAST == RSMI_DEV_PERF_LEVEL_DETERMINISM, + "kDevPerfLvlNameMap needs to be updated"); + static const std::map kBlockNameMap = { {RSMI_GPU_BLOCK_UMC, "UMC"}, {RSMI_GPU_BLOCK_SDMA, "SDMA"}, @@ -181,6 +202,9 @@ uint32_t ProcessCmdline(RSMITstGlobals* test, int arg_cnt, char** arg_list) { return 0; } +const char *GetPerfLevelStr(rsmi_dev_perf_level_t lvl) { + return kDevPerfLvlNameMap.at(lvl); +} const char *GetBlockNameStr(rsmi_gpu_block_t id) { return kBlockNameMap.at(id); } diff --git a/projects/rocm-smi-lib/tests/rocm_smi_test/test_common.h b/projects/rocm-smi-lib/tests/rocm_smi_test/test_common.h index 0b585a56ae..e601fb0e8e 100755 --- a/projects/rocm-smi-lib/tests/rocm_smi_test/test_common.h +++ b/projects/rocm-smi-lib/tests/rocm_smi_test/test_common.h @@ -63,6 +63,7 @@ struct RSMITstGlobals { uint32_t ProcessCmdline(RSMITstGlobals* test, int arg_cnt, char** arg_list); void PrintTestHeader(uint32_t dv_ind); +const char *GetPerfLevelStr(rsmi_dev_perf_level_t lvl); const char *GetBlockNameStr(rsmi_gpu_block_t id); const char *GetErrStateNameStr(rsmi_ras_err_state_t st); const char *FreqEnumToStr(rsmi_clk_type rsmi_clk);