Skip to content

[TransferEngine] Fix RDMA GID auto-discovery for IPv6 and reduce spur…#1597

Merged
alogfans merged 3 commits into
mainfrom
fix/rdma-gid-autodiscovery
Mar 10, 2026
Merged

[TransferEngine] Fix RDMA GID auto-discovery for IPv6 and reduce spur…#1597
alogfans merged 3 commits into
mainfrom
fix/rdma-gid-autodiscovery

Conversation

@stmatengss
Copy link
Copy Markdown
Collaborator

…ious errors

Fixes #1593 and #1592

Changes:

  1. Accept all RoCE v2 GIDs (both IPv4-mapped and pure IPv6) instead of only IPv4-mapped GIDs. This allows Transfer Engine to work in IPv6-only environments.

  2. Stop querying GID indices on first failure instead of iterating through all 256 possible indices. This eliminates spurious 'Failed to query GID' error logs when devices have fewer GIDs.

  3. Allow user-specified GIDs without network devices. When MC_GID_INDEX is explicitly set, log a warning but continue initialization instead of failing. Users setting this variable know their configuration.

Description

Module

  • Transfer Engine (mooncake-transfer-engine)
  • Mooncake Store (mooncake-store)
  • Mooncake EP (mooncake-ep)
  • Integration (mooncake-integration)
  • P2P Store (mooncake-p2p-store)
  • Python Wheel (mooncake-wheel)
  • PyTorch Backend (mooncake-pg)
  • Mooncake RL (mooncake-rl)
  • CI/CD
  • Docs
  • Other

Type of Change

  • Bug fix
  • New feature
  • Refactor
  • Breaking change
  • Documentation update
  • Other

How Has This Been Tested?

Checklist

  • I have performed a self-review of my own code.
  • I have formatted my own code using ./scripts/code_format.sh before submitting.
  • I have updated the documentation.
  • I have added tests to prove my changes are effective.

…ious errors

Fixes #1593 and #1592

Changes:
1. Accept all RoCE v2 GIDs (both IPv4-mapped and pure IPv6) instead of
   only IPv4-mapped GIDs. This allows Transfer Engine to work in
   IPv6-only environments.

2. Stop querying GID indices on first failure instead of iterating
   through all 256 possible indices. This eliminates spurious
   'Failed to query GID' error logs when devices have fewer GIDs.

3. Allow user-specified GIDs without network devices. When MC_GID_INDEX
   is explicitly set, log a warning but continue initialization instead
   of failing. Users setting this variable know their configuration.
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request enhances the robustness and compatibility of the Transfer Engine's RDMA GID discovery mechanism. It broadens support for IPv6 network configurations, streamlines the GID querying process to minimize error logging, and improves flexibility for users who manually configure GIDs, ensuring the system can operate effectively in a wider range of network setups.

Highlights

  • IPv6 GID Auto-Discovery: The system now accepts all RoCE v2 GIDs, including pure IPv6 GIDs, in addition to IPv4-mapped GIDs. This enables Transfer Engine functionality in IPv6-only environments.
  • Reduced Spurious Errors: GID index querying now stops on the first failure, preventing unnecessary iteration through all possible indices and reducing 'Failed to query GID' error logs for devices with fewer GIDs.
  • User-Specified GID Handling: User-specified GIDs (via MC_GID_INDEX) are now allowed even if they lack an associated network device. The system will log a warning but proceed with initialization instead of failing.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • mooncake-transfer-engine/src/transport/rdma_transport/rdma_context.cpp
    • Modified GID discovery logic to accept all RoCE v2 GIDs, including pure IPv6, by removing the IPv4-mapped address check.
    • Updated the GID querying loop to break on the first ibv_query_gid_ex failure, rather than logging an error and continuing.
    • Changed the handling of user-specified GIDs to issue a warning instead of failing when no associated network device is found.
    • Adjusted the informational log message for user-specified GIDs to indicate whether a network device is present.
Activity
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces three important fixes for RDMA GID handling in the Transfer Engine. First, it extends RoCE v2 GID support to include pure IPv6 addresses, enabling functionality in IPv6-only environments. Second, it optimizes GID discovery by stopping the search upon the first failure, which reduces spurious error logs on devices with fewer GIDs. Third, it allows user-specified GIDs to be used even without an associated network device, providing more flexibility for advanced user configurations while issuing a warning. The changes are well-implemented, targeted, and improve the robustness and usability of the RDMA transport. The code modifications are correct and align with the stated goals.

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Mar 2, 2026

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 0% with 32 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...gine/src/transport/rdma_transport/rdma_context.cpp 0.00% 32 Missing ⚠️

📢 Thoughts on this report? Let us know!


if ((ipv6_addr_v4mapped((struct in6_addr *)gid_entry.gid.raw) &&
gid_entry.gid_type == IBV_GID_TYPE_ROCE_V2) ||
if (gid_entry.gid_type == IBV_GID_TYPE_ROCE_V2 ||
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We originally add this restriction to avoid finding loopback GID if the network only supports IPv4. So it's better to find V4 GID first, the fallback to V6.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK

@alogfans
Copy link
Copy Markdown
Collaborator

alogfans commented Mar 6, 2026

@stmatengss I will merge it after fixing the code format issue.

@stmatengss
Copy link
Copy Markdown
Collaborator Author

@copilot fix code format issue

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 6, 2026

@stmatengss I've opened a new pull request, #1625, to work on those changes. Once the pull request is ready, I'll request review from you.

@alogfans
Copy link
Copy Markdown
Collaborator

alogfans commented Mar 9, 2026

After changing code format, I think it will be LGTM.

@stmatengss
Copy link
Copy Markdown
Collaborator Author

Fixed. Fall-back path: ipv4 => ipv4 w/o network => ipv6 => ipv6 w/o network. PTAL. @alogfans

@alogfans alogfans merged commit 34dacae into main Mar 10, 2026
18 checks passed
@zhyncs zhyncs deleted the fix/rdma-gid-autodiscovery branch March 13, 2026 22:08
whn09 pushed a commit to whn09/Mooncake that referenced this pull request Apr 4, 2026
kvcache-ai#1597)

* [TransferEngine] Fix RDMA GID auto-discovery for IPv6 and reduce spurious errors

Fixes kvcache-ai#1593 and kvcache-ai#1592

Changes:
1. Accept all RoCE v2 GIDs (both IPv4-mapped and pure IPv6) instead of
   only IPv4-mapped GIDs. This allows Transfer Engine to work in
   IPv6-only environments.

2. Stop querying GID indices on first failure instead of iterating
   through all 256 possible indices. This eliminates spurious
   'Failed to query GID' error logs when devices have fewer GIDs.

3. Allow user-specified GIDs without network devices. When MC_GID_INDEX
   is explicitly set, log a warning but continue initialization instead
   of failing. Users setting this variable know their configuration.

* update

* update
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: No suitable GID found when only IPv6 GIDs is set on rdma devices

4 participants