Skip to content

Stabilize DeepCompile ZeRO-3 memory scheduling - #8169

Open
tohtana wants to merge 9 commits into
deepspeedai:masterfrom
tohtana:tohtana/deepcompile-zero3-memory-stability-scheduler-standalone
Open

Stabilize DeepCompile ZeRO-3 memory scheduling#8169
tohtana wants to merge 9 commits into
deepspeedai:masterfrom
tohtana:tohtana/deepcompile-zero3-memory-stability-scheduler-standalone

Conversation

@tohtana

@tohtana tohtana commented Jul 23, 2026

Copy link
Copy Markdown
Collaborator

Depends on #8159.

DeepCompile's ZeRO-3 scheduler does not consistently account for memory pressure across gather/release ordering, prefetch, selective gathering, and native gather-buffer reuse. This can retain excess gathered storage or trigger a full-parameter gather while Dynamo evaluates guards.

This PR adds rank-consistent scheduler budgeting and diagnostics, coordinates prefetch and selective gathering with graph profiling, reuses native gather storage within a bounded pressure-aware lifecycle, and avoids guard-time full-parameter gathers while the DeepCompile eager fallback is active.

tohtana added 2 commits July 22, 2026 17:50
Signed-off-by: Masahiro Tanaka <mtanaka@anyscale.com>
Signed-off-by: Masahiro Tanaka <mtanaka@anyscale.com>
@tohtana tohtana changed the title Tohtana/deepcompile zero3 memory stability scheduler standalone Stabilize DeepCompile ZeRO-3 memory scheduling Jul 23, 2026
tohtana added 4 commits August 2, 2026 10:51
Signed-off-by: Masahiro Tanaka <mtanaka@anyscale.com>
Signed-off-by: Masahiro Tanaka <mtanaka@anyscale.com>
Signed-off-by: Masahiro Tanaka <mtanaka@anyscale.com>
Signed-off-by: Masahiro Tanaka <mtanaka@anyscale.com>
@tohtana
tohtana marked this pull request as ready for review August 3, 2026 17:56

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 55779855e3

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread deepspeed/utils/allocator_telemetry.py Outdated
Comment thread deepspeed/utils/allocator_telemetry.py Outdated
tohtana added 3 commits August 3, 2026 11:23
Signed-off-by: Masahiro Tanaka <mtanaka@anyscale.com>
Signed-off-by: Masahiro Tanaka <mtanaka@anyscale.com>
Signed-off-by: Masahiro Tanaka <mtanaka@anyscale.com>
Comment thread csrc/compile/init.cpp
m.def("register_graph_z3",
&dc::register_graph_z3,
"Register graph with a list of ds parameter ids");
m.def("set_z3_gather_buffer_pool_budget_for_test",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wondering if these new items are just test purpose only?



def deepcompile_z3_inductor_config_patch(enabled: bool):
"""Disable reduction heuristics that create oversized kernels for DeepCompile ZeRO-3 graphs."""

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How does inductor-generated mix-order or persistent reductions bother ZeRO-3? Is that related to GPU memory use?

Comment thread deepspeed/compile/util.py
def all_reduce(tensor, op, process_group=None):
if process_group is None:
return dist.all_reduce(tensor, op)
return dist.all_reduce(tensor, op, group=process_group)

@eternalNight eternalNight Aug 4, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That wrapper is unnecessary. dist.all_reduce already takes group as optional and default to None (which means the default process group will be used). Same to get_rank and barrier.

Comment thread csrc/compile/z3.cpp
if (!enabled_ || pressure_recovery_in_progress_) { return at::Tensor(); }

Entry* best = nullptr;
for (auto& entry : entries_) {

@pengdurice pengdurice Aug 4, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is entries_ ordered? if not, is the full loop expensive vs an max heap like solution?

@pengdurice

Copy link
Copy Markdown
Contributor

general question, do we have experiments results showcasing the changes' benefits?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants