Skip to content

Preserve ZeRO-3 release output metadata in DeepCompile - #8508

Open
tohtana wants to merge 1 commit into
deepspeedai:masterfrom
tohtana:tohtana/fix-zero3-release-meta
Open

Preserve ZeRO-3 release output metadata in DeepCompile#8508
tohtana wants to merge 1 commit into
deepspeedai:masterfrom
tohtana:tohtana/fix-zero3-release-meta

Conversation

@tohtana

@tohtana tohtana commented Sep 14, 2026

Copy link
Copy Markdown
Collaborator

Problem

The ZeRO-3 compile pass sets meta["val"] to None on inserted release_param nodes, even though the operator returns its input Tensor unchanged.

The activation-offload pass checks meta["val"] to identify floating-point tensors among the outputs saved for backward. Setting it to None causes the pass to skip tensors returned by release_param.

Correcting this metadata exposes a second issue: forward offload records the release node’s name, while backward reload looks up the original saved-output name. These names differ, so the backward pass does not insert the corresponding reload.

Approach

Preserve the input’s exact meta["val"] object on each release node, retaining its Tensor properties and alias relationships.

Also preserve the original saved-output name and use it to match forward offload with backward reload. When undoing an offload, restore the connection to the actual input of the offload node.

Parameter-release side effects, execution order, and graph dependencies remain unchanged.

@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: b02a6338e0

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

name=f"release_ds_param_{release_node.target}_{node.name}_{ds_id}",
meta=_make_node_meta(node, ds_id, False))
new_node.meta["val"] = None
new_node.meta["val"] = node.meta["val"]

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Add the required Signed-off-by trailer

This is a non-merge commit, but its commit message has no Signed-off-by trailer, so it does not satisfy the repository's mandatory DCO requirement; recreate the commit with --signoff using the configured Git identity.

AGENTS.md reference: AGENTS.md:L8-L8

Useful? React with 👍 / 👎.

Comment thread tests/unit/compile/test_zero3_release_meta.py
Signed-off-by: Masahiro Tanaka <tanaka.masahiro@gmail.com>
@tohtana
tohtana force-pushed the tohtana/fix-zero3-release-meta branch from b02a633 to 340a236 Compare September 14, 2026 05:32
@tohtana
tohtana requested a review from pengdurice September 14, 2026 06:29
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.

1 participant