Skip to content

docs: Do not pass MLX_METAL_FAST_SYNCH=1 by default - #4005

Merged
zcbenz merged 5 commits into
ml-explore:mainfrom
katlun-lgtm:fix/warn-fast-synch-fence
Aug 6, 2026
Merged

docs: Do not pass MLX_METAL_FAST_SYNCH=1 by default#4005
zcbenz merged 5 commits into
ml-explore:mainfrom
katlun-lgtm:fix/warn-fast-synch-fence

Conversation

@katlun-lgtm

Copy link
Copy Markdown
Contributor

Following up on #3830: since fast synch is not reliable and there is no fix in sight (per the discussion there and in #3142), this adds a one-time stderr warning the first time a fence is actually created in fast mode, so users hitting the wedge can find the cause without bisecting env vars. It fires on any multi-stream workload, not just distributed, matching the single-node report in #3830. One file, +12/−1, no behavior change beyond the message.

@zcbenz zcbenz left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think instead of printing a warning we should remove it from the mlx.launch command in distributed.rst and only mention it in the side note as a faster but buggy flag. The plan was to make it default after fixing the hanging bug, but at the moment I don't see any hope of that and we probably would have to end up removing it.

@katlun-lgtm

Copy link
Copy Markdown
Contributor Author

That's better, done — the runtime warning is gone and fence.cpp is back to identical with main. The flag is dropped from the mlx.launch example and the side note now says it's faster but unreliable, can deadlock and leave the GPU wedged in distributed runs and in any cross-stream workload, linking #3142 and #3830.

Now docs-only, one file, +9/−4.

@zcbenz zcbenz changed the title Warn once when a fast fence is created with MLX_METAL_FAST_SYNCH=1 docs: Do not pass MLX_METAL_FAST_SYNCH=1 by default Aug 6, 2026
The fast fence's GPU spin-wait has no guaranteed CPU/GPU memory
coherence (per the Metal team, see ml-explore#3142) and can deadlock any
multi-stream Metal workload, leaving the GPU wedged until reboot.
Originally reported for distributed runs (ml-explore#3830), since confirmed
single-node (four concurrent models on one Mac Studio), and the fence
is inserted on any cross-stream edge, so the exposure is not limited
to distributed.

Emit a one-time warning the first time a fence is actually created in
fast mode.
…time

Per review: drop the runtime warning, remove the flag from the mlx.launch
example in the distributed guide, and describe it in the side note as a
faster but unreliable option, citing ml-explore#3142 and ml-explore#3830.
@zcbenz
zcbenz force-pushed the fix/warn-fast-synch-fence branch from 74a45dd to 374dc4e Compare August 6, 2026 08:05
@zcbenz
zcbenz force-pushed the fix/warn-fast-synch-fence branch from 374dc4e to 3c09de6 Compare August 6, 2026 08:06
@zcbenz
zcbenz merged commit f1c5bcd into ml-explore:main Aug 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants