Skip to content

[Feature][KV Transfer] Support multiple memfabric TransDataOpType and A5 - #15570

Open
dsxsteven wants to merge 1 commit into
vllm-project:mainfrom
dsxsteven:support_memfabric_a5
Open

[Feature][KV Transfer] Support multiple memfabric TransDataOpType and A5#15570
dsxsteven wants to merge 1 commit into
vllm-project:mainfrom
dsxsteven:support_memfabric_a5

Conversation

@dsxsteven

@dsxsteven dsxsteven commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

What this PR does / why we need it?

  • Select data path via kv_connector_extra_config["memfabric_transfer_protocol"]: sdma (default) / device_rdma for A3 nodes, device_urma for A5 nodes; no machine-type checks in code
  • Fail fast on invalid protocol values; log resolved data_op_type at init
  • Fix UTs broken by hardcoded DEVICE_URMA and add protocol coverage
  • Document the new option in the layerwise/sparse KV offload guide and design doc

Does this PR introduce any user-facing change?

Yes: new kv_connector_extra_config["memfabric_transfer_protocol"] option (sdma (default) / device_rdma / device_urma) to select the MemFabric transfer data path for A3/A5 nodes; documented in the layerwise/sparse KV offload guide and design doc.

How was this patch tested?

pytest tests/ut/kv_offload/test_memfabric_transfer_engine.py
# 12 passed — covers sdma/device_rdma/device_urma selection, invalid-value fail fast, and init logging

Signed-off-by: dsxsteven dsxsteven@sina.com

@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 KV transfer mechanism by decoupling the MemFabric data-path protocol from hardware detection. By introducing a configurable protocol setting, users can now explicitly specify the transfer mode (sdma, device_rdma, or device_urma) via the kv_connector_extra_config. This change improves flexibility for different hardware environments, specifically enabling support for A5 nodes, and includes robust validation to prevent invalid configurations at startup.

Highlights

  • MemFabric Protocol Selection: Introduced a new configuration option kv_connector_extra_config["memfabric_transfer_protocol"] to explicitly select the data path (sdma, device_rdma, or device_urma) instead of relying on automatic hardware detection.
  • A5 Node Support: Enabled support for A5 series nodes by allowing the device_urma protocol selection, which is now documented in the developer and user guides.
  • Validation and Error Handling: Implemented fail-fast validation for protocol values and added logging during engine initialization to ensure configuration errors are caught early.
  • Testing: Updated unit tests in test_memfabric_transfer_engine.py to cover the new protocol selection logic, including mocking the TransDataOpType enum.
New Features

🧠 You can now enable Memory (public preview) 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.

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 the 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 counterproductive. 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.

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.

@github-actions github-actions Bot added documentation Improvements or additions to documentation module:tests labels Sep 2, 2026
@github-actions

github-actions Bot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

👋 Hi! Thank you for contributing to the vLLM Ascend project. The following points will speed up your PR merge:‌‌

  • A PR should do only one thing, smaller PRs enable faster reviews.
  • Every PR should include unit tests and end-to-end tests ‌to ensure it works and is not broken by other future PRs.
  • Write the commit message by fulfilling the PR description to help reviewer and future developers understand.

If CI fails, you can run linting and testing checks locally according Contributing and Testing.


Tip

💡 Consider Linking a Related Issue or RFC

Your PR title contains the [Feature] tag, indicating a bug fix or new feature.

Linking a related issue or RFC in the PR description is strongly encouraged — it gives reviewers helpful context and speeds up the review. You can use any of these keywords:

  • Fixes #<issue_number>
  • Closes #<issue_number>
  • Resolves #<issue_number>
  • Refs #<rfc_or_issue_number> (for RFCs)

🙏 Thanks for helping us keep the project well-organized!

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

Suggested PR Title:

[Ops][Feature] Support MemFabric transfer protocol configuration for A5 nodes

Suggested PR Summary:

### What this PR does / why we need it?
This PR adds support for A5 series nodes in layerwise and sparse KV cache offloading by introducing a configurable MemFabric transfer protocol (`memfabric_transfer_protocol`). Users can now specify `sdma` (default) or `device_rdma` for A3 nodes, and `device_urma` for A5 nodes. The PR also updates the documentation and unit tests accordingly.

Feedback on the changes includes:
- Adding type validation for `transfer_protocol` to prevent potential `AttributeError`s during string operations.
- Wrapping the import of `TransDataOpType` in a `try...except` block to gracefully handle older versions of `memfabric_hybrid` that might raise an `ImportError`.

### Does this PR introduce _any_ user-facing change?
Yes, users can now configure `memfabric_transfer_protocol` in `kv_connector_extra_config` to support A5 nodes.

### How was this patch tested?
The patch was tested using updated unit tests in `tests/ut/kv_offload/test_memfabric_transfer_engine.py`.

Comment on lines +103 to +108
protocol = (transfer_protocol or _DEFAULT_MEMFABRIC_TRANSFER_PROTOCOL).strip().lower()
if protocol not in _VALID_MEMFABRIC_TRANSFER_PROTOCOLS:
raise ValueError(
f"Invalid MemFabric transfer_protocol={transfer_protocol!r}; "
f"expected one of {_VALID_MEMFABRIC_TRANSFER_PROTOCOLS}"
)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

high

To prevent unexpected runtime crashes with generic AttributeErrors, we should validate that transfer_protocol is a string (or None) before performing string operations like .strip().lower().

        if transfer_protocol is not None and not isinstance(transfer_protocol, str):
            raise TypeError(
                f"MemFabric transfer_protocol must be a string, got {type(transfer_protocol).__name__}"
            )
        protocol = (transfer_protocol or _DEFAULT_MEMFABRIC_TRANSFER_PROTOCOL).strip().lower()
        if protocol not in _VALID_MEMFABRIC_TRANSFER_PROTOCOLS:
            raise ValueError(
                f"Invalid MemFabric transfer_protocol={transfer_protocol!r}; "
                f"expected one of {_VALID_MEMFABRIC_TRANSFER_PROTOCOLS}"
            )

Unknown names fail fast here as well: a wrong protocol otherwise only
surfaces later as an obscure engine initialization failure.
"""
from memfabric_hybrid import TransDataOpType

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

high

If an older version of memfabric_hybrid is installed, importing TransDataOpType will raise an ImportError. Since _get_transfer_protocol is called outside the main try...except ImportError block in _build_engine, this will result in an unhandled exception with a generic error message. Wrapping this import in a try...except block allows us to provide a clear and helpful error message advising the user to upgrade the library.

        try:
            from memfabric_hybrid import TransDataOpType
        except ImportError as exc:
            raise ImportError(
                "Please upgrade memfabric_hybrid (memfabric-hybrid) to a version that supports TransDataOpType."
            ) from exc

- Select data path via kv_connector_extra_config["memfabric_transfer_protocol"]:
  sdma (default) / device_rdma for A3 nodes, device_urma for A5 nodes; no
  machine-type checks in code
- Fail fast on invalid protocol values; log resolved data_op_type at init
- Fix UTs broken by hardcoded DEVICE_URMA and add protocol coverage
- Document the new option in the layerwise/sparse KV offload guide and design doc

Signed-off-by: dsxsteven <dsxsteven@sina.com>
@dsxsteven
dsxsteven force-pushed the support_memfabric_a5 branch from b492f0b to 391d6b5 Compare September 2, 2026 09:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation module:tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant