-
Notifications
You must be signed in to change notification settings - Fork 534
AIESW-29257: Fix xrt-smi device ID reporting #9716
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 4 commits
498ab2f
8ecf10b
fc560b2
707c17e
89e0497
02ce47b
6fbfd77
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -86,6 +86,40 @@ XBUtilities::Timer::format_time(std::chrono::duration<double> duration) | |
| return formatted_time; | ||
| } | ||
|
|
||
| static std::string | ||
| get_device_id(const std::shared_ptr<xrt_core::device>& device, | ||
| xrt_core::query::device_class::type device_class) | ||
| { | ||
| // Ryzen/NPU: no ROM or xclbin UUID — derive from PCIe BDF. | ||
| // Byte layout matches hip_device_get_uuid(). | ||
| if (device_class == xrt_core::query::device_class::type::ryzen) { | ||
| auto bdf = xrt_core::device_query<xrt_core::query::pcie_bdf>(device); | ||
| xuid_t uid = {}; | ||
| auto* ptr = reinterpret_cast<uint8_t*>(&uid); | ||
| std::apply([&ptr](const auto&... fields) { | ||
| ((std::memcpy(ptr, &fields, sizeof(fields)), ptr += sizeof(fields)), ...); | ||
| }, bdf); | ||
| return xrt::uuid(uid).to_string(); | ||
| } | ||
|
|
||
| // Alveo 2RP: UUID from loaded xclbin logic region | ||
| try { | ||
| auto logic_uuids = xrt_core::device_query<xrt_core::query::logic_uuids>(device); | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we need the UUID logic capture from XCLBIN ?
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The alveo code is existing code and now with newer code there is exclusive if/else for Ryzen vs Alveo |
||
| if (!logic_uuids.empty()) | ||
| return xrt_core::query::interface_uuids::to_uuid_upper_string(logic_uuids[0]); | ||
| } | ||
| catch(...) {} | ||
|
|
||
| // Alveo 1RP: timestamp-based ROM id | ||
| try { | ||
| return xrt_core::query::rom_time_since_epoch::to_string( | ||
| xrt_core::device_query<xrt_core::query::rom_time_since_epoch>(device)); | ||
| } | ||
| catch(...) {} | ||
|
|
||
| return ""; | ||
| } | ||
|
|
||
| boost::property_tree::ptree | ||
| XBUtilities::get_available_devices(bool inUserDomain) | ||
| { | ||
|
|
@@ -120,17 +154,10 @@ XBUtilities::get_available_devices(bool inUserDomain) | |
| break; | ||
| } | ||
|
|
||
| try { //1RP | ||
| pt_dev.put("id", xrt_core::query::rom_time_since_epoch::to_string(xrt_core::device_query<xrt_core::query::rom_time_since_epoch>(device))); | ||
| } | ||
| catch(...) { | ||
| // The id wasn't added | ||
| } | ||
|
|
||
| try { //2RP | ||
| auto logic_uuids = xrt_core::device_query<xrt_core::query::logic_uuids>(device); | ||
| if (!logic_uuids.empty()) | ||
| pt_dev.put("id", xrt_core::query::interface_uuids::to_uuid_upper_string(logic_uuids[0])); | ||
| try { | ||
| auto id = get_device_id(device, device_class); | ||
| if (!id.empty()) | ||
| pt_dev.put("id", id); | ||
| } | ||
| catch(...) { | ||
| // The id wasn't added | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we reuse the same function as used by HIP? See
hip_device_get_uuid(hipDevice_t device)defined in hip_device.cpp. Can that code be moved to some common place from where both HIP and xrt-smi can call it?Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @sonals, Implemented Centralized BDF-to-UUID logic in pcie_bdf::to_uuid() [src/runtime_src/core/common/query_requests.h]. Please review