Skip to content

Comment the BLOCK constexpr on the bf16 stochastic rounding kernels - #18343

Merged
danielhanchen merged 1 commit into
mainfrom
ci/bf16-sr-constexpr-comments
Nov 18, 2026
Merged

danielhanchen merged 1 commit into
mainfrom
ci/bf16-sr-constexpr-comments

Conversation

@danielhanchen

Copy link
Copy Markdown
Member

Comment the BLOCK constexpr on the bf16 stochastic rounding kernels

tests/test_triton_constexpr_comments.py fails on main since #18282. It shows up in Repo tests (CPU, rest) on unrelated PRs, for example #18312 and #18313:

E   AssertionError: tl.constexpr parameters without a comment:
E     unsloth/optimizers/bf16_stochastic_rounding.py:60 _round_kernel.BLOCK
E     unsloth/optimizers/bf16_stochastic_rounding.py:83 _adamw_kernel.BLOCK

Cause

That lint requires every tl.constexpr parameter of an Unsloth Triton kernel to sit on its own line with a comment saying what it is. It does this because each distinct constexpr value compiles a new kernel.

#18282 added _round_kernel and _adamw_kernel, whose BLOCK constexpr has no comment. _round_kernel also takes it inline on the def line.

Fix

Both kernels now take BLOCK on its own line with a comment: # elements per program, fixed at _BLOCK. _round_kernel's signature is split one parameter per line to match.

No behaviour changes. The parameters and their order are unchanged, and every launch still passes BLOCK = _BLOCK (1024).

Verification

  • tests/test_triton_constexpr_comments.py: fails on main on these two lines and passes with this change.
  • tests/test_bf16_stochastic_rounding.py: 13 passed, 2 skipped on CPU across the two files.
  • ruff is clean.

@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

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

Copy link
Copy Markdown
Codex Review Summary: ❌ Failed

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

Review Status Commit Review trigger
📝 Code Review ❌ Failed 2026-11-18T15:05:27.803774Z
We couldn’t complete this review. Comment @codex review to try again.
ff68ddf PR opened
ℹ️ 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: ff68ddfd08

ℹ️ 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".

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