Skip to content

AIESW-28179 : Introduce new cfg_type param for hw ctx creation#9709

Merged
chvamshi-xilinx merged 3 commits intoXilinx:masterfrom
rbramand-xilinx:userspace
Apr 6, 2026
Merged

AIESW-28179 : Introduce new cfg_type param for hw ctx creation#9709
chvamshi-xilinx merged 3 commits intoXilinx:masterfrom
rbramand-xilinx:userspace

Conversation

@rbramand-xilinx
Copy link
Copy Markdown
Collaborator

Problem solved by the commit

Introduces new cfg_type (std::map <std::string, std::string>) that can be passed to hw ctx which can be used as replacement for older cfg_param_type (std::map<std::string, uint32_t>). This new cfg_type can be passed as arg to constructor of xrt::hw_context, this way we have flexibility to pass configurations to xrt::hw_context like name etc
Also added changes to pass name while creating xrt::module object

The detailed discussion for same is captured in ticket - https://jira.xilinx.com/browse/AIESW-28179

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

This is EOU/Enhancement feature

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

We dont want to change shim interface at present so using std::variant style for storing both older and newer maps. This avoids unnecessary boiler plate or duplicate code. Also if new map is passed to create hw ctx we convert it to older map before sending it to shim.

Risks (if any) associated the changes in the commit

Low to moderate

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

Verified build flow
TODO : Need to verify Telluride start column test that uses QoS to specify start_col value.

Documentation impact (if any)

Added doxygen comments where ever needed

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_module.cpp Outdated
Comment thread src/runtime_src/core/common/api/xrt_module.cpp Outdated
Copy link
Copy Markdown
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

This PR extends the XRT hardware-context creation APIs to accept a new string-valued configuration map (cfg_type) alongside the legacy numeric QoS/config map (cfg_param_type), enabling keys like a human-readable context name. It also adds optional naming support when constructing xrt::module from an ELF.

Changes:

  • Add xrt::hw_context::cfg_type (map of string→string) and new hw_context constructor overloads accepting it.
  • Internally store either legacy or experimental config via std::variant, converting cfg_type to legacy numeric config when calling shim create_hw_context.
  • Add xrt::module constructor overload that accepts a module name and an internal accessor for it.

Reviewed changes

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

Show a summary per file
File Description
src/runtime_src/core/tools/common/tests/TestGemm.cpp Disambiguates xrt::hw_context constructor call by explicitly passing cfg_param_type{}.
src/runtime_src/core/include/xrt/xrt_hw_context.h Introduces cfg_type and new public constructor overloads using it.
src/runtime_src/core/common/api/xrt_hw_context.cpp Implements cfg_type handling via std::variant storage, conversion to legacy config, and adds get_cfg_map.
src/runtime_src/core/common/api/hw_context_int.h Adds internal get_cfg_map() accessor and updates get_qos_map() contract to throw when not applicable.
src/runtime_src/core/include/xrt/experimental/xrt_module.h Adds xrt::module(elf, name) constructor overload.
src/runtime_src/core/common/api/xrt_module.cpp Stores optional module name in module_impl and adds internal module_int::get_name().
src/runtime_src/core/common/api/module_int.h Declares internal get_name(const xrt::module&) helper.

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

Comment thread src/runtime_src/core/common/api/xrt_hw_context.cpp
Comment thread src/runtime_src/core/common/api/xrt_hw_context.cpp
Comment thread src/runtime_src/core/common/api/xrt_module.cpp
Comment thread src/runtime_src/core/tools/common/tests/TestGemm.cpp Outdated
Signed-off-by: rahul <rbramand@amd.com>
Signed-off-by: rahul <rbramand@amd.com>
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 3, 2026

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

Copy link
Copy Markdown
Collaborator

@stsoe stsoe left a comment

Choose a reason for hiding this comment

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

.

Let's not check for valid handle at public API level, it is an error if the module is empty.   Not sure if we even need the check internally, but if we do, then shouldn't get_name() should also error out?
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 3, 2026

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

@chvamshi-xilinx chvamshi-xilinx merged commit 625e52d into Xilinx:master Apr 6, 2026
21 checks passed
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