[FEATURE] Share Metal command queue between Quadrants and PyTorch MPS#2760
Open
hughperkins wants to merge 1 commit intoGenesis-Embodied-AI:mainfrom
Open
[FEATURE] Share Metal command queue between Quadrants and PyTorch MPS#2760hughperkins wants to merge 1 commit intoGenesis-Embodied-AI:mainfrom
hughperkins wants to merge 1 commit intoGenesis-Embodied-AI:mainfrom
Conversation
Collaborator
Author
|
(note: needs a new quadrnst release) |
15c0094 to
59bb31f
Compare
duburcqa
reviewed
May 4, 2026
duburcqa
reviewed
May 4, 2026
duburcqa
reviewed
May 4, 2026
duburcqa
reviewed
May 4, 2026
duburcqa
reviewed
May 4, 2026
At gs.init() time on Apple Metal, extract PyTorch MPS's MTLCommandQueue and pass it to Quadrants via external_metal_command_queue. This lets both frameworks dispatch GPU work on the same queue, so Metal's sequential command buffer ordering eliminates the need for explicit CPU-side syncs (qd.sync / torch.mps.synchronize) at every interop point. Raises an exception if the queue cannot be extracted, since correct synchronisation on Metal depends on the shared queue. Removes all torch.mps.synchronize() guards from solvers and misc.py. Depends on Genesis-Embodied-AI/quadrants#618. Co-authored-by: Cursor <cursoragent@cursor.com>
59bb31f to
3d0330c
Compare
duburcqa
approved these changes
May 4, 2026
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.
At gs.init() time on Apple Metal, extract PyTorch MPS's MTLCommandQueue and pass it to Quadrants via external_metal_command_queue. This lets both frameworks dispatch GPU work on the same queue, so Metal's sequential command buffer ordering eliminates the need for explicit CPU-side syncs (qd.sync / torch.mps.synchronize) at every interop point.
Falls back gracefully to separate queues (with syncs preserved) if the queue pointer cannot be extracted (e.g. older PyTorch or non-MPS device).
Depends on Genesis-Embodied-AI/quadrants#618.
Description
Related Issue
Resolves Genesis-Embodied-AI/Genesis#
Motivation and Context
How Has This Been / Can This Be Tested?
Screenshots (if appropriate):
Checklist:
Submitting Code Changessection of CONTRIBUTING document.