Skip to content

Dedicated Resource Manager, expose QueuePairs #272

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

dstaay-fb
Copy link

Summary:
This Diff refactors RDMA codebase to have RmdaManagerActor to act as a dedicated resource manager for each endpoint; and manages memory mappings and related communicators (QueuePairs). Today this process is relatively simple (we are using CPU, and exposing entire address space to NIC), and assume one QueuePair per route (ie. all traffic from A<->B will go though same QP), but as we transition supporting GPUs it will get more complex, so cleaning up api and abstractions now will help.

In this new model, RdmaBuffer's are extremely light-weight and should only be created by RdmaManagerActors. Its worth highlighting the RmdaBuffer is really designed to move the minimum data to remote caller, under the hood, RmdaBuffers represent a slice of a Memory Region w/ a given rkey/lkey.

Moving buffers requires leveraging RmdaQueuePairs GET/PUT API; again to obtain an QP it must be requested from an RmdaManagerActor.

core API for RdmaManagerActor:
request_buffer(addr: u32, size: usize) -> RmdaBuffer. // This acts a light-weight memory handle that can be serialized. In practice this a slice of IBV MR maintained by RdmaManagerActor

 request_queue_pair(remote: ActorRef<RdmaManagerActor> -> RmdaQueuePair // light-weight wrapper around QP.

Example API usage:

// setup envs, send remote_buffer -> local env.

// establish RMDA connection with Peer if required.
let qp = local_rmda_manager.request_queue_pair(client, remote_rmda_manager).await()?

// get/put api example, returns immediately.
qp.get(local_buffer, remote_buffer)?;

// ... poll for completion

Differential Revision: D76370567

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Meta Open Source bot. label Jun 15, 2025
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D76370567

Summary:
Pull Request resolved: pytorch-labs#272

This diff refactors the RDMA codebase to introduce the RdmaManagerActor as a dedicated resource manager for each endpoint, responsible for managing memory mappings and related communicators (QueuePairs).

Currently, the process is simple: we use CPU memory and expose the entire address space to the NIC, with a single QueuePair per route (i.e., all traffic between endpoints A and B goes through the same QP). As we move toward supporting GPUs, the requirements will become more complex. This refactor cleans up the API and abstractions in preparation for that transition.

In the new model, RdmaBuffers are extremely lightweight and should only be created by RdmaManagerActors. It's important to note that an RdmaBuffer is designed to carry only the minimum data necessary to the remote caller; under the hood, an RdmaBuffer represents a slice of a registered memory region with associated rkey and lkey.

Moving data between endpoints requires using the RdmaQueuePair's GET/PUT API. To obtain a QueuePair, it must be requested from an RdmaManagerActor.

core API for RdmaManagerActor:
     request_buffer(addr: u32, size: usize) -> RmdaBuffer.  // This acts a light-weight memory handle that can be serialized.  In practice this a slice of IBV MR maintained by RdmaManagerActor

     request_queue_pair(remote: ActorRef<RdmaManagerActor> -> RmdaQueuePair // light-weight wrapper around QP.

Example API usage:

  // setup envs, send remote_buffer -> local env.

  // establish RMDA connection with Peer if required.
  let qp = local_rmda_manager.request_queue_pair(client, remote_rmda_manager).await()?

  // get/put api example, returns immediately.
  qp.get(local_buffer, remote_buffer)?;

  // ... poll for completion

Differential Revision: D76370567
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D76370567

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Meta Open Source bot. fb-exported
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants