Skip to content

AIESW-28045 : Add internal hw ctx function to get QoS#9684

Open
rbramand-xilinx wants to merge 2 commits intoXilinx:masterfrom
rbramand-xilinx:userspace
Open

AIESW-28045 : Add internal hw ctx function to get QoS#9684
rbramand-xilinx wants to merge 2 commits intoXilinx:masterfrom
rbramand-xilinx:userspace

Conversation

@rbramand-xilinx
Copy link
Collaborator

Problem solved by the commit

Added internal hw ctx function to get QoS. This function will be used by XDP to check QoS of a ctx and apply changes.

Bug / issue (if any) fixed, which PR introduced the bug, how it was discovered

How problem was solved, alternative solutions (if any) and why they were rejected

Returning the QoS map from hw ctx using hw_context_int function

Risks (if any) associated the changes in the commit

Low

What has been tested and how, request additional testing if necessary

Documentation impact (if any)

NA

Signed-off-by: rahul <rbramand@amd.com>
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds an internal helper to retrieve a hardware context’s QoS/config parameter map for internal consumers (notably XDP) to inspect the context configuration.

Changes:

  • Added hw_context_impl::get_qos_map() to return the context’s QoS/config map.
  • Exposed xrt_core::hw_context_int::get_qos_map(const xrt::hw_context&) in the internal header and implemented it in xrt_hw_context.cpp.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
src/runtime_src/core/common/api/xrt_hw_context.cpp Implements hw_context_impl::get_qos_map() and the xrt_core::hw_context_int::get_qos_map() wrapper.
src/runtime_src/core/common/api/hw_context_int.h Declares the new internal exported get_qos_map() API for XDP/internal use.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

// where key is a string and value is a uint32_t
xrt::hw_context::qos_type
get_qos_map() const
{
Copy link

Copilot AI Mar 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

get_qos_map() returns m_cfg_param, but hw_context_impl::update_qos() only forwards to m_hdl->update_qos() and never updates m_cfg_param. That means callers of xrt_core::hw_context_int::get_qos_map() may observe stale QoS/config values after update_qos() is used. Consider making m_cfg_param the source of truth by updating it in update_qos() (and only calling into m_hdl if it exists), and protect reads/writes with a mutex similar to get_elf_map() to avoid data races once updates are supported.

Suggested change
{
{
std::lock_guard lk(m_mutex);

Copilot uses AI. Check for mistakes.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The lock make sense if there is also a lock on modification of the map.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added lock when updating and getting QoS map, please review

@github-actions
Copy link
Contributor

clang-tidy review says "All clean, LGTM! 👍"

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@github-actions
Copy link
Contributor

clang-tidy review says "All clean, LGTM! 👍"

Signed-off-by: rahul <rbramand@amd.com>
@github-actions
Copy link
Contributor

clang-tidy review says "All clean, LGTM! 👍"

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

std::lock_guard lk(m_mutex);
if (m_hdl) {
m_hdl->update_qos(qos);
// Store updated QoS if updation call to shim succeeded
Copy link

Copilot AI Mar 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment says "updation" (non-idiomatic/incorrect here). Consider changing to "update" (e.g., "if update call to shim succeeded").

Suggested change
// Store updated QoS if updation call to shim succeeded
// Store updated QoS if update call to shim succeeded

Copilot uses AI. Check for mistakes.
Comment on lines +328 to +333
std::lock_guard lk(m_mutex);
if (m_hdl) {
m_hdl->update_qos(qos);
// Store updated QoS if updation call to shim succeeded
m_cfg_param = qos;
}
Copy link

Copilot AI Mar 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

m_mutex is now used to protect both m_elf_map and m_cfg_param (via update_qos() / get_qos_map()), but the member comment still says it's only for the elf map. Consider updating the comment (or renaming the mutex) so future changes don't accidentally bypass the intended synchronization.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants