Skip to content

Commit

Permalink
VITIS-13337 Add pmode turbo to xrt-smi (#8394)
Browse files Browse the repository at this point in the history
* add turbo mode to performance

Signed-off-by: AShivangi <[email protected]>

* requested changes

---------

Signed-off-by: AShivangi <[email protected]>
  • Loading branch information
AShivangi authored Sep 8, 2024
1 parent e74fe24 commit 59111de
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 44 deletions.
17 changes: 1 addition & 16 deletions src/runtime_src/core/common/info_platform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -153,22 +153,7 @@ add_performance_info(const xrt_core::device* device, ptree_type& pt)
{
try {
const auto mode = xrt_core::device_query<xq::performance_mode>(device);
const std::string pmode = xq::performance_mode::parse_status(mode);
if (boost::iequals(pmode, "DEFAULT")) {
pt.add("power_mode", "Default");
}
else if (boost::iequals(pmode, "LOW")) {
pt.add("power_mode", "Powersaver");
}
else if (boost::iequals(pmode, "MEDIUM")) {
pt.add("power_mode", "Balanced");
}
else if (boost::iequals(pmode, "HIGH")) {
pt.add("power_mode", "Performance");
}
else {
pt.add("power_mode", "N/A");
}
pt.add("power_mode", xq::performance_mode::parse_status(mode));
}
catch (xrt_core::query::no_such_key&) {
pt.add("power_mode", "not supported");
Expand Down
17 changes: 10 additions & 7 deletions src/runtime_src/core/common/query_requests.h
Original file line number Diff line number Diff line change
Expand Up @@ -3696,10 +3696,11 @@ struct performance_mode : request
// Get and set power mode of device
enum class power_type
{
basic, // deafult
low,
medium,
high
basic = 0, // deafult
powersaver,
balanced,
performance,
turbo
};
using result_type = uint32_t; // get value type
using value_type = power_type; // put value type
Expand All @@ -3719,11 +3720,13 @@ struct performance_mode : request
case 0:
return "Default";
case 1:
return "Low";
return "Powersaver";
case 2:
return "Medium";
return "Balanced";
case 3:
return "High";
return "Performance";
case 4:
return "Turbo";
default:
throw xrt_core::system_error(EINVAL, "Invalid performance status: " + std::to_string(status));
}
Expand Down
2 changes: 1 addition & 1 deletion src/runtime_src/core/tools/common/tests/TestGemm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ TestGemm::run(std::shared_ptr<xrt_core::device> dev)
const auto perf_mode = xrt_core::device_query<xrt_core::query::performance_mode>(dev);

//set to performance mode
xrt_core::device_update<xrt_core::query::performance_mode>(dev.get(), xrt_core::query::performance_mode::power_type::high);
xrt_core::device_update<xrt_core::query::performance_mode>(dev.get(), xrt_core::query::performance_mode::power_type::performance);

// wait until clock reaches the targeted frequency
auto const target_h_clock_freq = 1810;
Expand Down
11 changes: 7 additions & 4 deletions src/runtime_src/core/tools/xbutil2/OO_Performance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ OO_Performance::OO_Performance( const std::string &_longName, bool _isHidden )
;

m_optionsHidden.add_options()
("mode", boost::program_options::value<decltype(m_action)>(&m_action)->required(), "Action to perform: default, powersaver, balanced, performance")
("mode", boost::program_options::value<decltype(m_action)>(&m_action)->required(), "Action to perform: default, powersaver, balanced, performance, turbo")
;

m_positionalOptions.
Expand Down Expand Up @@ -88,13 +88,16 @@ OO_Performance::execute(const SubCmdOptions& _options) const
xrt_core::device_update<xrt_core::query::performance_mode>(device.get(), xrt_core::query::performance_mode::power_type::basic); // default
}
else if (boost::iequals(m_action, "POWERSAVER")) {
xrt_core::device_update<xrt_core::query::performance_mode>(device.get(), xrt_core::query::performance_mode::power_type::low);
xrt_core::device_update<xrt_core::query::performance_mode>(device.get(), xrt_core::query::performance_mode::power_type::powersaver);
}
else if (boost::iequals(m_action, "BALANCED")) {
xrt_core::device_update<xrt_core::query::performance_mode>(device.get(), xrt_core::query::performance_mode::power_type::medium);
xrt_core::device_update<xrt_core::query::performance_mode>(device.get(), xrt_core::query::performance_mode::power_type::balanced);
}
else if (boost::iequals(m_action, "PERFORMANCE")) {
xrt_core::device_update<xrt_core::query::performance_mode>(device.get(), xrt_core::query::performance_mode::power_type::high);
xrt_core::device_update<xrt_core::query::performance_mode>(device.get(), xrt_core::query::performance_mode::power_type::performance);
}
else if (boost::iequals(m_action, "TURBO")) {
xrt_core::device_update<xrt_core::query::performance_mode>(device.get(), xrt_core::query::performance_mode::power_type::turbo);
}
else {
throw xrt_core::error(boost::str(boost::format("Invalid pmode value: '%s'\n") % m_action));
Expand Down
17 changes: 1 addition & 16 deletions src/runtime_src/core/tools/xbutil2/SubCmdValidate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -254,22 +254,7 @@ get_ryzen_platform_info(const std::shared_ptr<xrt_core::device>& device,
{
ptTree.put("platform", xrt_core::device_query<xrt_core::query::rom_vbnv>(device));
const auto mode = xrt_core::device_query_default<xrt_core::query::performance_mode>(device, 0);
const std::string pmode = xrt_core::query::performance_mode::parse_status(mode);
if (boost::iequals(pmode, "DEFAULT")) {
ptTree.put("power_mode", "Default");
}
else if (boost::iequals(pmode, "LOW")) {
ptTree.put("power_mode", "Powersaver");
}
else if (boost::iequals(pmode, "MEDIUM")) {
ptTree.put("power_mode", "Balanced");
}
else if (boost::iequals(pmode, "HIGH")) {
ptTree.put("power_mode", "Performance");
}
else {
ptTree.put("power_mode", "N/A");
}
ptTree.put("power_mode", xrt_core::query::performance_mode::parse_status(mode));
}

static void
Expand Down

0 comments on commit 59111de

Please sign in to comment.