Add reshard
API in experimental. Currently for sharding_in_types we have 2 APIs: mesh_cast
and reshard
. Both work in sharding_in_types mode and affect the sharding of the aval. Following are the semantics of both:
#25978
+159
−40
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.
Add
reshard
API in experimental. Currently for sharding_in_types we have 2 APIs:mesh_cast
andreshard
. Both work in sharding_in_types mode and affect the sharding of the aval. Following are the semantics of both:mesh_cast
: AxisTypes between src and dst mesh must differ. There should be no "visible" data movement. The shape of the aval doesn't change.reshard
: Mesh should be the same between src and dst (same axis_names, axis_sizes and axis_types). Data movement is allowed. The shape of the aval doesn't change.We might make
reshard
==device_put
, hence the API is in experimental. This decision can be taken at a later point in time. The reason not to just givedevice_put
this power is becausedevice_put
does a lot of stuff right now (and is going to get even more powers in the near future like cross-host transfers) and it's semantics would be very confusing if we keep piling sharding-in-types stuff on it.