Refactor drjax primitives to use jnp.broadcast_to and improve explicit sharding support.#37
Merged
Merged
Conversation
…cit sharding support. - Replace usage of `jnp.tile` with `jnp.broadcast_to` in `single_arg_broadcast` for more standard broadcasting. - Remove `jax.jit` from `single_arg_broadcast` to allow it to be trace-time executed or jitted by the caller. - Migrate `jax.tree_util.tree_map` to `jax.tree.map` (deprecated alias cleanup). - Update `map_to_placement` when using explicit axes to remove `axis_name` from `vmap` (allowing nested `shard_map`) and use `jax.sharding.reshard` to ensure output sharding constraints. PiperOrigin-RevId: 894053779
e321eaa to
8c609af
Compare
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.
Refactor drjax primitives to use
jnp.broadcast_toand improve explicit sharding support.jnp.tilewithjnp.broadcast_toinsingle_arg_broadcastfor more standard broadcasting.jax.jitfromsingle_arg_broadcastto allow it to be trace-time executed or jitted by the caller.jax.tree_util.tree_maptojax.tree.map(deprecated alias cleanup).map_to_placementwhen using explicit axes to removeaxis_namefromvmap(allowing nestedshard_map) and usejax.sharding.reshardto ensure output sharding constraints.