Repository navigation
Fix missing streams in l2_norm and scatter VJP - #4818
Merged
zcbenz merged 2 commits intoNov 20, 2026
Merged
Conversation
Contributor
Author
operator* and operator== build on the default stream. Complex l2_norm and the max/min scatter gradient both went through them.
zcbenz
force-pushed
the
stream-complex-norm-scatter-vjp
branch
from
November 20, 2026 01:22
0a84d43 to
25ae03c
Compare
zcbenz
approved these changes
Nov 20, 2026
Open
2 of 4 tasks
1 task
rcfa
pushed a commit
to cubiculum-ai/mlx
that referenced
this pull request
Nov 26, 2026
Co-authored-by: Cheng <git@zcbenz.com> (cherry picked from commit ab5d01b)
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.
AI usage disclosure: drafted with AI assistance from a stream audit. Both call sites were checked against
multiplyandequalinmlx/ops.h, which take a stream. The test suite has not been run locally.Follow-up to #4746. Two call sites still drop the stream the caller passed, and the stream checker misses them because they are operator overloads.
Complex
l2_normdidabs(a, s) * abs(a, s).operator*takes no stream, so the product is built on the thread's default stream. Real inputs already go throughsquare(a, s). The complex path now usesmultiply(abs(a, s), abs(a, s), s).Max and min
Scatter::vjpdidgathered_result == updatesinside amultiplythat already receivedstream().operator==takes no stream. That comparison is nowequal(gathered_result, updates, stream()).This only changes complex
l2_normand the max/min scatter gradient.The existing cross-thread test in
tests/scheduler_tests.cppnow builds both graphs on a thread-unsafe stream and evaluates them from the other thread: a complexlinalg::norm, and ascatter_maxVJP.Augustas from Malibu