You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Distributed: accept a null stream, and bind clear_backends() and init with an all-gather factory #134
This is a follow up to PR 482 on MLX-Swift to expose missing distributed functions. Happy to open PRs for the parts that can't be auto-generated, but I'm not sure which ones those are.
1. Accept a null stream in the distributed ops
Python's stream=None lets the group pick its communication stream: the GPU for NCCL, the CPU otherwise. mlx-c can't express that, and communication_stream() is internal, so a binding has to guess. Proposal: map a null stream to StreamOrDevice{} in all eight mlx_distributed_* ops.
intmlx_distributed_all_sum(
mlx_array*res,
constmlx_arrayx,
constmlx_distributed_groupgroup/* may be null */,
constmlx_streams/* may be null */);
Doing it in the StreamOrDevice rule for every op would work too.
2. Bind clear_backends()
intmlx_distributed_clear_backends(void);
A non-strict init caches its size-one fallback, so a later strict init of that backend returns it instead of retrying. Python also calls this at exit, which matters once 3 holds a binding's callback.
3. Bind init with an all-gather factory
For mx.distributed.init(backend="jaccl", all_gather_factory=...), flattened into one callback with payload and dtor as in mlx_closure_new_func_payload:
Activity