mirror of
https://github.com/kvcache-ai/Mooncake.git
synced 2026-11-05 01:17:55 +00:00
[PR #1077] [MERGED] [RDMA] Fix RDMA device selection to prioritize GIDs with network devices #1996
Labels
No labels
ascend
auto-closed
bug
bug
CI/Build
Common
documentation
enhancement
feature request
good first issue
help wanted
high priority
MetaX
nightly-failure
pull-request
PyTorch Backend
question
RFC
Roadmap
stale
Store
Tests
Transfer Engine
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
kvcache-ai/Mooncake#1996
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/kvcache-ai/Mooncake/pull/1077
Author: @uniqueni
Created: 11/18/2025
Status: ✅ Merged
Merged: 11/21/2025
Merged by: @stmatengss
Base:
main← Head:bugfix_device_gid📝 Commits (2)
ca566d0add gid stateac7506d[RDMA] Add hasNetworkDevice() helper and improve naming📊 Changes
3 files changed (+75 additions, -28 deletions)
View changed files
📝
mooncake-transfer-engine/include/config.h(+1 -1)📝
mooncake-transfer-engine/include/transport/rdma_transport/rdma_context.h(+12 -4)📝
mooncake-transfer-engine/src/transport/rdma_transport/rdma_context.cpp(+62 -23)📄 Description
Problem Statement
Current Behavior
The existing RDMA device initialization logic selects the first available device with any valid GID (Global Identifier), regardless of whether that GID has an associated network device (ndev). This can result in poor device selection where:
Example Issue
Real-world scenario from logs:
Root Cause
ibv_get_device_list()returns devices in arbitrary system orderSolution
Design Overview
Introduced a GID quality classification system to enable intelligent RDMA device selection based on network device associations.
Changes Made
1. Added GID Quality Enum (
rdma_context.h)2. Enhanced
getBestGidIndex()FunctionBefore:
After:
Key improvements:
GidNetworkStatequality level instead of just index3. Changed GID Auto-Selection Sentinel Value
Before: Used
gid_index == 0to indicate auto-selectionAfter: Uses
gid_index < 0(i.e.,-1) as sentinel valueWhy this matters:
MC_GID_INDEX=0-1is now the default value for auto-selectionChanges:
config.h: Changed defaultgid_index = -1(was0)rdma_context.h: Changedconstruct()default parameter to-1rdma_context.cpp: Changed condition from== 0to< 04. Modified
openRdmaDevice()LogicBehavior:
GID_WITHOUT_NETWORKare rejected (returnERR_CONTEXT)GID_WITH_NETWORKquality🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.