[inductor] Fix cpp-wrapper SyntaxError when Triton kernel has docstrings#176796
[inductor] Fix cpp-wrapper SyntaxError when Triton kernel has docstrings#176796desertfire wants to merge 2 commits intogh/desertfire/668/basefrom
Conversation
With autotune_at_compile_time=False, the Triton kernel source is embedded in a C++ raw string inside the outer Python r"""...""" wrapper. If a user-defined Triton kernel contains """ (e.g. a docstring), it prematurely terminates the outer string, causing a SyntaxError. Fix by converting """ to escaped '''. Authored with Claude. [ghstack-poisoned]
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/176796
Note: Links to docs will display an error until the docs builds have been completed. ✅ You can merge normally! (10 Unrelated Failures)As of commit 6666515 with merge base dc49385 ( FLAKY - The following jobs failed but were likely due to flakiness present on trunk:
BROKEN TRUNK - The following jobs failed but were present on the merge base:👉 Rebase onto the `viable/strict` branch to avoid these failures
UNSTABLE - The following job is marked as unstable, possibly due to flakiness on trunk:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
With autotune_at_compile_time=False, the Triton kernel source is embedded in a C++ raw string inside the outer Python r"""...""" wrapper. If a user-defined Triton kernel contains """ (e.g. a docstring), it prematurely terminates the outer string, causing a SyntaxError. Fix by converting """ to escaped '''. Authored with Claude. ghstack-source-id: c5ef4a0 Pull Request resolved: #176796
This PR needs a
|
…has docstrings" With autotune_at_compile_time=False, the Triton kernel source is embedded in a C++ raw string inside the outer Python r"""...""" wrapper. If a user-defined Triton kernel contains """ (e.g. a docstring), it prematurely terminates the outer string, causing a SyntaxError. Fix by converting """ to escaped '''. 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]
Summary: With autotune_at_compile_time=False, the Triton kernel source is embedded in a C++ raw string inside the outer Python r"""...""" wrapper. If a user-defined Triton kernel contains """ (e.g. a docstring), it prematurely terminates the outer string, causing a SyntaxError. Fixed by adding backslash. ghstack-source-id: 774a85f Pull Request resolved: #176796
|
@pytorchbot merge |
Merge failedReason: This PR needs a If not, please add the To add a label, you can comment to pytorchbot, for example For more information, see Details for Dev Infra teamRaised by workflow job |
This PR needs a
|
|
@pytorchbot merge |
Merge startedYour 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 |
…ngs (pytorch#176796) With autotune_at_compile_time=False, the Triton kernel source is embedded in a C++ raw string inside the outer Python r"""...""" wrapper. If a user-defined Triton kernel contains """ (e.g. a docstring), it prematurely terminates the outer string, causing a SyntaxError. Fixed by adding backslash. Authored with Claude. Pull Request resolved: pytorch#176796 Approved by: https://github.com/Skylion007, https://github.com/mlazos ghstack dependencies: pytorch#176745
Stack from ghstack (oldest at bottom):
With autotune_at_compile_time=False, the Triton kernel source is
embedded in a C++ raw string inside the outer Python r"""..."""
wrapper. If a user-defined Triton kernel contains """ (e.g. a
docstring), it prematurely terminates the outer string, causing a
SyntaxError. Fixed by adding backslash.
Authored with Claude.
cc @voznesenskym @penguinwu @EikanWang @jgong5 @Guobing-Chen @XiaobingSuper @zhuhaozhe @blzheng @wenzhe-nrv @jiayisunx @ipiszy @kadeng @muchulee8 @amjames @chauhang @aakhundov @coconutruben @jataylo @mlazos