Skip to content

[inductor] Add AotOnlyBuffer for AOTI codegen - #182303

Closed
desertfire wants to merge 2 commits into
gh/desertfire/705/basefrom
gh/desertfire/705/head
Closed

desertfire wants to merge 2 commits into
gh/desertfire/705/basefrom
gh/desertfire/705/head

Conversation

@desertfire

@desertfire desertfire commented May 4, 2026 •

Copy link
Copy Markdown
Contributor

Stack from ghstack (oldest at bottom):

Add AotOnlyBuffer(IndentedBuffer), a mirror with flipped defaults for
pure-AOTI codegen. Base IndentedBuffer gets stub methods with pure-JIT
defaults (writeline_jit=writeline, writeline_aot=noop, splice_jit=splice,
splice_aot=noop); AotOnlyBuffer flips them so writeline_aot/splice_aot
write while writeline_jit/splice_jit drop.

This lets call sites use writeline_jit/writeline_aot uniformly across
pure-JIT and pure-AOTI without sprinkling V.graph.aot_mode checks.
make_codegen_buffer() picks the right type per mode.

Authored with Claude

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

Add AotOnlyBuffer(IndentedBuffer), a mirror with flipped defaults for
pure-AOTI codegen. Base IndentedBuffer gets stub methods with pure-JIT
defaults (writeline_jit=writeline, writeline_aot=noop, splice_jit=splice,
splice_aot=noop); AotOnlyBuffer flips them so writeline_aot/splice_aot
write while writeline_jit/splice_jit drop.

This lets call sites use writeline_jit/writeline_aot uniformly across
pure-JIT and pure-AOTI without sprinkling V.graph.aot_mode checks.
make_codegen_buffer() picks the right type per mode.

Authored with Claude

[ghstack-poisoned]
@pytorch-bot

pytorch-bot Bot commented May 4, 2026 •

Copy link
Copy Markdown

🔗 Helpful Links

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

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

✅ No Failures

As of commit 7458100 with merge base 004acb4 (image):
💚 Looks good so far! There are no failures yet. 💚

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

@pytorch-bot

pytorch-bot Bot commented May 4, 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.

Add AotOnlyBuffer(IndentedBuffer), a mirror with flipped defaults for
pure-AOTI codegen. Base IndentedBuffer gets stub methods with pure-JIT
defaults (writeline_jit=writeline, writeline_aot=noop, splice_jit=splice,
splice_aot=noop); AotOnlyBuffer flips them so writeline_aot/splice_aot
write while writeline_jit/splice_jit drop.

This lets call sites use writeline_jit/writeline_aot uniformly across
pure-JIT and pure-AOTI without sprinkling V.graph.aot_mode checks.
make_codegen_buffer() picks the right type per mode.

Authored with Claude

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

[ghstack-poisoned]
@pytorchmergebot

Copy link
Copy Markdown
Collaborator

Starting merge as part of PR stack under #182304

2 similar comments
@pytorchmergebot

Copy link
Copy Markdown
Collaborator

Starting merge as part of PR stack under #182304

@pytorchmergebot

Copy link
Copy Markdown
Collaborator

Starting merge as part of PR stack under #182304

pytorchmergebot pushed a commit that referenced this pull request May 6, 2026
…182304)

PythonWrapperCodegen.__init__ now constructs self.header / self.prefix /
self.wrapper_call via make_codegen_buffer(), which returns AotOnlyBuffer
in AOT mode and plain IndentedBuffer otherwise. CppWrapperCpu picks up
the right type automatically — no override needed since aot_mode is the
graph-level flag that drives the choice.

Authored with Claude

Pull Request resolved: #182304
Approved by: https://github.com/angelayi
ghstack dependencies: #182264, #182265, #182303
Alokksinha00 pushed a commit to Alokksinha00/pytorch that referenced this pull request May 15, 2026
Add AotOnlyBuffer(IndentedBuffer), a mirror with flipped defaults for
pure-AOTI codegen. Base IndentedBuffer gets stub methods with pure-JIT
defaults (writeline_jit=writeline, writeline_aot=noop, splice_jit=splice,
splice_aot=noop); AotOnlyBuffer flips them so writeline_aot/splice_aot
write while writeline_jit/splice_jit drop.

This lets call sites use writeline_jit/writeline_aot uniformly across
pure-JIT and pure-AOTI without sprinkling V.graph.aot_mode checks.
make_codegen_buffer() picks the right type per mode.

Authored with Claude

Pull Request resolved: pytorch#182303
Approved by: https://github.com/angelayi
ghstack dependencies: pytorch#182264, pytorch#182265
Alokksinha00 pushed a commit to Alokksinha00/pytorch that referenced this pull request May 15, 2026
…ytorch#182304)

PythonWrapperCodegen.__init__ now constructs self.header / self.prefix /
self.wrapper_call via make_codegen_buffer(), which returns AotOnlyBuffer
in AOT mode and plain IndentedBuffer otherwise. CppWrapperCpu picks up
the right type automatically — no override needed since aot_mode is the
graph-level flag that drives the choice.

Authored with Claude

Pull Request resolved: pytorch#182304
Approved by: https://github.com/angelayi
ghstack dependencies: pytorch#182264, pytorch#182265, pytorch#182303
@github-actions
github-actions Bot deleted the gh/desertfire/705/head branch June 6, 2026 02:28
aperson30 pushed a commit to aperson30/pytorch that referenced this pull request Jun 20, 2026
Add AotOnlyBuffer(IndentedBuffer), a mirror with flipped defaults for
pure-AOTI codegen. Base IndentedBuffer gets stub methods with pure-JIT
defaults (writeline_jit=writeline, writeline_aot=noop, splice_jit=splice,
splice_aot=noop); AotOnlyBuffer flips them so writeline_aot/splice_aot
write while writeline_jit/splice_jit drop.

This lets call sites use writeline_jit/writeline_aot uniformly across
pure-JIT and pure-AOTI without sprinkling V.graph.aot_mode checks.
make_codegen_buffer() picks the right type per mode.

Authored with Claude

Pull Request resolved: pytorch#182303
Approved by: https://github.com/angelayi
ghstack dependencies: pytorch#182264, pytorch#182265
aperson30 pushed a commit to aperson30/pytorch that referenced this pull request Jun 20, 2026
…ytorch#182304)

PythonWrapperCodegen.__init__ now constructs self.header / self.prefix /
self.wrapper_call via make_codegen_buffer(), which returns AotOnlyBuffer
in AOT mode and plain IndentedBuffer otherwise. CppWrapperCpu picks up
the right type automatically — no override needed since aot_mode is the
graph-level flag that drives the choice.

Authored with Claude

Pull Request resolved: pytorch#182304
Approved by: https://github.com/angelayi
ghstack dependencies: pytorch#182264, pytorch#182265, pytorch#182303
gplutop7 pushed a commit to gplutop7/pytorch that referenced this pull request Jul 15, 2026
Add AotOnlyBuffer(IndentedBuffer), a mirror with flipped defaults for
pure-AOTI codegen. Base IndentedBuffer gets stub methods with pure-JIT
defaults (writeline_jit=writeline, writeline_aot=noop, splice_jit=splice,
splice_aot=noop); AotOnlyBuffer flips them so writeline_aot/splice_aot
write while writeline_jit/splice_jit drop.

This lets call sites use writeline_jit/writeline_aot uniformly across
pure-JIT and pure-AOTI without sprinkling V.graph.aot_mode checks.
make_codegen_buffer() picks the right type per mode.

Authored with Claude

Pull Request resolved: pytorch#182303
Approved by: https://github.com/angelayi
ghstack dependencies: pytorch#182264, pytorch#182265
gplutop7 pushed a commit to gplutop7/pytorch that referenced this pull request Jul 15, 2026
…ytorch#182304)

PythonWrapperCodegen.__init__ now constructs self.header / self.prefix /
self.wrapper_call via make_codegen_buffer(), which returns AotOnlyBuffer
in AOT mode and plain IndentedBuffer otherwise. CppWrapperCpu picks up
the right type automatically — no override needed since aot_mode is the
graph-level flag that drives the choice.

Authored with Claude

Pull Request resolved: pytorch#182304
Approved by: https://github.com/angelayi
ghstack dependencies: pytorch#182264, pytorch#182265, pytorch#182303
aws-kingrj pushed a commit to amazon-contributing/upstream-to-pytorch that referenced this pull request Jul 29, 2026
Add AotOnlyBuffer(IndentedBuffer), a mirror with flipped defaults for
pure-AOTI codegen. Base IndentedBuffer gets stub methods with pure-JIT
defaults (writeline_jit=writeline, writeline_aot=noop, splice_jit=splice,
splice_aot=noop); AotOnlyBuffer flips them so writeline_aot/splice_aot
write while writeline_jit/splice_jit drop.

This lets call sites use writeline_jit/writeline_aot uniformly across
pure-JIT and pure-AOTI without sprinkling V.graph.aot_mode checks.
make_codegen_buffer() picks the right type per mode.

Authored with Claude

Pull Request resolved: pytorch#182303
Approved by: https://github.com/angelayi
ghstack dependencies: pytorch#182264, pytorch#182265
aws-kingrj pushed a commit to amazon-contributing/upstream-to-pytorch that referenced this pull request Jul 29, 2026
…ytorch#182304)

PythonWrapperCodegen.__init__ now constructs self.header / self.prefix /
self.wrapper_call via make_codegen_buffer(), which returns AotOnlyBuffer
in AOT mode and plain IndentedBuffer otherwise. CppWrapperCpu picks up
the right type automatically — no override needed since aot_mode is the
graph-level flag that drives the choice.

Authored with Claude

Pull Request resolved: pytorch#182304
Approved by: https://github.com/angelayi
ghstack dependencies: pytorch#182264, pytorch#182265, pytorch#182303
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.

3 participants