Skip to content

Use codegen for the boxed interpreters#164573

Closed
ezyang wants to merge 4 commits intogh/ezyang/3170/basefrom
gh/ezyang/3170/head
Closed

Use codegen for the boxed interpreters#164573
ezyang wants to merge 4 commits intogh/ezyang/3170/basefrom
gh/ezyang/3170/head

Conversation

@ezyang
Copy link
Contributor

@ezyang ezyang commented Oct 3, 2025

Stack from ghstack (oldest at bottom):

Authored with claude code. The arg parsing is kind of horrible, open
to more suggestions.

Signed-off-by: Edward Yang ezyang@meta.com

cc @voznesenskym @penguinwu @EikanWang @jgong5 @Guobing-Chen @XiaobingSuper @zhuhaozhe @blzheng @wenzhe-nrv @jiayisunx @chenyang78 @kadeng @chauhang @amjames @Lucaskabela

[ghstack-poisoned]
@pytorch-bot
Copy link

pytorch-bot bot commented Oct 3, 2025

🔗 Helpful Links

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

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

❗ 1 Active SEVs

There are 1 currently active SEVs. If your PR is affected, please view them below:

⏳ No Failures, 1 Pending

As of commit 3c7374a with merge base 801e282 (image):
💚 Looks good so far! There are no failures yet. 💚

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

ezyang added a commit that referenced this pull request Oct 3, 2025
Authored with claude code.  The arg parsing is kind of horrible, open
to more suggestions.

Signed-off-by: Edward Yang <ezyang@meta.com>
ghstack-source-id: e0f5928
Pull-Request: #164573
@ezyang ezyang requested a review from jansel October 3, 2025 14:25
@ezyang ezyang added the topic: not user facing topic category label Oct 3, 2025
Copy link
Collaborator

@albanD albanD left a comment

Choose a reason for hiding this comment

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

Small nit,
I think the input unpacking will be terrible one way or the other haha

Sounds good if perf is actually where you need it to be!



__all__ = ["PythonCode", "CodeGen", "Graph"]
__all__ = ["PythonCode", "CodeGen", "Graph", "_BoxedCodeGen"]
Copy link
Collaborator

Choose a reason for hiding this comment

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

You can't put private API in there.
You can just remove this as it doesn't do anything.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I BLAME CLAUDE sorry for not reviewing carefully enough lol

Comment on lines +863 to +873
def process_inputs(self, args_list: Any) -> Any:
"""
Process boxed inputs. Expects a list of arguments.
"""
return args_list

def process_outputs(self, out: Any) -> Any:
"""
Process outputs - just return as-is for boxed calling convention.
"""
return out
Copy link
Collaborator

Choose a reason for hiding this comment

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

dead code

# Generate the function signature with args_list parameter
fn_def = f"def {self._func_name}(self, args_list){maybe_return_annotation}:"

if len(free_vars) > 0:
Copy link
Contributor

Choose a reason for hiding this comment

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

empty containers are falsey, non-empty containers are truthy

(why don't people ever rely on that anymore?)

[ghstack-poisoned]
ezyang added a commit that referenced this pull request Oct 3, 2025
Authored with claude code.  The arg parsing is kind of horrible, open
to more suggestions.

Signed-off-by: Edward Yang <ezyang@meta.com>
ghstack-source-id: 4c51eac
Pull-Request: #164573
@ezyang
Copy link
Contributor Author

ezyang commented Oct 3, 2025

@pytorchbot merge

@pytorch-bot pytorch-bot bot added the ciflow/trunk Trigger trunk jobs on your pull request label Oct 3, 2025
@pytorchmergebot
Copy link
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
Collaborator

Merge failed

Reason: 1 jobs have failed, first few of them are: trunk / linux-jammy-cuda12.8-py3.10-gcc11 / test (default, 5, 5, lf.linux.g6.4xlarge.experimental.nvidia.gpu)

Details for Dev Infra team Raised by workflow job

@ezyang
Copy link
Contributor Author

ezyang commented Oct 4, 2025

test fail is real

[ghstack-poisoned]
ezyang added a commit that referenced this pull request Oct 5, 2025
Authored with claude code.  The arg parsing is kind of horrible, open
to more suggestions.

Signed-off-by: Edward Yang <ezyang@meta.com>
ghstack-source-id: 16e6b40
Pull-Request: #164573
@ezyang
Copy link
Contributor Author

ezyang commented Oct 5, 2025

@pytorchbot merge

@pytorchmergebot
Copy link
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

@ezyang
Copy link
Contributor Author

ezyang commented Oct 5, 2025

@pytorchbot merge

@pytorchmergebot
Copy link
Collaborator

The merge job was canceled or timed out. This most often happen if two merge requests were issued for the same PR, or if merge job was waiting for more than 6 hours for tests to finish. In later case, please do not hesitate to reissue the merge command
For more information see pytorch-bot wiki.

@pytorchmergebot
Copy link
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
Collaborator

Merge failed

Reason: 1 jobs have failed, first few of them are: trunk / macos-py3-arm64 / test (default, 1, 3, macos-m1-stable)

Details for Dev Infra team Raised by workflow job

ezyang added a commit that referenced this pull request Oct 7, 2025
Authored with claude code.  The arg parsing is kind of horrible, open
to more suggestions.

Signed-off-by: Edward Yang <ezyang@meta.com>
ghstack-source-id: 16e6b40
Pull-Request: #164573
[ghstack-poisoned]
ezyang added a commit that referenced this pull request Oct 8, 2025
Authored with claude code.  The arg parsing is kind of horrible, open
to more suggestions.

Signed-off-by: Edward Yang <ezyang@meta.com>
ghstack-source-id: bcdd4df
Pull-Request: #164573
@ezyang
Copy link
Contributor Author

ezyang commented Oct 8, 2025

@pytorchbot merge

@pytorchmergebot
Copy link
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 pushed a commit that referenced this pull request Oct 9, 2025
…'t have decomposed (#164939)

This fixes AOTAutograd rms_norm not being bitwise equivalent to
eager, because it avoids a decomposition.  You can force the
decomposition by having the decomposition in the dispatch table,
but if eager mode wouldn't have decomposed (because it went to the fused
one), we now default to preserving the fused call by default.

This largely reverts #103275 for view ops. This means that in inference mode we could hit the wrong C++ kernel; if this occurs we should just SymInt'ify the C++ kernel.

Another neat side effect of this change is that Inductor's generated kernels for rms_norm now have rms_norm in their name.

Signed-off-by: Edward Z. Yang <ezyang@meta.com>

Pull Request resolved: #164939
Approved by: https://github.com/bdhirsh
ghstack dependencies: #164573
Chao1Han pushed a commit to Chao1Han/pytorch that referenced this pull request Oct 21, 2025
Authored with claude code.  The arg parsing is kind of horrible, open
to more suggestions.

Signed-off-by: Edward Yang <ezyang@meta.com>

Pull Request resolved: pytorch#164573
Approved by: https://github.com/albanD, https://github.com/jansel
Chao1Han pushed a commit to Chao1Han/pytorch that referenced this pull request Oct 21, 2025
…'t have decomposed (pytorch#164939)

This fixes AOTAutograd rms_norm not being bitwise equivalent to
eager, because it avoids a decomposition.  You can force the
decomposition by having the decomposition in the dispatch table,
but if eager mode wouldn't have decomposed (because it went to the fused
one), we now default to preserving the fused call by default.

This largely reverts pytorch#103275 for view ops. This means that in inference mode we could hit the wrong C++ kernel; if this occurs we should just SymInt'ify the C++ kernel.

Another neat side effect of this change is that Inductor's generated kernels for rms_norm now have rms_norm in their name.

Signed-off-by: Edward Z. Yang <ezyang@meta.com>

Pull Request resolved: pytorch#164939
Approved by: https://github.com/bdhirsh
ghstack dependencies: pytorch#164573
@github-actions github-actions bot deleted the gh/ezyang/3170/head branch November 8, 2025 02:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ciflow/inductor ciflow/trunk Trigger trunk jobs on your pull request fx Merged module: dynamo release notes: fx release notes category topic: not user facing topic category

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants