Skip to content

[JIT] [Bugfix] Config merge: catch live duplicates that differ only in _tag - #7720

Open
eppaneamd wants to merge 3 commits into
mainfrom
eppaneamd/config-merge-tag-live-rows
Open

eppaneamd wants to merge 3 commits into
mainfrom
eppaneamd/config-merge-tag-live-rows

Conversation

@eppaneamd

@eppaneamd eppaneamd commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Summary

The tuned-config merge now reports a shape with two live rows even when their _tag labels differ. As a key, _tag
separates only flydsl_fallback rows, which lookups skip, from all other rows.

Motivation

  • update_config_files keys its duplicate-shape check on the raw _tag value (_shape_dedup_keys). The key came with
    the FlyDSL a4w4 MoE ([FlyDSL] import flydsl implement of a4w4 moe #2113), so that a flydsl_fallback row can sit beside the live row for the same shape.
  • Lookups use _tag only to skip flydsl_fallback rows: get_cfg_2stages (aiter/fused_moe.py) drops the rows whose
    label is exactly that, keys the rest on the shape and keeps the first row per shape with a warning. The FlyDSL MoE AOT
    build (aiter/aot/flydsl/moe.py) skips them after stripping whitespace.
  • _tag also carries other labels on main: fused_expert, exact-m4096-a, asm_flat_situv2,
    glm5.2_moe_pertokenfp8_large_20260831, and 0, which the merge itself writes into the rows of a table without
    the column.
  • So two live rows for one shape pass the merge when their labels differ, for example a row from a table without
    _tag (filled 0) and an untagged row from another table. The runtime then serves the row of whichever file comes
    first, and the merge's own resolution (keep the lowest us, rewrite the sources) never runs.

Changes

  • aiter/jit/core.py, _raise_on_duplicate_shapes: the key compares _tag as fallback or live, comparing the label
    exactly as get_cfg_2stages does (a padded flydsl_fallback is live). The merged table and the error message keep
    the labels as written.
  • The same function's power-table conflict check (power_merge_conflict) groups the duplicate rows on the keys as the
    duplicate check compared them: numeric cells as numbers (256 and 256.0 are one shape), the tag as fallback or
    live. Grouped on the raw cells, a power row and a latency row for one shape would fall into separate groups on a
    label or a numeric spelling, and the merge would rank one against the other and delete the loser from its source.
  • op_tests/tuning_tests/test_config_shape_collision.py: test_merge_keys_tag_as_live_or_fallback and
    test_merge_refuses_power_row_against_latency_row_keyed_differently.
  • .claude/skills/aiter-config-shape/SKILL.md: the key description says what _tag separates.
  • Not changed: the AOT build's whitespace stripping; the tuners' result dedup (aiter/utility/base_tuner.py) and the power overlay's shape coverage
    (aiter/utility/power_configs.py, _overlay_power_tables) still key on the raw _tag.

Testing

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

Documentation

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

The skill file above is the only description of the merge key; no user or performance guide covers _tag.

Dependencies

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

Breaking Changes

A merge whose tables hold two live rows for one shape under different _tag labels now raises the duplicate-shape
error and rewrites the sources to the lowest-us row, as for any other duplicate. No table on main has such a pair:
the family tests of test_config_shape_collision, which merge the real tables (tuned_fmoe among them), pass.

PR Self-Review

Reviewed revision

54a256d7e0563463b09fe67f9e06282d803c8d25

Behavior and intent

The merge's duplicate check sees the rows that lookups see: live rows collide per shape whatever their label, and a
flydsl_fallback row still sits beside the live one. Before, a label difference, including the 0 the merge fills in,
hid a duplicate that the runtime then resolved by file order.

Validation and unverified scope

  • CPU only, no GPU: vllm/vllm-openai-rocm:nightly-rocm100-083fbac021348c2c7af8a7bc71ba18199d0dd7a4 (Python 3.12,
    torch 2.13.0+rocm10.0.0, pandas 3.0.1) with FlyDSL 0.5.0 from PyPI, GPU_ARCHS=gfx950, and the tree on
    PYTHONPATH.
  • python3 -m unittest op_tests.tuning_tests.test_config_shape_collision: 34 passed on this branch (based on main at
    d02f9d058a). With the key on the raw _tag, as before this PR, the fused_expert and padded-label cases and the
    power test fail and the flydsl_fallback case passes.
  • op_tests.tuning_tests.test_fast_tuning and test_tuner_infra: the same 3 errors with this change and with main's
    core.py (no Triton GPU driver: 0 active drivers; GroupedFmoeTuner has no blank-cell value for
    a_preshuffle), everything else passes.
  • Mutations of this change, each against the 34 tests:
    • stripping the label before comparing (the previous head): only the padded-label case fails (no duplicate reported);
    • grouping the power check on the _tag alone, as the previous head did: the numeric-spelling cases of
      test_merge_refuses_power_row_against_latency_row_keyed_differently fail, because the merge auto-resolves the power
      row against the latency row and rewrites the sources;
    • handing the power check the raw dup_rows: all three cases of that test fail;
    • keying without _tag fails test_fmoe (gptoss_fp8fp4_tuned_fmoe.csv has fallback rows beside live rows),
      measured at 948b1cd15.
  • On main's core.py, a power row and a latency row written 256 and 256.0 with no tags are auto-resolved and the
    latency row is deleted from its table (observed on the fix and main trees in the same container): the gap in
    the conflict check is older than this change, and the numeric-spelling cases above close it.
  • Unverified: nothing ran on a GPU. Lookup code is unchanged.

PR-specific question

Which workload keys consume this, and what shows that unrelated shapes keep their selection:

  • No tuned table changes. The change decides which rows the merge reports as duplicates; for a table set without a
    duplicate, the merged table and every lookup are the same as before.
  • The family tests of test_config_shape_collision merge the real tables on main and pass with the change, so no
    shipped shape has two live rows and none changes selection.
  • A shape that does have two live rows under different labels now resolves to the lower-us row through the existing
    duplicate path, instead of to the first file.

Changed op tests

op_tests/tuning_tests/test_config_shape_collision.py:

  • test_merge_keys_tag_as_live_or_fallback: a labeled live row, or a padded flydsl_fallback row, against a row from a
    table without _tag must collide (the labeled case fails on main, the padded one with the whitespace stripped), and
    an exact flydsl_fallback row beside a live row must not.
  • test_merge_refuses_power_row_against_latency_row_keyed_differently: a power row and a latency row for one shape are
    refused with "a power-tuned row and a latency row share a shape", and both source files are unchanged afterwards,
    whether the two tables write the key with different tags, with 256 against 256.0, or both.
  • The other synthetic tests in the file have no _tag column, and the family tests pass with or without this change
    because main has no such pair.

🤖 Generated with Claude Code

The tuned-config merge keyed its duplicate-shape check on the raw _tag
value. The key was added so a flydsl_fallback row can sit beside the
live row for the same shape, but lookups skip only flydsl_fallback rows
and serve every other row whatever its _tag, keeping the first per
shape. Model tables now carry other labels (fused_expert,
exact-m4096-a, ...), and the merge fills 0 into the rows of a table
without the column, so two live rows for one shape passed the check and
the runtime served whichever file the glob listed first.

The key now compares _tag as fallback or live. The power-table conflict
check groups the duplicate rows the same way: grouped by label, a power
row and a latency row for one shape would be ranked against each other.

Signed-off-by: Rony Leppänen <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
@github-actions

Copy link
Copy Markdown
Contributor

🏷️ CI Guide

Runs automatically on every PR:

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

Extended tests (opt-in via labels):

Label Tests
ci:mi300x Run Aiter standard tests on MI300X in PRs; main branch always runs them
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 Radeon R9700 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 7720 --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.

Reviews:
A reviewer is usually assigned within one working day after the PR is ready for review (see Code Review Process). If nobody has responded for about a week, mention the area contact listed in CONTACTS.md. Want to help review? See REVIEWERS.md.

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

Fallback-label normalization can delete the only live source row, and the changed power-conflict grouping lacks merge-level regression coverage.

2 open issues
What changed in this PR

This PR aligns tuned-config duplicate detection with lookup behavior: _tag distinguishes fallback rows from live rows, rather than separating every label.

Changes:

  • Detects same-shape live-row collisions across different labels and applies the same grouping to power-conflict checks.
  • Adds regression coverage for differently labeled live rows and fallback coexistence.
  • Clarifies the merge-key documentation.
File Description
op_tests/​tuning_tests/​test_config_shape_collision.py Adds live-versus-fallback merge cases.
aiter/​jit/​core.py Groups duplicate shapes and power conflicts by fallback status.
.claude/​skills/​aiter-config-shape/​SKILL.md Documents how _tag participates in merge keys.

Review effort: Balanced

Comment thread aiter/jit/core.py Resolved
…er-conflict grouping

The merge's duplicate key took `_tag` as fallback or live after stripping the
label, but get_cfg_2stages compares it exactly, so "flydsl_fallback " is a live
row there. Stripped, an exact fallback row and a padded live row for one shape
shared a key, and the auto-resolution kept the fallback row and deleted the live
one from its source. The key now compares exactly.

test_merge_keys_tag_as_live_or_fallback gains the padded label. A new merge-level
test covers the power-conflict grouping: a power row and a latency row for one
shape with different labels are refused and both sources stay as they are.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@eppaneamd
eppaneamd marked this pull request as ready for review November 10, 2026 14:13
@eppaneamd
eppaneamd requested review from a team and a balanced review from Copilot November 10, 2026 14:13
@github-actions github-actions Bot changed the title [Bugfix] Config merge: catch live duplicates that differ only in _tag [JIT] [Bugfix] Config merge: catch live duplicates that differ only in _tag Nov 10, 2026
@github-actions github-actions Bot added the JIT label Nov 10, 2026
@aiter-bot

aiter-bot commented Nov 10, 2026 •

Copy link
Copy Markdown

READY FOR HUMAN REVIEW

PR Self-Review

Revision 54a256d7e056 · 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

The merge's duplicate check sees the rows that lookups see: live rows collide per shape whatever their label, and a
`flydsl_fallback` row still sits beside the live one. Before, a label difference, including the `0` the merge fills in,
hid a duplicate that the runtime then resolved by file order.

Validation and unverified scope

- CPU only, no GPU: `vllm/vllm-openai-rocm:nightly-rocm100-083fbac021348c2c7af8a7bc71ba18199d0dd7a4` (Python 3.12,
  torch 2.13.0+rocm10.0.0, pandas 3.0.1) with FlyDSL 0.5.0 from PyPI, `GPU_ARCHS=gfx950`, and the tree on
  `PYTHONPATH`.
- `python3 -m unittest op_tests.tuning_tests.test_config_shape_collision`: 34 passed on this branch (based on `main` at
  `d02f9d058a`). With the key on the raw `_tag`, as before this PR, the `fused_expert` and padded-label cases and the
  power test fail and the `flydsl_fallback` case passes.
- `op_tests.tuning_tests.test_fast_tuning` and `test_tuner_infra`: the same 3 errors with this change and with `main`'s
  `core.py` (no Triton GPU driver: `0 active drivers`; `GroupedFmoeTuner` has no blank-cell value for
  `a_preshuffle`), everything else passes.
- Mutations of this change, each against the 34 tests:
  - stripping the label before comparing (the previous head): only the padded-label case fails (no duplicate reported);
  - grouping the power check on the `_tag` alone, as the previous head did: the numeric-spelling cases of
    `test_merge_refuses_power_row_against_latency_row_keyed_differently` fail, because the merge auto-resolves the power
    row against the latency row and rewrites the sources;
  - handing the power check the raw `dup_rows`: all three cases of that test fail;
  - keying without `_tag` fails `test_fmoe` (`gptoss_fp8fp4_tuned_fmoe.csv` has fallback rows beside live rows),
    measured at `948b1cd15`.
- On `main`'s `core.py`, a power row and a latency row written `256` and `256.0` with no tags are auto-resolved and the
  latency row is deleted from its table (observed on the `fix` and `main` trees in the same container): the gap in
  the conflict check is older than this change, and the numeric-spelling cases above close it.
- Unverified: nothing ran on a GPU. Lookup code is unchanged.

PR-specific question

Which workload keys consume this, and what shows that unrelated shapes keep their selection:

- No tuned table changes. The change decides which rows the merge reports as duplicates; for a table set without a
  duplicate, the merged table and every lookup are the same as before.
- The family tests of `test_config_shape_collision` merge the real tables on `main` and pass with the change, so no
  shipped shape has two live rows and none changes selection.
- A shape that does have two live rows under different labels now resolves to the lower-`us` row through the existing
  duplicate path, instead of to the first file.

Changed op tests

`op_tests/tuning_tests/test_config_shape_collision.py`:
- `test_merge_keys_tag_as_live_or_fallback`: a labeled live row, or a padded `flydsl_fallback ` row, against a row from a
  table without `_tag` must collide (the labeled case fails on `main`, the padded one with the whitespace stripped), and
  an exact `flydsl_fallback` row beside a live row must not.
- `test_merge_refuses_power_row_against_latency_row_keyed_differently`: a power row and a latency row for one shape are
  refused with "a power-tuned row and a latency row share a shape", and both source files are unchanged afterwards,
  whether the two tables write the key with different tags, with `256` against `256.0`, or both.
- The other synthetic tests in the file have no `_tag` column, and the family tests pass with or without this change
  because `main` has no such pair.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

PR state

  • PASS — pull request is marked ready for review

Copilot findings

  • PASS — no active Copilot finding lacks a substantive author reply

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.

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

A critical conflict-detection bug groups equivalent numeric keys by raw CSV text, allowing auto-resolution to delete a source row instead of preserving both files.

1 open issue
2 resolved since last review

Review effort: Balanced

Comment thread aiter/jit/core.py Resolved
@eppaneamd
eppaneamd requested a review from vgokhale November 10, 2026 15:49
… duplicate check compared

The duplicate check compares numeric key cells as numbers (256 and 256.0 are one
shape) and the tag as fallback or live, but power_merge_conflict still grouped
the rows on the raw cells, other than the tag. A power row and a latency row
that the duplicate check took for one shape could fall into separate groups on
256 against 256.0, the conflict was missed, and the auto-resolution deleted the
slower row from its source. The conflict check now gets the compared value of
every key column.

The merge-level power test covers a differing tag, a differing numeric spelling
and both.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Copilot AI balanced review requested due to automatic review settings November 10, 2026 16:26

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.

🟢 Approval recommended

No active review issues remain for the changes aligning tuned-config collision detection with runtime lookup behavior.

No open issues 🎉

1 resolved since last review

Review effort: Balanced

Comment thread aiter/jit/core.py
# tag separates only those two kinds of row. get_cfg_2stages
# compares the label exactly, so a padded "flydsl_fallback " is a
# live row there and here.
comparable["_tag"] = merge_df["_tag"].astype(str).eq("flydsl_fallback")

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.

Item 1: The live-or-fallback key reports the swiglu_limit=N rows of tuned_swiglu_limit_fmoe as duplicates on current main (category: correctness)

On main the premise "lookups use _tag only to skip flydsl_fallback rows" no longer holds. read_table (aiter/moev2/dispatch/tuned.py:120-122) keeps only the rows whose _tag equals the requested label when a tag is passed, and fused_moe.py passes swiglu_limit_tag(swiglu_limit) for AITER_CONFIG_FMOE_SWIGLU_LIMIT_FILE. a8w8_blockscale_tuned_swiglu_limit_fmoe_gfx942.csv holds every shape twice, tagged swiglu_limit=5 and swiglu_limit=7, and both rows are served, each for its own limit.

With this key both rows count as live. Merging the head into main a7752f1 and running op_tests.tuning_tests.test_config_shape_collision: test_fmoe_swiglu_limit fails with Found 16 duplicate shape entries during merge of 'tuned_swiglu_limit_fmoe', and the auto-resolution reports a8w8_blockscale_tuned_swiglu_limit_fmoe_gfx942.csv: 16 -> 8 rows. In a checkout that deletes the slower limit's rows from the committed table. The same suite passes on main alone (34 of 34) and on this head against its own base, so the PR's CI cannot show it.

Could you rebase and keep the raw _tag in the key for families whose lookup selects rows by tag (today tuned_swiglu_limit_fmoe), and collapse it to live or fallback only for the families whose lookup ignores it? A merge-level case with two live rows of one shape tagged swiglu_limit=5 and swiglu_limit=7, expecting no error, would pin that down.

Comment thread aiter/jit/core.py
# Numeric columns compare as numbers, so 256 and 256.0 are one shape.
comparable = merge_df.apply(as_numbers)
if has_tag:
# Lookups skip flydsl_fallback rows and serve every other row

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.

Item 2: Comments, skill text and description name the old lookup as the rule for every family (category: documentation)

This comment says lookups "serve every other row whatever its _tag" and points to the exact comparison in get_cfg_2stages. On main get_cfg_2stages delegates to read_table, and a tagged read serves only the exact label. The same sentence is in .claude/skills/aiter-config-shape/SKILL.md (the _tag description around line 33) and in the PR description. Once item 1 settles which families key on the raw tag and which on live or fallback, could you state that in the comment and the skill file, and name read_table as the lookup the key mirrors?

Comment thread aiter/jit/core.py
# tag separates only those two kinds of row. get_cfg_2stages
# compares the label exactly, so a padded "flydsl_fallback " is a
# live row there and here.
comparable["_tag"] = merge_df["_tag"].astype(str).eq("flydsl_fallback")

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.

Item 3: The duplicate-shape header names _tag as a key for rows whose _tag differs (category: documentation) (nit, lower importance)

For two live rows with different labels, for example fused_expert against 0, the header prints dedup key: [..., '_tag'] and then lists rows whose _tag cells differ. A reader sees a key column with different values reported as a duplicate. Printing the key as it is compared, for example _tag (fallback or live), would remove the confusion.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants