Skip to content

[FlyDSL] [Bugfix] gfx1250 grouped MoE: read integer config cells that the merge writes as floats - #6360

Open
jhinpan wants to merge 5 commits into
mainfrom
jhinpan/gfx1250-grouped-config-float-cells
Open

jhinpan wants to merge 5 commits into
mainfrom
jhinpan/gfx1250-grouped-config-float-cells

Conversation

@jhinpan

@jhinpan jhinpan commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

Since #6090 added model_configs/qwen3_5_397b_tuned_grouped_fmoe.csv, the default AITER_CONFIG_GROUPED_FMOE resolves to a file that update_config_files merges with pandas. pandas writes the integers of a column that has a blank cell as floats: 16 becomes 16.0, and ep_fused = 1 becomes 1.0.

On main at 0f6cb2f, grouped_moe_gfx1250 reads those cells through float(): _as_int since #6425, and the lookup's key comparison (_cell in _find_grouped_config) since #6557. That accepts the integral floats, but it also rounds through a binary float: 9007199254740993.0 becomes 9007199254740992, and 1.0000000000000001 is read as 1.

This PR reads integer cells as exact text in both places. _integral_text drops only an all-zero fraction, and _as_int raises on anything else. This also covers #6557's "1.0" / "0.0" flag case, so that special case is gone. The first version of this PR also fixed the AOT parser in aiter/aot/flydsl/grouped_moe.py; #6362 removed that file, and the AOT build now replays the runtime lookup.

op_tests/tuning_tests/test_config_shape_collision.py gets three tests:

  • test_grouped_int_cells_parse_exactly: 16.0 reads as 16, 9007199254740993.0 as 9007199254740993, and 1.0000000000000001 raises. It fails on main (9007199254740992 != 9007199254740993).
  • test_grouped_fmoe_merged_cells_parse: every integer cell of the real merged grouped config parses.
  • test_grouped_fmoe_merged_ep_row_matches: an ep_fused row still wins its EP lookup after the merge writes it as 1.0.

The last two also pass on main; they keep the merged-config cases covered.

@zufayu, could you help review this?

PR Self-Review

Reviewed revision

50d31f5

Behavior and intent

grouped_moe_gfx1250 reads integer config cells as exact text. _as_int and the lookup's key comparison drop only an all-zero fraction (16.0 reads as 16, 1.0 matches 1) and reject any other fraction, instead of parsing through a binary float. On main, float() rounds integers above 2^53 and accepts near-integers such as 1.0000000000000001, so a mistyped or corrupted cell is read as a different integer without an error.

Validation and unverified scope

  • On a CPU-only container with CU_NUM=256, python3 -m pytest op_tests/tuning_tests/test_config_shape_collision.py: the 3 tests of this PR passed at this revision. With the same tests on main 0f6cb2f, test_grouped_int_cells_parse_exactly failed (9007199254740992 != 9007199254740993), and the other two passed.
  • test_config_shape_collision, test_csv_validation, test_grouped_ep_fused_lookup and test_grouped_gemm_launch_abi otherwise gave the same results as on main; the same 9 cases failed on both because they need a GPU.
  • Not run: fused_moe on gfx1250 with the merged default config.

PR-specific question

No config file changes. The parser change affects every gfx1250 grouped MoE row lookup (_find_grouped_config) and every integer cell that _as_int reads. For well-formed cells (integers, and integers written as floats with an all-zero fraction), the result is the same as on main. Only cells that main rounds or accepts through float() now raise. test_grouped_fmoe_merged_cells_parse checks that every integer cell of the merged default config still parses (13,900 subtests), and test_grouped_fmoe_merged_ep_row_matches checks that an ep_fused row still wins its lookup.

Changed op tests

op_tests/tuning_tests/test_config_shape_collision.py: three tests. test_grouped_int_cells_parse_exactly fails on main because of the float rounding and passes here; no other test checks that _as_int keeps every digit. test_grouped_fmoe_merged_cells_parse and test_grouped_fmoe_merged_ep_row_matches read the real pandas-merged config, which no other test parses with the grouped reader; they keep the integral-float and ep_fused = "1.0" cases from regressing.

@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: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: GPT-OSS-120B, DeepSeek-R1-0528, Kimi-K2.5
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 6360 --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.

@github-actions github-actions Bot changed the title [Bugfix] gfx1250 grouped MoE: read integer config cells that the merge writes as floats [FlyDSL] [Bugfix] gfx1250 grouped MoE: read integer config cells that the merge writes as floats Oct 10, 2026
@zufayu
zufayu requested review from coderfeli and removed request for zufayu October 12, 2026 05:17
@zufayu

zufayu commented Oct 12, 2026

Copy link
Copy Markdown
Contributor

The pandas-generated 16.0 fix and EP lookup regression test look good, but please avoid using binary float as the integer validator. Both _as_int helpers currently accept 1.0000000000000001 as 1 and convert 9007199254740993.0 to 9007199254740992. A custom AITER_CONFIG_GROUPED_FMOE CSV can reach this path directly, so malformed or large config values can be silently changed instead of rejected.

Please parse integral decimal syntax exactly (for example, with Decimal or an explicit zero-only fractional-part check) and add regression cases for these two values.

…floats

Since #6090 added a grouped MoE config under model_configs/,
the default AITER_CONFIG_GROUPED_FMOE resolves to a file that
update_config_files merges with pandas. pandas writes the integers of a
column that has a blank cell as floats ("16.0"). Every row of the merged
file has such a cell in a column that grouped_moe_gfx1250 reads with
_as_int, which calls int(), so fused_moe on gfx1250 raises ValueError
when it finds a row. The same merge writes ep_fused = 1 as "1.0", so EP
lookups never match their rows.

Read integral float cells as integers in _as_int (runtime and AOT) and
in the lookup's key comparison. Non-integral values still raise.

Signed-off-by: Jin Pan <[email protected]>
dtypes.fp8 is torch.float8_e4m3fnuz on gfx942, so on the MI300X runner
the lookup key did not match the synthetic rows (written as
torch.float8_e4m3fn) and the test got no row. Pass the dtypes the rows
name and write the rows from the same objects.

Signed-off-by: Jin Pan <[email protected]>
@jhinpan
jhinpan force-pushed the jhinpan/gfx1250-grouped-config-float-cells branch from e194103 to 9909b8d Compare October 13, 2026 04:58
@jhinpan

jhinpan commented Oct 13, 2026

Copy link
Copy Markdown
Contributor Author

@zufayu Done in 9909b8d. Both _as_int helpers now drop only an all-zero fraction and parse the rest with int(), so 1.0000000000000001 raises ValueError and 9007199254740993.0 reads as 9007199254740993. In grouped_moe_gfx1250.py, _as_int and _cell share this rule through _integral_text. test_grouped_int_cells_parse_exactly checks both values, and 16.0, for both helpers.

The branch is also rebased on main. #6425 had changed the runtime _as_int to convert every value through float(), which also rounded plain integers above 2^53; that path is gone as well. _GROUPED_INT_COLUMNS now includes rolled_drain, persistent_workers and persistent_workers2, which #6269 reads with _as_int. On gfx1250, test_config_shape_collision.py passes (25 tests), also with #6356 applied on top.

@github-actions

Copy link
Copy Markdown
Contributor

No activity for 15 days, so this is now labelled stale. A push or a comment clears it; keep-open exempts it. Nothing is closed automatically.

@github-actions github-actions Bot added the stale The PR hasn't been updated in 2 weeks label Oct 31, 2026
aiter/aot/flydsl/grouped_moe.py: take main's deletion; #6362 replaced the
AOT CSV parser with a replay of the runtime lookup.
grouped_moe_gfx1250._cell: keep this branch's exact integral-text
normalization, which also covers #6557's "1.0"/"0.0" flag case without
parsing through a binary float.
…arser

main removed aiter/aot/flydsl/grouped_moe.py (#6362), so importing its parser
made both tests skip. The AOT build now replays the runtime lookup, so the
tests check grouped_moe_gfx1250._as_int alone.
@aiter-bot

Copy link
Copy Markdown

READY FOR HUMAN REVIEW

PR Self-Review

Revision 50d31f5f2e55 · 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

`grouped_moe_gfx1250` reads integer config cells as exact text. `_as_int` and the lookup's key comparison drop only an all-zero fraction (`16.0` reads as 16, `1.0` matches `1`) and reject any other fraction, instead of parsing through a binary float. On main, `float()` rounds integers above 2^53 and accepts near-integers such as `1.0000000000000001`, so a mistyped or corrupted cell is read as a different integer without an error.

Validation and unverified scope

- On a CPU-only container with `CU_NUM=256`, `python3 -m pytest op_tests/tuning_tests/test_config_shape_collision.py`: the 3 tests of this PR passed at this revision. With the same tests on main 0f6cb2f, `test_grouped_int_cells_parse_exactly` failed (`9007199254740992 != 9007199254740993`), and the other two passed.
- `test_config_shape_collision`, `test_csv_validation`, `test_grouped_ep_fused_lookup` and `test_grouped_gemm_launch_abi` otherwise gave the same results as on main; the same 9 cases failed on both because they need a GPU.
- Not run: `fused_moe` on gfx1250 with the merged default config.

PR-specific question

No config file changes. The parser change affects every gfx1250 grouped MoE row lookup (`_find_grouped_config`) and every integer cell that `_as_int` reads. For well-formed cells (integers, and integers written as floats with an all-zero fraction), the result is the same as on main. Only cells that main rounds or accepts through `float()` now raise. `test_grouped_fmoe_merged_cells_parse` checks that every integer cell of the merged default config still parses (13,900 subtests), and `test_grouped_fmoe_merged_ep_row_matches` checks that an `ep_fused` row still wins its lookup.

Changed op tests

`op_tests/tuning_tests/test_config_shape_collision.py`: three tests. `test_grouped_int_cells_parse_exactly` fails on main because of the float rounding and passes here; no other test checks that `_as_int` keeps every digit. `test_grouped_fmoe_merged_cells_parse` and `test_grouped_fmoe_merged_ep_row_matches` read the real pandas-merged config, which no other test parses with the grouped reader; they keep the integral-float and `ep_fused = "1.0"` cases from regressing.

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.

@github-actions github-actions Bot removed the stale The PR hasn't been updated in 2 weeks label Nov 15, 2026
@jhinpan

jhinpan commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor Author

@coderfeli @zufayu Please review this PR. The last reviewer comment was on Oct 12.

  • State: Aiter Test Gate is green at 50d31f5. The PR has no conflicts with main.
  • Earlier comment: 9909b8d (Oct 13) fixed zufayu's point. The integer parser does not use binary float.

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