Skip to content

test: repro for paged-MQA-logits Preshuffle=False OOB and score pollution - #5591

Closed
HongliMi wants to merge 1 commit into
ROCm:mainfrom
HongliMi:repro/paged-mqa-logits-preshuffle-false
Closed

HongliMi wants to merge 1 commit into
ROCm:mainfrom
HongliMi:repro/paged-mqa-logits-preshuffle-false

Conversation

@HongliMi

Copy link
Copy Markdown

Summary

 Adds `tests/repro_paged_mqa_logits_preshuffle_false.py`, a standalone repro
 for two bugs in `_gluon_deepgemm_fp8_paged_mqa_logits` (the
 `Preshuffle=False` variant of `deepgemm_fp8_paged_mqa_logits`) when used
 with `KVBlockSize=64` and block-level page tables — the layout used by
 vLLM's DSA (DeepSeek sparse attention) indexer cache.

 * **Issue 1 — HIP error 700 (illegal memory access):** `kv_indices` are
   read per token position (`pid_batch * max_block_len + token_pos +
   arange(ChunkK)`), which runs off a block-level page table sized in
   64-token blocks.
 * **Issue 2 — silent score pollution:** the same out-of-contract reads
   land in *valid-but-wrong* memory (no crash), and KV addresses are formed
   without the in-block offset, so only token 0 of each 64-token block is
   ever read. Result: 5968/6000 scores mismatch an fp32 reference, silently.

Root cause

 The `Preshuffle=False` kernel is built for **per-token paging**
 (`KVBlockSize=1`, 132B/token interleaved rows): per-token `kv_indices`
 reads and `idx * stride + arange(128)` KV addressing are only correct for
 that layout. The wrapper's `KVBlockSize=64` slicing (values then scales
 per block) suggests 64-token blocks are supported, but the kernel's
 address math never implements them.

 This path has never been exercised upstream: DSv4 uses `Preshuffle=True`
 (SHUFFLE tile layout), the new MQA sweep (#5434) covers only
 `Preshuffle=True`, and #4774 explicitly left the non-preshuffle kernel's
 identical defects enumerated but unconverted ("unreachable from vLLM").

Repro

  PYTHONPATH=. python tests/repro_paged_mqa_logits_preshuffle_false.py

Observed on MI350X (gfx950), ROCm 7.2, triton 3.7, on current main:

  gfx: gfx950:sramecc+:xnack-
  [issue2] allclose=False mismatch=5968/6000
  ...
    File "tests/repro_paged_mqa_logits_preshuffle_false.py", line 137, in <module>
      issue1_illegal_address()
  torch.AcceleratorError: HIP error: an illegal memory access was encountered
  ...
  RuntimeError: Triton Error [HIP]:  Code: 700, Messsage: an illegal memory access was encountered

• Issue 2 reproduces first (no crash, wrong scores — the micro form of the
"long-prompt gibberish" symptom seen in production).
• Issue 1 then aborts with the illegal access.

…tion

Standalone repro for two bugs in _gluon_deepgemm_fp8_paged_mqa_logits
(Preshuffle=False) on 64-token-block page tables:

* issue 1: HIP error 700 (illegal memory access) -- kv_indices are read
  per token position, running off block-level page tables.
* issue 2: 5968/6000 polluted scores vs an fp32 reference -- the same
  out-of-contract reads land in valid-but-wrong memory, and KV addresses
  are formed without the in-block offset (only token 0 of each 64-token
  block is reachable).

Root cause: the Preshuffle=False kernel is built for per-token paging
(KVBlockSize=1, 132B/token interleaved) and was never exercised with
KVBlockSize=64 + block-level page tables.

Run: PYTHONPATH=. python tests/repro_paged_mqa_logits_preshuffle_false.py
@HongliMi
HongliMi requested a review from a team September 16, 2026 13:45
@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; main branch always runs both MI35X and MI300X
multigpu 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 5591 --add-label <label>

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 opt this PR out.

@github-actions

github-actions Bot commented Oct 7, 2026

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 7, 2026
@amd-ruitang3

Copy link
Copy Markdown
Contributor

test need add in aiter/op_tests/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

stale The PR hasn't been updated in 2 weeks

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants