Skip to content

[FlyDSL] [Perf] split-3 decode MXFP8 GEMM (fp32 K-third slabs) for 65-128 rows, MiniMax-M3.1 TP4 QKV - #8610

Closed
ganyi1996ppo wants to merge 8 commits into
ROCm:mainfrom
ganyi1996ppo:ganyi/qkv-split3-gemm
Closed

ganyi1996ppo wants to merge 8 commits into
ROCm:mainfrom
ganyi1996ppo:ganyi/qkv-split3-gemm

Conversation

@ganyi1996ppo

@ganyi1996ppo ganyi1996ppo commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

What

Stacked on #8606 / #8607 (the diff against main shows their commits; review the last one, +453 lines). A split-3 decode MXFP8 GEMM for the MiniMax-M3.1 TP4 QKV projection (N 2560, K 6144) at 65-128 rows: one-wave workgroups over RT 16-row x NI 16-column tiles of one K third, both operands in the (16, 16) preshuffled layout (the quantizer of #8606 writes the codes), W and A blocks issued ahead of the scaled MFMAs, odd-RT activation-scale re-pairing, output the fp32 slabs [3, m, 2560] that the reduce-insert of the next PR reads. Row configs: 65-80 rows (RT 5, NI 2), 81-96 (3, 4), 97-128 (4, 4). Technique from amd-kernels' decode GEMM (gemm/mxfp8_common/mxfp8_gemm_decode.py), ported to aiter's FlyDSL helpers, no import.

This PR has no consumer on its own: the slabs are read by the reduce-insert of aiter #8611, which is wired into ATOM by ATOM #3810. Open together.

Why

At 65-128 rows the public path (gemm_a8w8_blockscale on row-major codes) runs the GEMM at 9.7-11.7 us per layer while the (16, 16)-layout decode tiles with a K split run it at 8.1-9.1 us, and give the follow-up insert the fp32 partials directly.

Measured (graph replay, 8 rotated weights, us per layer, MI355X, one GPU)

rows this PR amd-kernels oracle public aiter GEMM delta vs public
65 8.19 8.04 9.76 -1.6
72 8.14 8.21 10.08 -1.9
80 8.21 8.18 9.83 -1.6
81 8.53 8.52 9.96 -1.4
88 8.60 8.56 9.84 -1.2
96 8.63 8.52 9.87 -1.2
97 9.04 8.99 11.00 -2.0
112 9.07 8.98 11.21 -2.1
128 9.12 9.08 11.71 -2.6

Combined gain of the QKV chain stack. Stage 1 (#8606, #8607, ATOM #3809, 17-64 rows) measured -0.24 to -0.69 ms per decode step at B3-B8 (in-step decode_bench --sim1, flag off/on ABAB). This stage (65-128 rows = B9-B16 at k=7) measures -0.38 to -0.51 ms per step (table below), so the chain covers B3-B16, the whole range that sets ITL p90. Not yet measured: a real 4-rank step or AgentX (sim1 has no all-reduce).

Numerics

Slabs bit-equal to the amd-kernels split-3 decode GEMM at 65, 72, 80, 81, 88, 96, 97, 112, 128 rows (all three slabs). Versus the public bf16 GEMM output: rel_l2 1.65e-3 (bf16 rounding of the public result vs fp32 slabs).

Tests

op_tests/test_flydsl_mxfp8_gemm_decode_splitk.py plus the chain tests of the paired PR: 67 passed (GPU, MI355X). black and ruff clean.

Review

Run by hand against .claude/skills/review-pr: perf claim has numbers, shapes and repro; buffer resources are sized from n_mbBMK / NK / mN4KS and host asserts guard rows, tiles and dtypes; no change to existing kernels or dispatch (new files); new files use the same legacy buffer_ops helpers as #8606/#8607 (AGENTS.md prefers buffer tensors for new code; kept consistent with the stack, to port later).

Repro: /shared_nfs/ygan/p1/070-decode-closers/gbin (t_g1.py, run_pytest.py).

Generated with Claude Code

ganyi1996ppo and others added 7 commits November 24, 2026 07:45
…Max-M3 TP4 prefill

Same bytes as the HIP kernel, 1.6-3.0x faster on device and 3.5x less host time per
call for calls of at least 1024 tokens (nvfp4 K/V/index-K, 16/1/1 heads, rotary 64,
gfx950). Ported from amd-kernels. AITER_FUSED_QKNORM_NVFP4_FLYDSL=0 keeps the HIP kernel.

Co-Authored-By: Claude <[email protected]>
…6) code layout + shuffled E8M0 scales

gfx950 FlyDSL quantizer: bf16 [M, K] -> fp8 e4m3 codes in the weight's (16, 16) preshuffled layout (rows padded to the row
tile, padding rows zero) plus E8M0 scales in AITER's shuffled layout, or row-major codes. One launch, a workgroup per
32-row x 256-K tile. Prerequisite of the one-launch QKV front chain (next PR): that kernel reads exactly these codes.

Technique source: amd-kernels gemm/mxfp8_common/mxfp8_quant.py and the scale/convert helpers of mxfp8_gemm_decode.py
(ported, no import). op_tests/test_flydsl_mxfp8_quant_shuffled.py compares codes and scales byte for byte against a torch
reference of the Triton MXFP8 rule (60 shape/magnitude cases).

Co-Authored-By: Claude <[email protected]>
…ode rows (TP4)

QKV MXFP8 GEMM (deferred split-3) + q/k/index-q/index-k RMSNorm + partial RoPE + NVFP4 K/V/index-K page inserts in ONE
launch: 240 five-wave workgroups, a head's 12 workgroups publish sc1 slabs and bump an epoch counter, the last roles reduce
and insert eight rows each. Replaces the three launches of the public decode path (quantize, GEMM, fused_qknorm_idxrqknorm)
for 17-64 rows. Host wrapper qkv_chain_cooperative_insert keeps counters per device/stream or HIP capture id.

Technique source: amd-kernels attention/mxfp8_qkv_norm_rope_nvfp4_insert_n2560_k6144_rot64_p128 (kernel_cooperative.py,
host.py) and the decode GEMM primitives of mxfp8_gemm_decode.py (ported, no import). Helpers come from the FlyDSL NVFP4
insert of ROCm#8576, activation codes from the quantizer of the previous commit.

Co-Authored-By: Claude <[email protected]>
…-128 rows, MiniMax-M3.1 TP4 QKV

One-wave workgroups over RT 16-row x NI 16-column tiles of one K third, both operands in the (16, 16) preshuffled layout,
W / A blocks issued ahead of the scaled MFMAs, odd-RT A scale re-pairing; writes the fp32 slabs a fused reduce-insert reads.
Bit-identical to the amd-kernels decode GEMM at 65..128 rows; graph replay 8.1-9.1 us vs 9.7-11.7 us for the public GEMM.

Technique source: amd-kernels gemm/mxfp8_common/mxfp8_gemm_decode.py (ported, no import).

Co-Authored-By: Claude <[email protected]>
…er-device compiled handle + x.device stream, whole-tile rule for rpw>2, op test entry point

Co-Authored-By: Claude <[email protected]>
… extents), per-device handle + stream, stricter page checks, op test entry point

Co-Authored-By: Claude <[email protected]>
@ganyi1996ppo
ganyi1996ppo requested review from a team and a balanced review from Copilot November 24, 2026 19:19
@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 8610 --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.

@aiter-bot

aiter-bot commented Nov 24, 2026 •

Copy link
Copy Markdown

DRAFT — evaluation paused

PR Self-Review

Revision 751a482b3d4c · mode shadow

This pull request is a draft, so readiness evaluation is paused and no verdict applies. Evaluation resumes when it is marked ready for review and the required CI completes.

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

Critical input-validation and device/architecture dispatch gaps can produce incorrect results or invalid launches, while the default CI invocation executes neither added test.

5 open issues
What changed in this PR

Adds a gfx950 split-3 MXFP8 GEMM for MiniMax-M3.1 TP4 QKV decoding at 65–128 rows. It produces FP32 partial slabs for the follow-up reduce-and-insert PR; the broader diff also includes prerequisite quantization and QKV-chain work.

Changes:

  • Adds row-tiered GEMM configurations with prefetched operands and odd-row-tile scale handling.
  • Includes stacked shuffled quantization, fused QKV processing, and NVFP4 insert support.
  • Adds numerical comparisons and graph-replay tests.
File Description
op_tests/​test_fused_qknorm_nvfp4_flydsl.py Checks NVFP4 insert parity and optional timings.
op_tests/​test_flydsl_qkv_chain.py Tests the cooperative QKV chain and graph replay.
op_tests/​test_flydsl_mxfp8_quant_shuffled.py Checks shuffled quantization codes and scale bytes.
op_tests/​test_flydsl_mxfp8_gemm_decode_splitk.py Tests split-GEMM numerics and graph replay.
aiter/​ops/​fused_qknorm_idxrqknorm.py Adds conditional FlyDSL NVFP4 insert dispatch.
aiter/​ops/​flydsl/​kernels/​qkv_chain.py Provides the cooperative-chain wrapper and counter storage.
aiter/​ops/​flydsl/​kernels/​qkv_chain_cooperative.py Implements fused decode GEMM, normalization, RoPE, and inserts.
aiter/​ops/​flydsl/​kernels/​mxfp8_quant_shuffled.py Produces padded, shuffled MXFP8 codes and scales.
aiter/​ops/​flydsl/​kernels/​mxfp8_gemm_decode_splitk.py Implements row-tiered split-3 GEMM with FP32 slab output.
aiter/​ops/​flydsl/​kernels/​fused_qknorm_idxr_nvfp4_insert.py Implements NVFP4 insertion and eligibility checks.
aiter/​ops/​flydsl/​kernels/​fused_qknorm_idxr_nvfp4_insert_prefill.py Adds the prefill-optimized NVFP4 insert variant.

Review effort: Balanced

) -> torch.Tensor:
"""The three K-third fp32 partial sums of ``A @ W^T`` for 65-128 rows: ``out[z]`` is third ``z``. The caller sums
``out[0] + out[1] + out[2]`` (in that order; ``qkv_reduce_insert`` does)."""
assert supported(m), f"{m} rows outside {ROWS}"
Comment on lines +329 to +337
assert activation.is_contiguous() and weight.is_contiguous()
assert activation.shape[0] >= rows, (activation.shape, rows)
assert activation_scale.numel() >= (rows + 31) // 32 * 32 * (K // 32)
assert weight_scale.numel() == N * (K // 32)
rt, ni, nt, il = row_config(m)
if out is None:
out = torch.empty((KS, m, N), dtype=torch.float32, device=activation.device)
assert out.dtype == torch.float32 and out.is_contiguous()
assert out.shape == (KS, m, N)
Comment on lines +340 to +352
_run_compiled(
compile_mxfp8_gemm_decode_splitk(RT=rt, NI=ni, OUT_NT=nt, INTERLEAVE=il),
activation.data_ptr(),
weight.data_ptr(),
activation_scale.data_ptr(),
weight_scale.data_ptr(),
out.data_ptr(),
m,
activation_scale.numel() * activation_scale.element_size(),
n_mb,
grid,
torch.cuda.current_stream(),
)
Comment on lines +55 to +57
tot = slab[0] + slab[1] + slab[2]
rel = ((tot - ref.float()).norm() / ref.float().norm()).item()
assert rel < 4e-3, f"m={m}: relative error {rel}"
out.zero_()
graph.replay()
torch.cuda.synchronize()
assert torch.equal(out, eager)
Copilot AI balanced review requested due to automatic review settings November 24, 2026 19:41

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.

🔵 Needs a closer look

The launcher can reuse compiled handles across GPUs, select the wrong device’s stream, and accept incompatible raw-pointer inputs, risking incorrect execution and corrupted results.

5 open issues
1 previously missed issue

In code that hasn't changed since last review

Low severity Add a reproducible benchmark sweep for all row tiers

op_tests/​test_flydsl_mxfp8_gemm_decode_splitk.py:39

This suite has no runnable timing path, and the PR's reproduction scripts are on a private filesystem, so maintainers cannot reproduce the claimed row-tier latency improvement from this checkout. Please add the @benchmark/run_perftest sweep and summary table required by .claude/skills/aiter-op-test/SKILL.md, covering all three supported row tiers and the public GEMM baseline.

Review effort: Balanced

@ganyi1996ppo
ganyi1996ppo marked this pull request as draft November 25, 2026 02:56
@ganyi1996ppo

Copy link
Copy Markdown
Contributor Author

Closing: the split-K QKV GEMM (65-128 rows) is folded into the single QKV front PR #8607 (one op, tier by row count; the combined branch is being prepared there). The fork branch stays, so this can be reopened if needed.

ganyi1996ppo added a commit to ganyi1996ppo/aiter that referenced this pull request Nov 25, 2026
…through the kernel, the reduce-insert and the tuned rows; tuner enumerates ks x tile; ROCm#8610's row-major split kernel merged in

Co-Authored-By: Claude <[email protected]>
ganyi1996ppo added a commit that referenced this pull request Nov 30, 2026
…ch (1-64 rows) + split-K (65-128 rows) GEMM / norm / RoPE / NVFP4 insert (#8607)

* [FlyDSL] [Perf] fused_qknorm_idxrqknorm: FlyDSL NVFP4 insert for MiniMax-M3 TP4 prefill

Same bytes as the HIP kernel, 1.6-3.0x faster on device and 3.5x less host time per
call for calls of at least 1024 tokens (nvfp4 K/V/index-K, 16/1/1 heads, rotary 64,
gfx950). Ported from amd-kernels. AITER_FUSED_QKNORM_NVFP4_FLYDSL=0 keeps the HIP kernel.

Co-Authored-By: Claude <[email protected]>

* [FlyDSL] mxfp8 activation quantizer for the decode GEMM tiers: (16, 16) code layout + shuffled E8M0 scales

gfx950 FlyDSL quantizer: bf16 [M, K] -> fp8 e4m3 codes in the weight's (16, 16) preshuffled layout (rows padded to the row
tile, padding rows zero) plus E8M0 scales in AITER's shuffled layout, or row-major codes. One launch, a workgroup per
32-row x 256-K tile. Prerequisite of the one-launch QKV front chain (next PR): that kernel reads exactly these codes.

Technique source: amd-kernels gemm/mxfp8_common/mxfp8_quant.py and the scale/convert helpers of mxfp8_gemm_decode.py
(ported, no import). op_tests/test_flydsl_mxfp8_quant_shuffled.py compares codes and scales byte for byte against a torch
reference of the Triton MXFP8 rule (60 shape/magnitude cases).

Co-Authored-By: Claude <[email protected]>

* [FlyDSL] [Perf] one-launch MiniMax-M3.1 QKV front chain for 17-64 decode rows (TP4)

QKV MXFP8 GEMM (deferred split-3) + q/k/index-q/index-k RMSNorm + partial RoPE + NVFP4 K/V/index-K page inserts in ONE
launch: 240 five-wave workgroups, a head's 12 workgroups publish sc1 slabs and bump an epoch counter, the last roles reduce
and insert eight rows each. Replaces the three launches of the public decode path (quantize, GEMM, fused_qknorm_idxrqknorm)
for 17-64 rows. Host wrapper qkv_chain_cooperative_insert keeps counters per device/stream or HIP capture id.

Technique source: amd-kernels attention/mxfp8_qkv_norm_rope_nvfp4_insert_n2560_k6144_rot64_p128 (kernel_cooperative.py,
host.py) and the decode GEMM primitives of mxfp8_gemm_decode.py (ported, no import). Helpers come from the FlyDSL NVFP4
insert of #8576, activation codes from the quantizer of the previous commit.

Co-Authored-By: Claude <[email protected]>

* [FlyDSL] [Perf] split-3 decode MXFP8 GEMM (fp32 K-third slabs) for 65-128 rows, MiniMax-M3.1 TP4 QKV

One-wave workgroups over RT 16-row x NI 16-column tiles of one K third, both operands in the (16, 16) preshuffled layout,
W / A blocks issued ahead of the scaled MFMAs, odd-RT A scale re-pairing; writes the fp32 slabs a fused reduce-insert reads.
Bit-identical to the amd-kernels decode GEMM at 65..128 rows; graph replay 8.1-9.1 us vs 9.7-11.7 us for the public GEMM.

Technique source: amd-kernels gemm/mxfp8_common/mxfp8_gemm_decode.py (ported, no import).

Co-Authored-By: Claude <[email protected]>

* [FlyDSL] [Perf] split-3 reduce + norm / RoPE + NVFP4 insert, QKV chain for 65-128 decode rows (TP4)

Sums the three fp32 K-third slabs, rounds to bf16 and runs the norm / RoPE / NVFP4 K, V, index-K insert arithmetic of
fused_qknorm_idxr_nvfp4_insert in one launch (V in workgroups of its own through LDS); qkv_chain_insert serves 17-128 rows
(one launch to 64 rows, GEMM + reduce-insert above). Bit-identical to the amd-kernels chain at 65..128 rows; graph replay
13.7-16.3 us vs 16.9-20.0 us for quantize + public GEMM + fused_qknorm_idxrqknorm.

Technique source: amd-kernels attention/mxfp8_qkv_norm_rope_nvfp4_insert_n2560_k6144_rot64_p128 (reduce_insert.py, packing.py).

Co-Authored-By: Claude <[email protected]>

* [FlyDSL] mxfp8 quantizer review fixes: bf16/contiguous input check, per-device compiled handle + x.device stream, whole-tile rule for rpw>2, op test entry point

Co-Authored-By: Claude <[email protected]>

* [FlyDSL] qkv chain review fixes: operand validation (devices, dtypes, extents), per-device handle + stream, stricter page checks, op test entry point

Co-Authored-By: Claude <[email protected]>

* [FlyDSL] [Perf] QKV front tier chosen by a tuned table: gemm_a8w8_qkv_front + deferred fused epilogue in fused_qknorm_idxrqknorm

The MXFP8 QKV projection of a decode layer is one interface (gemm_a8w8_qkv_front); a tuned row
(a8w8_mxfp8_qkv_front_tuned_gemm.csv, kernelId qkvfront) picks plain / one-launch chain (17-64 rows) / split-3 chain
(65-128 rows). A fused tier only quantizes in the projection and runs GEMM + norm + RoPE + NVFP4 insert inside the
fused_qknorm_idxrqknorm call on the same tensor. Whole-front tuner: op_tests/tune_gemm_a8w8_qkv_front.py.

Co-Authored-By: Claude <[email protected]>

* [FlyDSL] qkv chain: row-major activation mode (a_row) for the one-launch tier and the front, to measure (16, 16) vs plain A

Co-Authored-By: Claude <[email protected]>

* [FlyDSL] qkv front on row-major A only: drop the (16, 16) activation layout, the shuffled quantizer and code_rows; retune the one-launch lookahead; regenerate the tier rows

Co-Authored-By: Claude <[email protected]>

* [FlyDSL] qkv front: split-K factor ks as a tuning config (1/2/3/4/6) through the kernel, the reduce-insert and the tuned rows; tuner enumerates ks x tile; #8610's row-major split kernel merged in

Co-Authored-By: Claude <[email protected]>

* drop the shuffled-A split-K op test (replaced by test_gemm_a8w8_qkv_front.py row-major split cases)

Co-Authored-By: Claude <[email protected]>

* [FlyDSL] QKV front as one op: static tier by row count (17-64 one-launch, 65-128 split-K, ks a kernel parameter), no tuned table / tuner / config family; hand-off failure modes documented and checked; quantizer guard-byte and fused-vs-unfused bitwise tests

Co-Authored-By: Claude <[email protected]>

* [FlyDSL] one-launch QKV front serves 1-16 rows too (RT=1 tile; no structural limit found), window 1-128

Co-Authored-By: Claude <[email protected]>

* [FlyDSL] drop the closed #8576 FlyDSL insert and an unrelated import reorder from the QKV front branch

The QKV front kernels import only the device helpers of the FlyDSL NVFP4 insert, not the insert kernels. Keep those
helpers (qkv_front_common.py) and remove the rest: the decode and prefill FlyDSL insert kernels, their test, and the
FlyDSL route inside fused_qknorm_idxrqknorm (the NVFP4 insert stays the HIP kernel of #8472). Only the deferred QKV
front hook remains in fused_qknorm_idxrqknorm.py. bench_models.py goes back to main (an import reorder only).

Co-Authored-By: Claude <[email protected]>

* [FlyDSL] QKV front review fixes: operand validation as exceptions, op-boundary shape / head checks, device-keyed split launches

- asserts that validated caller operands (shapes, dtypes, devices, strides, ranges, ks) are ValueError now, so
  python -O keeps them; one _validate shared by the one-launch and split tiers (the split tier had fewer checks)
- the head set (16 / 1 / 1, rotary 64) and N 2560 / K 6144 are checked with a message naming the supported shape, at
  gemm_a8w8_qkv_front and at both chain entries; ks outside (1, 2, 3, 4, 6) is rejected
- the split GEMM and the reduce-insert launches key the compiled handle by device and run under the operand's device
  and stream (a handle reused on another device does not launch)

Co-Authored-By: Claude <[email protected]>

* [FlyDSL] [Build] AOT prebuild of the QKV front kernels

aiter.aot.flydsl.qkv_front replays qkv_chain_insert on FakeTensors over 1-128 rows, bisected where the tile or tier
switches, so the one-launch kernels (16 / 32 / 48 / 64 rows), the split-K GEMM tiles and the reduce-insert are in the
prebuilt cache; registered in AOT_MODULES and the AOT README.

Co-Authored-By: Claude <[email protected]>

* [FlyDSL] QKV front: drop stale skips (not-in-this-tree) and tuned-table wording from tests and comments

Co-Authored-By: Claude <[email protected]>

* [FlyDSL] [Build] dry_run: the Event stand-in accepts record / synchronize

The QKV front's counter pool records and waits on a cuda Event on first use; under the AOT dry run the stand-in had
neither method, so the replay of qkv_chain_insert failed with AttributeError.

Co-Authored-By: Claude <[email protected]>

* [FlyDSL] QKV front: document the slot_mapping run contract (consecutive slots per octet, no gapped or split-octet runs)

Co-Authored-By: Claude <[email protected]>

* [FlyDSL] qkv front _validate: require f32 k/v scales and non-overlapping uint8 KV pages

Harden the operand checks the raw-pointer launch depends on (Copilot review,
PR #8607):
- k_scale / v_scale: the kernels read the scalar via _gptr(..., T.f32, 4), so
  require float32 with numel() >= 1; a 1-element bf16 scalar previously passed
  but would be a 2-byte read reinterpreted as f32.
- kv_cache / index_cache: require uint8 and stride(0) >= full page footprint
  (2*128*72 / 128*72). The kernels index pages by slot>>7, so an expanded or
  overlapping page layout (e.g. stride(0)==0) would let distinct slots alias the
  same page. dtype uint8 is now also enforced.

Co-Authored-By: Claude Opus 4.8 <[email protected]>

* op_tests: consolidate gemm_a8w8_qkv_front tests into test_flydsl_qkv_chain.py (remove standalone file)

All chain and gemm_a8w8_qkv_front correctness cases are retained verbatim in the
single file; no coverage change (7 test functions / 257 parametrized cases before
and after). Shared `needs_gfx950` mark and `NB` constant deduplicated; the
standalone file is removed.

Co-Authored-By: Claude Opus 4.8 <[email protected]>

---------

Co-authored-by: Claude <[email protected]>
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