Repository navigation
[CK] [fix] blockscale moe header: include moe_silu.hpp and <cmath> directly - #8305
Conversation
🏷️ CI GuideRuns automatically on every PR:
Extended tests (opt-in via labels):
One backend per PR: PR title tags & labels: Reviews: |
WAITING ON AUTHORPR Self-ReviewRevision Waiting for the PR author. The readiness report will appear after the self-review answers are complete for this revision. Questions to answer in the PR description
Edit the Missing or invalid answers
Shadow mode reports what would block but keeps the status successful. Set |
…rectly
gemm_moe_ck2stages_common_blockscale.cuh uses std::isfinite and
ck::MoeSilu::ValidRuntimeLimit at lines 45 and 50 but includes neither
<cmath> nor ck/tensor_operation/gpu/element/moe_silu.hpp. It compiled only
because the non-blockscale gemm_moe_ck2stages_common.cuh happens to pull
moe_silu.hpp in.
That is a latent build break: a generated instance includes exactly one
gemm_moe_ck2stages_common{quanttype}.cuh, so the blockscale TU never sees
the other header, and touching the includes of a sibling header takes the
per_1x128 blockscale instances down with:
gemm_moe_ck2stages_common_blockscale.cuh:50:25: error: no member named
'MoeSilu' in namespace 'ck'
Seen for real in #8294, where a revert dropped those two includes from the
non-blockscale header and broke module_moe_ck2stages_abi2_f8_f8_
preshuffle_on_b16_silu_per_1x128_mulWeightStage2_runtime_swiglu_limit.
Include what is used; no behavior change.
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
65f601d to
ff27ce7
Compare
What this changes
Today
_publish.pypostscard.mdas one top-level issue comment. This changes it to post a PR review —POST /repos/{owner}/{repo}/pulls/{pr}/reviewswithevent: "COMMENT", neverAPPROVEorREQUEST_CHANGES— with the findings that can be anchored attached to the lines they are about, and everything else left in the review body.The mechanism is ported from ROCm/ATOM's
feat/atom-review-bot. ATOM's bot has never posted successfully (its machine account is flagged), so this code has never run against live GitHub. aiter's bot is live, which is why this is a draft — see "What is not verified" below.Why
Across the 61 real cards this bot has already published on this repo, there are 229 findings. 120 (52%) cite a
file:line, and 65 of those lines are inside the PR's own diff. Those are findings a reader would rather meet next to the code than half-way down a wall of prose.Measured on ten of those real cards, replayed against the diffs they were written for:
Every card gets shorter. But read the rows honestly: where nothing anchors (#5767, #6188, #6343, #5776) the card only loses ~300–400 characters, and that is the bold one-sentence PR summary the review body omits — not the mechanism working. The real win is the four rows with ≥2 anchors. On aiter, only 28% of findings anchor (65/229), against the ~50% ATOM measured, because aiter findings more often cite a line of context code the PR did not touch, or carry no
file:lineat all. 35 of 61 cards would get at least one inline comment; 26 would be unchanged in substance.The index is not decoration
The review body ends with a one-line index of every finding that went inline:
Without it, a reader of the summary alone cannot tell whether three findings exist elsewhere or none do — and an invisible finding reads exactly like a finding that was never made.
Anchoring is a privilege a finding earns
check_citations.pycomes across from ATOM and is wired in asrun_one.shstep 3c. It writescitations.txt,_lib.pycollects it into the report dir, and_publish.pyrefuses to anchor any finding carrying a citation the checker flagged — even if another citation in the same sentence would resolve. A top-level card that cites a wrong line is a flaw the reader works around; an inline comment on a wrong line lands in the author's working view and is visibly wrong, and a reviewer who gets burned once stops reading the rest.With no
citations.txtat all, nothing anchors and the whole card stays in the summary — i.e. exactly what this bot posts today. That is the intended degradation.The checker never gates the run (
|| true, not in_gates.py). It ran 1-for-2 on real cards; a 50%-precision heuristic that withholds correct reviews costs more than the defect it catches. It did earn its keep here: on #5776 it flaggedaiter/mla.py:2693, and that finding correctly lost its inline slot.Degrade-to-summary
A review is all-or-nothing: one
comments[]entry naming a line GitHub will not accept fails the whole call, summary included — strictly worse than the issue comment this replaces. So a refusal retries the same endpoint with the anchors folded back into the body and says[ANCHORS REFUSED -- folded into summary]. A review that silently sheds half its findings reads exactly like a review that only had the other half. Two tests pin this.Adapted, not transcribed
Where aiter differs from ATOM and what changed as a result:
SKILL.mdwritesReview (advisory):, not ATOM'sReview:, and adds aPerf (advisory|deterministic):line ATOM has no counterpart for. ATOM's literal"Review:"/"Validation"prefixes would have dropped all three status lines, leaving a summary with no verdict in it. The summary now matches on the bare word and keeps every one, in card order. Pinned by a test.BOTis overridable viaAITER_BOT_NAME; the dedup marker is deliberately not derived from it, or a box with that var set would repost over every review the real bot already published. Andalready_posted()now searches both the issues-comments and the reviews endpoints — aiter's markers are sitting in live issue comments right now, and a check that only read reviews would repost on top of all of them. Both pinned by tests.AITER_BOT_TOKEN(_FILE),AITER_BOT_REPO, repo defaultROCm/aiter, status file.aiter-review-status, annotation titleaiter-bot— all kept as aiter had them._api_raw()(the.diffmedia type) is new; aiter had no caller for it.check_citations.pyprovenance. Its measurements are ATOM's and have not been rerun on aiter's cards; the docstring now says so instead of presenting them as local facts. Its "ambiguous bare basename" comment was recounted against this tree (aiter has 8utils.py, 7quant.py)._lib.py.citations.txtjoinsOPTIONAL, notREQUIRED: a run whose worker died before writing a card has no citations to check, and absence is not a defect._publish.pywas ATOM's minus the anchoring work, plus the env-overridableREPO/BOT; both overrides are kept..github/scripts/pr_self_review.pyis a separate system that PATCHes its own comment in place. It is not this skill and nothing here goes near it. The workflow YAML is also untouched.Guards
check_prompts.pygains three checks:check_publish_review_is_advisory— the event staysCOMMENT,APPROVE/REQUEST_CHANGESappear nowhere in the file, and there is exactly one POST call site,pulls/{pr}/reviews.check_publish_needs_post_flag—_publish.pyfalls back to~/.git-credentialson the self-hosted box, a human PAT with write access, soGITHUB_TOKENscoping does not stop it posting at all; the missing--postflag is the only closure. If the workflow ever grantsissues: writeorpull-requests: write, the invocation must pass--postexplicitly.check_anchoring_has_a_citation_check—run_one.sh→citations.txt→_lib.py→_publish.pycannot be half-removed in silence, because that degradation looks identical to a card whose findings simply cite nothing.selftest.shnow runs_publish_test.py(35 cases: the--postclosure, the anchoring rule, dedup, the degrade-to-summary fallback), and says out loud whenpytestis absent rather than passing over it — a check that did not run is not a check that passed.Verification, verbatim, on a clean tree built with
git archive HEAD(Baseline on
origin/mainwas93 green / 0 redandOK: 0 drift(s); the extra green is the new pytest block.)preflight.shon the same tree:20 green / 1 red. The red is pre-existing and environmental — the self-hosted runner is not installed as a systemd service — and is untouched by this change.What is verified live, and what still is not
A real review was posted by this code on 2026-11-03 —
pullrequestreview-5749640123,
this PR reviewing itself at
72d8c7c3baa9. What GitHub actually stored, read backthrough the API:
That settles the three things the anchor rules were only reasoned about: the API
accepts the payload as built, a range anchor resolves to the span rather than its
first line, and
event: "COMMENT"lands asCOMMENTED— the bot cannot approve orrequest changes.
citations.txtwas produced by a realrun_one.shin the same run(
CITATIONS: every cited file:line resolves (1 proximity note(s))), and the runclosed 7 gates green with 3 findings, all 3 surviving independent refutation.
Still not verified:
were accepted, so the refusal path stayed on the stub that rejects any payload
carrying
comments[]. It is untested where it matters most, and a review isall-or-nothing, so this is the residual risk this PR carries.
AITER_BOT_TOKEN's scope is still unconfirmed by use. The live post was made witha classic PAT carrying
repo(zufayu), not with the bot's token. Creating a reviewneeds
Pull requests: writewhere an issue comment needs onlyIssues: write, so afine-grained PAT carrying only the latter would fail every review and lose the card —
a regression the anchor fallback does not cover, because it handles a bad anchor,
not a token that cannot create reviews at all. The first run under the bot's own token
is the thing to watch.
still matches the SHA in the card's marker, so those diffs are the ones the findings
were written against. The 61-card population figures used current diffs, so for PRs
that have moved since review they are an approximation.
leaves the comment on the older commit — observed here, where the finding posted was
already fixed at head. In production the window is one job; by hand it is as long as
you take.
Landed checks
Done, in this order:
_publish.py <pr> --payloadon this PR and read the JSON, then--postfor real. Both outputs are quoted above. The remaining step for whoever mergesthis is the first run under
AITER_BOT_TOKENrather than a personal PAT.🤖 Generated with Claude Code
PR Self-Review
Reviewed revision
17936b2e7c56Behavior and intent
_publish.pyposted the review card as one top-level issue comment. On ten realaiter-botcards that comment averages 3300 characters of dense prose, and a singlefinding averages ~900 — a paragraph each, in a wall nobody reads to the end. Half the
findings cite a
file:line, so some of them can be attached to the code they are aboutinstead.
It now posts
POST /pulls/{n}/reviewswithevent: "COMMENT"— neverAPPROVEorREQUEST_CHANGES; this bot does not gate merges — anchoring the findings whose citedline is inside the diff, and keeping the rest, plus a one-line index of the anchored
ones, in the review body. The index matters: without it a reader of the summary cannot
tell whether findings exist elsewhere or none do, and an invisible finding reads exactly
like one that was never made.
Anchoring is gated on
check_citations.py, ported here from ATOM along with therun_one.shstep and_lib.OPTIONALentry that produce and collectcitations.txt.A finding whose citation the checker could not resolve is not anchored: an inline
comment on the wrong line lands in the author's working view and is visibly wrong, and
a reviewer burned once stops reading the rest.
Three further changes landed here because this PR's own review found them, and each is
the same defect wearing a different hat — a check that does not run looks exactly like
a check that passes:
errexit, producing no cardat all. One missing optional import took the whole review down, which reads to the
person waiting on it like the bot being offline. The integrity checks stay fail-closed
— evidence that does not match this PR's head, base or patch is still never used — but
rejecting it now degrades the review and records why, instead of deleting it.
errexitkilledrun_one.shinside the fetch pipelinebefore the classification could run, and the exit trap wrote a status file while
printing nothing, so the log ended mid-sentence. The traps now speak, and a spent
GitHub quota is told apart from a token fault and from an account GitHub has
restricted (60 core calls with GraphQL at 0), because only one of those is fixed by
waiting.
flagged_citations()read a crashed checker as a clean verdict.check_citations.pyraised
NameErroron every call,run_one.sh's|| trueswallowed it, and thetraceback in
citations.txtreturned an empty flagged-set — "every citation checksout" — so findings anchored with no checking at all, which is precisely what the
checker exists to prevent. Absence of a
CITATIONSverdict line now means the checkerdid not run, matching the contract this module's own docstring already stated.
Validation and unverified scope
Validated, on a clean tree built with
git archive HEAD:Baseline on
origin/mainbefore the change: 93 green / 0 red, 0 drift;_publish_test.pydoes not exist there, so all 35 cases are new. Measured on ten realpublished cards replayed against the diffs they were written for: 36 findings, 11
anchored, summary 33025 → 24173 characters (−27%). The win is concentrated in the four
cards with ≥2 anchors; cards where nothing anchors barely shrink.
Validated against the live API, on this PR, 2026-11-03, hardware irrelevant (one
gh apicall from a CPU box):The run that produced that card was a real
run_one.shagainst this repo: 7 gatesgreen,
citations.txta genuine verdict (every cited file:line resolves, 1 proximitynote), 3 findings, 3 surviving independent refutation.
Unverified, and listed above in full: the degrade-to-summary fallback has never fired
against the real API, because the anchors were accepted;
AITER_BOT_TOKEN's scope isstill unconfirmed by use, since the live post used a personal PAT with
repo; and the61-card population figures use current diffs, so for PRs that moved after review they
are an approximation.
One honesty note on method: three of the defects fixed in this PR were found by this
bot reviewing this PR, and two of those were in code written the same day — including a
test suite that passed only because it ran the extracted shell region under bare
set -ewhile the real script runsset -euo pipefail, so every classification itclaimed to cover was unreachable in production.
PR-specific question
The boundary this introduces: a review is all-or-nothing. GitHub rejects the entire
call — summary included — if any single
comments[]entry names a line it will notaccept. The old single comment either posted or did not; after this change, one bad
anchor could lose a whole review, findings and all. That is a strictly worse failure
than the one it replaces, so it is covered three ways:
finding only earns one if
check_citations.pyresolved its citation. A citation thechecker could not vouch for — including one it never checked, because it crashed —
forfeits the slot.
do_postretries the same endpoint with the anchors folded back into thebody and says
[ANCHORS REFUSED -- folded into summary]. Two tests pin that path,including that the folded body still carries the anchored finding's full text. A
review that silently sheds half its findings reads exactly like one that only ever
had the other half.
summary alone can tell that findings exist elsewhere rather than inferring there are
none.
The evidence is uneven, and the gap is in the most important place. Paths 1 and 3
are now covered by a live call: a range anchor was accepted and stored on the span
(
start_line=211 line=248). Path 2 — the refusal — has only ever run against a stubthat rejects any payload with
comments[], because the real API accepted ours. Thefallback is the thing standing between one bad anchor and a lost review, and it is the
one piece still unproven against the API it exists to survive.
Changed op tests
None— noop_tests/file is touched. The change is confined to.claude/skills/review-pr/.Update — anchors point at the section, and what cannot be anchored gets a link
The anchoring above attaches a finding to one line. Two follow-on changes, both measured
on this bot's own archived cards.
1. Range anchors
25 of 221 archived findings cite a line range —
layernorm.py:1002-1012— and everyone was anchored to line 1002 alone, so the reader saw a comment pinned to one line of a
block the finding is about, which reads as a claim about that line. GitHub spells a span
as
start_line+linewith astart_side/sidefor each end; a cited range is nowanchored as one.
Both endpoints and every line between must be commentable. That is exactly "inside one
hunk" —
commentable()holds one contiguous run per hunk — and checking the two endpointsalone would accept a span across the gap between hunks, which is a malformed range, which
fails the whole review. When only part of the span is in the diff, the end that is takes
a single-line anchor rather than the finding being dropped.
The span pattern is deliberately tight — ASCII hyphen, no surrounding whitespace. A loose
one reads the real card sentence
flash_kda.py:381 — 6 published tuning candidatesas thebackwards span
381..6. Over 221 findings the tight form matched 25 spans and no falsepositive; the loose form added that one sentence and nothing true.
2. Permalinks for what cannot be anchored
A citation whose line the diff does not reach cannot be anchored — GitHub is right to
refuse it — and used to sit in the summary as bare
moe.py:5220text the reader had to goand find. It now also gets a blob permalink pinned to the head SHA, alone on its own
line, which is the only place GitHub expands one into the code it names. Pinned and not a
branch: a link that drifts off the code it was written about is a wrong anchor arriving
late. The finding's own
path:linetext is untouched — the link is in addition.Neither is invented
Both run through the gate anchoring already had. A citation
check_citations.pyflagged,or a card it never ran on, gets no anchor and no link. A path that does not resolve to
a file this PR touched gets no link either: a blob URL built from an unresolved basename is
a guess, and a link to the wrong code is worse than no link, for the same reason a wrong
anchor is.
Measured
Replaying eight real cards against the diffs they were written for — 37 findings:
Auditing every span citation in the 57-card corpus: 23 of 35 span-anchor cleanly, 1
falls back to an endpoint (part of the span is outside the diff), and 11 resolve to no file
in the diff — a vLLM path, an ambiguous basename matching two changed files, context code
the PR does not touch — and so are correctly left alone. None was too wide for
MAX_SPAN.Replaying also found a defect this change introduced: when a span collapses to one endpoint
the summary index stripped
path:563and left the line opening with a bare-569. Fixed,and pinned by a test.
The all-or-nothing boundary, again
A malformed span is a new way to fail the whole call. The degrade-to-summary fallback
covers it like any other refusal, and a test now pins that a refused range review degrades
with the span finding's text intact and folded as
path:101-104, not as a bare line._publish_test.pyis new in this PR and carries 35 cases.check_prompts.pygains two drift checks thatbuild a review over a synthetic two-hunk diff and assert the shape GitHub will take —
start_line < line, matching sides, span inside one hunk, permalinks gated — rather thanthe source that produced it.
Verified against the real API
A range anchor was posted and read back:
start_line=211 line=248 side=RIGHT start_side=RIGHT, stored on the span, not collapsed to its first line. Thehunk-containment rule held on a real diff. What remains untested is the refusal path —
the anchors were accepted, so the degrade-to-summary fallback has still only ever run
against a stub.