Skip to content

spark-model: dump q/k post-norm/rope ops on chunked prefill too (ATLAS_OP_DUMP) - #99

Merged
AzeezIsh merged 1 commit into
mainfrom
fix/op-dump-qk-layout
Sep 26, 2026
Merged

AzeezIsh merged 1 commit into
mainfrom
fix/op-dump-qk-layout

Conversation

@AzeezIsh

Copy link
Copy Markdown
Contributor

Tooling fix, found during #95.

Bug. ATLAS_OP_DUMP's k_post_norm, k_post_rope and q_post_rope were dumped only in prefill_attention_with_cache_skip, which runs only for chunk 0 (seq_len_start == 0, prefill_inner.rs:141). The dump file follows "last chunk wins", so in a chunked prefill it held chunk 0's last token while an unchunked run held the prompt's last token.

Reiner job 354 compared a 53-token single chunk against 16-token chunks. These three ops read cos ~0.4 even though attn_out_pre_gate (dumped on every chunk in paged.rs) matched at 0.9994: the comparison was between token 52 and token 15. Every buffer is token-major, which the rope kernels' indexing and the deinterleave_qg_split layout confirm. The slicing was fine; the dump fired in the wrong function.

Fix. The same three dump ops are added at the matching points of prefill_attention_paged (after k_norm, and after the rope chain), so chunks 1+ overwrite them and the file holds the global last token. The file format is unchanged. A structural test pins all three ops on both prefill paths.

  • fmt, clippy (spark-model --tests), typos.

…h too (#95)

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant