Skip to content

osc/rdma: Preserve remote base for local window peers - #14204

Open
jeffhammond wants to merge 1 commit into
open-mpi:mainfrom
jeffhammond:issue-14203
Open

osc/rdma: Preserve remote base for local window peers#14204
jeffhammond wants to merge 1 commit into
open-mpi:mainfrom
jeffhammond:issue-14203

Conversation

@jeffhammond

Copy link
Copy Markdown
Contributor

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

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>
@hppritcha

Copy link
Copy Markdown
Member

@devreal please review when you have a chance

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_base while preserving the leader’s registered address in peer->base.
  • Translate local Put/Get copy fast paths from base to local_base.
  • Return local_base from ompi_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_DYNAMIC the peer object type is ompi_osc_rdma_peer_dynamic_t, but this local-base fast path now casts it to ompi_osc_rdma_peer_basic_t and reads base/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);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Open MPI osc/rdma over OFI crashes after MPI_Win_allocate with multiple local ranks

3 participants