Commit a8d98a2
[pmap] Fix mesh sharding mismatch for ferminet with jax_pmap_shmap_merge.
When jax_pmap_shmap_merge is enabled, pmap creates an internal mesh with the
specified axis_name. Input arrays must have matching NamedSharding with the
same axis_name, otherwise JAX raises a sharding mismatch error.
This change:
- Inlines device_put_replicated logic in replicate_all_local_devices so we can
pass an axis_name, allowing replicated args to have matching mesh sharding.
- Updates broadcast_all_local_devices to use axis_name-aware pmap when
jax_pmap_shmap_merge is enabled.
- Updates ferminet calls to pass the correct axis_name (PMAP_AXIS_NAME).
PiperOrigin-RevId: 866453666
Change-Id: I8bfffeb48bd2db6f0bb91860ccba1aadf9e78a191 parent b65b124 commit a8d98a2
2 files changed
Lines changed: 27 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
326 | 326 | | |
327 | 327 | | |
328 | 328 | | |
| 329 | + | |
| 330 | + | |
329 | 331 | | |
| 332 | + | |
| 333 | + | |
330 | 334 | | |
331 | | - | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
332 | 338 | | |
333 | 339 | | |
334 | 340 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
340 | 340 | | |
341 | 341 | | |
342 | 342 | | |
343 | | - | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
344 | 346 | | |
345 | | - | |
| 347 | + | |
| 348 | + | |
346 | 349 | | |
347 | 350 | | |
348 | 351 | | |
| |||
425 | 428 | | |
426 | 429 | | |
427 | 430 | | |
428 | | - | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
429 | 434 | | |
430 | | - | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
431 | 438 | | |
432 | 439 | | |
433 | 440 | | |
| |||
530 | 537 | | |
531 | 538 | | |
532 | 539 | | |
533 | | - | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
534 | 543 | | |
535 | 544 | | |
536 | 545 | | |
| |||
619 | 628 | | |
620 | 629 | | |
621 | 630 | | |
622 | | - | |
| 631 | + | |
| 632 | + | |
| 633 | + | |
623 | 634 | | |
624 | | - | |
| 635 | + | |
| 636 | + | |
| 637 | + | |
625 | 638 | | |
626 | 639 | | |
627 | 640 | | |
| |||
0 commit comments