Repository navigation
[HIP] [FlyDSL] Add OPUS FP4 MQA writer and query scale layouts - #7128
Conversation
🏷️ CI GuideRuns automatically on every PR:
Extended tests (opt-in via labels):
One backend per PR: PR title tags & labels: |
6523086 to
1303505
Compare
The launchers declared block_size = WARP_SIZE and m_block = vec_size * WARP_SIZE / dim as const ints. A const int whose initializer is a constant expression is constant-evaluated, so WarpSizeValue took its host fallback of 64. On gfx1250 (wave32) the kernels are compiled for 32 lanes and cover vec_size * 32 / dim rows each, while the grid was sized for 64-lane blocks of twice as many rows: half of the rows were never written. Without const the initializers run at launch and read the device's wave size. Co-Authored-By: Claude Opus 5.5 <[email protected]>
WAITING ON AUTHORPR Self-ReviewRevision Waiting for the PR author. The readiness report will appear after the self-review answers are complete for this revision. Questions to answer in the PR description
Edit the Missing or invalid answers
Shadow mode reports what would block but keeps the status successful. Set |
Keep the gfx950-specific FP4 layout guards while routing both gfx1250 variants to the wave32 compressor. Preserve upstream compressor changes.
|
@aiter-bot review |
aiter-bot
left a comment
There was a problem hiding this comment.
ROCm/aiter PR #7128 — [HIP] [OPUS] [FlyDSL] Add OPUS FP4 MQA writer and query scale layouts
Review (advisory):
Validation (deterministic): NOT RUN — REVIEW_AUTO_VALIDATE=0 (auto-validation disabled; the required target op_tests/test_dsv4_opus_query_layout.py exists but was not run — environment gap, not a PR defect)
Perf (advisory): NOT RUN — target op_tests/test_dsv4_opus_query_layout.py exposes no benchmark entry point (no --scenario bench / perftest harness), so no base-vs-head timing of the changed writers exists; the PR's E2E table is the combined four-SHA ATOM integration, explicitly not isolated writer speedups
📝 [verified] aiter/ops/quant.py is a Tier-2 downstream contract and this diff changes a public signature and its default semantics (shuffle_scale:bool=True → scale_layout:str="none"), with valarLip the de-facto owner by commit count (15 of ~40 commits on the file). Reviewer should ask valarLip to sign off on the rope_rotate_activation contract change before merge, on top of the downstream CI run.
📝 [verified] The WARP_SIZE const→runtime change in csrc/kernels/dsv4_rotate_quant.cu re-sizes all six rotate/quant launches on gfx1250 (block 64→32, grid roughly doubles; the const init const-folds to the host-pass fallback 64 per aiter_hip_common.h while the device kernel steps 32-lane rows on gfx1250), and the PR itself marks gfx1250 hardware/E2E validation as pending while no gfx1250 op-test job runs in the default CI set. Reviewer should ask for the pending gfx1250 run of op_tests/test_dsv4_rotate_quant.py before merge, since nothing else exercises the new launch geometry.
2 finding(s) posted inline, on the lines they are about:
aiter/ops/flydsl/kernels/fused_compress_attn.py:1163— The new OPUS KV-cache writer ships with zero aiter-side coverage: the scale-offset formula is hand-copied…aiter/ops/quant.py:1431— Existing callers silently get different bytes with no error: aiter/ops/quant.py:1431 flips…
🏷️ CI GuideRuns automatically on every PR:
Extended tests (opt-in via labels):
One backend per PR: PR title tags & labels: |
🏷️ CI GuideRuns automatically on every PR:
Extended tests (opt-in via labels):
One backend per PR: PR title tags & labels: |
* [OPUS] Add FP4 MQA compressor and query scale layouts * [HIP] Size the DSV4 rotate-quant launches with the runtime wave size The launchers declared block_size = WARP_SIZE and m_block = vec_size * WARP_SIZE / dim as const ints. A const int whose initializer is a constant expression is constant-evaluated, so WarpSizeValue took its host fallback of 64. On gfx1250 (wave32) the kernels are compiled for 32 lanes and cover vec_size * 32 / dim rows each, while the grid was sized for 64-lane blocks of twice as many rows: half of the rows were never written. Without const the initializers run at launch and read the device's wave size. Co-Authored-By: Claude Opus 5.5 <[email protected]> * Support 32-head OPUS FP4 query scale layout * fix(mqa): preserve legacy writer APIs and cover OPUS cache writes * test(mqa): remove standalone query layout tests * fix(flydsl): preserve padding infinities in compressor softmax --------- Co-authored-by: Claude Opus 5.5 <[email protected]>
Add the FP4 cache-writer and query-scale layouts used by ATOM's V4/V4.1 indexer with OPUS MQA, including H32 queries for V4.1 on MI355 (gfx950).
Changes
fp4_gfx950_opusselects the OPUS cache layout for both single-wave and K-split execution.scale_layout="none"|"flydsl"|"opus"while preserving the legacy FlyDSL default and positional/keywordshuffle_scalecalls. OPUS supports H32/H64, D128 and group size 32, with scales[T, 2, 32, H/16].fp4/preshufflebehavior on gfx9 and natural rows on gfx1250; explicit gfx950 modes select their layouts. Keep legacy FP8 mode aliases and reject incompatible FP4 cache views.The scorer/API from #6952 is already merged into main. ATOM #2809 consumes both PRs; this diff contains the writer/query changes. Rebuild cached
module_dsv4_rotate_quantwhen upgrading.Validation
CPU wrapper checks and all five legacy-query GPU equality cases passed on gfx950; the query kernel was built from source. OPUS prefill/decode checks with automatic K-split passed. Writer coverage also checks independent natural-reference permutations, physical page mapping, guard pages and forced single-wave execution.
The single-wave padding scale error (
255) is fixed by preserving-infsemantics through the softmax maximum and exponential arguments; protecting only comparisons was insufficient under fast-math. The accumulation and other kernel stages retain their compiler settings. On MI355, the full compressor op-test script completed successfully (159 invocations), covering both FP4 layouts, single-wave/K-split writers and masked-NaN cases, with unchanged tolerances. All 18 local query layout/compatibility GPU checks also passed.MI355 integration performance
These measure the combined integration, not isolated writer speedups: ATOM
75cdfb334, this writer5927993491, runtime AITERe6833294ff, upstream #6952791fc88746.V4.1 Flash, 4 x MI355 / TP4, c4, DSpark5, FP8 KV / FP4 index, Eager without graphs, 1024 output tokens; max sequences 4, batched tokens 512, model length 20480. Median of three warmed, unprofiled engine-E2E runs; target and draft use the listed path.
Native 16K is effectively at parity; DSpark acceptance/tail work varies across repeats. GPU 3 had brief independent work during the latest repeat on GPUs 4-7, so host interference is possible. Mono measures its fused scorer reading the selected layout. See ATOM #2809 for per-run values and separate MQA trace timings.
Pending: gfx1250 V4.1 hardware/E2E/performance validation. The integration performance above was measured on the listed earlier revisions; E2E performance has not been rerun after the softmax fix.