Repository navigation
[Triton/Gluon] Add OPUS FP4 mode to the DSA cache writer - #7730
junhaha666 wants to merge 1 commit into
Conversation
🏷️ CI GuideRuns automatically on every PR:
Extended tests (opt-in via labels):
One backend per PR: PR title tags & labels: Reviews: |
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 |
There was a problem hiding this comment.
🟡 Changes recommended
An accepted strided Q view can overflow the int32 offset calculation at head 32, causing out-of-bounds reads before the Q buffer.
1 open issue
What changed in this PR
Moves ATOM’s DSA FP4 cache writer into AITER through an opt-in OPUS layout on gfx950, complementing the query and compressor APIs in #7128.
Changes:
- Adds
scale_layout="opus"while preserving the default HIP dispatch and existing positional arguments. - Adds a Triton wrapper, fused writer kernel and JSON configuration for BF16 Q/K with packed FP4 data and OPUS scales.
- Adds reference, graph-replay, masking and large-offset tests, plus a rotating-buffer benchmark.
| File | Description |
|---|---|
op_tests/triton_tests/fusions/test_indexer_qk_quant_and_cache_fp4.py |
Tests output bytes, graph replay, input validation and dispatch compatibility. |
op_tests/op_benchmarks/triton/bench_indexer_qk_quant_and_cache_fp4.py |
Adds a rotating-buffer benchmark for writer shapes. |
aiter/ops/triton/fusions/indexer_qk_quant_and_cache_fp4.py |
Validates tensors and launches the gfx950 OPUS writer. |
aiter/ops/triton/configs/gfx950/triton/fusions/indexer_qk_quant_and_cache_fp4/DEFAULT.json |
Defines launch and floating-point fusion settings. |
aiter/ops/triton/_triton_kernels/fusions/indexer_qk_quant_and_cache_fp4.py |
Implements normalization, optional RoPE and direct OPUS FP4 writes. |
aiter/ops/cache.py |
Adds OPUS dispatch while retaining the legacy HIP path. |
Review effort: Balanced
| MAX_POS: tl.constexpr, | ||
| ): | ||
| token = tl.program_id(0).to(tl.int64) | ||
| task = tl.program_id(1) |
|
Superseded by #7798, which extends the existing fused HIP indexer writer with OPUS FP4 and NoPE support. ROCm/ATOM#3042 now uses #7798 through the same public API (ATOM commit f1485d59f). The HIP integration passed 1183 ATOM regression tests; eight graph-replay cases verify actual HIP launches, cache bytes/scales, and DCP adapter padding semantics. Closing this Triton alternative to keep a single writer implementation. The branch is retained for historical comparisons. |

Motivation
Move ATOM's DSA FP4 cache writer into AITER. This is the companion change for
ROCm/ATOM#3042 and its writer-ownership review.
Technical Details
scale_layout="opus"toindexer_qk_rope_quant_and_cacheon gfx950.Support BF16 Q/K, H32/H64, D128, and NoPE/RoPE64.
weights, negative-slot masking and the all-Q option used by DCP.
No weight quantization or cache repacking is added.
benchmark. PR [HIP] [FlyDSL] Add OPUS FP4 MQA writer and query scale layouts #7128 supplies the V4 query/compressor APIs; this adds the DSA
LayerNorm/QK writer mode.
Test Plan And Results
Validation below used the identical writer patch before rebase (
84b57cf9b0on main
0de43e662b, FlyDSL 0.4.1). The pushed commita021b2e8ddis based onmain
fb372c9c08, which requires FlyDSL >=0.5; that toolchain rerun is pending.graph replay, strided inputs, negative/padded slots and writes beyond 4 GiB.
for Q/K payloads, scales and head weights (M1/6/64/252, H32/H64, NoPE/RoPE).
through ATOM's DCP adapter and LMCache tests. This is not a full-model rerun.
shapes; M6/H32 NoPE and RoPE64 measured 2.216 and 2.156 us. These are writer
timings only, not Mono or end-to-end speedups.