Support PaddlePaddle with compatible API #115
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
We are PaddlePaddle contributors working on a PyTorch compatibility layer aimed at making it significantly easier for PyTorch ecosystem libraries to run on Paddle.
Background
We recently explored a similar integration with FlashInfer (see flashinfer-ai/flashinfer#1642). While working on that PR, we learned that FlashInfer has adopted TVM FFI (https://github.com/apache/tvm-ffi) as a framework-agnostic binding solution, which better aligns with our long-term compatibility goals.
Purpose of This PR
We would like to bring similar PaddlePaddle support to FlashMLA and are opening this PR to:
Approach 1: Compatibility Layer (Similar to FlashInfer PR flashinfer-ai/flashinfer#1642)
paddle.compat.enable_torch_proxy()which makesimport torchactually loadpaddle, keeping changes non-invasive.PADDLE_COMPATIBLE_APIenvironment variable, ensuring default behavior remains unchanged.Approach 2: TVM FFI Integration (Recommended)
We notice that FlashInfer has successfully migrated to TVM FFI (see flashinfer-ai/flashinfer#1641), which provides:
If FlashMLA is interested in TVM FFI integration, we would be very happy to help with the migration work. This approach offers better long-term maintainability and broader ecosystem compatibility compared to framework-specific adapters.
Next Steps
We're opening this as a draft PR to start the conversation. Depending on FlashMLA team's preference, we can:
We look forward to hearing your thoughts and are excited about the possibility of bringing FlashMLA support to the PaddlePaddle ecosystem!
Related Links
__tvm_ffi_env_stream__protocol PaddlePaddle/Paddle#75193