Skip to content

review-pr: correct FlyDSL D10/D10b and add D13/D14 from review outcomes - #7227

Merged
zufayu merged 3 commits into
ROCm:mainfrom
samremes:review-pr/flydsl-rule-corrections
Nov 10, 2026
Merged

zufayu merged 3 commits into
ROCm:mainfrom
samremes:review-pr/flydsl-rule-corrections

Conversation

@samremes

@samremes samremes commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Companion PR: #7226 updates the Copilot FlyDSL instructions, aiter-op-test and C5, and adds aiter/ops/flydsl/AGENTS.md. This PR leaves the C5 block alone.

Summary

Corrects two FlyDSL rules in aiter-bot's review-pr that fire on correct code, and adds two FlyDSL rules taken from bugs human reviewers caught. Also replaces the bot's stale LDS facts and adds FlyDSL facts to the refuter prompt.

Motivation

From a study of one month of review outcomes on aiter FlyDSL PRs, plus GPU checks on MI355X:

Changes

  • rules.md D10 (rewritten, 🔴): fires on a double launch (handle called right after flyc.compile with the same live args), on a runtime path that compiles with placeholder/CPU args or under COMPILE_ONLY and returns without launching, and on a preload path that dispatches. _run_compiled on a miss is explicitly clear.
  • rules.md D10b (rewritten, ⚠️): a raw arith.* op not in fx.arith.__all__ on a + line. It asks for the typed fx form, or a comment naming the missing API, and no longer asks for unwrap.
  • rules.md D13 (new, 🔴): a cache of CompiledFunctions (_run_compiled, FastJitLauncher, module dicts) whose key misses the device, a tensor's rank or unit-stride axis, constexpr/dtype choices or mode globals. Its FP self-check notes that other strides are runtime values: a padded-row view is correct (measured).
  • rules.md D14 (new, ⚠️, 🔴 with a named OOB input): the raw-pointer launch contract (device, stride, alignment, length, offsets widened to 64-bit in bytes). Its FP self-check covers cudagraph-safe wrappers and over-tight bounds that reject legal calls ([FlyDSL] [CI] [Kernel] Add fused KDA decode kernels on gfx942 and gfx950 #6026, [FlyDSL] [FMHA][gfx1250] FP8/BF8 Support. #6702).
  • rules.md HK12: drop the stale op_tests/flydsl_tests/ file count.
  • SKILL.md Step 7: LDS capacity comes from chip_info.get_lds_capacity_bytes(), and footprints are recomputed with every term (@fx.union aliases). The line count stays at the 500-line budget.
  • prompts/refuter.md: "FlyDSL facts that kill a finding", a list of the facts behind recurring false positives. It sits outside the verbatim-quoted Step 7.7 block.
  • triage.py: D13 and D14 join the flydsl and flydsl-kernel families and the fallback list; selftest.sh gains a wrapper-only derivation case. MAPPING.md is regenerated.

Testing

  • Unit tests added or updated
  • Performance benchmarks run
  • Tested on MI250X
  • Tested on MI300X

Review-tooling change. See Validation below.

Documentation

  • Docstrings updated
  • User guide updated
  • Performance guide updated
  • No documentation change is needed, with the reason stated below

The change is itself the reviewer documentation.

Dependencies

  • No new third-party dependencies added
  • New dependencies are listed and justified below

Breaking Changes

None. Rule ids D10 and D10b keep their ids with new bodies. D13 and D14 are new.

PR Self-Review

Reviewed revision

0007355

Behavior and intent

  • D10 and D10b stop firing on correct FlyDSL code and stop prescribing a double launch or a deprecated construct.
  • Two new rules check the cache-key and raw-pointer bug classes that human reviewers kept catching.
  • Refuter and Step 7 now have correct LDS facts and the FlyDSL facts behind recurring false positives.

Validation and unverified scope

  • check_prompts.py: OK: 0 drift(s).
  • triage.py expand: emits the D10, D10b, D12, D13 and D14 bodies, with no MISSING-RULE-TEXT.
  • Rebased on main 4726326bd48, after review-pr: add HK20 (submodule upstream check) and A4 (new-feature re… #6865 (A4, HK20). Conflicts in triage.py resolved by keeping both: flydsl-kernel derives A1 A4 B8 D1 D8 D12 D13 D14 P6 C5 and flydsl derives D10 D10b D12 D13 D14 C5, and ALL_RULES carries A4, HK20, D13 and D14.
  • triage.py mapping: output matches the committed MAPPING.md (46 families, 66 rule ids).
  • SKILL.md: still 500 lines.
  • selftest.sh: 95 green / 0 red on Linux (ROCm devcontainer): main's 93 plus two new wrapper-only cases asserting that flydsl derives D13 and D14.
  • D10 facts, measured on MI355X with FlyDSL 0.4.0 and 0.4.1:
    • compiling with live args launches once;
    • compiling and then calling the handle launches twice;
    • COMPILE_ONLY returns None and does not launch;
    • one CPU tensor argument plus a live GPU pointer gives no launch;
    • a null optional pointer plus a live buffer launches once;
    • _run_compiled launches once on a miss and once more on a hit.
  • D10b facts: the raw op on an fx value raises Operand 0 of operation "arith.bitcast" must be a Value, while the typed .bitcast and unwrap forms are bit-exact against x.view(torch.int32).
  • D13 facts:
    • contiguous handle on a stride-2 view: writes outside the view, while a fresh compile rejects the view;
    • padded rows: correct;
    • handle from device 0 on device 1: hipErrorInvalidDevice, printed but not raised, while a fresh compile on device 1 is correct.
  • Unverified:
    • D13/D14 precision on real PRs; a replay of the bot on recent FlyDSL PRs would show it.

PR-specific question

The PR Self-Review comment posted no path-specific question for this revision; the readiness report passed all checks other than the draft state.

Changed op tests

None.

@github-actions

Copy link
Copy Markdown
Contributor

🏷️ CI Guide

Runs automatically on every PR:

  • ✅ Pre-checks (submodule verification, code formatting)
  • ✅ Aiter op tests (gfx942 + gfx950)
  • ✅ Triton tests on MI35X (only when aiter/ops/triton/** or related paths are changed)

Extended tests (opt-in via labels):

Label Tests
ci:gfx1250-ffm-triton Run the five-shard gfx1250 FFM Triton test suite
ci:triton-300x Run an additional Triton test job on MI300X in PRs (added automatically when gfx942 configs change); main branch always runs both MI35X and MI300X
ci:triton-355 Run the full Triton test suite on MI35X, not only the tests the change affects
ci:windows Windows JIT op smoke test on the gfx1201 ROCm runner
ci:multi-gpu Aiter multi-GPU tests on the 8-GPU runner
ci:sglang SGLang integration tests: DeepSeek-R1-MXFP4 accuracy, Qwen 3.5 accuracy
ci:atom ATOM benchmark: DeepSeek-R1-0528, GPT-OSS-120B
ci:atom_full ATOM accuracy suite for PR and main models from ATOM models_accuracy.json
ci:vllm vLLM benchmark: DeepSeek-V4-Pro, MiniMax-M3-MXFP4
ci:all All standard extended tests (excludes ci:atom_full)

Only add ci:atom_full for FlyDSL or Triton upgrades.
Add labels via the sidebar or gh pr edit 7227 --add-label <label>

One backend per PR:
A PR changes one kernel backend: [Triton/Gluon] (Triton and Gluon count as one), [HIP], [ASM], [CK], [OPUS] or [FlyDSL]. If the title ends up with two backend tags, split the PR -- as stacked pull requests when one part cannot merge without the other.

PR title tags & labels:
Component tags ([Triton/Gluon], [HIP], [CK], [ASM], ...) are added to the PR title and as PR labels automatically from the changed files and re-synced on every push — change-type tags like [fix]/[Perf], op tags like [MLA], and human labels (ci:*) are left untouched. Add the no-auto-title label to stop the title rewrites; labels stay in sync either way.

@aiter-bot

aiter-bot commented Oct 30, 2026 •

Copy link
Copy Markdown

READY FOR HUMAN REVIEW

PR Self-Review

Revision 000735532b7f · mode shadow

Author self-review accepted. Readiness report:

Author answers

  • PASS — current-SHA answers are present and structurally specific
Show the author's self-review answers

Behavior and intent

- **D10 and D10b** stop firing on correct FlyDSL code and stop prescribing a double launch or a deprecated construct.
- **Two new rules** check the cache-key and raw-pointer bug classes that human reviewers kept catching.
- **Refuter and Step 7** now have correct LDS facts and the FlyDSL facts behind recurring false positives.

Validation and unverified scope

- **`check_prompts.py`:** `OK: 0 drift(s)`.
- **`triage.py expand`:** emits the D10, D10b, D12, D13 and D14 bodies, with no `MISSING-RULE-TEXT`.
- **Rebased on main `4726326bd48`**, after #6865 (A4, HK20). Conflicts in `triage.py` resolved by keeping both: `flydsl-kernel` derives `A1 A4 B8 D1 D8 D12 D13 D14 P6 C5` and `flydsl` derives `D10 D10b D12 D13 D14 C5`, and `ALL_RULES` carries A4, HK20, D13 and D14.
- **`triage.py mapping`:** output matches the committed `MAPPING.md` (46 families, 66 rule ids).
- **`SKILL.md`:** still 500 lines.
- **`selftest.sh`:** 95 green / 0 red on Linux (ROCm devcontainer): `main`'s 93 plus two new wrapper-only cases asserting that `flydsl` derives D13 and D14.
- **D10 facts, measured on MI355X with FlyDSL 0.4.0 and 0.4.1:**
  - compiling with live args launches once;
  - compiling and then calling the handle launches twice;
  - `COMPILE_ONLY` returns `None` and does not launch;
  - one CPU tensor argument plus a live GPU pointer gives no launch;
  - a null optional pointer plus a live buffer launches once;
  - `_run_compiled` launches once on a miss and once more on a hit.
- **D10b facts:** the raw op on an fx value raises `Operand 0 of operation "arith.bitcast" must be a Value`, while the typed `.bitcast` and `unwrap` forms are bit-exact against `x.view(torch.int32)`.
- **D13 facts:**
  - contiguous handle on a stride-2 view: writes outside the view, while a fresh compile rejects the view;
  - padded rows: correct;
  - handle from device 0 on device 1: `hipErrorInvalidDevice`, printed but not raised, while a fresh compile on device 1 is correct.
- **Unverified:**
  - D13/D14 precision on real PRs; a replay of the bot on recent FlyDSL PRs would show it.

PR-specific question

The PR Self-Review comment posted no path-specific question for this revision; the readiness report passed all checks other than the draft state.

Changed op tests

None.

PR state

  • PASS — pull request is marked ready for review

Copilot findings

  • PASS — no active Copilot finding lacks a substantive author reply
  • ADVISORY — Copilot did not review the current head SHA

Code and op-test hygiene

  • PASS — no committed artifact or conflict marker detected

Required CI

  • PASS — Black: passed
  • PASS — Ruff: passed
  • PASS — Repository dependency: passed
  • PASS — Aiter Test Gate: passed

Shadow mode reports what would block but keeps the status successful. Set AITER_PR_SELF_REVIEW_MODE=enforce only after reviewing real false positives.

@samremes
samremes requested a review from zufayu November 2, 2026 16:04
D10 asserted that flyc.compile does not execute and asked for cf(*args)
on the cache-miss branch. FlyDSL 0.4.0 and 0.4.1 launch on compile with
live arguments (verified on MI355X, and asserted by FlyDSL's own tests), so
the rule fired on tensor_shim._run_compiled and its fix launched twice. D10
now covers the real hazards: a double launch, no launch with placeholder
arguments or under COMPILE_ONLY, and a dispatching preload.

D10b asked for arith.unwrap() around raw arith.bitcast. It now asks for the
typed fx form instead of raw arith dialect ops, which are not stable API.

D13 (compiled-handle cache key) and D14 (raw-pointer launch contract) come
from bugs human reviewers found in the last month; D13 was reproduced on
MI355X. The refuter prompt gains the FlyDSL facts behind recurring false
positives. Step 7's LDS facts point at chip_info (gfx950 is 160 KiB).

Co-Authored-By: Claude <[email protected]>
@samremes
samremes force-pushed the review-pr/flydsl-rule-corrections branch from a1aa78b to eb7dfa2 Compare November 5, 2026 08:28
@samremes
samremes marked this pull request as ready for review November 5, 2026 08:29
@samremes
samremes requested review from a team and a balanced review from Copilot November 5, 2026 08:29

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.

🟡 Changes recommended

D14 misses wrapper-only raw-pointer launch changes because it is selected only by flydsl-kernel; the general flydsl mapping and a wrapper-only regression case need updating.

1 open issue
What changed in this PR

This PR updates aiter’s review tooling to reduce FlyDSL false positives and detect compiled-handle cache and raw-pointer contract bugs. It complements #7226 without changing the C5 guidance or kernel implementations.

Changes:

  • Corrects D10 compile-and-launch guidance and D10b raw-operation recommendations.
  • Adds D13/D14 checks and updates rule selection and the generated mapping.
  • Refreshes LDS guidance and adds FlyDSL-specific checks for rejecting false findings.
File Description
.claude/​skills/​review-pr/​triage.py Adds D13/D14 to rule-selection lists.
.claude/​skills/​review-pr/​SKILL.md Corrects LDS capacities and footprint guidance.
.claude/​skills/​review-pr/​rules.md Revises D10/D10b, adds D13/D14, and removes a stale test count.
.claude/​skills/​review-pr/​prompts/​refuter.md Adds FlyDSL facts for checking potential false positives.
.claude/​skills/​review-pr/​MAPPING.md Updates the generated family-to-rule mapping.

Review effort: Balanced

Comment thread .claude/skills/review-pr/triage.py Resolved
Copilot AI balanced review requested due to automatic review settings November 5, 2026 08:33

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.

🔵 Needs a closer look

D14 is omitted for wrapper-only raw-pointer launch changes, leaving device, layout, and capacity contract checks uncovered where they are needed.

1 open issue

Review effort: Balanced

Raw-pointer launches live in aiter/ops/flydsl/*.py, which derive the flydsl
family but not flydsl-kernel. Add D14 to flydsl, regenerate MAPPING.md, and
add a wrapper-only derivation case to selftest.sh.

Co-Authored-By: Claude <[email protected]>
Copilot AI balanced review requested due to automatic review settings November 5, 2026 08:38

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.

🟡 Changes recommended

The rules omit storage-dtype checks needed to prevent undersized-buffer writes and incorrectly impose a blanket 2 GiB limit on AMD buffer offsets.

2 open issues
1 resolved since last review

Review effort: Balanced

Comment thread .claude/skills/review-pr/rules.md Resolved
Comment thread .claude/skills/review-pr/rules.md Resolved
@zufayu

zufayu commented Nov 10, 2026

Copy link
Copy Markdown
Contributor

@aiter-bot review

@aiter-bot

Copy link
Copy Markdown

aiter-bot — queued behind 1 review(s); expect to start in about 28 min. The box reviews one PR at a time.

@zufayu

zufayu commented Nov 10, 2026

Copy link
Copy Markdown
Contributor

Checked this against #7226 and the merged result holds up — the two do not conflict, and 7226 → 7227 lands clean on current main:

selftest    142 green / 0 red
drift       OK: 0 drift(s)
MAPPING.md  matches triage.py mapping
pytest      37 passed
D10 D10b D13 D14 (and C5 from #7226) all expand — 1238–2049 chars each

The D10 correction is the part I'd call out as worth having: carrying the History: line that records what the earlier version of the rule asserted, rather than quietly replacing it. A rule that was wrong once and says so is easier to trust than one that has always claimed to be right.

One gap, and it is not caused by this PR so much as widened by it. B8 and D12 are emitted by derive():

hit("flydsl-kernel", "A1 A4 B8 D1 D8 D12 D13 D14 P6 C5")
hit("flydsl",        "D10 D10b D12 D13 D14 C5")

but neither appears in ALL_RULES. Eight HK ids (HK4–HK11) are missing from it too, so this predates the PR.

It is mild, because ALL_RULES is only read in four places — the derivation-failed, diff-too-large and underivable fallbacks, plus the rules=N/M denominator. Normal derivation expands B8 and D12 fine (2492 and 2310 chars). But the fallbacks are exactly when the full list matters most: a diff too large to derive gets handed the catalogue, and the catalogue is missing ten rules. The denominator is also understated.

ATOM's port of this skill carries a selftest for precisely this, added during the port:

t "every id derive() emits is in ALL_RULES"

which is why the drift is visible there and not here. Worth bringing back upstream — adding a rule and forgetting to register it would then turn the suite red on the spot rather than silently shrinking the fallback.

Happy to send that as its own small PR (the ten ids plus the guard) if you would rather not grow this one; you are in this file already, so whichever is less work for you.

@aiter-bot

Copy link
Copy Markdown

⚠️ aiter-bot — this review could not complete: a problem with the GLM model service, not with this PR.

GLM backend unavailable at http://localhost:30000 (deep inference probe returned '000')

@yhl-amd — please take a look.

Triage: if GLM serves but its output is malformed it may be the ATOM framework (@valarLip); if the box, GPU, disk or network is unhealthy it may be the machine (@gyohuangxin).

Re-comment @aiter-bot review once it is resolved.

@zufayu
zufayu merged commit 075695e into ROCm:main Nov 10, 2026
zufayu added a commit that referenced this pull request Nov 10, 2026
…omits (#7708)

`derive()` can emit sixty rule ids; `ALL_RULES` listed fifty-eight of them.
Missing: `B8`, `D12` (arrived with #7227) and `HK4`-`HK11`, which had been
absent for longer.

It is a quiet gap because ALL_RULES is read in only four places, and normal
derivation does not touch it -- `B8` and `D12` expand correctly today. But
those four places are the derivation-failed, diff-too-large and underivable
fallbacks, plus the `rules=N/M` denominator. The fallbacks hand the worker the
whole catalogue precisely when the deriver could not narrow it, which is the
moment a short catalogue costs most: a diff too large to derive was being
reviewed against a list missing ten rules, and nothing said so.

The ids are added beside their families, and MAPPING.md regenerated.

The second half matters more than the list. ROCm/ATOM's port of this skill
carries a selftest comparing the two sets, added during that port; it is why
the drift was visible there and not here. Ported back:

    t "every id derive() emits is in ALL_RULES"

Removing `B8` from ALL_RULES now fails it with `missing:B8` rather than
passing. Adding a rule and forgetting to register it stops being silent.

Worth recording how close this came to looking verified: the first attempt at
that regression check edited the first ` B8 ` in the file, which is prose in
an unrelated help string, and the suite stayed green -- a test that proved
nothing while appearing to prove the guard worked. The check above edits
ALL_RULES itself.

selftest 143 green / 0 red, 0 drift, MAPPING.md matches.

Co-authored-by: zufayu <[email protected]>
Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
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.

4 participants