Repository navigation
DeepCompile: stabilize ZeRO-3 parameter guards - #8328
pengdurice merged 1 commit into
Conversation
Signed-off-by: Masahiro Tanaka <mtanaka@anyscale.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e4bcfd9e27
ℹ️ 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".
| # PyTorch 2.10 does not yet accept the user stack argument. | ||
| guard_manager.add_lambda_guard(semantic_parameter_guard, verbose_code) | ||
| return | ||
| return original_tensor_match(self, guard, value) |
There was a problem hiding this comment.
Preserve the older TENSOR_MATCH call signature
On supported PyTorch 2.6/2.7 releases, GuardBuilder.TENSOR_MATCH accepts only (self, guard), but this delegation always supplies the additional value argument. Any ordinary input or other non-ZeRO tensor therefore reaches this branch and raises TypeError while Dynamo builds guards, preventing ZeRO-3 DeepCompile from producing a graph on those versions; call the original without value when its older signature is in use.
Useful? React with 👍 / 👎.
Under DeepCompile's ZeRO-3, a module parameter can be empty (while partitioned) and full-sized
param.data(while gathered). Dynamo could recompile the graph when the status changes.The eager fallback added in #8059 gathers ZeRO-3 parameters for frames that Dynamo skips, which made these temporary state changes visible during tracing. #8157 prevented one parameter lookup performed during guard evaluation from triggering a gather. However, Dynamo could still build tensor guards from the parameter's temporary gathered or partitioned representation, and
ZeROOrderedDictcould still read the current ds_status while Dynamo was compiling.This PR makes Dynamo's graph reuse check compare the parameter's identity and logical properties, including its type, dispatch keys, dtype, device, layout,
requires_grad,ds_id, andds_shape. It does not make the check depend on the temporaryparam.datashape ords_status. As the result, DeepCompile can keep Dynamo's existing tensor checks unchanged for non-ZeRO tensors.When DeepCompile supplies a full-sized placeholder during tracing, it now looks up the corresponding module parameter before building the check. It also returns parameters from
ZeROOrderedDictduring compilation without readingds_status.