Scope DeepCompile compiler state to graph and engine lifecycles - #8159
Conversation
Signed-off-by: Masahiro Tanaka <mtanaka@anyscale.com>
0b27f37 to
8f8f693
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8f8f69327a
ℹ️ 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".
Signed-off-by: Masahiro Tanaka <mtanaka@anyscale.com>
|
The changes look good to me. One question about the assumptions of use. This PR seems relevant to use cases where multiple engines are created within a single process. Do we assume that the I have not seen any use case running multiple engines in an overlapping manner, though. So the question is just out of curiosity. |
|
Hi @eternalNight, This PR only makes captured backward inputs and cleanup owner-specific, but the torch.autograd.Function patch is still process-global. This can cause the same kind of repeated recompilation that #7980 fixed. I haven’t seen a real workload relying on that pattern either, but it is a real limitation. To address the issue, I think we could limit the behavior to the owning engine/frame. For example, only resetting |
DeepCompile uses several process-global PyTorch compiler mechanisms while building graph-specific state. Scheduled recompilation also replaces previously compiled graphs.
These lifetimes did not have explicit ownership boundaries.
This PR gives those existing mechanisms explicit graph and engine lifecycle ownership.
Fixes:
InputStorage.torch.autograd.Functionpatch active until the last owned backward frame is released, then clear captured backward inputs.AotAutograd.__init__patch to the Inductor compilation call and restore it infinally.