osc/rdma: Preserve remote base for local window peers - #14204
Open
jeffhammond wants to merge 1 commit into
Open
Conversation
MPI_Win_allocate maps a node-local shared segment into every process. When CPU and NIC atomics cannot be mixed, local accumulates are sent through the node leader's BTL endpoint and must use the leader's registered virtual address. The shared peer initialization instead stored each origin process's local mapping in the remote base field, causing OFI to access an invalid address in the leader and corrupt process memory. Store the process-local mapping in the existing local_base field while preserving the leader's address in base. Translate local Put and Get copies to local_base, and return local_base from MPI_Win_shared_query. Fixes open-mpi#14203 Signed-off-by: Jeff Hammond <jehammond@nvidia.com>
Member
|
@devreal please review when you have a chance |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes osc/rdma handling of MPI_Win_allocate shared-memory windows when local peers must route RMA/atomics through a node leader (e.g., when CPU and NIC atomics cannot be mixed). It preserves the leader’s registered “remote” base address in base while storing each process’s local mapping in local_base, and then uses local_base for local load/store/copy paths and MPI_Win_shared_query.
Changes:
- Store per-process local mappings in
peer->local_basewhile preserving the leader’s registered address inpeer->base. - Translate local Put/Get copy fast paths from
basetolocal_base. - Return
local_basefromompi_osc_rdma_shared_query()for local peers.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| ompi/mca/osc/rdma/osc_rdma_component.c | Populate local_base alongside base during peer initialization and return local_base from MPI_Win_shared_query logic. |
| ompi/mca/osc/rdma/osc_rdma_comm.c | Adjust local Put/Get copy fast paths to translate from base to local_base for node-local peers. |
Suppressed comments (1)
ompi/mca/osc/rdma/osc_rdma_comm.c:836
- Same issue as the put path: for
MPI_WIN_FLAVOR_DYNAMICthepeerobject type isompi_osc_rdma_peer_dynamic_t, but this local-base fast path now casts it toompi_osc_rdma_peer_basic_tand readsbase/local_base, which is undefined behavior. Guard the translation so it only runs for non-dynamic windows.
/* optimize self/local communication */
if (ompi_osc_rdma_peer_local_base (peer)) {
ompi_osc_rdma_peer_basic_t *ex_peer = (ompi_osc_rdma_peer_basic_t *) peer;
source_address = ex_peer->local_base + source_address - ex_peer->base;
return ompi_osc_rdma_copy_local ((void *) (intptr_t) source_address, source_count, source_datatype,
origin_addr, origin_count, origin_datatype, request);
}
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
788
to
794
| /* optimize communication with peers that we can do direct load and store operations on */ | ||
| if (ompi_osc_rdma_peer_local_base (peer)) { | ||
| ompi_osc_rdma_peer_basic_t *ex_peer = (ompi_osc_rdma_peer_basic_t *) peer; | ||
| target_address = ex_peer->local_base + target_address - ex_peer->base; | ||
| return ompi_osc_rdma_copy_local (origin_addr, origin_count, origin_datatype, (void *) (intptr_t) target_address, | ||
| target_count, target_datatype, request); | ||
| } |
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.
MPI_Win_allocate maps a node-local shared segment into every process. When CPU and NIC atomics cannot be mixed, local accumulates are sent through the node leader's BTL endpoint and must use the leader's registered virtual address. The shared peer initialization instead stored each origin process's local mapping in the remote base field, causing OFI to access an invalid address in the leader and corrupt process memory.
Store the process-local mapping in the existing local_base field while preserving the leader's address in base. Translate local Put and Get copies to local_base, and return local_base from MPI_Win_shared_query.
Fixes #14203