Skip to content

[pmap] In-line definitions of jax.device_put_sharded and jax.device_put_replicated. - #5374

Merged
copybara-service[bot] merged 1 commit into
mainfrom
test_888582438
Apr 7, 2026
Merged

copybara-service[bot] merged 1 commit into
mainfrom
test_888582438

Conversation

@copybara-service

@copybara-service copybara-service Bot commented Mar 25, 2026 •

Copy link
Copy Markdown

[pmap] In-line definitions of jax.device_put_sharded and jax.device_put_replicated.

NOTE: Added a axis_name argument because jax_utils is a commonly used utility and it may be beneficial for flax users to be able to specify the axis name to match the axis name used in their experiment.

Both jax.device_put_sharded and jax.device_put_replicated were deprecated in JAX v0.8.1 in November 2025. We in-line their definitions using public JAX APIs taking the jax_pmap_shmap_merge=True branch, which was made the default in JAX v0.8.0 in October 2025.

Please see the below for more information:

@vfdev-5

vfdev-5 commented Mar 25, 2026

Copy link
Copy Markdown
Collaborator

@danielsuo I tried to tackle this problem some time ago and there were some internal failures that I could not fix in the flax code: #5101
Can you take the tests from my PR here to ensure we get the same behaviour with the rewritten methods. Thanks

@copybara-service
copybara-service Bot force-pushed the test_888582438 branch 3 times, most recently from 41d0052 to 4ddd1a3 Compare April 7, 2026 12:49
…e_put_replicated`.

NOTE: Added a `axis_name` argument because `jax_utils` is a commonly used utility and it may be beneficial for `flax` users to be able to specify the axis name to match the axis name used in their experiment.

Both `jax.device_put_sharded` and `jax.device_put_replicated` were deprecated in JAX v0.8.1 in November 2025. We in-line their definitions using public JAX APIs taking the `jax_pmap_shmap_merge=True` branch, which was made the default in JAX v0.8.0 in October 2025.

Please see the below for more information:
- JAX CHANGELOG: https://docs.jax.dev/en/latest/changelog.html
- Migrating from `jax.pmap`: https://docs.jax.dev/en/latest/migrate_pmap.html

PiperOrigin-RevId: 895857088
@copybara-service
copybara-service Bot merged commit 355e141 into main Apr 7, 2026
@copybara-service
copybara-service Bot deleted the test_888582438 branch April 7, 2026 13:03
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