Skip to content

Helion + Inductor prologue / epilogue fusion#1324

Draft
yf225 wants to merge 1 commit into
mainfrom
helion_inductor_fusion_v3
Draft

Helion + Inductor prologue / epilogue fusion#1324
yf225 wants to merge 1 commit into
mainfrom
helion_inductor_fusion_v3

Conversation

@yf225
Copy link
Copy Markdown
Contributor

@yf225 yf225 commented Jan 5, 2026

NOTE: CI is failing because we need pytorch/pytorch#171683 to land first.

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Jan 5, 2026
@meta-codesync
Copy link
Copy Markdown

meta-codesync Bot commented Jan 5, 2026

@yf225 has imported this pull request. If you are a Meta employee, you can view this in D90104736.

@yf225 yf225 requested review from jansel and oulgen January 5, 2026 10:27
return out


class TestMutation(RefEagerTestDisabled, TestCase):
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.

@oulgen I added this test class to check the correctness of mutation analysis

@yf225 yf225 force-pushed the helion_inductor_fusion_v3 branch 2 times, most recently from 24b4c33 to ed56113 Compare January 5, 2026 19:31
Comment thread helion/language/memory_ops.py Outdated
subscript,
value,
store_index,
)
Copy link
Copy Markdown
Contributor Author

@yf225 yf225 Jan 5, 2026

Choose a reason for hiding this comment

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

The overall design is we insert the prologue / epilogue ops into the Helion-generated Triton kernel during hl.load / hl.store codegen. I explored several approaches and this feels the most natural, since the Inductor scheduler IR node representing the prologue / epilogue op is already at Triton statement level, so inserting them into the Helion kernel at codegen level is easiest and doesn't need to go from lower IR level to higher IR level.

@yf225 yf225 force-pushed the helion_inductor_fusion_v3 branch 2 times, most recently from e797791 to f18d7c0 Compare January 5, 2026 21:23
Comment thread test/test_torch_compile_fusion.py Outdated
self.assertIn("epilogue", code.lower())

def test_inductor_output_code_has_helion_generated_triton_kernel(self):
"""Test that Inductor-generated wrapper code contains Helion-generated Triton code."""
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.

Adding this test to show that Inductor output code contains Helion-generated Triton code.

@yf225 yf225 force-pushed the helion_inductor_fusion_v3 branch 2 times, most recently from 3833f17 to 84d588d Compare January 6, 2026 02:03
@choijon5 choijon5 requested a review from shunting314 January 6, 2026 03:41
@yf225 yf225 force-pushed the helion_inductor_fusion_v3 branch 7 times, most recently from 0a4c1ef to 487bd88 Compare January 10, 2026 03:19
@yf225 yf225 force-pushed the helion_inductor_fusion_v3 branch from 487bd88 to c924c63 Compare January 21, 2026 19:26
self._prologue_fused_once.clear()
# Ensure config is available (triggers autotuning if needed)
if self._autotune_args:
self._bound_kernel.ensure_config_exists(self._autotune_args)
Copy link
Copy Markdown
Contributor Author

@yf225 yf225 Jan 22, 2026

Choose a reason for hiding this comment

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

TODO: can this support AOT autotuning (not JIT)? if so, how does the UX of passing in a config look like?

from helion._compiler.host_function import HostFunction


def _find_mutated_inputs(
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 is extremely useful. Do you think you could land this first so that I can start using it? Thanks

mutation: more tests

up

mutation: wip
@meta-cla
Copy link
Copy Markdown

meta-cla Bot commented Apr 18, 2026

Hi @yf225!

Thank you for your pull request.

We require contributors to sign our Contributor License Agreement, and yours needs attention.

You currently have a record in our system, but the CLA is no longer valid, and will need to be resubmitted.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants