[SWDEV-488276/SWDEV-497613] Update memory partition set functionality
Changes:
- [CLI] Added warning screen to AMD SMI users
setting memory partition
- [CLI] Added a progress bar time-bar for CLI sets display to 40 seconds
- [API] Updated to wait until the driver reloads with SYSFS files active
- [CLI] Now users can set or reset without providing:
amd-smi set -g all <set arguments>
or amd-smi reset -g all <set arguments>
now can directly call -> sudo amd-smi set <set arguments>
or sudo amd-smi reset <set arguments>
- [SWDEV-475712][CLI/API] Fixed target_graphics_version field
not properly displaying for older MI or Navi ASICs.
- [All APIs] Added a catch for the driver to report invalid arguments
now these APIs will show AMDSMI_STATUS_INVAL
(ex. changing to NPS8 if the device does not support it)
- [Install] Modified paths for Python install commands to support
multi-ROCm installs
Change-Id: Id11f25d68a82d23c6b2d77ccb30b51e860dd0ca7
Signed-off-by: Charis Poag <Charis.Poag@amd.com>
Dieser Commit ist enthalten in:
@@ -1455,16 +1455,57 @@ amdsmi_get_gpu_accelerator_partition_profile(amdsmi_processor_handle processor_h
|
||||
amdsmi_accelerator_partition_profile_t *profile,
|
||||
uint32_t *partition_id) {
|
||||
AMDSMI_CHECK_INIT();
|
||||
// TODO: also fill out profile later
|
||||
// default to 0xffffffff if not supported
|
||||
*partition_id = std::numeric_limits<uint32_t>::max();
|
||||
auto tmp_partition_id = uint32_t(0);
|
||||
if (profile == nullptr) {
|
||||
return AMDSMI_STATUS_INVAL;
|
||||
}
|
||||
std::ostringstream ss;
|
||||
// TODO(amdsmi_team): also fill out profile later
|
||||
amdsmi_nps_caps_t flags;
|
||||
flags.amdsmi_nps_flags_t.nps1_cap = 0;
|
||||
flags.amdsmi_nps_flags_t.nps2_cap = 0;
|
||||
flags.amdsmi_nps_flags_t.nps4_cap = 0;
|
||||
flags.amdsmi_nps_flags_t.nps8_cap = 0;
|
||||
profile->memory_caps = flags;
|
||||
|
||||
amdsmi_status_t status = rsmi_wrapper(rsmi_dev_partition_id_get, processor_handle, &tmp_partition_id);
|
||||
if (status == amdsmi_status_t::AMDSMI_STATUS_SUCCESS){
|
||||
// TODO(amdsmi_team): add resources here ^
|
||||
auto tmp_partition_id = uint32_t(0);
|
||||
auto tmp_xcd_count = uint16_t(0);
|
||||
amdsmi_status_t status = AMDSMI_STATUS_NOT_SUPPORTED;
|
||||
|
||||
status = rsmi_wrapper(rsmi_dev_partition_id_get, processor_handle, &tmp_partition_id);
|
||||
if (status == AMDSMI_STATUS_SUCCESS) {
|
||||
*partition_id = tmp_partition_id;
|
||||
}
|
||||
|
||||
// Add memory partition capabilities here
|
||||
constexpr uint32_t kLenCapsSize = 30;
|
||||
char memory_caps[kLenCapsSize];
|
||||
status = rsmi_wrapper(rsmi_dev_memory_partition_capabilities_get, processor_handle,
|
||||
memory_caps, kLenCapsSize);
|
||||
ss << __PRETTY_FUNCTION__
|
||||
<< " | rsmi_dev_memory_partition_capabilities_get Returning: "
|
||||
<< smi_amdgpu_get_status_string(status, false)
|
||||
<< " | Type: memory_partition_capabilities"
|
||||
<< " | Data: " << memory_caps;
|
||||
LOG_DEBUG(ss);
|
||||
std::string memory_caps_str = "N/A";
|
||||
if (status == AMDSMI_STATUS_SUCCESS) {
|
||||
memory_caps_str = std::string(memory_caps);
|
||||
if (memory_caps_str.find("NPS1") != std::string::npos) {
|
||||
flags.amdsmi_nps_flags_t.nps1_cap = 1;
|
||||
}
|
||||
if (memory_caps_str.find("NPS2") != std::string::npos) {
|
||||
flags.amdsmi_nps_flags_t.nps2_cap = 1;
|
||||
}
|
||||
if (memory_caps_str.find("NPS4") != std::string::npos) {
|
||||
flags.amdsmi_nps_flags_t.nps4_cap = 1;
|
||||
}
|
||||
if (memory_caps_str.find("NPS8") != std::string::npos) {
|
||||
flags.amdsmi_nps_flags_t.nps8_cap = 1;
|
||||
}
|
||||
}
|
||||
profile->memory_caps = flags;
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
@@ -624,3 +624,35 @@ amdsmi_status_t smi_amdgpu_is_gpu_power_management_enabled(amd::smi::AMDSmiGPUDe
|
||||
return AMDSMI_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
std::string smi_amdgpu_split_string(std::string str, char delim) {
|
||||
std::vector<std::string> tokens;
|
||||
std::stringstream ss(str);
|
||||
std::string token;
|
||||
|
||||
if (str.empty()) {
|
||||
return "";
|
||||
}
|
||||
|
||||
while (std::getline(ss, token, delim)) {
|
||||
tokens.push_back(token);
|
||||
return token; // return 1st match
|
||||
}
|
||||
}
|
||||
|
||||
// wrapper to return string expression of a rsmi_status_t return
|
||||
// rsmi_status_t ret - return value of RSMI API function
|
||||
// bool fullStatus - defaults to true, set to false to chop off description
|
||||
// Returns:
|
||||
// string - if fullStatus == true, returns full decription of return value
|
||||
// ex. 'RSMI_STATUS_SUCCESS: The function has been executed successfully.'
|
||||
// string - if fullStatus == false, returns a minimalized return value
|
||||
// ex. 'RSMI_STATUS_SUCCESS'
|
||||
std::string smi_amdgpu_get_status_string(amdsmi_status_t ret, bool fullStatus = true) {
|
||||
const char *err_str;
|
||||
amdsmi_status_code_to_string(ret, &err_str);
|
||||
if (!fullStatus) {
|
||||
return smi_amdgpu_split_string(std::string(err_str), ':');
|
||||
}
|
||||
return std::string(err_str);
|
||||
}
|
||||
|
||||
|
||||
In neuem Issue referenzieren
Einen Benutzer sperren