Repository navigation
Conversation
Add plan_transfers, which plans every parameter of one sync and hands a replica policy every request at once, as agreed in deepspeedai#8935. The policy returns a holder location per request, or splits a request along axis 0 across validated holders. The planner checks every answer before it emits a segment: one answer per request, only validated holders, and parts that tile the request exactly. So a policy decides where data is read from, never what arrives. Requests name map locations and, when the caller passes the location-to-process mappings, the processes behind them, so a policy can tell a local copy from a transfer. element_size turns elements into bytes and min_split_bytes bounds every part of a split. Policies live in affine_replica_policy.py: first_holder (plan_transfer's default), local_first_least_loaded (the plan_transfers default) and per_request, which runs an existing replica_selector as a batch policy. plan_transfer itself is unchanged; it now shares its validation and emission steps with plan_transfers. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: 0z5a <dezhen.lu@student.uni-tuebingen.de>
This branch has not been deployed
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.
Implements the planner side of #8935. It does not close the issue: the cost-aware policies are the policy layer under #8252.
What it adds
plan_transfers(pairs, limits, *, source_processes, target_processes, element_size, min_split_bytes, replica_policy)indeepspeed/checkpoint/affine_transfer.py. It plans every parameter of one sync and calls one replica policy with every request at once.ReplicaRequestandReplicaPart.ReplicaParts that cut the region along axis 0.InvalidReplicaPolicyErrorotherwise:min_split_bytes, every part of a split is at least that large;PlanBudget.max_pair_checks.deepspeed/checkpoint/affine_replica_policy.pyholds three policies:first_holder: whatplan_transferdoes by default.local_first_least_loaded: theplan_transfersdefault. It takes a holder in the target's own process first, then the sending process with the fewest bytes assigned so far in this batch. Ties go to the lowest location, and it never splits.per_request(selector): runs an existingreplica_selectoras a batch policy.What it does not change
plan_transferbehaves exactly as before; it now shares its validation and emission steps withplan_transfers. AutoEP'splan_expert_transferand its docs are untouched.Decisions from #8935
TransferEndpoints, so the planner does not import the executor.min_split_bytescomes from my last comment on #8935 and has not been agreed yet. It is optional and off by default. Theprocess_nodemapping proposed there is deferred.Tests
tests/unit/checkpoint/test_affine_replica_policy.py, CPU only:extract. This is the check that matches Theorem 3 of the correctness draft for Define affine IR for checkpointing #8252.first_holderandper_requestreproduceplan_transfer's plans exactly.Noneand strings;min_split_bytes, and more parts than the budget allows.With
DS_ACCELERATOR=cpu, the new file passes together withtest_affine_transfer_plan.py,test_autoep_affine.pyandtest_affine_shard_map.py(272 tests), andtests/unit/v1/moe/test_autoep_unit.py(which coversplan_expert_transfer) together withtest_autoep_affine_universal.pypass too (215 passed, 8 skipped). yapf 0.43.0, flake8 5.0.4, codespell and the license check are clean.How it fits with other PRs
affine_transfer.pychanges apply cleanly on top of this branch (git apply --check).plan_transferinto_prepare/_emitahead of youraffine_geometry.pymove. I'm happy to rebase in whichever order suits you.affine-transfer.rstin [checkpoint] Execute affine transfer plans with bounded peer staging #8809. I'll add aplan_transferssection there once one of the two lands.cc @Achyuthan-S @delock