Skip to content

vllm.distributed.engram_pool.proxy

RDMA owner proxy: per GPU, a process whose NIC gathers rows of the shards it serves into other GPUs' landing buffers.

It has its own GIL and one thread that moves rows (its command thread sleeps in recv once set up), so it never waits on a CPU-busy model thread. The GPU process sends commands over a socket (fds by SCM_RIGHTS). For a GPU fetching rows (requester) from GPUs holding them (owners):

  1. The requester's GPU writes, per owner and table, chained RDMA WRITEs whose SGEs gather that owner's rows, a packet's worth each, into the requester's landing buffer, with the owner proxy's pointers. Each QP's last chain links a READ of the requester's memory, which returns only once the rows before it have landed, then a fenced inline WRITE of seq into that QP's flag for the table. The GPU then posts a WRITE_WITH_IMM that copies them into this owner's mailbox (rdma.py).
  2. The owner process, asleep on its receive CQ's completion channel, posts the WRs as they are: its NIC gathers the rows, then writes the flags. Rows in host memory of the requester's node are gathered the same way by the requester's own owner process over loopback QPs, so no GPU reads host memory.

It wakes once per request and never spins.

Run as a script: only the standard library and verbs.py are imported.

Classes:

  • Owner –

    Posts requesters' WRs, so its NIC gathers rows of this GPU's shard and

Functions:

  • chain_length –

    WRs per chain when an owner posts num_wrs WRs over qps QPs.

  • mailbox_bytes –

    A requester's WRs, then their SGEs.

Owner

Posts requesters' WRs, so its NIC gathers rows of this GPU's shard and of its node's host shards; rows and flags of this GPU land through it.

Methods:

  • connect –

    Connect peers' gathering QPs and requesters' request QPs; returns

  • fits –

    Whether the next chain fits its send queue; a large one also needs no

  • map_peer –

    Register another process's host shard (a memfd) for this GPU's

  • register –

    Register host memory or HBM; returns its address, lkey and rkey.

  • retire –

    Reap completed chains, returning their send queue room.

  • run –

    Post requests' WRs a whole chain at a time: small requests (decode)

connect(peers, requesters, box_sizes, max_tables)

Connect peers' gathering QPs and requesters' request QPs; returns this GPU's mailboxes (per requester and table) and their rkey and lkey.

fits(request)

Whether the next chain fits its send queue; a large one also needs no other large chain on its QP and fewer than max_large in flight.

map_peer(pid, fd, size)

Register another process's host shard (a memfd) for this GPU's loopback gathers; returns its address here and lkey.

register(kind, size, iova, access, fds)

Register host memory or HBM; returns its address, lkey and rkey.

retire()

Reap completed chains, returning their send queue room.

run()

Post requests' WRs a whole chain at a time: small requests (decode) first, large ones (prefill) in turn and bounded by fits.

_Request

A request's WRs in a mailbox, posted a chain at a time over its QPs, as the requester's GPU chained them.

Attributes:

  • next_wrs (int) –

    The next chain's WRs: each QP's last also links a READ and a flag.

next_wrs property

The next chain's WRs: each QP's last also links a READ and a flag.

_check(wc, count, what)

Raise on the first failed completion in wc.

chain_length(num_wrs, qps)

WRs per chain when an owner posts num_wrs WRs over qps QPs.

mailbox_bytes(max_wrs, max_items)

A requester's WRs, then their SGEs.