Skip to content

feat(refit): view-ops slice planning for reshard - #672

Draft
tanushriya910 wants to merge 1 commit into
tanushriyas/reshard-native-convertfrom
tanushriyas/view-ops-pr2
Draft

feat(refit): view-ops slice planning for reshard#672
tanushriya910 wants to merge 1 commit into
tanushriyas/reshard-native-convertfrom
tanushriyas/view-ops-pr2

Conversation

@tanushriya910

Copy link
Copy Markdown
Contributor

What

Extend reshard geometry capture and the slice planner to support rank-reducing view ops, so a trainer that publishes a stacked source (e.g. MoE experts stacked into one tensor) can be resharded into its per-slice destination weights.

Changes

  • geometry.py — add select and split to _SUPPORTED_OPS. select (rank-reducing) and split (multi-return view, like chunk) are how a stacked source is unstacked into per-expert / per-slice tensors. Without them, every such weight was classified unsupported and the receiver failed closed.
  • slice_plan.py_view_to_box_perm now derives the source box for rank-reducing views (select/unbind drop a dim): a dropped source dim is not iterated by any view dim, so it contributes a single fixed index ([idx, idx+1]) decoded from the offset. Rank increase (unsqueeze) and dim-merging reshapes still raise UnsupportedReshard.
  • Tests: test_reshard_refit_geometry.py, test_reshard_refit_slice_plan.py.

Why

Stacked-expert MoE layouts (and similar stacked sources) need select/split to map each slice onto its own destination box — closing that gap in view-op coverage.

Stacked on the receiver-mapping PR (base tanushriyas/reshard-native-convert); retarget to main once that merges.

Record view ops during geometry capture and plan strided reads in slice_plan, so a receiver can reconstruct converted/sharded sources. Adds geometry + slice_plan tests.

Signed-off-by: Tanushriya Singh <tanushriyas@nvidia.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant