Skip to content

Add review-flydsl-kernel: legacy-spelling scanner distilled from 479 maintainer comments - #1047

Open
jhinpan wants to merge 3 commits into
mainfrom
skill/review-flydsl-kernel
Open

Add review-flydsl-kernel: legacy-spelling scanner distilled from 479 maintainer comments#1047
jhinpan wants to merge 3 commits into
mainfrom
skill/review-flydsl-kernel

Conversation

@jhinpan

@jhinpan jhinpan commented Aug 20, 2026

Copy link
Copy Markdown
Collaborator

Motivation

An agent reviewing a FlyDSL kernel PR today has two FlyDSL-specific rules (both in aiter's review-pr) and no knowledge of what this repo's maintainers actually ask for. Meanwhile the same objection gets typed by hand, over and over.

Mined from all 865 PRs here: 163 carry human review, 479 comments total.

reviewer comments PRs active
coderfeli 273 101 2026-01-05 → 2026-08-20
sjfeng1999 57 32 2026-03-20 → 2026-08-20
xudoyuan 20 13 2026-03-12 → 2026-08-14
yanguahe 11 5 2026-06-18 → 2026-08-17

46 of those 479 comments are one objection: a legacy DSL spelling where the current one already exists. That is what this PR automates.

Technical Details

One rule and one scanner — deliberately.

scan_legacy_spelling.py carries the pairs the maintainers ask for, and review-pr Step 1 runs it so the candidates are in context before the rule pass:

legacy current asked for on
ir.* / _mlir.* / ArithValue / manual wrap-unwrap internal fx types (fx.Float32, fx.Int32) #202 #250 #300 #326 #426 #850
scf.IfOp / scf.ForOp ordinary Python if / for #33 #433 #540 #582
buffer_ops.* fx.copy / a copy atom #404 #416 #894 #1032
arith wrapper raw op with the fastmath hint #433 #848 #894
SmemAllocator SharedAllocator #549 #567
make_ptr to retype a pointer recast_iter #288 #745
hand-rolled partition tiledCopy.partition_src/dst #564

It only looks at added lines, defaults to ⚠️, and groups all instances into one finding rather than spending five slots on style.

Test Plan

  1. Does the scanner fire where maintainers actually objected? For every .py file where coderfeli or sjfeng1999 left a comment of this class, check it flags that file from the PR's diff.
  2. Does each candidate rule change an outcome? Seed the pattern into the real kernels/norm/softmax_bwd_kernel.py, open it as a PR in a fork, and review it twice — with and without this skill — keeping only rules that catch something review-pr alone does not. Plus a comment-only null control.

Test Result

Scanner: 10 of 12 files flagged. Both misses were checked and are not scanner errors — in one the commented file is absent from the diff as fetched today, in the other the pattern is only on pre-existing lines, which the scanner ignores by design.

Five further families were tested and dropped. They were distilled from the same corpus and each cites real comments, but the seeded test said they add nothing:

candidate family review-pr alone + this skill kept?
default argument aliasing another buffer dropped
duplicated code path dropped
config/dispatch inside the kernel file dropped
test unreachable from the CI entry point dropped¹
unvalidated cast at the ABI boundary dropped

¹ the only one that changed an outcome, dropped with the rest for now: one rule's worth of benefit did not justify keeping a second, unvalidated section in the file. It is the first candidate to bring back.

No false-positive inflation: on the comment-only control the two arms produced 2 and 1 findings, both reasonable documentation notes rather than invented defects.

One control-arm run was discarded and re-run after it analysed a different PR's diff — review-pr Step 1 wrote to a fixed /tmp/pr.diff and two concurrent reviews overwrote each other. That is a review-pr bug, fixed separately in ROCm/aiter#4870.

Limitations

  • The seeded test is biased toward the control arm. Each seeded PR is a 4–20 line diff whose single change is the defect; real PRs bury these patterns in hundreds of lines. "Caught in a 4-line PR" does not imply "caught in a 2000-line PR", so the 4/5 is a floor for the control, not proof the dropped families are worthless — only that they show no measured benefit today.
  • No held-out real set exists for the dropped families. They were derived from nearly all their own evidence (uncited same-family instances: 1, 3, 0, 1, 3 — and most of those are over-matches), so scoring them on the cited PRs would measure memorisation. The seeded design was the substitute.
  • The scanner's pair list is a snapshot of taste through 2026-08-20 and will drift; re-mine before trusting it.
  • Nothing here judges correctness or performance — review-pr and validate-kernel-pr do that.

…view history

An agent reviewing a FlyDSL kernel PR currently has two rules for FlyDSL (in
aiter's review-pr) and no knowledge of what this repo's maintainers actually ask
for. This adds that, taken from the history rather than invented.

Corpus: all 865 PRs, of which 163 carry human review, 479 comments total.
coderfeli (273 comments over 101 PRs, Jan-Aug 2026) and sjfeng1999 (57 over 32)
dominate; the taste is consistent enough across eight months to encode. Every
rule cites the PRs the objection was actually made on.

Six families, ordered by how often they occurred:

  F1 legacy spelling where the current one exists -- 46 of the 479 comments, by
     far the largest. ir.*/ArithValue -> fx types, scf.If -> plain Python if,
     buffer_ops -> fx.copy, SmemAllocator -> SharedAllocator, make_ptr ->
     recast_iter. Ships as scan_legacy_spelling.py rather than prose: validated
     against the files maintainers commented on, it flags 10 of 12; the two it
     does not flag are cases where the pattern is not on an added line.
  F2 a default argument that silently aliases another buffer (yanguahe #844 filed
     three blockers on one PR for this; the same shape recurred in #629)
  F3 duplicated code paths that should be shared
  F4 config/dispatch/tile selection living inside the kernel file
  F5 a new test the entry point CI runs cannot reach
  F6 unvalidated cast at the C ABI boundary

It deliberately does not restate flydsl-kernel-authoring or kernel-code-cleanup,
does not duplicate review-pr's correctness rules, and does not judge performance.

F1 is a scanner and not a rule for a measured reason: across four controlled arms
on 14 PRs, a rule rewritten in prose caught 0 of 3 of the defects it targeted,
including after the instruction was moved to where the agent reliably executes it.
Copilot AI lite review requested due to automatic review settings August 20, 2026 23:39

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Five of the six families are removed before merge because a controlled test said
they add nothing. Each was seeded into the real softmax backward kernel, opened
as a PR, and reviewed twice -- once with review-pr alone, once with review-pr
plus this skill. review-pr alone already caught four of the five: the default
argument aliasing another buffer, the duplicated path, the config table inside
the kernel file, and the unvalidated cast. Only the unreachable-test family
needed this skill.

Rules that change nothing are not free. They cost reviewer attention and dilute
the findings that matter, and the output contract allows five findings per PR.

What remains is F1, the legacy-spelling family: 46 of the 479 human review
comments in this repo, shipped as scan_legacy_spelling.py, which flags 10 of the
12 files where a maintainer actually raised it.

The seeded test is biased toward the control -- a 4-to-20 line diff whose only
change is the defect is far easier to spot than the same pattern buried in a
2000-line PR -- so this is not proof the dropped families are worthless. It is
that they have no measured benefit today. The corpus analysis is retained
outside the repo and they can return with evidence; the file now states that
standard for anything added.
@jhinpan jhinpan changed the title Add review-flydsl-kernel skill distilled from this repo's review history Add review-flydsl-kernel: legacy-spelling scanner distilled from 479 maintainer comments Aug 21, 2026
…ged an outcome

Dropping F5 with the other four was wrong. It is the single family review-pr
alone missed in the seeded test (4/5 -> 5/5), so it is the only one with direct
evidence that it adds something, and it was cut for tidiness rather than for a
reason.

It returns as a scanner rather than prose, which is what the evidence supports.
scan_unreachable_tests.py parses the test file, resolves what `__main__` reaches
transitively, and reports only tests the diff ADDS. Validated three ways:

  - replaying #481 it names exactly the three tests coderfeli named
    (test_rmsnorm_fused_add and its dynamicquant/smoothquant variants -- "the
    fused/quant variants are not exercised in that path")
  - on a seeded PR adding one pytest-only test, it flags that test and nothing else
  - on a comment-only control it reports nothing

Only added tests count. A first version reported absolute state and fired on 6 of
7 untouched tests in one file, because pytest-first files with a one-line
__main__ are the norm here; that version would have been noise.

F5 pairs with validate-kernel-pr from the other side: this catches a test that
will not run, the shape grid catches shapes a running test never reaches.
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