vllm.distributed.engram_pool.verbs
¶
ctypes bindings to libibverbs: just enough for RC QPs and RDMA WRITEs.
Structs and constants mirror rdma-core's verbs.h and mlx5dv.h under their C
names (LP64 ABI), as pynccl_wrapper does for NCCL. ibv_post_send,
ibv_post_recv, ibv_poll_cq and ibv_req_notify_cq are inline in verbs.h,
so they are called through the context's ops table. Only the standard library
is imported: the RDMA proxy process loads this file without vllm or torch.
Classes:
-
Device–One opened RDMA device and protection domain on port 1.
-
ibv_context–Up to the ops called here; the skipped ops are
_compat_*stubs or -
ibv_qp–Up to the fields read here.
-
ibv_send_wr–With
wr.rdmaof thewrunion. RDMA WRITEs and READs leave the -
mlx5dv_obj–Its
qpmember'sinandout; the other members stay null. -
mlx5dv_qp_queue–The
sqandrqmembers of struct mlx5dv_qp.
Functions:
-
active_devices–Names of mlx5 RDMA devices (the WQEs we build are mlx5's) whose port 1
-
local_cpus–CPUs on the device's NUMA node.
Device
¶
One opened RDMA device and protection domain on port 1.
Methods:
-
connect–Move a QP through INIT, RTR and RTS towards
remote_qpn. -
cq_event–Sleep until the next event of
channeland consume it. -
create_cq–A CQ, and if
wakeablea completion channel (else 0) whose events -
create_qp–An RC QP; it receives only WRITE_WITH_IMM notices. Returns it and
-
mlx5_queue–An mlx5 QP's send queue, doorbell record and BlueFlame register, for
-
notify_cq–Raise one event on the CQ's channel at its next completion.
-
reg_host–Register memory with
accessNIC_READ, PEER_WRITE or PEER_ORDERED;
Attributes:
mtu_bytes
property
¶
The path MTU (enum ibv_mtu) in bytes.
connect(qp, remote_qpn, remote)
¶
Move a QP through INIT, RTR and RTS towards remote_qpn.
cq_event(channel)
¶
Sleep until the next event of channel and consume it.
create_cq(depth, wakeable=False)
¶
A CQ, and if wakeable a completion channel (else 0) whose events
(cq_event) wake a sleeper.
create_qp(send_cq, recv_cq, max_send_wr, max_send_sge=1, max_inline=0, max_recv_wr=1)
¶
An RC QP; it receives only WRITE_WITH_IMM notices. Returns it and its number.
mlx5_queue(qp)
staticmethod
¶
An mlx5 QP's send queue, doorbell record and BlueFlame register, for posting without libibverbs.
notify_cq(cq)
¶
Raise one event on the CQ's channel at its next completion.
reg_host(address, num_bytes, access)
¶
Register memory with access NIC_READ, PEER_WRITE or PEER_ORDERED;
returns its lkey and rkey.
ibv_context
¶
ibv_send_wr
¶
Bases: Structure
With wr.rdma of the wr union. RDMA WRITEs and READs leave the
trailing bind_mw/tso union (spare) unused.
_pick_gid_index(device)
¶
RoCE v2 with an IPv4-mapped address if present, else index 0 (IB).
active_devices()
¶
Names of mlx5 RDMA devices (the WQEs we build are mlx5's) whose port 1 is active. By driver, since udev may rename devices.
local_cpus(device)
¶
CPUs on the device's NUMA node.