Repository navigation
Conversation
prepare_transfers does the validation, schedule agreement, window offset exchange and arena allocation of execute_transfers once; PreparedTransfer.run moves only data. On CUDA, window owners and copiers order each run with symmetric-memory signals instead of group barriers; other devices keep the barriers. Window copies run on one side stream, in staggered peer order, so they overlap staged messages. Signed-off-by: Jin, Youzhi <youzhi.jin@intel.com>
Signed-off-by: Jin, Youzhi <youzhi.jin@intel.com>
Each peer's staging arena is now a 256-byte aligned slice of one allocation per direction instead of its own allocation. With oneCCL on XPU, peer buffers are mapped through IPC handles, and allocating them again after a release cost about 0.1-0.4 s per batch at 2-4 processes on B70; one allocation brings that to 5-36 ms. Run time and the bytes moved are unchanged. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: Jin, Youzhi <youzhi.jin@intel.com>
ZeRO-3 offload_states / reload_states move every weight partition, and a master that aliases it, to new storage. The plans still hold, but a prepared transfer keeps its buffers and peer views and would go on writing into the old storage without error. run(requests) now compares the batch rebuilt from the live state with the layout it was prepared with and, agreed across processes, raises everywhere before data moves. Signed-off-by: Jin, Youzhi <youzhi.jin@intel.com>
0z5a
added a commit
to 0z5a/DeepSpeed
that referenced
this pull request
Nov 16, 2026
A weight sync moves the same batch every step, and every execute_transfers call repeats validation, the alias check, scheduling, the digest agreement, arena allocation and region views before the first byte moves. prepare_transfers does that work once and returns a PreparedTransfer whose run only moves data. The handle keeps the arenas that deepspeedai#9027's schedule reports, and for each round one list of (destination, source) views: the packs before a send and the unpacks after a receive, plus one list of local copies. execute_transfers is now prepare_transfers followed by one run, with the same collectives as before. Python's cyclic collector is paused while the views are built: tens of thousands stay alive together, and the collections their allocation triggered made a one-shot call at 8 processes on CPU about a third slower than master. A buffer that moves after prepare, as reload_states moves offloaded ZeRO-3 partitions, would leave those views writing into the old storage. So run checks by default: each process compares its buffers (the held tensors, or requests rebuilt from the live state) with what it prepared, and one small all-gather refuses on every process, before data moves, if a buffer moved on any of them or the processes are not running the same handle for the same time. The shape of prepare_transfers and the buffer layout check follow jinyouzhi#8 (a8c34e3); this is its staged half, without the window transport. Signed-off-by: 0z5a <dezhen.lu@student.uni-tuebingen.de> Co-authored-by: Jin, Youzhi <youzhi.jin@intel.com>
0z5a
added a commit
to 0z5a/DeepSpeed
that referenced
this pull request
Nov 20, 2026
A weight sync moves the same batch every step, and every execute_transfers call repeats validation, the alias check, scheduling, the digest agreement, arena allocation and region views before the first byte moves. prepare_transfers does that work once and returns a PreparedTransfer whose run only moves data. The handle keeps the arenas that deepspeedai#9027's schedule reports, and for each round one list of (destination, source) views: the packs before a send and the unpacks after a receive, plus one list of local copies. execute_transfers is now prepare_transfers followed by one run, with the same collectives as before. Python's cyclic collector is paused while the views are built: tens of thousands stay alive together, and the collections their allocation triggered made a one-shot call at 8 processes on CPU about a third slower than master. A buffer that moves after prepare, as reload_states moves offloaded ZeRO-3 partitions, would leave those views writing into the old storage. So run checks by default: each process compares its buffers (the held tensors, or requests rebuilt from the live state) with what it prepared, and one small all-gather refuses on every process, before data moves, if a buffer moved on any of them or the processes are not running the same handle for the same time. The shape of prepare_transfers and the buffer layout check follow jinyouzhi#8 (a8c34e3); this is its staged half, without the window transport. Signed-off-by: 0z5a <dezhen.lu@student.uni-tuebingen.de> Co-authored-by: Jin, Youzhi <youzhi.jin@intel.com>
jinyouzhi
added a commit
that referenced
this pull request
Nov 23, 2026
A weight sync moves the same batch every step, and every execute_transfers call repeats validation, the alias check, scheduling, the digest agreement, arena allocation and region views before the first byte moves. prepare_transfers does that work once and returns a PreparedTransfer whose run only moves data. The handle keeps the arenas that deepspeedai#9027's schedule reports, and for each round one list of (destination, source) views: the packs before a send and the unpacks after a receive, plus one list of local copies. execute_transfers is now prepare_transfers followed by one run, with the same collectives as before. Python's cyclic collector is paused while the views are built: tens of thousands stay alive together, and the collections their allocation triggered made a one-shot call at 8 processes on CPU about a third slower than master. A buffer that moves after prepare, as reload_states moves offloaded ZeRO-3 partitions, would leave those views writing into the old storage. So run checks by default: each process compares its buffers (the held tensors, or requests rebuilt from the live state) with what it prepared, and one small all-gather refuses on every process, before data moves, if a buffer moved on any of them or the processes are not running the same handle for the same time. The shape of prepare_transfers and the buffer layout check follow #8 (a8c34e3); this is its staged half, without the window transport. Signed-off-by: 0z5a <dezhen.lu@student.uni-tuebingen.de> Co-authored-by: Jin, Youzhi <youzhi.jin@intel.com>
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.
Stacked on #7 (
affine-symm-window).Why
At executor level, PR #7's window path lost to staging for small messages: every call paid ~1 ms of control plane (an
all_gather_objectof window offsets plus a group barrier), not data movement. Rollout weight refresh repeats the same plan on the same buffers every step, so that work only needs to happen once.What
prepare_transfers(...) -> PreparedTransfer: validation, digest agreement, window offset exchange, arena allocation and peer views, done once.PreparedTransfer.run()only moves data.execute_transfer(s)= prepare + one run, so existing callers are unchanged.READYto its copiers (ordered after its writes on the current stream), and copiers raiseDONEback after their copies. No host collective per run. Other devices keep group barriers.run(requests)compares the batch rebuilt from the live state with the buffers it was prepared with (data_ptr, numel, dtype, device, plan). If any moved on any process, e.g. after ZeRO-3offload_states/reload_states, which move every weight partition and an aliased master to new storage, every process raises before data moves (one int64 all-reduce).run()without arguments skips the check.affine-transfer.rstprepare/run section. Test: the window test now prepares once and runs twice, rewriting sources between runs, at 2 and 4 ranks.Policy stays outside: when to re-prepare,
pull/push, staging vs window are caller choices.Results: 8x L20 (PCIe, CUDA 13, NCCL 2.30), executor-only deepspeedai#8966 scenarios
Aggregate GB/s, median of 5, all bitwise exact. Upstream =
origin/masterexecute_transfer(staging).prep= prepared once,run()timed.Prepared pull beats upstream staging in all 38 pattern/width/size cells (1.08x-2.65x). Prepared staging alone also gains (no per-call preflight).
Results: 8x Arc Pro B70 (PCIe, torch 2.14 XPU), same scenarios
GB/s;
up= upstream master staging per call,_p= prepared, median of 5 runs. All results exact. Best prepared method beats upstream in all 40 cells (1.12-2.97x).On B70, push beats pull (on L20 pull is equal or slightly better), so direction stays a caller choice. Aggregate tops out around 56-57 GB/s.
Tests:
test_affine_transfer_executor.py+test_affine_transfer_executor_external_group.pyon 8x L20: 54 passed, 1 skipped.test_affine_transfer_executor.pyon 8x Arc Pro B70 (torch 2.14 XPU, oneCCL with oneccl#1053): 54 passed, with both barrier and signal paths.Not yet
runthe same number of times. A moved buffer is caught only whenrunis given the rebuilt requests; the check does not see a buffer that was freed and reallocated at the same address with different contents meaning.