mirror of
https://github.com/deepseek-ai/DeepEP.git
synced 2026-11-05 00:47:32 +00:00
[PR #671] Make get_rdma_gbs RoCE-LAG aware #694
Labels
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
deepseek-ai/DeepEP#694
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/deepseek-ai/DeepEP/pull/671
Author: @zfan2356
Created: 6/25/2026
Status: 🔄 Open
Base:
main← Head:fix/rdma-gbs-lag-aware📝 Commits (3)
a7113cdMake get_rdma_gbs RoCE-LAG awarec3cb61dAdd tests for get_rdma_gbs LAG-aware path2c5745aPass explicit comp_mask=NUM_LAG_PORTS to query_mlx5_device📊 Changes
2 files changed (+184 additions, -2 deletions)
View changed files
📝
deep_ep/utils/envs.py(+54 -2)➕
tests/utils/test_envs.py(+130 -0)📄 Description
Background
get_rdma_gbsreadsibstat'sRate:to feedElasticBuffer.get_theoretical_num_sms. On Mellanox RoCE LAG (e.g., CX-7 with two 200 Gb/s NDR rails bonded into onemlx5_bond_*),ibstatreports the per-rail rate — the mlx5 driver hashes traffic across both rails, so a single QP only ever uses one, but multiple QPs reach the bond's full aggregate. The probe therefore returns half of the real per-NIC capacity and the downstream SM-count calculation picks the wrong bottleneck.Same root cause as #614.
Measurement (H800 + CX-7,
mlx5_bond_*2-rail LAG)ibstat 'mlx5_bond_1' .. Rate:ib_write_bw -d mlx5_bond_1 -F(1 QP)ib_write_bw -d mlx5_bond_1 -F -q 8Mlx5Context.query_mlx5_device(comp_mask=MASK_NUM_LAG_PORTS).num_lag_portsReal per-NIC bandwidth is ~50 GB/s, not 25 — a 2x error.
Fix
Query
num_lag_portsvia pyverbs and multiply the ibstat rate by it. Same approach as Mooncake's transfer engine, seemooncake-transfer-engine/src/transport/rdma_transport/rdma_context.cpp:266for the C++ equivalent (mlx5dv_query_device+MLX5DV_CONTEXT_MASK_NUM_LAG_PORTS).Gotcha:
query_mlx5_device()'s defaultcomp_mask=-1ORs only the masks pyverbs knows about; at least the version I tested against didn't includeNUM_LAG_PORTS, sonum_lag_portscame back as 0. The bit must be passed explicitly. Hardcoded frominfiniband/mlx5dv.hsince pyverbs doesn't re-export the constant.Also adds an
EP_RDMA_GBS=<gbps>env override (also/8to GB/s) so users with broken probes or non-Mellanox fabrics can short-circuit detection — addresses the request in #614.Falls back cleanly to the original single-rail behaviour when
pyverbsis missing, when the NIC isn't mlx5, or when LAG isn't enabled.Tests
tests/utils/test_envs.py— three local checks (no distributed setup needed) that auto-skip when pyverbs / ibstat /mlx5_bond_*aren't present. On H800 + CX-7 LAG the test prints:Compatibility
No new hard dependencies;
pyverbsis optional (import istry/except). No API changes. Only the returned value changes, and only when LAG is actually in effect.Fixes #614. Credit @michaelchen1996 env-override sketch.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.