[feat][JAX] Add Apple Silicon MPS support - #1979
Conversation
71c6cf3 to
7e8a200
Compare
There was a problem hiding this comment.
Code Review
This pull request introduces experimental support for Apple Silicon (macOS 14+) in the JAX backend using the jax-mps PJRT plugin. It includes documentation updates, dependency adjustments in pyproject.toml, and custom workarounds in the attention layers and KV cache update logic to bypass current jax-mps limitations. Additionally, it implements ephemeral in-memory sampler checkpoints to avoid redundant disk writes. Feedback on the changes highlights a behavioral discrepancy in the custom MPS KV cache update logic, where negative start indices are incorrectly wrapped instead of clamped to zero as standard JAX dynamic_update_slice does. Suggestions have been provided to simplify this logic and update the corresponding unit tests.
f126075 to
fdf83df
Compare
Signed-off-by: bvolpato <brunocvcunha@gmail.com>
fdf83df to
99a2d51
Compare
Summary
Add opt-in Apple Silicon support for SkyRL's JAX backend using
jax-mps.Changes
mpsdependency extra for Apple Silicon macOS.dynamic_update_sliceboundary behavior in the KV-cache fallback.Validation
Current Linux validation after rebasing onto
main:19 passed)8 passed)66 pages)uv lock --checkandgit diff --checkEarlier branch validation on an M4 Max covered the MPS JAX backend, DeepSeek-V3 against its Hugging Face reference, and Qwen3-0.6B forward, backward, optimizer update, and sampling. Those hardware results predate the latest rebase and fallback fixes; current fixes have CPU regression coverage but have not been rerun on Apple hardware.
Limitations
jax-mpsremains experimental and supports one Apple GPU.einsumfallback until batched scatter support lands upstream.