Skip to content

ROCm skinny linear: request fp fusion on both launches and document the constexpr parameters - #19047

Merged
danielhanchen merged 1 commit into
mainfrom
fix/rocm-skinny-kernel-conventions
Nov 23, 2026
Merged

danielhanchen merged 1 commit into
mainfrom
fix/rocm-skinny-kernel-conventions

Conversation

@danielhanchen

Copy link
Copy Markdown
Member

Summary

Repo tests (CPU, rest) fails on main since #18874:

tests/test_triton_fp_fusion.py::test_every_launch_requests_fp_fusion
E   AssertionError: Triton launches without enable_fp_fusion: ['rocm_skinny_linear.py:269:_skinny_linear_kernel', 'rocm_skinny_linear.py:302:_splitk_reduce_kernel']
tests/test_triton_constexpr_comments.py::test_every_constexpr_line_has_a_comment
E   AssertionError: tl.constexpr parameters without a comment:
E     unsloth/kernels/rocm_skinny_linear.py:66 _skinny_linear_kernel.HAS_LORA
...

Root cause

The new kernel, not the guards. #18874 added unsloth/kernels/rocm_skinny_linear.py without the two conventions every other kernel follows:

  • Triton 3.9.0 changes the enable_fp_fusion default to False, so a launch that does not ask for it loses FMA contraction there: slower, and numerically different from every other kernel. Both launches (_skinny_linear_kernel and _splitk_reduce_kernel) relied on the default.
  • Its nine tl.constexpr parameters had no comment saying what they are.

Fix

unsloth/kernels/rocm_skinny_linear.py only:

  • enable_fp_fusion = True on both launches. Triton 3.8 and earlier already default to True (checked in 3.8.0's AMD and NVIDIA backend options), so the compiled kernels do not change there; 3.9.0 defaults to False, and this keeps them fused.
  • A short comment on each tl.constexpr parameter.

Testing

  • tests/test_triton_fp_fusion.py, tests/test_triton_constexpr_comments.py: pass (both failed on main).
  • tests/test_rocm_skinny_linear.py: 34 passed; its 51 GPU cases skip on this CPU host. The launch change only makes today's default explicit.

@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-23T10:58:11.991090Z c0a1037 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🚀

Reviewed commit: c0a10379d1

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@danielhanchen
danielhanchen merged commit 4acebc5 into main Nov 23, 2026
@danielhanchen
danielhanchen deleted the fix/rocm-skinny-kernel-conventions branch November 23, 2026 10:59
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.

1 participant