mirror of
https://github.com/kvcache-ai/Mooncake.git
synced 2026-11-05 01:17:55 +00:00
[GH-ISSUE #3350] [RFC]: Decouple native EP from the PyTorch C++ API #850
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#850
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?
Originally created by @UNIDY2002 on GitHub (Aug 10, 2026).
Original GitHub issue: https://github.com/kvcache-ai/Mooncake/issues/3350
Changes proposed
Motivation
Mooncake EP currently builds its native extension through PyTorch C++ APIs and a
setup.py-driven staging flow. The native implementation takestorch::Tensorand ATen CUDA stream objects directly, which ties the EP binary to a specific PyTorch C++ ABI. Release builds consequently compile and stage an EP artifact for every supported PyTorch version, even though the EP communication and kernel implementation does not require PyTorch at runtime.This RFC establishes a native EP boundary based on device pointers, tensor metadata, CUDA-compatible streams, and CUDA-compatible events. The Python wheel owns tensor validation, allocation, stream-handle extraction, and lifetime management. The native library owns transport setup, workspace management, kernel launches, and event synchronization.
The new boundary removes the per-PyTorch-version native EP build matrix. Releases still build the required Python ABI artifacts, while one native EP implementation serves supported PyTorch versions. This shortens release builds, removes the EP-specific
setup.pystaging path, and makes the build graph easier to reason about and maintain.Proposed changes
mooncake-epas a first-class CMake target and remove itssetup.pyandBuildEpExt.cmakebuild/staging flow.torch::Tensorand ATen CUDA stream types in the native legacy and elastic EP APIs with device pointers, shape and dtype metadata, and native stream handles.BufferandElasticBufferbehavior while routing them through the new native ABI.Scope and compatibility
The RFC covers both legacy and elastic EP. They share the same native build target and ABI boundary, and migrating them together removes the existing split build path.
The implementation retains CUDA behavior and adds the build/runtime compatibility required for MUSA through the same native boundary. MUSA protocol details and platform-specific performance tuning are implementation follow-ups; they are not the motivation for this RFC.
The public Python EP API remains unchanged. Existing callers continue to construct
BufferandElasticBufferand invokedispatchandcombinewith tensors.Validation plan
Before submitting a new issue...
@github-actions[bot] commented on GitHub (Aug 10, 2026):
Thanks for opening this issue, @UNIDY2002!
41641284A maintainer will triage this when possible. To help us respond faster, please include:
Useful links: Documentation · Contributing guide