Fix[io]: xgmi suballocation offset#479
Closed
maning00 wants to merge 4 commits into
Closed
Conversation
XgmiBackendSession transfers computed remote addresses from the IPC-remapped allocation base without accounting for the offset of the registered region within that allocation. hipIpcGetMemHandle/hipIpcOpenMemHandle are keyed to the allocation base, so registering a sub-region (e.g. a per-layer view of one paged KV-cache allocation, as PD-disaggregation KV connectors do) produced a remote pointer pointing at the allocation base instead of the registered region. Concretely this caused BatchRead/BatchReadWrite to either move the wrong bytes (silent corruption, StatusCode::SUCCESS) or, when the mis-computed pointer fell outside the mapped range, to be classified as host memory by hipPointerGetAttributes and trigger a CPU memcpy over a device address inside hipMemcpyPeerAsync -> SIGSEGV. Fix: record the registered pointer's offset within its allocation (MemoryDesc::ipcOffset, computed via hipMemGetAddressRange at registration) and add it back to the remapped base on the importing side. ipcOffset is 0 for whole-allocation registrations, so existing callers are unaffected. Repro (pure mori + torch): register a sub-region at base+OFF on one GPU and XGMI BatchRead it from another -> returns zeros before, correct data after.
Two-process XGMI test that registers a sub-region (offset view) of a larger allocation on one GPU and batch_reads it from another process/GPU, then checks the bytes. Before the offset fix the reader gets the allocation base instead of the registered region, so the data mismatches. Must be cross-process: a single process serves remote memory via the same-process direct pointer, which already carries the offset. Skips when fewer than 2 GPUs are visible.
Contributor
Author
|
@copilot resolve the merge conflicts in this pull request |
Contributor
Merged with latest |
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.
Motivation
Closes #415.
ref: #416