feat(qdp): add Jax support and generic DLPack fallbackc#1152
Closed
Sumit6307 wants to merge 1 commit intoapache:mainfrom
Closed
feat(qdp): add Jax support and generic DLPack fallbackc#1152Sumit6307 wants to merge 1 commit intoapache:mainfrom
Sumit6307 wants to merge 1 commit intoapache:mainfrom
Conversation
Author
|
@guan404ming Sir, Plz look into this PR |
Member
|
cc @viiccwen to take a look first before I make the final call |
Member
|
Have a better idea for jax, closing it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This PR aligns with the 2026 Q1 Roadmap for QDP (Quantum Data Plane) regarding "Integration & Release" and "Input Format Support."
Changes
Why
Currently, the Quantum Data Plane (QDP) has tight integration with PyTorch but lacks native support for the Jax ecosystem, which is a leading framework for quantum machine learning research. Furthermore, the
encodemethod was specialized for specific frameworks, making it harder to support other DLPack-compliant libraries like Cupy. This change enables Mahout to act as a truly universal Quantum Data Plane.How
Jax Integration: Created a new
jax.rsmodule that detects Jax arrays and handles asynchronous synchronization viablock_until_ready()before data extraction.Generic DLPack Fallback: Updated the unified
encodemethod inengine.rsto support any Python object that implements the standard DLPack protocol (__dlpack__and__dlpack_device__).Framework Interoperability: Ensured that the logic is "non-invasive"—the QDP only attempts to synchronize Jax/DLPack objects when they are passed as input, maintaining zero overhead for other paths.
Improved Validation: Added robust error handling during the DLPack extraction process to ensure device and memory alignment consistency.
Tests: Added a new test suite in
testing/qdp/test_jax.pyspecifically for Jax-to-QDP-to-PyTorch workflows.