Skip to content

AIESW-32262: Fix xrt::bo::get_memory_group() for cross-device imported BOs#9926

Open
svup-xilinx wants to merge 1 commit into
Xilinx:masterfrom
svup-xilinx:AIESW-32262
Open

AIESW-32262: Fix xrt::bo::get_memory_group() for cross-device imported BOs#9926
svup-xilinx wants to merge 1 commit into
Xilinx:masterfrom
svup-xilinx:AIESW-32262

Conversation

@svup-xilinx

Copy link
Copy Markdown
Collaborator

Problem solved by the commit

get_memory_group() returned the wrong bank index for a BO imported
from another device — it used the exporting device's stale bank flag
instead of a value valid on the importing device.

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

AIESW-32262

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

bo_impl::get_bo_properties() now recomputes grpid for imported BOs
(gated by is_imported()) from the BO's physical address, which is
valid on the importing device, using the already-existing but unused
address_to_memidx() helper against the importing device's own
GROUP_TOPOLOGY.

Risks (if any) associated the changes in the commit

Low

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

Tested on telluride board with provided test in the ticket AIESW-32262

Documentation impact (if any)

NA

… BOs

xrt::bo::get_memory_group() returned a stale memory bank index for a BO
imported from another device. bo_impl::get_bo_properties() took grpid
directly from the shim-reported xcl_bo_flags.bank, which for an imported
BO reflects the exporting device's bank assignment and is meaningless on
the importing device.

The BO's physical address (prop.paddr), however, is valid in the
importing device's address space even for imported BOs. Recompute grpid
from that address against the importing device's own GROUP_TOPOLOGY,
using the existing address_to_memidx() helper. The
recompute is gated on is_imported() so allocation-path behavior for
normal BOs is unchanged, and falls back to the original flags.bank value
if the device has no core device, no loaded topology section, or the
address doesn't map to any bank.

Tested with a cross-device dma-buf export/import repro on VEK385
(NPU device 0 -> PL device 1); get_memory_group() now returns the
correct bank index on the importing device.

Signed-off-by: Srikanth Vuppala <120363307+svup-xilinx@users.noreply.github.com>
@github-actions

Copy link
Copy Markdown
Contributor

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

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