DeepCompile: stabilize ZeRO-3 parameter guards - #8328
Draft
tohtana wants to merge 1 commit into
Draft
Conversation
Signed-off-by: Masahiro Tanaka <mtanaka@anyscale.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.
Under DeepCompile's ZeRO-3, the same module parameter can be empty (while partitioned) and full-sized
param.data(while gathered). Dynamo could treat the state transition as a change to the model and recompile the graph.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.