Repository navigation
Conversation
Channel-last prefill without prefix caching (Kimi-K3.1 KDA) ran the 8-token row kernel. It now runs one program per [16 tokens x 512 channels] tile, and at width 4 a sliding-window kernel that reads each input row once and keeps the last three in registers instead of re-reading the tile per tap. Other layouts keep the row kernel. Both use the row kernel per-element arithmetic with fp fusion off, so the outputs and the conv-state pool are bit-identical at Kimi-K3.1 shape (width 4, no bias). The 16x512, 4-warp channel-fast tile was the fastest of 72 tile/warp/grid-order configurations swept on MI355X; the sliding kernel uses 256 channels, 1 warp, 2 stages. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…nt split - The KDA prefill reads and writes the recurrent state in the slot pool (FlashKDA paged state_cache) instead of gathering it, copying it K-first and scattering the final state back. Steps with a state fork, or with interior checkpoints that are not split, keep the gather path. Bit-identical. - gfx950 FlashKDA pass A always takes its published wide tile (BW=64); bit-identical. Pass B runs the prefetching scan (subject to aiter AITER_FDA_SCAN_PREFETCH); changes numerics. - A multi-sequence step sizes FlashKDA segments on its total chunks, by FlashKDA own chooser, rather than on its longest sequence; changes numerics of multi-sequence steps. FlashKDA CHUNK_DELTA_ATTN_FLASH_KDA_SEG override still applies, through that chooser. - Interior checkpoints: the builder cuts the step at them and each block runs FlashKDA on the paged state; a checkpoint is copied out of the runtime slot after the block that ends on it. This replaces re-running every checkpoint head as one more sequence (a 1025-token prefill anchored at 1024 ran 2049 tokens of recurrence). A resumed block of at most 6 tokens per row runs on the fp32 token recurrence instead (TAIL_RECURRENT_MAX, measured crossover). Changes numerics where cuts move FlashKDA segments and in the tail blocks (closer to fp32). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The builder tests of the head re-run layout plan no split; a stand-in FlashKDA pins balanced_chunks_per_seg to FlashKDA chooser. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
🏷️ CI GuideRuns automatically on every eligible PR before approval:
Heavy model tests:
Path scope:
|
atom.model_ops.kimi_k3 binds AITER kernels at import, so the CPU unit-test job (no AITER) failed to collect test_flash_kda_tuning.py. Load the module with aiter_stub.atom_without_aiter like the other CPU tests do. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Kimi-K3.1 KDA prefill: tiled/sliding conv, paged state, FlashKDA schedules, checkpoint split
Faster KDA prefill for Kimi-K3.1 on MI355X. Every change here is on by default. No environment variable is added. Each optimization was developed behind a switch, and this PR drops both the switch and the old path.
What changed
causal_conv1d (B, bit-identical)
[16 tokens x 512 channels]tile.KDA prefill on the paged state (B)
state_cache). Before, the state was gathered, copied K-first and scattered back.FlashKDA schedules
AITER_FDA_SCAN_PREFETCH. The scan schedule differs, so numerics change (N)._choose_chunks_per_seg, capped at the longest sequence. Multi-sequence numerics change (N).CHUNK_DELTA_ATTN_FLASH_KDA_SEGoverride directly withos.getenvin ATOM. That read is removed. The override now applies through FlashKDA's chooser, the same way it does for FlashKDA's own calls.Prefill checkpoints by cutting the recurrence (N)
kda_ckpt_split.py). Each block runs FlashKDA on the paged state, and a checkpoint is copied out of the runtime slot right after the block that ends on it.cu_seqlens, so FlashKDA does not sync the host per block.TAIL_RECURRENT_MAX = 6). Why 6:Performance (MI355X, Kimi-K3.1 TP8 + DCP8)
Dependencies
KimiKDAAttention._prefill_recurrence, because Restore Kimi-K3.1 token graphs and qualify zero-addend storage #3636 makes token-graph KDA prefills write checkpoints. The resolution is to route that path through_settle_prefill, whose head re-run pads its output to the bucket's height; a local merge of the two was built and CPU-tested for a follow-up PR.Left out (follow-ups)
Tests
tests/test_kda_ckpt_split.py: planner, builder transfer, stand-in recurrence equal to the head re-run.tests/test_flash_kda_tuning.py.tests/test_causal_conv1d_tiled.pyandtests/test_causal_conv1d_slide.py, both bit-exact against the row kernel / the tiled kernel.🤖 Generated with Claude Code