Conversation
The function only ever tried a host mapping, so it answered UNAVAILABLE for any device-local buffer -- the comment beside it said as much, that a real GPU device "would use iree_hal_buffer_export". Anything needing a device address was therefore unreachable through the C API: a peer copy has no source to name, hsa_amd_agents_allow_access has no allocation to grant, and a caller that wants hsa_amd_memory_async_copy cannot describe either end, so transfers fall back to the HAL's blit kernels. It now exports the buffer through the owning device's allocator and returns the device allocation pointer, falling back to the existing mapping paths so host-visible and local-task buffers behave exactly as before.
Geramy
force-pushed
the
fix/buffer-get-device-ptr-gpu
branch
from
August 21, 2026 20:22
4f6f547 to
d728bd0
Compare
Author
|
@jimw567 Please take these PRs as suggestions made during creation of an HRX backed engine, if you would like them in hrx let me know what would need to follow to get it merged please. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
hrx_buffer_get_device_ptronly ever tried a host mapping, so it returnedHRX_STATUS_UNAVAILABLEfor any device-local buffer. The comment beside it already said what was missing:The consequence is that nothing needing a device address is reachable through the C API:
hsa_amd_agents_allow_accesshas no allocation to grant, so device pools stayDISALLOWED_BY_DEFAULT;hsa_amd_memory_async_copycannot describe either end, and falls back to the HAL's blit kernels.On an 8x gfx1201 box that last one is the difference between a copy engine and the shader cores: HIP reaches ~48 GB/s H2D and ~56 GB/s D2H on the same link where a blit-kernel copy measures about 8.
This exports the buffer through the owning device's allocator with
IREE_HAL_EXTERNAL_BUFFER_TYPE_DEVICE_ALLOCATIONand returns the device pointer. The existing paths are untouched and still tried first, so an already-mapped buffer and a local-task device behave exactly as before, and a failed export falls through to the mapping attempt rather than becoming an error.Tested on gfx1201 (Radeon AI PRO R9700, ROCm 7.13): device-local buffers now answer with an address,
hsa_amd_memory_async_copyaccepts both ends and completes, and the previous behaviour is unchanged for host-visible buffers.