Introduce FlexShard for flexible bucketed parameter sharding#3239
Draft
weifengpy wants to merge 106 commits into
Draft
Introduce FlexShard for flexible bucketed parameter sharding#3239weifengpy wants to merge 106 commits into
weifengpy wants to merge 106 commits into
Conversation
This was referenced May 14, 2026
This was referenced Jun 3, 2026
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.
Stack from ghstack (oldest at bottom):
Introduce experimental FlexShard, a placement-driven API for flexible bucketed parameter sharding. FlexShard lets users group parameters into explicit communication buckets and assign each parameter a pluggable placement implementation. The initial runtime is eager for now.
flex_shard() API with explicit BucketSpecs
Per-bucket flat byte storage for sharded parameters
Pluggable Placement contract for local layout, unshard collectives, and gradient reduction
Shard, Owned, and RaggedShard example placements to prove the placement contract
RaggedShard supports uneven flattened-prefix sharding, bucket unshard/reduce-grad, and focused CPU/CUDA runtime coverage
Eager parameter accessors backed by batched bucket unshard hooks
Per-bucket MixedPrecisionPolicy
reshard-after-forward path using selective activation checkpointing
Runtime support is eager-only; will explore graph capture and torch.compile in next PR
Each bucket currently requires a uniform parameter dtype and placement tuple.
Mixed precision is supported per bucket.
CPU offload is represented in the API but rejected until implemented
Test Plan: