AIESW-26391:Fix eff_net hip testcase failure.#9723
AIESW-26391:Fix eff_net hip testcase failure.#9723chvamshi-xilinx merged 1 commit intoXilinx:masterfrom
Conversation
b81386f to
47fce96
Compare
|
clang-tidy review says "All clean, LGTM! 👍" |
| } | ||
|
|
||
| if (hip_mem_info.second) | ||
| r.set_arg(static_cast<int>(arg->index), *bufptr); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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>
47fce96 to
2458415
Compare
|
clang-tidy review says "All clean, LGTM! 👍" |
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