[Feat] use host-pinned memory with dual CPU/device addresses for transport buffers#1024
Open
yumingyue624 wants to merge 1 commit into
Open
[Feat] use host-pinned memory with dual CPU/device addresses for transport buffers#1024yumingyue624 wants to merge 1 commit into
yumingyue624 wants to merge 1 commit into
Conversation
… transport buffers ## Purpose Switch ASU send/flag buffers from plain host memory to host-pinned memory so that CPU code packs SQEs through the local mapping while HCOMM/RDMA uses the device-visible mapping of the same allocation. ## Modifications 1. BufferManager: allocate host-pinned memory via aclrtMallocHost + aclrtHostRegisterV2, obtain device pointer via aclrtHostGetDevicePointer. ScatterGatherEntry gains device_addr. RegisterMemory uses device address for host-pinned regions. 2. AsuTransportImpl: send/flag buffers use HOST_PINNED instead of HOST. 3. asu_submit_flow: pass device_addr to SendIoBatch. 4. sqe_request: use flagBuffer.device_addr for response_buffer_addr. 5. Tests: added host-pinned dual-address and device_addr assertions. ## Test - buffer_manager_test: HostPinnedRegistersDeviceAddress. - asu_submit_flow_test: BuildSubBatchSendBuffersUsesHostPinnedDeviceAddresses. - sqe_request_test: packed response address matches device_addr.
Infinite666
reviewed
Jun 12, 2026
| } | ||
|
|
||
| if (subBatchContext.flagBuffer.addr == 0 || subBatchContext.flagBuffer.length == 0) { | ||
| if (subBatchContext.sendSge.device_addr == 0 || subBatchContext.flagBuffer.addr == 0 || |
Contributor
There was a problem hiding this comment.
What about sendSge.addr and sendSge.length?
Infinite666
reviewed
Jun 12, 2026
| TransProvider::MemType providerMemType{TransProvider::MemType::MEM_HOST}; | ||
| }; | ||
|
|
||
| class BufferRegionCreator : public Trans::AscendBuffer { |
Contributor
There was a problem hiding this comment.
Naming problem, the parent class is a Buffer and the child class is a Creator?
Infinite666
reviewed
Jun 12, 2026
| } | ||
| BufferRegionCreator regionCreator; | ||
| BufferRegion region; | ||
| auto allocStatus = regionCreator.MakeRegion(memory_type_, total, region); |
Contributor
There was a problem hiding this comment.
Violating the inherit spirit, the child class has its own public function and will be called directly.
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.
Purpose
Switch ASU send/flag buffers from plain host memory to host-pinned
memory so that CPU code packs SQEs through the local mapping while
HCOMM/RDMA uses the device-visible mapping of the same allocation.
Modifications
aclrtHostRegisterV2, obtain device pointer via
aclrtHostGetDevicePointer. ScatterGatherEntry gains device_addr.
RegisterMemory uses device address for host-pinned regions.
Test