Skip to content

AIESW-26391:Fix eff_net hip testcase failure.#9723

Merged
chvamshi-xilinx merged 1 commit intoXilinx:masterfrom
svup-xilinx:AIESW-26391
Apr 15, 2026
Merged

AIESW-26391:Fix eff_net hip testcase failure.#9723
chvamshi-xilinx merged 1 commit intoXilinx:masterfrom
svup-xilinx:AIESW-26391

Conversation

@svup-xilinx
Copy link
Copy Markdown
Collaborator

@svup-xilinx svup-xilinx commented Apr 13, 2026

Problem solved by the commit

HIP kernels using pointer arithmetic for sub-buffer addresses (e.g., address + offset) fail because extracting the buffer object returns only the base address, losing the offset calculation. All computed addresses collapse to the same base value, causing kernels to access wrong memory.

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

AIESW-26391
HIP global arguments using pointer arithmetic (base + offset) incorrectly receive only the base address, causing kernels to access wrong memory locations.

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

Use get_hip_mem_from_addr() to extract both the base buffer object and offset. When offset is non-zero (pointer arithmetic detected), pass the raw pointer to preserve the exact computed address. When offset is zero (base buffer), pass the buffer object with proper binding for memory management.

Risks (if any) associated the changes in the commit

Low

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

tested with test case added in
https://gitenterprise.xilinx.com/XRT/Telluride/pull/743

Documentation impact (if any)

NA

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/hip/core/event.cpp Outdated
Comment thread src/runtime_src/hip/core/event.cpp Outdated
@github-actions
Copy link
Copy Markdown
Contributor

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

Comment thread src/runtime_src/hip/core/event.cpp Outdated
}

if (hip_mem_info.second)
r.set_arg(static_cast<int>(arg->index), *bufptr);
Copy link
Copy Markdown
Collaborator

@stsoe stsoe Apr 14, 2026

Choose a reason for hiding this comment

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

This will not work because *bufptr is treated as a scalar and not bound to the command buffer as I indicated earlier. I understand the offset, but you need to go the xrt::bo route with a sub-buffer. Best I can tell, you don't need to worry about managing the scope of the sub-buffer, all that really matters is that set_arg is called with a bo that is a sub-buffer of the parent bo, whose lifetime you are managing.

So, at line 270, carve out an xrt::bo{hip_men->get_xrt_bo(), size, offset} where you should be able to compute size and offset from the hip memory? Then pass the bo to set_arg.

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.

updated code to use sub buffer when there is a offset.

Support computed addresses (base + offset) for global memory arguments
to enable pointer arithmetic use cases like sub-buffer access.

Detect offset in global arguments and pass carved out sub buffer,
otherwise pass buffer object directly.

Previously, extracting the buffer object would return only the base
address, breaking computed addresses like: wts_base + (offset[i] * 4)

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! 👍"

@chvamshi-xilinx chvamshi-xilinx merged commit 58adc06 into Xilinx:master Apr 15, 2026
36 of 37 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