Skip to content

Minor re-factor tweaks#9759

Merged
stsoe merged 4 commits intoXilinx:masterfrom
stsoe:hwctx_tweaks
Apr 30, 2026
Merged

Minor re-factor tweaks#9759
stsoe merged 4 commits intoXilinx:masterfrom
stsoe:hwctx_tweaks

Conversation

@stsoe
Copy link
Copy Markdown
Collaborator

@stsoe stsoe commented Apr 28, 2026

Some small re-factor changes to xrt_hw_context.cpp with few more comments.

Some small re-factor changes to xrt_hw_context.cpp with few more
comments.

Signed-off-by: Soren Soe <2106410+stsoe@users.noreply.github.com>
@stsoe stsoe requested a review from rbramand-xilinx April 28, 2026 21:27
Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

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

clang-tidy made some suggestions

Comment thread src/runtime_src/core/common/api/xrt_hw_context.cpp Outdated
Signed-off-by: Soren Soe <2106410+stsoe@users.noreply.github.com>
@github-actions
Copy link
Copy Markdown
Contributor

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


bool m_elf_flow = false;

// update_elf_map() - Insert all kernels in elf
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Minor fix
Mismatch b/w function name and the name in comment

// Add kernels available in ELF to elf map
// This function throws if kernel with same name is already present
create_elf_map(elf);
std::lock_guard lk(m_mutex);
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

init_from_elf() is currently invoked while holding the mutex and performs a driver call to create the HW context. This can potentially extend the lock hold time due to kernel latency.
So I was thinking whether this needs to be under the lock or if it could be done outside the critical section.
Ideally this should be okay as hw ctx creation is not in critical path but just a thought.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

@rbramand-xilinx . Thanks for the comments. My concern was that add_config() could theoretically be called from different threads, and without locking m_hdl creation could be created under race (multiple handles created). I don't think we have choice but to lock as I did?

Signed-off-by: Soren Soe <2106410+stsoe@users.noreply.github.com>
@github-actions
Copy link
Copy Markdown
Contributor

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

Signed-off-by: Soren Soe <2106410+stsoe@users.noreply.github.com>
@github-actions
Copy link
Copy Markdown
Contributor

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

1 similar comment
@github-actions
Copy link
Copy Markdown
Contributor

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

@stsoe stsoe merged commit 00cc075 into Xilinx:master Apr 30, 2026
21 checks passed
@stsoe stsoe deleted the hwctx_tweaks branch April 30, 2026 15:01
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.

2 participants