Skip to content

[Fix] Preserve softplus names in compiled Triton kernels - #1353

Merged
yzhangcs merged 4 commits into
fla-org:mainfrom
huong8373tt-beep:fix/gdn-torch-compile-fused-recurrent
Oct 10, 2026
Merged

yzhangcs merged 4 commits into
fla-org:mainfrom
huong8373tt-beep:fix/gdn-torch-compile-fused-recurrent

Conversation

@huong8373tt-beep

@huong8373tt-beep huong8373tt-beep commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Fix unresolved softplus and softplus2 references in Inductor-generated Triton kernels. Replace platform-selected function aliases with named JIT forwarding functions so generated callers and helper definitions use matching names. The existing implementations, arithmetic, and platform selection are preserved. See also pytorch/pytorch#198050.

The final diff only changes fla/ops/utils/softplus.py.

Test plan

  • Passed offline Inductor source-collection and Triton compilation checks on PyTorch 2.9.1 / Triton 3.5.1 for both helpers and both NVIDIA/generic implementations. All four baseline cases reproduce the missing-name error; the fixed cases compile.
  • Passed pre-commit, header checks, and git diff --check.
  • GPU runtime validation remains pending in a submitted H200 job. No test files are changed in this PR.

Benchmark / NCU

Offline PTX instruction comparisons match the baseline for all four helper/implementation combinations, excluding debug information. GPU latency measurements are pending; NCU was not run.

Breaking changes

None. Public signatures, numerical algorithms, and backend selection are unchanged.

Checklist

  • I have read CONTRIBUTING.md and follow its conventions (code style, docstrings, commit prefixes).
  • I have read AGENTS.md and, where my change matches its scope, the relevant skill under .agents/skills.
  • Dependent tests pass locally or in CI, and new behavior is covered by tests where applicable (tick as N/A for changes with no testable code, e.g. docs-only).
  • Kernel changes include same-hardware before/after benchmark numbers, dense + varlen where applicable (tick as N/A when no kernel code changed).
  • This PR is minor/cosmetic-only (typo, formatting, style-only tweaks) — tick only if it is, and justify below.
  • I understand this PR exceeds 500 changed lines and have explained its single purpose and why it should stay together below.

@yzhangcs

yzhangcs commented Oct 10, 2026 •

Copy link
Copy Markdown
Member

Merged as 51e80c5. The final diff only changes fla/ops/utils/softplus.py; no test files or Dynamo-disable decorators are added.

Inductor can serialize softplus = softplus_nv as a definition named softplus_nv, while generated callers still reference softplus. Named JIT forwarding functions preserve the names of both helpers without changing arithmetic or platform selection. See also pytorch/pytorch#198050.

All four offline Inductor/Triton compilation checks pass and preserve the baseline PTX instructions. Static checks pass. GPU runtime validation and timings remain pending.

@yzhangcs yzhangcs changed the title [Fix] Keep fused recurrent GDN outside TorchDynamo [Fix] Preserve softplus helper names under torch.compile Oct 10, 2026
@yzhangcs
yzhangcs marked this pull request as draft October 10, 2026 07:43
@yzhangcs
yzhangcs marked this pull request as ready for review October 10, 2026 07:47
yzhangcs
yzhangcs previously approved these changes Oct 10, 2026
@yzhangcs yzhangcs changed the title [Fix] Preserve softplus helper names under torch.compile [Fix] Preserve softplus names in compiled Triton kernels Oct 10, 2026
@yzhangcs
yzhangcs merged commit 51e80c5 into fla-org:main Oct 10, 2026
8 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants