Skip to content

VITIS-15769 Deprecate legacy image management APIs in favor of xrt::…#9651

Merged
chvamshi-xilinx merged 6 commits intoXilinx:masterfrom
karthdmg-xilinx:master
Mar 12, 2026
Merged

VITIS-15769 Deprecate legacy image management APIs in favor of xrt::…#9651
chvamshi-xilinx merged 6 commits intoXilinx:masterfrom
karthdmg-xilinx:master

Conversation

@karthdmg-xilinx
Copy link
Collaborator

Problem solved by the commit
Added warning for this release to deprecate any XRT requirements associated with v++ --package.generateAiePdi=1 that are not supported through xrt::hw_context.

Bug / issue (if any) fixed, which PR introduced the bug, how it was discovered
Added warning for this release to deprecate any XRT requirements associated with v++ --package.generateAiePdi=1 that are not supported through xrt::hw_context.

How problem was solved, alternative solutions (if any) and why they were rejected
Added warning for this release to deprecate any XRT requirements associated with v++ --package.generateAiePdi=1 that are not supported through xrt::hw_context.

Risks (if any) associated the changes in the commit
None

What has been tested and how, request additional testing if necessary
Ran XRT validate test suite to verify warning logged while load xclbins.
Ran application that call create kernels, create ext. BOs, graph creation APIs
Documentation impact (if any)
Attached .xls sheet in jira that has a list of APIs that log deprication warning

…hw_context-based APIs

Signed-off-by: karthik dmg <karthdmg@xcokarthdmg50x.amd.com>
@github-actions
Copy link
Contributor

github-actions bot commented Mar 7, 2026

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

Copy link
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.

Can our internal code and tests be fixed? If not, then I don't think the APIs can be deprecated.

*
* This constructor initializes a buffer object with the specified device, xclbin UUID, and string identifier. This throws an exception if no GMIO/External buffer exists with given name
*/
[[deprecated("deprecated, please use corresponding hw_context function instead")]]
Copy link
Collaborator

Choose a reason for hiding this comment

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

In my experience, you need to provide the API to use and not leave the user guessing.

Comment on lines +85 to +91
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
auto sender_receiver_k1 =
xrt::kernel(device, uuid, "sender_receiver:{sender_receiver_1}");
auto controller_k1 =
xrt::kernel(device, uuid, "pl_controller_kernel:{controller_1}");
#pragma GCC diagnostic pop
Copy link
Collaborator

Choose a reason for hiding this comment

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

What deprecated functions does this hide? Is it not possible to fix test tests?

Comment on lines +101 to +109
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
if (retVal == EOPNOTSUPP) {
krnl_name = "slavebridge";
xclbin_uuid = device.load_xclbin(old_binary_file.string());
} else {
xclbin_uuid = device.load_xclbin(b_file);
}
#pragma GCC diagnostic pop
Copy link
Collaborator

Choose a reason for hiding this comment

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

If this cannot be fixed, then the APIs cannot be deprecated.

Comment on lines +29 to +31
#if defined(__GNUC__)
# pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif
Copy link
Collaborator

Choose a reason for hiding this comment

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

What APIs are used here that are deprecated. If the code cannot be fixed, then APIs cannot be deprecated.

@karthdmg-xilinx karthdmg-xilinx requested a review from stsoe March 9, 2026 03:07
Signed-off-by: Karthik Dmg <karthdmg@xcokarthdmg50x.amd.com>
@github-actions
Copy link
Contributor

github-actions bot commented Mar 9, 2026

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

Signed-off-by: karthik dmg <karthdmg@xcokarthdmg50x.amd.com>
Copy link
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

xrt::hw_context hw_ctx(device, uuid);

std::vector<xrt::kernel> krnls = create_kernel_objects(device, xclbin_uuid, num_kernel);
std::vector<xrt::kernel> krnls = create_kernel_objects(hw_ctx, num_kernel);
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: narrowing conversion from 'unsigned int' to signed type 'int' is implementation-defined [bugprone-narrowing-conversions]

  std::vector<xrt::kernel> krnls = create_kernel_objects(hw_ctx, num_kernel);
                                                                 ^

try {
if (num_kernel_ddr) {
auto throughputs = test_bandwidth_ddr(device, krnls, num_kernel_ddr);
auto throughputs = test_bandwidth_ddr(hw_ctx, krnls, num_kernel_ddr);
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: narrowing conversion from 'unsigned int' to signed type 'int' is implementation-defined [bugprone-narrowing-conversions]

      auto  throughputs = test_bandwidth_ddr(hw_ctx, krnls, num_kernel_ddr);
                                                            ^

}
if (chk_hbm_mem) {
double max_throughput = test_bandwidth_hbm(device, krnls, num_kernel);
double max_throughput = test_bandwidth_hbm(hw_ctx, krnls, num_kernel);
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: narrowing conversion from 'unsigned int' to signed type 'int' is implementation-defined [bugprone-narrowing-conversions]

      double max_throughput = test_bandwidth_hbm(hw_ctx, krnls, num_kernel);
                                                                ^

auto bandwidth_kernel = xrt::kernel(hw_ctx, "bandwidth_kernel");

auto max_throughput_bo = xrt::bo(device, 4096, bandwidth_kernel.group_id(1));
auto max_throughput_bo = xrt::bo(hw_ctx, 4096, bandwidth_kernel.group_id(1));
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: 4096 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers]

  auto max_throughput_bo = xrt::bo(hw_ctx, 4096, bandwidth_kernel.group_id(1));
                                           ^

karthik dmg added 2 commits March 8, 2026 22:56
Signed-off-by: karthik dmg <karthdmg@xcokarthdmg50x.amd.com>
Signed-off-by: karthik dmg <karthdmg@xcokarthdmg50x.amd.com>
Copy link
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.

Thank you. Good to see that we at least can fix our own code to not use the deprecated APIs. One small suggestion about header include.

#include "xrt/xrt_device.h"
#include "xrt/xrt_bo.h"
#include "xrt/xrt_hw_context.h"
#include "xrt/experimental/xrt_xclbin.h"
Copy link
Collaborator

Choose a reason for hiding this comment

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

It doesn't look like this header file requires xrt_xclbin.h, include-what-you-use, probably move to .cpp?

stsoe added a commit to stsoe/XRT that referenced this pull request Mar 9, 2026
This PR address changes to the OpenCL XRT flow.

In hwctx flow, we create hw contexts from xclbins on demand instead of
explicitly loading the xclbins.  The created hwctxs are cached in hal
device and accessors are provided so that xclbin references can be
converted into the hwctx that has loaded the xclbin.

Signed-off-by: Soren Soe <2106410+stsoe@users.noreply.github.com>
Signed-off-by: karthik dmg <karthdmg@xcokarthdmg50x.amd.com>
Copy link
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.

Looks good. Thank you!

@chvamshi-xilinx chvamshi-xilinx merged commit 8349360 into Xilinx:master Mar 12, 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.

3 participants