Skip to content

ensure user modes are disabled when running aot_compile_joint_with_descriptors#169023

Open
bdhirsh wants to merge 17 commits intogh/bdhirsh/679/basefrom
gh/bdhirsh/679/head
Open

ensure user modes are disabled when running aot_compile_joint_with_descriptors#169023
bdhirsh wants to merge 17 commits intogh/bdhirsh/679/basefrom
gh/bdhirsh/679/head

Conversation

@bdhirsh
Copy link
Copy Markdown
Collaborator

@bdhirsh bdhirsh commented Nov 24, 2025

In vanilla torch.compile, dynamo disables all active modes during compilation: https://github.com/pytorch/pytorch/blob/main/torch/_dynamo/convert_frame.py#L2151

When using the compile pipeline flow that splits graph capture from compilation, since we split graph capture and compilation into two stages, we only end up disabling modes during the graph capture step but not compilation.

We already have a notion of an ExitStack, so one option would have been for me to arrange for the ExitStack to include a call to disable modes. I found it a bit unwieldy, though, since today only the AOTAutograd code handles the exit stack, and the context manager that I need is used by dynamo, so instead I just manually popped modes in aot_compile_joint_with_descriptors directly.

Stack from ghstack (oldest at bottom):

@pytorch-bot
Copy link
Copy Markdown

pytorch-bot Bot commented Nov 24, 2025

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/169023

Note: Links to docs will display an error until the docs builds have been completed.

✅ You can merge normally! (2 Unrelated Failures)

As of commit 9e704ce with merge base c49edf7 (image):

FLAKY - The following job failed but was likely due to flakiness present on trunk:

UNSTABLE - The following job is marked as unstable, possibly due to flakiness on trunk:

This comment was automatically generated by Dr. CI and updates every 15 minutes.

bdhirsh added a commit that referenced this pull request Nov 24, 2025
…scriptors

ghstack-source-id: 6ca7f0f
Pull Request resolved: #169023
…int_with_descriptors"

In vanilla torch.compile, dynamo disables all active modes during compilation: [https://github.com/pytorch/pytorch/blob/main/torch/_dynamo/convert_frame.py#L2151](https://github.com/pytorch/pytorch/blob/main/torch/_dynamo/convert_frame.py?brid=t6D9McqWPJ2TbxhsrYj_dQ#L2151)


When using the compile pipeline flow that splits graph capture from compilation, since we split graph capture and compilation into two stages, we only end up disabling modes during the graph capture step but not compilation.

We already have a notion of an ExitStack, so one option would have been for me to arrange for the ExitStack to include a call to disable modes. I found it a bit unwieldy, though, since today only the AOTAutograd code handles the exit stack, and the context manager that I need is used by dynamo, so instead I just manually popped modes in `aot_compile_joint_with_descriptors` directly.




[ghstack-poisoned]
bdhirsh added a commit that referenced this pull request Nov 25, 2025
…scriptors

ghstack-source-id: 5b18736
Pull Request resolved: #169023
@bdhirsh
Copy link
Copy Markdown
Collaborator Author

bdhirsh commented Nov 26, 2025

@pytorchbot merge

@pytorch-bot pytorch-bot Bot added the ciflow/trunk Trigger trunk jobs on your pull request label Nov 26, 2025
@albanD albanD removed their request for review November 26, 2025 17:44
…int_with_descriptors"

In vanilla torch.compile, dynamo disables all active modes during compilation: [https://github.com/pytorch/pytorch/blob/main/torch/_dynamo/convert_frame.py#L2151](https://github.com/pytorch/pytorch/blob/main/torch/_dynamo/convert_frame.py?brid=t6D9McqWPJ2TbxhsrYj_dQ#L2151)


When using the compile pipeline flow that splits graph capture from compilation, since we split graph capture and compilation into two stages, we only end up disabling modes during the graph capture step but not compilation.

We already have a notion of an ExitStack, so one option would have been for me to arrange for the ExitStack to include a call to disable modes. I found it a bit unwieldy, though, since today only the AOTAutograd code handles the exit stack, and the context manager that I need is used by dynamo, so instead I just manually popped modes in `aot_compile_joint_with_descriptors` directly.




[ghstack-poisoned]
bdhirsh added a commit that referenced this pull request Dec 1, 2025
…scriptors

ghstack-source-id: f2dfd16
Pull Request resolved: #169023
…int_with_descriptors"

In vanilla torch.compile, dynamo disables all active modes during compilation: [https://github.com/pytorch/pytorch/blob/main/torch/_dynamo/convert_frame.py#L2151](https://github.com/pytorch/pytorch/blob/main/torch/_dynamo/convert_frame.py?brid=t6D9McqWPJ2TbxhsrYj_dQ#L2151)


When using the compile pipeline flow that splits graph capture from compilation, since we split graph capture and compilation into two stages, we only end up disabling modes during the graph capture step but not compilation.

We already have a notion of an ExitStack, so one option would have been for me to arrange for the ExitStack to include a call to disable modes. I found it a bit unwieldy, though, since today only the AOTAutograd code handles the exit stack, and the context manager that I need is used by dynamo, so instead I just manually popped modes in `aot_compile_joint_with_descriptors` directly.




[ghstack-poisoned]
@bdhirsh
Copy link
Copy Markdown
Collaborator Author

bdhirsh commented Dec 1, 2025

@pytorchbot merge

@pytorchmergebot
Copy link
Copy Markdown
Collaborator

Merge started

Your change will be merged once all checks pass (ETA 0-4 Hours).

Learn more about merging in the wiki.

Questions? Feedback? Please reach out to the PyTorch DevX Team

Advanced Debugging
Check the merge workflow status
here

@pytorchmergebot
Copy link
Copy Markdown
Collaborator

Merge failed

Reason: 1 jobs have failed, first few of them are: trunk / linux-jammy-rocm-py3.10 / test (default, 3, 6, linux.rocm.gpu.gfx942.1)

Details for Dev Infra team Raised by workflow job

…int_with_descriptors"

In vanilla torch.compile, dynamo disables all active modes during compilation: [https://github.com/pytorch/pytorch/blob/main/torch/_dynamo/convert_frame.py#L2151](https://github.com/pytorch/pytorch/blob/main/torch/_dynamo/convert_frame.py?brid=t6D9McqWPJ2TbxhsrYj_dQ#L2151)


When using the compile pipeline flow that splits graph capture from compilation, since we split graph capture and compilation into two stages, we only end up disabling modes during the graph capture step but not compilation.

We already have a notion of an ExitStack, so one option would have been for me to arrange for the ExitStack to include a call to disable modes. I found it a bit unwieldy, though, since today only the AOTAutograd code handles the exit stack, and the context manager that I need is used by dynamo, so instead I just manually popped modes in `aot_compile_joint_with_descriptors` directly.




[ghstack-poisoned]
tiendatngcs pushed a commit to tiendatngcs/pytorch-Dec25 that referenced this pull request Dec 10, 2025
…int_with_descriptors"

In vanilla torch.compile, dynamo disables all active modes during compilation: [https://github.com/pytorch/pytorch/blob/main/torch/_dynamo/convert_frame.py#L2151](https://github.com/pytorch/pytorch/blob/main/torch/_dynamo/convert_frame.py?brid=t6D9McqWPJ2TbxhsrYj_dQ#L2151)


When using the compile pipeline flow that splits graph capture from compilation, since we split graph capture and compilation into two stages, we only end up disabling modes during the graph capture step but not compilation.

We already have a notion of an ExitStack, so one option would have been for me to arrange for the ExitStack to include a call to disable modes. I found it a bit unwieldy, though, since today only the AOTAutograd code handles the exit stack, and the context manager that I need is used by dynamo, so instead I just manually popped modes in `aot_compile_joint_with_descriptors` directly.




[ghstack-poisoned]
…int_with_descriptors"

In vanilla torch.compile, dynamo disables all active modes during compilation: [https://github.com/pytorch/pytorch/blob/main/torch/_dynamo/convert_frame.py#L2151](https://github.com/pytorch/pytorch/blob/main/torch/_dynamo/convert_frame.py?brid=t6D9McqWPJ2TbxhsrYj_dQ#L2151)


When using the compile pipeline flow that splits graph capture from compilation, since we split graph capture and compilation into two stages, we only end up disabling modes during the graph capture step but not compilation.

We already have a notion of an ExitStack, so one option would have been for me to arrange for the ExitStack to include a call to disable modes. I found it a bit unwieldy, though, since today only the AOTAutograd code handles the exit stack, and the context manager that I need is used by dynamo, so instead I just manually popped modes in `aot_compile_joint_with_descriptors` directly.




[ghstack-poisoned]
…int_with_descriptors"

In vanilla torch.compile, dynamo disables all active modes during compilation: [https://github.com/pytorch/pytorch/blob/main/torch/_dynamo/convert_frame.py#L2151](https://github.com/pytorch/pytorch/blob/main/torch/_dynamo/convert_frame.py?brid=t6D9McqWPJ2TbxhsrYj_dQ#L2151)


When using the compile pipeline flow that splits graph capture from compilation, since we split graph capture and compilation into two stages, we only end up disabling modes during the graph capture step but not compilation.

We already have a notion of an ExitStack, so one option would have been for me to arrange for the ExitStack to include a call to disable modes. I found it a bit unwieldy, though, since today only the AOTAutograd code handles the exit stack, and the context manager that I need is used by dynamo, so instead I just manually popped modes in `aot_compile_joint_with_descriptors` directly.




[ghstack-poisoned]
…int_with_descriptors"

In vanilla torch.compile, dynamo disables all active modes during compilation: [https://github.com/pytorch/pytorch/blob/main/torch/_dynamo/convert_frame.py#L2151](https://github.com/pytorch/pytorch/blob/main/torch/_dynamo/convert_frame.py?brid=t6D9McqWPJ2TbxhsrYj_dQ#L2151)


When using the compile pipeline flow that splits graph capture from compilation, since we split graph capture and compilation into two stages, we only end up disabling modes during the graph capture step but not compilation.

We already have a notion of an ExitStack, so one option would have been for me to arrange for the ExitStack to include a call to disable modes. I found it a bit unwieldy, though, since today only the AOTAutograd code handles the exit stack, and the context manager that I need is used by dynamo, so instead I just manually popped modes in `aot_compile_joint_with_descriptors` directly.




[ghstack-poisoned]
…int_with_descriptors"

In vanilla torch.compile, dynamo disables all active modes during compilation: [https://github.com/pytorch/pytorch/blob/main/torch/_dynamo/convert_frame.py#L2151](https://github.com/pytorch/pytorch/blob/main/torch/_dynamo/convert_frame.py?brid=t6D9McqWPJ2TbxhsrYj_dQ#L2151)


When using the compile pipeline flow that splits graph capture from compilation, since we split graph capture and compilation into two stages, we only end up disabling modes during the graph capture step but not compilation.

We already have a notion of an ExitStack, so one option would have been for me to arrange for the ExitStack to include a call to disable modes. I found it a bit unwieldy, though, since today only the AOTAutograd code handles the exit stack, and the context manager that I need is used by dynamo, so instead I just manually popped modes in `aot_compile_joint_with_descriptors` directly.




[ghstack-poisoned]
…int_with_descriptors"

In vanilla torch.compile, dynamo disables all active modes during compilation: [https://github.com/pytorch/pytorch/blob/main/torch/_dynamo/convert_frame.py#L2151](https://github.com/pytorch/pytorch/blob/main/torch/_dynamo/convert_frame.py?brid=t6D9McqWPJ2TbxhsrYj_dQ#L2151)


When using the compile pipeline flow that splits graph capture from compilation, since we split graph capture and compilation into two stages, we only end up disabling modes during the graph capture step but not compilation.

We already have a notion of an ExitStack, so one option would have been for me to arrange for the ExitStack to include a call to disable modes. I found it a bit unwieldy, though, since today only the AOTAutograd code handles the exit stack, and the context manager that I need is used by dynamo, so instead I just manually popped modes in `aot_compile_joint_with_descriptors` directly.




[ghstack-poisoned]
…int_with_descriptors"

In vanilla torch.compile, dynamo disables all active modes during compilation: [https://github.com/pytorch/pytorch/blob/main/torch/_dynamo/convert_frame.py#L2151](https://github.com/pytorch/pytorch/blob/main/torch/_dynamo/convert_frame.py?brid=t6D9McqWPJ2TbxhsrYj_dQ#L2151)


When using the compile pipeline flow that splits graph capture from compilation, since we split graph capture and compilation into two stages, we only end up disabling modes during the graph capture step but not compilation.

We already have a notion of an ExitStack, so one option would have been for me to arrange for the ExitStack to include a call to disable modes. I found it a bit unwieldy, though, since today only the AOTAutograd code handles the exit stack, and the context manager that I need is used by dynamo, so instead I just manually popped modes in `aot_compile_joint_with_descriptors` directly.




[ghstack-poisoned]
…int_with_descriptors"

In vanilla torch.compile, dynamo disables all active modes during compilation: [https://github.com/pytorch/pytorch/blob/main/torch/_dynamo/convert_frame.py#L2151](https://github.com/pytorch/pytorch/blob/main/torch/_dynamo/convert_frame.py?brid=t6D9McqWPJ2TbxhsrYj_dQ#L2151)


When using the compile pipeline flow that splits graph capture from compilation, since we split graph capture and compilation into two stages, we only end up disabling modes during the graph capture step but not compilation.

We already have a notion of an ExitStack, so one option would have been for me to arrange for the ExitStack to include a call to disable modes. I found it a bit unwieldy, though, since today only the AOTAutograd code handles the exit stack, and the context manager that I need is used by dynamo, so instead I just manually popped modes in `aot_compile_joint_with_descriptors` directly.




[ghstack-poisoned]
…int_with_descriptors"

In vanilla torch.compile, dynamo disables all active modes during compilation: [https://github.com/pytorch/pytorch/blob/main/torch/_dynamo/convert_frame.py#L2151](https://github.com/pytorch/pytorch/blob/main/torch/_dynamo/convert_frame.py?brid=t6D9McqWPJ2TbxhsrYj_dQ#L2151)


When using the compile pipeline flow that splits graph capture from compilation, since we split graph capture and compilation into two stages, we only end up disabling modes during the graph capture step but not compilation.

We already have a notion of an ExitStack, so one option would have been for me to arrange for the ExitStack to include a call to disable modes. I found it a bit unwieldy, though, since today only the AOTAutograd code handles the exit stack, and the context manager that I need is used by dynamo, so instead I just manually popped modes in `aot_compile_joint_with_descriptors` directly.




[ghstack-poisoned]
…int_with_descriptors"

In vanilla torch.compile, dynamo disables all active modes during compilation: [https://github.com/pytorch/pytorch/blob/main/torch/_dynamo/convert_frame.py#L2151](https://github.com/pytorch/pytorch/blob/main/torch/_dynamo/convert_frame.py?brid=t6D9McqWPJ2TbxhsrYj_dQ#L2151)


When using the compile pipeline flow that splits graph capture from compilation, since we split graph capture and compilation into two stages, we only end up disabling modes during the graph capture step but not compilation.

We already have a notion of an ExitStack, so one option would have been for me to arrange for the ExitStack to include a call to disable modes. I found it a bit unwieldy, though, since today only the AOTAutograd code handles the exit stack, and the context manager that I need is used by dynamo, so instead I just manually popped modes in `aot_compile_joint_with_descriptors` directly.




[ghstack-poisoned]
…int_with_descriptors"

In vanilla torch.compile, dynamo disables all active modes during compilation: [https://github.com/pytorch/pytorch/blob/main/torch/_dynamo/convert_frame.py#L2151](https://github.com/pytorch/pytorch/blob/main/torch/_dynamo/convert_frame.py?brid=t6D9McqWPJ2TbxhsrYj_dQ#L2151)


When using the compile pipeline flow that splits graph capture from compilation, since we split graph capture and compilation into two stages, we only end up disabling modes during the graph capture step but not compilation.

We already have a notion of an ExitStack, so one option would have been for me to arrange for the ExitStack to include a call to disable modes. I found it a bit unwieldy, though, since today only the AOTAutograd code handles the exit stack, and the context manager that I need is used by dynamo, so instead I just manually popped modes in `aot_compile_joint_with_descriptors` directly.




[ghstack-poisoned]
…int_with_descriptors"

In vanilla torch.compile, dynamo disables all active modes during compilation: [https://github.com/pytorch/pytorch/blob/main/torch/_dynamo/convert_frame.py#L2151](https://github.com/pytorch/pytorch/blob/main/torch/_dynamo/convert_frame.py?brid=t6D9McqWPJ2TbxhsrYj_dQ#L2151)


When using the compile pipeline flow that splits graph capture from compilation, since we split graph capture and compilation into two stages, we only end up disabling modes during the graph capture step but not compilation.

We already have a notion of an ExitStack, so one option would have been for me to arrange for the ExitStack to include a call to disable modes. I found it a bit unwieldy, though, since today only the AOTAutograd code handles the exit stack, and the context manager that I need is used by dynamo, so instead I just manually popped modes in `aot_compile_joint_with_descriptors` directly.




[ghstack-poisoned]
@pytorchmergebot
Copy link
Copy Markdown
Collaborator

Starting merge as part of PR stack under #169295

1 similar comment
@pytorchmergebot
Copy link
Copy Markdown
Collaborator

Starting merge as part of PR stack under #169295

SergeyTyshkevich pushed a commit to SergeyTyshkevich/chart2 that referenced this pull request Jan 19, 2026
@github-actions
Copy link
Copy Markdown
Contributor

Looks like this PR hasn't been updated in a while so we're going to go ahead and mark this as Stale.
Feel free to remove the Stale label if you feel this was a mistake.
If you are unable to remove the Stale label please contact a maintainer in order to do so.
If you want the bot to never mark this PR stale again, add the no-stale label.
Stale pull requests will automatically be closed after 30 days of inactivity.

@github-actions github-actions Bot added the Stale label Apr 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants