#152: Add pure-ibverbs MPRQ raw-Ethernet backend (engine: ibverbs) - #148
Conversation
|
| Filename | Overview |
|---|---|
| src/engines/ibverbs/daqiri_ibverbs_engine.cpp | New 3200-line MPRQ engine: DevX CQ/RQ/TIR, mlx5dv_dr steering, TX WQE-direct path, GPU reorder, send scheduling. BurstParams free contract correctly separated (stride release vs. metadata pool return). TX two-phase handoff (fill-thread → worker → pool) is sound. |
| include/daqiri/types.h | Adds EngineType::IBVERBS and a stream-aware config_engine_from_string overload; updates engine_type_supports_stream_type to accept IBVERBS for RAW streams. Changes are minimal, correct, and properly guarded by DAQIRI_ENGINE_IBVERBS. |
| src/CMakeLists.txt | ibverbs now maps to both 'rdma' and 'ibverbs' internal engines. The rdma-first ordering (for socket→rdma link), socket always-built, and DAQIRI_ENGINE_=1 compile-definition invariants are all preserved. |
| src/engines/ibverbs/daqiri_ibverbs_engine.h | IbverbsEngine declaration with complete Engine vtable override coverage. Several per-queue ibv_wq/ibv_qp/dr_domain fields remain (verbs legacy path) but are harmlessly initialised to nullptr and guarded in shutdown. |
| docs/tutorials/configuration-walkthrough.md | Line 20 still describes ibverbs as enabling only roce:// endpoints, omitting the new MPRQ raw-Ethernet path; needs one-line update per doc-sync rule. |
Reviews (6): Last reviewed commit: "Add pure-ibverbs MPRQ raw engine (engine..." | Re-trigger Greptile
| struct ibv_mr* gmr = ibv_reg_dmabuf_mr(pd, offset, mr.ttl_size_, va, dmabuf_fd, access); | ||
| if (gmr == nullptr) { | ||
| DAQIRI_LOG_CRITICAL("ibv_reg_dmabuf_mr failed for MR {} ({} bytes): {}", mr_name, | ||
| mr.ttl_size_, strerror(errno)); | ||
| close(dmabuf_fd); | ||
| return Status::NULL_PTR; | ||
| } | ||
| *out_base = static_cast<uint8_t*>(base); | ||
| *out_lkey = gmr->lkey; |
There was a problem hiding this comment.
File descriptor leak on successful GPU MR registration.
ibv_reg_dmabuf_mr makes a kernel-side dma_buf_get() call that increases the underlying dma_buf's reference count, so the userspace fd is no longer needed after a successful call. The error path already closes it; the success path does not, leaking one fd per GPU MR per queue for the lifetime of the process.
| struct ibv_mr* gmr = ibv_reg_dmabuf_mr(pd, offset, mr.ttl_size_, va, dmabuf_fd, access); | |
| if (gmr == nullptr) { | |
| DAQIRI_LOG_CRITICAL("ibv_reg_dmabuf_mr failed for MR {} ({} bytes): {}", mr_name, | |
| mr.ttl_size_, strerror(errno)); | |
| close(dmabuf_fd); | |
| return Status::NULL_PTR; | |
| } | |
| *out_base = static_cast<uint8_t*>(base); | |
| *out_lkey = gmr->lkey; | |
| struct ibv_mr* gmr = ibv_reg_dmabuf_mr(pd, offset, mr.ttl_size_, va, dmabuf_fd, access); | |
| close(dmabuf_fd); | |
| if (gmr == nullptr) { | |
| DAQIRI_LOG_CRITICAL("ibv_reg_dmabuf_mr failed for MR {} ({} bytes): {}", mr_name, | |
| mr.ttl_size_, strerror(errno)); | |
| return Status::NULL_PTR; | |
| } | |
| *out_base = static_cast<uint8_t*>(base); | |
| *out_lkey = gmr->lkey; |
| - ibverbs backend: requires a Mellanox/mlx5 NIC (ConnectX-6/7, BlueField). | ||
| Multi-queue 5-tuple flow steering is not yet implemented (single-queue flow | ||
| matching works via a catch-all rule); HDS is a logical split (headers remain | ||
| in the same, possibly GPU, buffer). RX (MPRQ), TX, GPUDirect, and GPU | ||
| reorder/quantize are supported. |
There was a problem hiding this comment.
The ibverbs limitations bullet was written for the initial milestone commit and not updated as later commits in this PR added multi-queue 5-tuple flow steering (
install_port_flows, mlx5dv_dr, per-packet MARK) and physical HDS (Add physical HDS + multi-region RX via a non-striding DevX RQ, Add TX-side HDS). As merged the README will tell operators these features are absent when they are fully present.
| - ibverbs backend: requires a Mellanox/mlx5 NIC (ConnectX-6/7, BlueField). | |
| Multi-queue 5-tuple flow steering is not yet implemented (single-queue flow | |
| matching works via a catch-all rule); HDS is a logical split (headers remain | |
| in the same, possibly GPU, buffer). RX (MPRQ), TX, GPUDirect, and GPU | |
| reorder/quantize are supported. | |
| - ibverbs backend: requires a Mellanox/mlx5 NIC (ConnectX-6/7, BlueField). | |
| RX (MPRQ), TX, GPUDirect, multi-queue 5-tuple flow steering (`mlx5dv_dr`, | |
| per-packet MARK), physical header-data split (HDS) on both RX and TX, accurate | |
| TX send scheduling (wait-on-time WAIT WQE), RX hardware timestamps, and GPU | |
| reorder/quantize are supported. |
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
…abstraction Re-ports the pure-libibverbs/DevX Multi-Packet (striding) Receive Queue raw-Ethernet engine onto main's new engine abstraction (Engine/EngineFactory, src/engines/, DAQIRI_ENGINE, stream_type+engine selection). This consolidates the prior 16-commit feature branch (preserved at backup-ibverbs-premain) onto the renamed structure introduced by #156. Engine: src/engines/ibverbs/daqiri_ibverbs_engine.{cpp,h} (IbverbsEngine : public Engine) + mlx5_prm_min.h. Drives a mlx5 striding RQ via DevX (CQ + RQ + TIR + mlx5dv_dr steering, manual WQE/doorbell, cyclic refill); RX (MPRQ, host or GPU via dmabuf), direct-SQ TX, physical/logical HDS, multi-queue 5-tuple flow steering with per-packet flow IDs, flex-item arbitrary-offset and IPv4-total-length matching (flex parser / misc_parameters_4), RX hardware timestamps, accurate TX send scheduling, GPU reorder/quantize, and netdev-MTU auto-raise for jumbo frames. Reuses DPDK rte_ring/rte_mempool for the worker->app handoff only. Selection: new EngineType::IBVERBS. The user-facing engine name "ibverbs" now resolves stream-type-aware -- "ibverbs"+raw -> IBVERBS (MPRQ), "ibverbs"+socket -> RDMA (RoCE) -- via a config_engine_from_string(str, stream_type) overload used by both EngineFactory::get_engine_type and the YAML decode path. raw still defaults to dpdk. CMake: DAQIRI_ENGINE="...ibverbs" now builds both internal engines (rdma for RoCE, ibverbs for raw MPRQ); the ibverbs engine links libibverbs + libmlx5 + DPDK rings. Docs (README, concepts, getting-started, configuration, AGENTS) updated to describe ibverbs as a raw-stream engine selectable with engine: "ibverbs". Validated on ConnectX loopback: engine: ibverbs + raw closed loop (4.3 Mpps @512B GPUDirect), raw default still selects dpdk, and flex-parser matching is byte-accurate against the bench's incrementing payload pattern. Signed-off-by: Cliff Burdick <cburdick@nvidia.com>
5895c3a to
076da59
Compare
Summary
A new
ibverbsraw-Ethernet backend (src/managers/ibverbs/), selected viastream_type: "raw"+engine: "ibverbs"and built only whenibverbsis inDAQIRI_MGR. It replaces DPDK's per-packetrte_mbufalloc/free with a Mellanox/mlx5 Multi-Packet (striding) Receive Queue (MPRQ) driven through DevX, plus a direct mlx5 send-queue TX path. It reuses DPDKrte_ring/rte_mempoolfor the worker↔app handoff (so it still links DPDK, like the rdma backend) but does not use DPDK for the NIC.DPDK stays the default for
stream_type: "raw";ibverbsis opt-in for A/B comparison.What's implemented
Core datapath
ibv_reg_dmabuf_mr).mlx5dv_init_obj, bypassingibv_post_send) from a slot slab tracked by cyclic index counters; NIC IP/UDP checksum offload +tx_eth_src.src/kernels.cuC ABI), drop/allow-all.Feature parity work (each its own commit)
mlx5dv_dr, one domain/table per port) + per-packetflow_id(MARK) via a tag action so flows sharing a queue are distinguishable.cpu_coreare serviced round-robin by one thread.tx_eth_srcoffloads,get_mac_addr(sysfs).get_packet_rx_timestamp, CQE TS →mlx5dv_ts_to_ns).print_statswith RX/TX counts + ring-full drop counters.set_packet_tx_time) via a wait-on-time WAIT WQE (HCA-cap-gated).Validation (ConnectX, cabled loopback, GPU memory)
All hardware-validated; 0.000% PHY loss unless noted.
Notes
Signed-off-by. Per CONTRIBUTING, the title should be prefixed with the issue number — please advise the issue and I'll amend.README.md,AGENTS.md,docs/concepts.md,docs/getting-started.md, anddocs/api-reference/configuration.mdreflect theibverbsengine and its capabilities (multi-queue steering, physical HDS, etc.).🤖 Generated with Claude Code