Fix crash when reporting partial rings in mlx.distributed_config - #4026
Merged
Conversation
extract_rings returns (path, count) pairs, but the diagnostic in check_valid_ring iterated the list as if each element were a bare path and indexed hosts with it, raising TypeError instead of printing the rings it found.
zcbenz
approved these changes
Aug 6, 2026
krystophny
pushed a commit
to krystophny/mlx-jaccl-fix-small-recv
that referenced
this pull request
Aug 7, 2026
krystophny
pushed a commit
to krystophny/mlx-jaccl-fix-small-recv
that referenced
this pull request
Aug 7, 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.
Proposed changes
When
mlx.distributed_configcannot find a full ring it tries to print the partial rings it did find, but that diagnostic path raisesTypeErrorinstead:extract_ringsreturns(path, count)pairs:check_valid_ringalready unpacks correctly when testing for a full ring (len(rings[0][0]) == len(hosts)), but the error branch iterates the pairs as if each element were a bare path and indexeshostswith it:so
iis the path list itself rather than a node index.This means the failure is worst exactly when the diagnostic matters most: a user whose fabric is miswired gets a traceback instead of the list of rings that were found, and loses the hint to run
--dot.Repro
The branch is on the error path whenever a partial ring exists and no full ring does:
After the change the same input prints what was intended:
Checklist
pre-commit run --all-filesto format my code / installed pre-commit prior to committing changesNo test added: this is a one-line fix in an error-reporting branch that needs a miswired multi-host Thunderbolt fabric to reach naturally, and this repo has trimmed tests from small fixes of this size before (#3914). Happy to add one if you would prefer.