Repository navigation
Conversation
🏷️ CI GuideRuns automatically on every PR:
Extended tests (opt-in via labels):
PR title tags & labels: |
968bd15 to
e366c08
Compare
- Adds cu_num to the MXFP8 BMM tuned key in both loaders, so two devices that share an architecture but differ in CU count no longer resolve to one row. - Falls back to the previous gfx-only key, with a warning, when a tuned CSV has no cu_num column, so files written before this change keep loading. - Resolves cu_num inside lookup_mxscale_bmm_config from the running device, alongside the gfx it already reads, so no call site changes. - Emits cu_num from the BMM tuner and adds it to the tuned key and sort order, so newly tuned files carry the column the loaders now look for. - Records cu_num on the shipped gfx950 rows, binding them to the CU count they were tuned on rather than to every device of that architecture. - Covers resolving two CU counts to different rows, the legacy fallback, and rejection of rows that stay duplicates under the new key. Without cu_num the key could not express a second variant of an architecture: its rows matched the other variant silently, and adding them tripped the duplicate-shape check, which rejects the whole file rather than the one shape.
e366c08 to
c004f2a
Compare
…okup # Conflicts: # aiter/configs/model_configs/dsv4_batched_gemm_a8w8_blockscale_mxscale_tuned.csv # aiter/ops/batched_gemm_op_a8w8.py # aiter/ops/opus/policy.py # csrc/opus_gemm/opus_bmm_mxscale_tune.py # op_tests/tuning_tests/test_config_shape_collision.py
The lookup keeps its own padded-M loop, which tries the cu_num key and then the gfx-only key at each padding level. The helper takes a single key function, so adopting it would let a padded-M row tuned for this CU count win over an exact-M row that is not.
|
No activity for 15 days, so this is now labelled |
- Takes main's batched_gemm_op_a8w8.py, whose MXFP8 BMM loader and lookup now delegate to opus.policy, so the cu_num key lives in policy alone. - Keeps main's per-layout table selection in the policy loader and adds cu_num to its key, with the gfx-only fallback for tables and rows that carry none. - Re-applies cu_num to main's rewritten BMM tuner through its key list, which the preshuffled-B tuner inherits. - Fills a missing cu_num with 0 when the tuner reads a table, so writing a table back leaves other devices' rows unbound instead of binding them to this one. - Counts an unbound tuned row as tuned for every CU count of its arch, so a rerun over a table without cu_num skips the shapes it already holds. - Reads w_scale_block from the last key field in the preshuffle BMM test, which holds for both the bound and the gfx-only key. - Indexes bound rows on the numeric cu_num, so a non-numeric cell cannot make a key that the integer device CU count never matches. - Documents cu_num in the preshuffle BMM README key and tuned header.
- Normalizes cu_num in the BMM loader before the duplicate check, so a missing column, a blank and a non-positive value all leave a row keyed on gfx alone. - Replaces index_tuned_by_cu_num and the separate missing-column path with that one rule, which keeps the loader in main's statement order. - Logs unbound rows at info level, since the shipped preshuffled-B table stays without cu_num on purpose and a warning there is not actionable. - Logs cu_num alone in the tuned config line, as the other mxscale loaders do. - Normalizes cu_num the same way in the BMM tuner and inserts a missing column after gfx as 0, so writing a table back never binds other devices' rows. - Counts an unbound tuned row as tuned for every CU count when the tuner skips shapes it already holds. - Keeps cu_num 0 rows in the base tuner run_config filter, which otherwise benchmarked nothing from a table without cu_num. - Sorts and deduplicates in sortResults only on key columns the file has, so a run with nothing to tune no longer fails on a table without cu_num. - Adds cu_num to the empty preshuffled-B template header, matching the README. - Covers the lookup and the tuner in one test each, including blank and negative cu_num, write-back, run_config and the written column order. - Stubs get_cu_num in the invalid kid test, which otherwise needs a GPU.
There was a problem hiding this comment.
🟡 Changes recommended
Merging multiple legacy tuner CSVs fails before the new CU defaults are applied.
1 open finding
What changed in this PR
Makes MXFP8 batched GEMM tuning distinguish GPUs with the same architecture but different compute-unit counts.
Changes:
- Adds CU-aware lookup keys with legacy-row fallback.
- Updates tuner handling and marks 77 existing rows as 256-CU configurations.
- Extends compatibility tests and documents the schema.
| File | Description |
|---|---|
op_tests/tuning_tests/test_config_shape_collision.py |
Updates expected lookup keys. |
op_tests/test_opus_a8w8_interface.py |
Tests CU selection and legacy compatibility. |
op_tests/test_batched_gemm_a8w8_mxscale_bpreshuffle.py |
Adjusts scale-block key access. |
csrc/opus_gemm/opus_bmm_mxscale_tune.py |
Adds CU-aware tuning and normalization. |
csrc/bmm_a8w8_mxscale/README.md |
Documents CU keys and legacy behavior. |
aiter/utility/base_tuner.py |
Adjusts sorting and benchmark filtering. |
aiter/ops/opus/policy.py |
Implements CU-specific lookup and fallback. |
aiter/ops/batched_gemm_op_a8w8.py |
Updates loader docstring. |
aiter/jit/core.py |
Clarifies a comment about optional columns. |
aiter/configs/model_configs/dsv4_batched_gemm_a8w8_blockscale_mxscale_tuned.csv |
Backfills 256-CU values. |
aiter/configs/batched_gemm_a8w8_blockscale_mxscale_bpreshuffle_tuned.csv |
Adds the CU header column. |
🧠 Review effort: Balanced
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
- Deduplicates merged tuner tables only on the key columns present, so loading several MXFP8 BMM tables without cu_num no longer raises KeyError before the tuner fills the column with 0. - Applies the same rule when a _tag column is present, which used to restore the full key list. - Drops the MXFP8 BMM example from the sortResults comment, since the rule applies to any tuner. - Covers merging two MXFP8 BMM tables without cu_num, which must keep both rows unbound.
|
Closed. #6937 already keys the OPUS tuned lookups on cu_num and the tuners record it. |

Motivation
MI350P and MI355X are both
gfx950, but have 128 and 256 CUs respectively. The MXFP8 BMM tuned lookup currently keys only on(gfx, b, m, n, k), so it cannot distinguish them. This can cause a kernel tuned for 256 CU to be selected on a device with 128CU. The CK batched gemm already keys on both gfx and cu_num (aiter/ops/batched_gemm_op_a8w8.py:84), as well as opus A16W16 (aiter/ops/opus/policy.py:51). Opus MXFP8 BMM does not.Changes
(gfx, cu_num, b, m, n, k).cu_numinside the lookup functions, alongsidegfx, without changing call sites.opus_bmm_mxscale_tune.pyto recordcu_numin generated rows.gfx950rows withcu_num=256.cu_numcolumn. They continue using the old(gfx, b, m, n, k)key and print a warning message.index_tuned_by_cu_numfor merged tables containing both rows both with and without CU. The update_config_files function joins the per-model CSVs and fills a missing cu_num with 0 (aiter/jit/core.py:385). The index_tuned_by_cu_num function removes defaulted 0 cu_num from the keys.Testing
Added tests for:
cu_num;cu_numfrom the tuner.