Rename NPS -> memory partition + compute partition node fix
* Updates:
- rocm_smi_lib + CLI:
Rename all "NPS mode" -> "memory partition"
related files/functions/API/CLI to align with correct
technical naming
- rocm_smi_main: fixed identifying primary card's unique id
utilize rsmi_dev_unique_id_get to map which
KFD nodes belong to it
- rsmi_dev_*_partition*: now have better logging output
- compute partition tests:
Added 20 sec delay for workaround until GPU
busy is confirmed as the issue
- CPPLint fixes/formatting
- [Example] Moved all endl to "\n" for efficiency
- [Example] Added Edge & Junction temperature examples
- [Example] Added rsmi_minmax_bandwidth_get() example - WIP
Change-Id: Ida6db6fda7e0ac9d696a34cb15b4746e69d58d51
Signed-off-by: Charis Poag <Charis.Poag@amd.com>
[ROCm/rocm_smi_lib commit: b251bb0c9f]
This commit is contained in:
+50
-25
@@ -45,8 +45,12 @@
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <iostream>
|
||||
#include <chrono> // NOLINT [build]
|
||||
#include <map>
|
||||
#include <string>
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
#include "rocm_smi/rocm_smi.h"
|
||||
@@ -134,6 +138,26 @@ void TestComputePartitionReadWrite::Run(void) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Confirm system supports compute partition, before executing wait
|
||||
ret = rsmi_dev_compute_partition_get(0, orig_char_computePartition, 255);
|
||||
if (ret == RSMI_STATUS_SUCCESS) {
|
||||
// Adding a delay - since changing partitions depends on gpus not
|
||||
// being in an active state, we'll wait a few seconds before starting
|
||||
// full testing
|
||||
auto start = std::chrono::high_resolution_clock::now();
|
||||
int waitTime = 20;
|
||||
std::cout << "** Waiting for "
|
||||
<< std::dec << waitTime
|
||||
<< " seconds, for any GPU"
|
||||
<< " activity to clear up. **" << std::endl;
|
||||
sleep(waitTime);
|
||||
auto stop = std::chrono::high_resolution_clock::now();
|
||||
auto duration =
|
||||
std::chrono::duration_cast<std::chrono::microseconds>(stop - start);
|
||||
std::cout << "** Waiting took " << duration.count() / 1000000
|
||||
<< " seconds **" << std::endl;
|
||||
}
|
||||
|
||||
for (uint32_t dv_ind = 0; dv_ind < num_monitor_devs(); ++dv_ind) {
|
||||
if (dv_ind != 0) {
|
||||
IF_VERB(STANDARD) {
|
||||
@@ -142,7 +166,7 @@ void TestComputePartitionReadWrite::Run(void) {
|
||||
}
|
||||
PrintDeviceHeader(dv_ind);
|
||||
|
||||
//Standard checks to see if API is supported, before running full tests
|
||||
// Standard checks to see if API is supported, before running full tests
|
||||
ret = rsmi_dev_compute_partition_get(dv_ind, orig_char_computePartition,
|
||||
255);
|
||||
if (ret == RSMI_STATUS_NOT_SUPPORTED) {
|
||||
@@ -169,12 +193,12 @@ void TestComputePartitionReadWrite::Run(void) {
|
||||
ASSERT_EQ(RSMI_STATUS_SUCCESS, ret);
|
||||
|
||||
// Verify api support checking functionality is working
|
||||
uint32_t length = 2;
|
||||
char smallBuffer[length];
|
||||
err = rsmi_dev_compute_partition_get(dv_ind, smallBuffer, length);
|
||||
uint32_t kLength = 2;
|
||||
char smallBuffer[kLength];
|
||||
err = rsmi_dev_compute_partition_get(dv_ind, smallBuffer, kLength);
|
||||
size_t size = sizeof(smallBuffer)/sizeof(*smallBuffer);
|
||||
ASSERT_EQ(err, RSMI_STATUS_INSUFFICIENT_SIZE);
|
||||
ASSERT_EQ((size_t)length, size);
|
||||
ASSERT_EQ((size_t)kLength, size);
|
||||
IF_VERB(STANDARD) {
|
||||
if (err == RSMI_STATUS_INSUFFICIENT_SIZE) {
|
||||
std::cout << "\t**"
|
||||
@@ -207,9 +231,9 @@ void TestComputePartitionReadWrite::Run(void) {
|
||||
}
|
||||
|
||||
// Verify api support checking functionality is working
|
||||
rsmi_compute_partition_type new_computePartition
|
||||
= rsmi_compute_partition_type::RSMI_COMPUTE_PARTITION_INVALID;
|
||||
err = rsmi_dev_compute_partition_set(dv_ind, new_computePartition);
|
||||
rsmi_compute_partition_type_t newPartition
|
||||
= rsmi_compute_partition_type_t::RSMI_COMPUTE_PARTITION_INVALID;
|
||||
err = rsmi_dev_compute_partition_set(dv_ind, newPartition);
|
||||
ASSERT_TRUE((err == RSMI_STATUS_INVALID_ARGS) ||
|
||||
(err == RSMI_STATUS_NOT_SUPPORTED) ||
|
||||
(err == RSMI_STATUS_PERMISSION));
|
||||
@@ -246,24 +270,24 @@ void TestComputePartitionReadWrite::Run(void) {
|
||||
* //!< work together with shared memory
|
||||
*/
|
||||
|
||||
for (int partition = RSMI_COMPUTE_PARTITION_CPX;
|
||||
partition <= RSMI_COMPUTE_PARTITION_QPX;
|
||||
for (int partition =
|
||||
rsmi_compute_partition_type_t::RSMI_COMPUTE_PARTITION_CPX;
|
||||
partition <= rsmi_compute_partition_type_t::RSMI_COMPUTE_PARTITION_QPX;
|
||||
partition++) {
|
||||
new_computePartition
|
||||
= static_cast<rsmi_compute_partition_type>(partition);
|
||||
newPartition = static_cast<rsmi_compute_partition_type_t>(partition);
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << std::endl;
|
||||
std::cout << "\t**"
|
||||
<< "======== TEST RSMI_COMPUTE_PARTITION_"
|
||||
<< computePartitionString(new_computePartition)
|
||||
<< computePartitionString(newPartition)
|
||||
<< " ===============" << std::endl;
|
||||
}
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**"
|
||||
<< "Attempting to set compute partition to: "
|
||||
<< computePartitionString(new_computePartition) << std::endl;
|
||||
<< computePartitionString(newPartition) << std::endl;
|
||||
}
|
||||
ret = rsmi_dev_compute_partition_set(dv_ind, new_computePartition);
|
||||
ret = rsmi_dev_compute_partition_set(dv_ind, newPartition);
|
||||
bool isSettingUnavailable = false;
|
||||
ASSERT_TRUE((ret == RSMI_STATUS_SUCCESS) ||
|
||||
(ret == RSMI_STATUS_SETTING_UNAVAILABLE));
|
||||
@@ -282,7 +306,7 @@ void TestComputePartitionReadWrite::Run(void) {
|
||||
}
|
||||
if (isSettingUnavailable) {
|
||||
ASSERT_EQ(RSMI_STATUS_SETTING_UNAVAILABLE, ret);
|
||||
ASSERT_STRNE(computePartitionString(new_computePartition).c_str(),
|
||||
ASSERT_STRNE(computePartitionString(newPartition).c_str(),
|
||||
current_char_computePartition);
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**"
|
||||
@@ -290,19 +314,19 @@ void TestComputePartitionReadWrite::Run(void) {
|
||||
<< "RSMI_STATUS_SETTING_UNAVAILABLE,\n\t current compute "
|
||||
<< "partition (" << current_char_computePartition
|
||||
<< ") did not update to ("
|
||||
<< computePartitionString(new_computePartition) << ")"
|
||||
<< computePartitionString(newPartition) << ")"
|
||||
<< std::endl;
|
||||
}
|
||||
} else {
|
||||
ASSERT_EQ(RSMI_STATUS_SUCCESS, ret);
|
||||
ASSERT_STREQ(computePartitionString(new_computePartition).c_str(),
|
||||
ASSERT_STREQ(computePartitionString(newPartition).c_str(),
|
||||
current_char_computePartition);
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**"
|
||||
<< "Confirmed current compute partition ("
|
||||
<< current_char_computePartition << ") matches"
|
||||
<< "\n\t requested compute partition ("
|
||||
<< computePartitionString(new_computePartition) << ")"
|
||||
<< computePartitionString(newPartition) << ")"
|
||||
<< std::endl;
|
||||
}
|
||||
}
|
||||
@@ -355,26 +379,27 @@ void TestComputePartitionReadWrite::Run(void) {
|
||||
<< "=========== TEST RETURN TO ORIGINAL COMPUTE PARTITION "
|
||||
<< "SETTING ========" << std::endl;
|
||||
}
|
||||
new_computePartition
|
||||
= mapStringToRSMIComputePartitionTypes.at(orig_char_computePartition);
|
||||
ret = rsmi_dev_compute_partition_set(dv_ind, new_computePartition);
|
||||
newPartition
|
||||
= mapStringToRSMIComputePartitionTypes.at(
|
||||
std::string(orig_char_computePartition));
|
||||
ret = rsmi_dev_compute_partition_set(dv_ind, newPartition);
|
||||
CHK_ERR_ASRT(ret)
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**" << "Returning compute partition to: "
|
||||
<< computePartitionString(new_computePartition) << std::endl;
|
||||
<< computePartitionString(newPartition) << std::endl;
|
||||
}
|
||||
ret = rsmi_dev_compute_partition_get(dv_ind, current_char_computePartition,
|
||||
255);
|
||||
CHK_ERR_ASRT(ret)
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**" << "Attempted to set compute partition: "
|
||||
<< computePartitionString(new_computePartition) << std::endl
|
||||
<< computePartitionString(newPartition) << std::endl
|
||||
<< "\t**" << "Current compute partition: "
|
||||
<< current_char_computePartition
|
||||
<< std::endl;
|
||||
}
|
||||
ASSERT_EQ(RSMI_STATUS_SUCCESS, ret);
|
||||
ASSERT_STREQ(computePartitionString(new_computePartition).c_str(),
|
||||
ASSERT_STREQ(computePartitionString(newPartition).c_str(),
|
||||
current_char_computePartition);
|
||||
}
|
||||
}
|
||||
|
||||
+87
-80
@@ -47,45 +47,47 @@
|
||||
#include <stddef.h>
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <map>
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
#include "rocm_smi/rocm_smi.h"
|
||||
#include "rocm_smi_test/functional/npsmode_read_write.h"
|
||||
#include "rocm_smi_test/functional/memorypartition_read_write.h"
|
||||
#include "rocm_smi_test/test_common.h"
|
||||
|
||||
TestNPSModeReadWrite::TestNPSModeReadWrite() : TestBase() {
|
||||
set_title("RSMI NPS Mode Read Test");
|
||||
set_description("The NPS Mode tests verifies that the memory "
|
||||
"parition setting can be read and updated properly.");
|
||||
TestMemoryPartitionReadWrite::TestMemoryPartitionReadWrite() : TestBase() {
|
||||
set_title("RSMI Memory Partition Read Test");
|
||||
set_description("The memory partition tests verifies that the memory "
|
||||
"partition settings can be read and updated properly.");
|
||||
}
|
||||
|
||||
TestNPSModeReadWrite::~TestNPSModeReadWrite(void) {
|
||||
TestMemoryPartitionReadWrite::~TestMemoryPartitionReadWrite(void) {
|
||||
}
|
||||
|
||||
void TestNPSModeReadWrite::SetUp(void) {
|
||||
void TestMemoryPartitionReadWrite::SetUp(void) {
|
||||
TestBase::SetUp();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void TestNPSModeReadWrite::DisplayTestInfo(void) {
|
||||
void TestMemoryPartitionReadWrite::DisplayTestInfo(void) {
|
||||
TestBase::DisplayTestInfo();
|
||||
}
|
||||
|
||||
void TestNPSModeReadWrite::DisplayResults(void) const {
|
||||
void TestMemoryPartitionReadWrite::DisplayResults(void) const {
|
||||
TestBase::DisplayResults();
|
||||
return;
|
||||
}
|
||||
|
||||
void TestNPSModeReadWrite::Close() {
|
||||
void TestMemoryPartitionReadWrite::Close() {
|
||||
// This will close handles opened within rsmitst utility calls and call
|
||||
// rsmi_shut_down(), so it should be done after other hsa cleanup
|
||||
TestBase::Close();
|
||||
}
|
||||
|
||||
static const std::string
|
||||
npsModeString(rsmi_nps_mode_type npsModeType) {
|
||||
switch (npsModeType) {
|
||||
memoryPartitionString(rsmi_memory_partition_type memoryPartitionType) {
|
||||
switch (memoryPartitionType) {
|
||||
case RSMI_MEMORY_PARTITION_NPS1:
|
||||
return "NPS1";
|
||||
case RSMI_MEMORY_PARTITION_NPS2:
|
||||
@@ -99,20 +101,20 @@ npsModeString(rsmi_nps_mode_type npsModeType) {
|
||||
}
|
||||
}
|
||||
|
||||
static const std::map<std::string, rsmi_nps_mode_type_t>
|
||||
mapStringToRSMINpsModeTypes {
|
||||
static const std::map<std::string, rsmi_memory_partition_type_t>
|
||||
mapStringToRSMIMemoryPartitionTypes {
|
||||
{"NPS1", RSMI_MEMORY_PARTITION_NPS1},
|
||||
{"NPS2", RSMI_MEMORY_PARTITION_NPS2},
|
||||
{"NPS4", RSMI_MEMORY_PARTITION_NPS4},
|
||||
{"NPS8", RSMI_MEMORY_PARTITION_NPS8}
|
||||
};
|
||||
|
||||
void TestNPSModeReadWrite::Run(void) {
|
||||
void TestMemoryPartitionReadWrite::Run(void) {
|
||||
rsmi_status_t ret, err;
|
||||
char orig_nps_mode[255];
|
||||
char current_nps_mode[255];
|
||||
orig_nps_mode[0] = '\0';
|
||||
current_nps_mode[0] = '\0';
|
||||
char orig_memory_partition[255];
|
||||
char current_memory_partition[255];
|
||||
orig_memory_partition[0] = '\0';
|
||||
current_memory_partition[0] = '\0';
|
||||
|
||||
TestBase::Run();
|
||||
if (setup_failed_) {
|
||||
@@ -128,8 +130,8 @@ void TestNPSModeReadWrite::Run(void) {
|
||||
}
|
||||
PrintDeviceHeader(dv_ind);
|
||||
|
||||
//Standard checks to see if API is supported, before running full tests
|
||||
ret = rsmi_dev_nps_mode_get(dv_ind, orig_nps_mode, 255);
|
||||
// Standard checks to see if API is supported, before running full tests
|
||||
ret = rsmi_dev_memory_partition_get(dv_ind, orig_memory_partition, 255);
|
||||
if (ret == RSMI_STATUS_NOT_SUPPORTED) {
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**" << ": "
|
||||
@@ -140,36 +142,35 @@ void TestNPSModeReadWrite::Run(void) {
|
||||
CHK_ERR_ASRT(ret)
|
||||
}
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << std::endl << "\t**"
|
||||
<< "NPS Mode: "
|
||||
<< orig_nps_mode << std::endl;
|
||||
std::cout << std::endl << "\t**Current Memory Partition: "
|
||||
<< orig_memory_partition << std::endl;
|
||||
}
|
||||
|
||||
if ((orig_nps_mode == nullptr) ||
|
||||
(orig_nps_mode[0] == '\0')) {
|
||||
std::cout << "***System nps mode value is not defined or received unexpected data. "
|
||||
"Skip nps mode test." << std::endl;
|
||||
if ((orig_memory_partition == nullptr) ||
|
||||
(orig_memory_partition[0] == '\0')) {
|
||||
std::cout << "***System memory partition value is not defined or received"
|
||||
" unexpected data. Skip memory partition test." << std::endl;
|
||||
continue;
|
||||
}
|
||||
ASSERT_TRUE(ret == RSMI_STATUS_SUCCESS);
|
||||
|
||||
// Verify api support checking functionality is working
|
||||
uint32_t length = 2;
|
||||
char smallBuffer[length];
|
||||
err = rsmi_dev_nps_mode_get(dv_ind, smallBuffer, length);
|
||||
uint32_t kLen = 2;
|
||||
char smallBuffer[kLen];
|
||||
err = rsmi_dev_memory_partition_get(dv_ind, smallBuffer, kLen);
|
||||
size_t size = sizeof(smallBuffer)/sizeof(*smallBuffer);
|
||||
ASSERT_EQ(err, RSMI_STATUS_INSUFFICIENT_SIZE);
|
||||
ASSERT_EQ((size_t)length, size);
|
||||
ASSERT_EQ((size_t)kLen, size);
|
||||
if (err == RSMI_STATUS_INSUFFICIENT_SIZE) {
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**"
|
||||
<< "Confirmed RSMI_STATUS_INSUFFICIENT_SIZE was returned "
|
||||
<< "and size matches length requested." << std::endl;
|
||||
<< "and size matches kLen requested." << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
// Verify api support checking functionality is working
|
||||
err = rsmi_dev_nps_mode_get(dv_ind, nullptr, 255);
|
||||
err = rsmi_dev_memory_partition_get(dv_ind, nullptr, 255);
|
||||
ASSERT_EQ(err, RSMI_STATUS_INVALID_ARGS);
|
||||
|
||||
if (err == RSMI_STATUS_INVALID_ARGS) {
|
||||
@@ -181,7 +182,7 @@ void TestNPSModeReadWrite::Run(void) {
|
||||
}
|
||||
|
||||
// Verify api support checking functionality is working
|
||||
err = rsmi_dev_nps_mode_get(dv_ind, orig_nps_mode, 0);
|
||||
err = rsmi_dev_memory_partition_get(dv_ind, orig_memory_partition, 0);
|
||||
ASSERT_TRUE((err == RSMI_STATUS_INVALID_ARGS) ||
|
||||
(err == RSMI_STATUS_NOT_SUPPORTED));
|
||||
if (err == RSMI_STATUS_INVALID_ARGS) {
|
||||
@@ -193,12 +194,12 @@ void TestNPSModeReadWrite::Run(void) {
|
||||
}
|
||||
|
||||
/******************************/
|
||||
/* rsmi_dev_nps_mode_set(...) */
|
||||
/* rsmi_dev_memory_partition_set(...) */
|
||||
/******************************/
|
||||
// Verify api support checking functionality is working
|
||||
rsmi_nps_mode_type new_nps_mode;
|
||||
err = rsmi_dev_nps_mode_set(dv_ind, new_nps_mode);
|
||||
// Note: new_nps_mode is not set
|
||||
rsmi_memory_partition_type new_memory_partition;
|
||||
err = rsmi_dev_memory_partition_set(dv_ind, new_memory_partition);
|
||||
// Note: new_memory_partition is not set
|
||||
ASSERT_TRUE((err == RSMI_STATUS_INVALID_ARGS) ||
|
||||
(err == RSMI_STATUS_NOT_SUPPORTED));
|
||||
if (err == RSMI_STATUS_INVALID_ARGS) {
|
||||
@@ -210,9 +211,9 @@ void TestNPSModeReadWrite::Run(void) {
|
||||
} else if (err == RSMI_STATUS_NOT_SUPPORTED) {
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**" << ": "
|
||||
<< "rsmi_dev_nps_mode_set not supported on this device"
|
||||
<< "\n\t (if rsmi_dev_nps_mode_get works, then likely "
|
||||
<< "need to set in bios)"
|
||||
<< "rsmi_dev_memory_partition_set not supported on this "
|
||||
<< "device\n\t (if rsmi_dev_memory_partition_get works, "
|
||||
<< "then likely need to set in bios)"
|
||||
<< std::endl;
|
||||
}
|
||||
continue;
|
||||
@@ -222,8 +223,9 @@ void TestNPSModeReadWrite::Run(void) {
|
||||
ASSERT_FALSE(err == RSMI_STATUS_PERMISSION);
|
||||
|
||||
// Verify api support checking functionality is working
|
||||
new_nps_mode = rsmi_nps_mode_type::RSMI_MEMORY_PARTITION_UNKNOWN;
|
||||
err = rsmi_dev_nps_mode_set(dv_ind, new_nps_mode);
|
||||
new_memory_partition =
|
||||
rsmi_memory_partition_type::RSMI_MEMORY_PARTITION_UNKNOWN;
|
||||
err = rsmi_dev_memory_partition_set(dv_ind, new_memory_partition);
|
||||
ASSERT_TRUE((err == RSMI_STATUS_INVALID_ARGS) ||
|
||||
(err == RSMI_STATUS_NOT_SUPPORTED) ||
|
||||
(err == RSMI_STATUS_PERMISSION));
|
||||
@@ -242,101 +244,106 @@ void TestNPSModeReadWrite::Run(void) {
|
||||
}
|
||||
|
||||
// Re-run original get, so we can reset to later
|
||||
ret = rsmi_dev_nps_mode_get(dv_ind, orig_nps_mode, 255);
|
||||
ret = rsmi_dev_memory_partition_get(dv_ind, orig_memory_partition, 255);
|
||||
ASSERT_EQ(RSMI_STATUS_SUCCESS, ret);
|
||||
|
||||
for (int partition = RSMI_MEMORY_PARTITION_NPS1;
|
||||
partition <= RSMI_MEMORY_PARTITION_NPS8;
|
||||
partition++) {
|
||||
new_nps_mode = static_cast<rsmi_nps_mode_type>(partition);
|
||||
new_memory_partition = static_cast<rsmi_memory_partition_type>(partition);
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << std::endl;
|
||||
std::cout << "\t**"
|
||||
<< "======== TEST RSMI_MEMORY_PARTITION_"
|
||||
<< npsModeString(new_nps_mode)
|
||||
<< memoryPartitionString(new_memory_partition)
|
||||
<< " ===============" << std::endl;
|
||||
}
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**"
|
||||
<< "Attempting to set nps mode to: "
|
||||
<< npsModeString(new_nps_mode) << std::endl;
|
||||
<< "Attempting to set memory partition to: "
|
||||
<< memoryPartitionString(new_memory_partition) << std::endl;
|
||||
}
|
||||
ret = rsmi_dev_nps_mode_set(dv_ind, new_nps_mode);
|
||||
ret = rsmi_dev_memory_partition_set(dv_ind, new_memory_partition);
|
||||
CHK_ERR_ASRT(ret)
|
||||
|
||||
ret = rsmi_dev_nps_mode_get(dv_ind, current_nps_mode, 255);
|
||||
ret = rsmi_dev_memory_partition_get(dv_ind, current_memory_partition,
|
||||
255);
|
||||
CHK_ERR_ASRT(ret)
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**"
|
||||
<< "Current nps mode: " << current_nps_mode << std::endl;
|
||||
<< "Current memory partition: " << current_memory_partition
|
||||
<< std::endl;
|
||||
}
|
||||
ASSERT_EQ(RSMI_STATUS_SUCCESS, ret);
|
||||
ASSERT_STREQ(npsModeString(new_nps_mode).c_str(), current_nps_mode);
|
||||
ASSERT_STREQ(memoryPartitionString(new_memory_partition).c_str(),
|
||||
current_memory_partition);
|
||||
}
|
||||
|
||||
/* TEST RETURN TO BOOT NPS MODE SETTING */
|
||||
/* TEST RETURN TO BOOT MEMORY PARTITION SETTING */
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << std::endl;
|
||||
std::cout << "\t**"
|
||||
<< "=========== TEST RETURN TO BOOT NPS MODE SETTING "
|
||||
<< "========" << std::endl;
|
||||
<< "=========== TEST RETURN TO BOOT MEMORY PARTITION "
|
||||
<< "SETTING ========" << std::endl;
|
||||
}
|
||||
std::string oldMode = current_nps_mode;
|
||||
std::string oldMode = current_memory_partition;
|
||||
bool wasResetSuccess = false;
|
||||
ret = rsmi_dev_nps_mode_reset(dv_ind);
|
||||
ret = rsmi_dev_memory_partition_reset(dv_ind);
|
||||
ASSERT_TRUE((ret == RSMI_STATUS_SUCCESS) ||
|
||||
(ret == RSMI_STATUS_NOT_SUPPORTED));
|
||||
if (ret == RSMI_STATUS_SUCCESS) {
|
||||
wasResetSuccess = true;
|
||||
}
|
||||
ret = rsmi_dev_nps_mode_get(dv_ind, current_nps_mode, 255);
|
||||
ret = rsmi_dev_memory_partition_get(dv_ind, current_memory_partition, 255);
|
||||
CHK_ERR_ASRT(ret)
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**"
|
||||
<< "Current nps mode: " << current_nps_mode << std::endl;
|
||||
<< "Current memory partition: " << current_memory_partition
|
||||
<< std::endl;
|
||||
}
|
||||
if (wasResetSuccess) {
|
||||
ASSERT_STRNE(oldMode.c_str(), current_nps_mode);
|
||||
ASSERT_STRNE(oldMode.c_str(), current_memory_partition);
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**"
|
||||
<< "Confirmed prior nps mode (" << oldMode << ") is not "
|
||||
<< "equal to current nps mode ("
|
||||
<< current_nps_mode << ")" << std::endl;
|
||||
<< "Confirmed prior memory partition (" << oldMode << ") is "
|
||||
<< "not equal to current memory partition ("
|
||||
<< current_memory_partition << ")" << std::endl;
|
||||
}
|
||||
} else {
|
||||
ASSERT_STREQ(oldMode.c_str(), current_nps_mode);
|
||||
ASSERT_STREQ(oldMode.c_str(), current_memory_partition);
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**"
|
||||
<< "Confirmed prior nps mode (" << oldMode << ") is equal"
|
||||
<< " to current nps mode ("
|
||||
<< current_nps_mode << ")" << std::endl;
|
||||
<< "Confirmed prior memory partition (" << oldMode << ") is "
|
||||
<< "equal to current memory partition ("
|
||||
<< current_memory_partition << ")" << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
/* TEST RETURN TO ORIGINAL NPS MODE SETTING */
|
||||
/* TEST RETURN TO ORIGINAL MEMORY PARTITION SETTING */
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << std::endl;
|
||||
std::cout << "\t**"
|
||||
<< "=========== TEST RETURN TO ORIGINAL NPS MODE "
|
||||
<< "=========== TEST RETURN TO ORIGINAL MEMORY PARTITION "
|
||||
<< "SETTING ========" << std::endl;
|
||||
}
|
||||
new_nps_mode
|
||||
= mapStringToRSMINpsModeTypes.at(orig_nps_mode);
|
||||
new_memory_partition
|
||||
= mapStringToRSMIMemoryPartitionTypes.at(orig_memory_partition);
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**" << "Returning nps mode to: "
|
||||
<< npsModeString(new_nps_mode) << std::endl;
|
||||
std::cout << "\t**" << "Returning memory partition to: "
|
||||
<< memoryPartitionString(new_memory_partition) << std::endl;
|
||||
}
|
||||
ret = rsmi_dev_nps_mode_set(dv_ind, new_nps_mode);
|
||||
ret = rsmi_dev_memory_partition_set(dv_ind, new_memory_partition);
|
||||
CHK_ERR_ASRT(ret)
|
||||
ret = rsmi_dev_nps_mode_get(dv_ind, current_nps_mode, 255);
|
||||
ret = rsmi_dev_memory_partition_get(dv_ind, current_memory_partition, 255);
|
||||
CHK_ERR_ASRT(ret)
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**" << "Attempted to set nps mode: "
|
||||
<< npsModeString(new_nps_mode) << std::endl
|
||||
<< "\t**" << "Current nps mode: " << current_nps_mode
|
||||
std::cout << "\t**" << "Attempted to set memory partition: "
|
||||
<< memoryPartitionString(new_memory_partition) << std::endl
|
||||
<< "\t**" << "Current memory partition: "
|
||||
<< current_memory_partition
|
||||
<< std::endl;
|
||||
}
|
||||
ASSERT_EQ(RSMI_STATUS_SUCCESS, ret);
|
||||
ASSERT_STREQ(npsModeString(new_nps_mode).c_str(), current_nps_mode);
|
||||
ASSERT_STREQ(memoryPartitionString(new_memory_partition).c_str(), current_memory_partition);
|
||||
}
|
||||
}
|
||||
+7
-7
@@ -42,17 +42,17 @@
|
||||
* DEALINGS WITH THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
#ifndef TESTS_ROCM_SMI_TEST_FUNCTIONAL_NPSMODE_READ_WRITE_H_
|
||||
#define TESTS_ROCM_SMI_TEST_FUNCTIONAL_NPSMODE_READ_WRITE_H_
|
||||
#ifndef TESTS_ROCM_SMI_TEST_FUNCTIONAL_MEMORYPARTITION_READ_WRITE_H_
|
||||
#define TESTS_ROCM_SMI_TEST_FUNCTIONAL_MEMORYPARTITION_READ_WRITE_H_
|
||||
|
||||
#include "rocm_smi_test/test_base.h"
|
||||
|
||||
class TestNPSModeReadWrite : public TestBase {
|
||||
class TestMemoryPartitionReadWrite : public TestBase {
|
||||
public:
|
||||
TestNPSModeReadWrite();
|
||||
TestMemoryPartitionReadWrite();
|
||||
|
||||
// @Brief: Destructor for test case of TestNPSModeReadWrite
|
||||
virtual ~TestNPSModeReadWrite();
|
||||
// @Brief: Destructor for test case of TestMemoryPartitionReadWrite
|
||||
virtual ~TestMemoryPartitionReadWrite();
|
||||
|
||||
// @Brief: Setup the environment for measurement
|
||||
virtual void SetUp();
|
||||
@@ -70,4 +70,4 @@ class TestNPSModeReadWrite : public TestBase {
|
||||
virtual void DisplayTestInfo(void);
|
||||
};
|
||||
|
||||
#endif // TESTS_ROCM_SMI_TEST_FUNCTIONAL_NPSMODE_READ_WRITE_H_
|
||||
#endif // TESTS_ROCM_SMI_TEST_FUNCTIONAL_MEMORYPARTITION_READ_WRITE_H_
|
||||
@@ -87,7 +87,7 @@
|
||||
#include "rocm_smi_test/functional/gpu_metrics_read.h"
|
||||
#include "rocm_smi_test/functional/metrics_counter_read.h"
|
||||
#include "rocm_smi_test/functional/perf_determinism.h"
|
||||
#include "functional/npsmode_read_write.h"
|
||||
#include "functional/memorypartition_read_write.h"
|
||||
|
||||
static RSMITstGlobals *sRSMIGlvalues = nullptr;
|
||||
|
||||
@@ -271,8 +271,8 @@ TEST(rsmitstReadWrite, TestComputePartitionReadWrite) {
|
||||
TestComputePartitionReadWrite tst;
|
||||
RunGenericTest(&tst);
|
||||
}
|
||||
TEST(rsmitstReadWrite, TestNPSModeReadWrite) {
|
||||
TestNPSModeReadWrite tst;
|
||||
TEST(rsmitstReadWrite, TestMemoryPartitionReadWrite) {
|
||||
TestMemoryPartitionReadWrite tst;
|
||||
RunGenericTest(&tst);
|
||||
}
|
||||
TEST(rsmitstReadWrite, TestEvtNotifReadWrite) {
|
||||
|
||||
Reference in New Issue
Block a user