Skip to content

[dynamo] Deprecate inline_inbuilt_nn_modules config#178205

Closed
anijain2305 wants to merge 3 commits into
gh/anijain2305/1109/basefrom
gh/anijain2305/1109/head
Closed

[dynamo] Deprecate inline_inbuilt_nn_modules config#178205
anijain2305 wants to merge 3 commits into
gh/anijain2305/1109/basefrom
gh/anijain2305/1109/head

Conversation

@anijain2305

@anijain2305 anijain2305 commented Mar 23, 2026

Copy link
Copy Markdown
Contributor

Stack from ghstack (oldest at bottom):

inline_inbuilt_nn_modules has defaulted to True and the False path is legacy. This makes the config a no-op (always True), emits a deprecation warning when users set it to False, and removes all dead False-path code from runtime

cc @voznesenskym @penguinwu @EikanWang @jgong5 @Guobing-Chen @XiaobingSuper @zhuhaozhe @blzheng @wenzhe-nrv @jiayisunx @ipiszy @kadeng @muchulee8 @amjames @chauhang @aakhundov @coconutruben @jataylo @Lucaskabela @mlazos

inline_inbuilt_nn_modules has defaulted to True and the False path is legacy. This makes the config a no-op (always True), emits a deprecation warning when users set it to False, and removes all dead False-path code from runtime

[ghstack-poisoned]
@pytorch-bot

pytorch-bot Bot commented Mar 23, 2026

Copy link
Copy Markdown

🔗 Helpful Links

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

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

✅ You can merge normally! (4 Unrelated Failures)

As of commit 7211897 with merge base e534ad5 (image):

BROKEN TRUNK - The following job failed but were present on the merge base:

👉 Rebase onto the `viable/strict` branch to avoid these failures

UNSTABLE - The following jobs are marked as unstable, possibly due to flakiness on trunk:

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

anijain2305 added a commit that referenced this pull request Mar 23, 2026
inline_inbuilt_nn_modules has defaulted to True and the False path is legacy. This makes the config a no-op (always True), emits a deprecation warning when users set it to False, and removes all dead False-path code from runtime

ghstack-source-id: 2941144
Pull Request resolved: #178205
@pytorch-bot

pytorch-bot Bot commented Mar 23, 2026

Copy link
Copy Markdown

This PR needs a release notes: label

If your changes are user facing and intended to be a part of release notes, please use a label starting with release notes:.

If not, please add the topic: not user facing label.

To add a label, you can comment to pytorchbot, for example
@pytorchbot label "topic: not user facing"

For more information, see
https://github.com/pytorch/pytorch/wiki/PyTorch-AutoLabel-Bot#why-categorize-for-release-notes-and-how-does-it-work.

inline_inbuilt_nn_modules has defaulted to True and the False path is legacy. This makes the config a no-op (always True), emits a deprecation warning when users set it to False, and removes all dead False-path code from runtime

cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx ipiszy kadeng muchulee8 amjames chauhang aakhundov coconutruben jataylo Lucaskabela

[ghstack-poisoned]
anijain2305 added a commit that referenced this pull request Mar 23, 2026
inline_inbuilt_nn_modules has defaulted to True and the False path is legacy. This makes the config a no-op (always True), emits a deprecation warning when users set it to False, and removes all dead False-path code from runtime

ghstack-source-id: 8704e4f
Pull Request resolved: #178205
inline_inbuilt_nn_modules has defaulted to True and the False path is legacy. This makes the config a no-op (always True), emits a deprecation warning when users set it to False, and removes all dead False-path code from runtime

cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx ipiszy kadeng muchulee8 amjames chauhang aakhundov coconutruben jataylo Lucaskabela

[ghstack-poisoned]
anijain2305 added a commit that referenced this pull request Mar 24, 2026
inline_inbuilt_nn_modules has defaulted to True and the False path is legacy. This makes the config a no-op (always True), emits a deprecation warning when users set it to False, and removes all dead False-path code from runtime

ghstack-source-id: 5c85e7f
Pull Request resolved: #178205
@anijain2305 anijain2305 added ciflow/trunk Trigger trunk jobs on your pull request release notes: dynamo labels Mar 24, 2026
if (
(
torch._dynamo.config.inline_inbuilt_nn_modules
or isinstance(self, variables.FSDPManagedNNModuleVariable)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Shouldn't we keep the check from the or?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Wait nvm since inline_inbuilt_nn_modules is true this entire portion is now true - checked myself sorry XD

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

No worries - I was confused too - Trust in Claude we must lol

@Lucaskabela Lucaskabela left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Generally LGTM - minor comment on our deprecation message

Comment thread torch/_dynamo/config.py
default=True,
justknob="pytorch/compiler:inline_inbuilt_nn_modules",
deprecated=True,
deprecation_message="does not do anything, inline_inbuilt_nn_modules is always True",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Do we have an expected removal date? We could include that in the message if so

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I dont want to add it now -- because in the past, this has been hard, so I am expecting reverts.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I can do this post 2.12 release, if the deprecate flag survives till 2.12 release.

if (
(
torch._dynamo.config.inline_inbuilt_nn_modules
or isinstance(self, variables.FSDPManagedNNModuleVariable)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Wait nvm since inline_inbuilt_nn_modules is true this entire portion is now true - checked myself sorry XD

Comment thread torch/_dynamo/guards.py
@@ -910,13 +908,7 @@ def raise_local_type_error(obj: Any) -> NoReturn:


def should_optimize_getattr_on_nn_module(value: Any) -> bool:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Return type should be typing_extensions.TypeIs[torch.nn.Module] to properly propogate typing info now.

@anijain2305

Copy link
Copy Markdown
Contributor Author

@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

meta-codesync Bot pushed a commit to pytorch/benchmark that referenced this pull request Mar 25, 2026
Summary:
inline_inbuilt_nn_modules has defaulted to True and the False path is legacy. This makes the config a no-op (always True), emits a deprecation warning when users set it to False, and removes all dead False-path code from runtime

X-link: pytorch/pytorch#178205
Approved by: https://github.com/Lucaskabela, https://github.com/mlazos

Reviewed By: georgehong

Differential Revision: D98065356

fbshipit-source-id: e55bae4fd2e0ff075f6a7de0215af05a18de5279
Copilot AI pushed a commit that referenced this pull request Mar 27, 2026
inline_inbuilt_nn_modules has defaulted to True and the False path is legacy. This makes the config a no-op (always True), emits a deprecation warning when users set it to False, and removes all dead False-path code from runtime

Pull Request resolved: #178205
Approved by: https://github.com/Lucaskabela, https://github.com/mlazos

Co-authored-by: Xia-Weiwen <12522207+Xia-Weiwen@users.noreply.github.com>
AaronWang04 pushed a commit to AaronWang04/pytorch that referenced this pull request Mar 31, 2026
inline_inbuilt_nn_modules has defaulted to True and the False path is legacy. This makes the config a no-op (always True), emits a deprecation warning when users set it to False, and removes all dead False-path code from runtime

Pull Request resolved: pytorch#178205
Approved by: https://github.com/Lucaskabela, https://github.com/mlazos
xuhancn pushed a commit to xuhancn/pytorch that referenced this pull request Apr 2, 2026
inline_inbuilt_nn_modules has defaulted to True and the False path is legacy. This makes the config a no-op (always True), emits a deprecation warning when users set it to False, and removes all dead False-path code from runtime

Pull Request resolved: pytorch#178205
Approved by: https://github.com/Lucaskabela, https://github.com/mlazos
nklshy-aws pushed a commit to nklshy-aws/pytorch that referenced this pull request Apr 7, 2026
inline_inbuilt_nn_modules has defaulted to True and the False path is legacy. This makes the config a no-op (always True), emits a deprecation warning when users set it to False, and removes all dead False-path code from runtime

Pull Request resolved: pytorch#178205
Approved by: https://github.com/Lucaskabela, https://github.com/mlazos
@github-actions github-actions Bot deleted the gh/anijain2305/1109/head branch April 24, 2026 02:25
pytorchmergebot pushed a commit that referenced this pull request May 11, 2026
…churn (#182531)

PR #178205 stripped the cudagraph re-record limit entirely (made
exceed_rerecord_limit a no-op). Restore it, but don't count
StaticInputIdxMismatch (nn parameter / mark_static_address ptr churn
under inline_inbuilt_nn_modules) toward the limit; structural reasons
like CudagraphManagedIdxMismatch and ExpectedDeadIndicesBeforeGraphMismatch
do count.

Authored with assistance from Claude.

Differential Revision: [D103898330](https://our.internmc.facebook.com/intern/diff/D103898330)
Pull Request resolved: #182531
Approved by: https://github.com/BoyuanFeng
ghstack dependencies: #182524
Alokksinha00 pushed a commit to Alokksinha00/pytorch that referenced this pull request May 15, 2026
…churn (pytorch#182531)

PR pytorch#178205 stripped the cudagraph re-record limit entirely (made
exceed_rerecord_limit a no-op). Restore it, but don't count
StaticInputIdxMismatch (nn parameter / mark_static_address ptr churn
under inline_inbuilt_nn_modules) toward the limit; structural reasons
like CudagraphManagedIdxMismatch and ExpectedDeadIndicesBeforeGraphMismatch
do count.

Authored with assistance from Claude.

Differential Revision: [D103898330](https://our.internmc.facebook.com/intern/diff/D103898330)
Pull Request resolved: pytorch#182531
Approved by: https://github.com/BoyuanFeng
ghstack dependencies: pytorch#182524
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.

5 participants