[FEATURE] Avoid manually sync between torch and quadrants on Metal.#2760
Merged
duburcqa merged 3 commits intoMay 12, 2026
Merged
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
59bb31f to
3d0330c
Compare
duburcqa
previously approved these changes
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>
The ctypes/ObjC logic to extract PyTorch MPS's MTLCommandQueue* now lives in Quadrants (qd.interop module), so Genesis just calls the public API. Removes ~35 lines of low-level ctypes code. Co-authored-by: Cursor <cursoragent@cursor.com>
c9351d6 to
4e02588
Compare
4e02588 to
1836b42
Compare
duburcqa
approved these changes
May 12, 2026
|
🔴 Benchmark Regression Detected ➡️ Report |
duburcqa
added a commit
that referenced
this pull request
May 16, 2026
duburcqa
added a commit
to duburcqa/Genesis
that referenced
this pull request
May 18, 2026
…rants on Metal. (Genesis-Embodied-AI#2760)" (Genesis-Embodied-AI#2794)" This reverts commit a74efed.
duburcqa
added a commit
that referenced
this pull request
May 18, 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.