Skip to content

[Helion + torch.compile] Allow multi-output template fusion logic override in TemplateBuffer#175186

Closed
yf225 wants to merge 1 commit intomainfrom
helion_torch_compile_prologue_epilogue_fusion_pr2
Closed

[Helion + torch.compile] Allow multi-output template fusion logic override in TemplateBuffer#175186
yf225 wants to merge 1 commit intomainfrom
helion_torch_compile_prologue_epilogue_fusion_pr2

Conversation

@yf225
Copy link
Copy Markdown
Contributor

@yf225 yf225 commented Feb 17, 2026

Move is_multi_outputs_template and can_fuse_multi_outputs_template onto TemplateBuffer as virtual methods so that subclasses (e.g. HelionTemplateBuffer) can override fusion behavior.

Design doc: pytorch/helion#1346

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

@yf225 yf225 requested review from eellison, jansel and oulgen February 17, 2026 21:10
@pytorch-bot
Copy link
Copy Markdown

pytorch-bot bot commented Feb 17, 2026

🔗 Helpful Links

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

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

✅ No Failures

As of commit 081c94d with merge base fb9623f (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
Copy link
Copy Markdown

pytorch-bot bot commented Feb 17, 2026

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.

@yf225 yf225 added the topic: not user facing topic category label Feb 17, 2026
@yf225 yf225 force-pushed the helion_torch_compile_prologue_epilogue_fusion_pr2 branch 3 times, most recently from 793c14a to c5a6242 Compare February 18, 2026 05:42
Comment on lines +5211 to +5213
def can_fuse_multi_outputs_template(
self, node1: BaseSchedulerNode, node2: BaseSchedulerNode
) -> bool:
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.

This adds some risk of circular dependency between scheduler.py and ir.py. Any reason that this method can not be in scheduler.py.

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.

Made some changes to this part, but I think we still need an overridable method in TemplateBuffer so that HelionTemplateBuffer can override it to implement custom fusion decisions

@yf225 yf225 force-pushed the helion_torch_compile_prologue_epilogue_fusion_pr2 branch 6 times, most recently from 3e864b0 to 11609b2 Compare February 18, 2026 23:47
@yf225 yf225 requested a review from shunting314 February 18, 2026 23:54
@yf225 yf225 force-pushed the helion_torch_compile_prologue_epilogue_fusion_pr2 branch from 11609b2 to 081c94d Compare February 19, 2026 00:12
@yf225
Copy link
Copy Markdown
Contributor Author

yf225 commented Feb 19, 2026

@pytorchbot merge

@pytorch-bot pytorch-bot bot added the ciflow/trunk Trigger trunk jobs on your pull request label Feb 19, 2026
@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

norx1991 pushed a commit that referenced this pull request Feb 24, 2026
…rride in TemplateBuffer (#175186)

Move `is_multi_outputs_template` and `can_fuse_multi_outputs_template` onto `TemplateBuffer` as virtual methods so that subclasses (e.g. `HelionTemplateBuffer`) can override fusion behavior.

Design doc: pytorch/helion#1346

Pull Request resolved: #175186
Approved by: https://github.com/shunting314
@github-actions github-actions bot deleted the helion_torch_compile_prologue_epilogue_fusion_pr2 branch March 22, 2026 02:23
EmanueleCoradin pushed a commit to EmanueleCoradin/pytorch that referenced this pull request Mar 30, 2026
…rride in TemplateBuffer (pytorch#175186)

Move `is_multi_outputs_template` and `can_fuse_multi_outputs_template` onto `TemplateBuffer` as virtual methods so that subclasses (e.g. `HelionTemplateBuffer`) can override fusion behavior.

Design doc: pytorch/helion#1346

Pull Request resolved: pytorch#175186
Approved by: https://github.com/shunting314
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants