Skip to content

[Test] aiter#6912 rebased on main (cu_seqlens_cpu for KDA) - #14

Closed
amd-sriram wants to merge 1 commit into
mainfrom
rocm/rebase-6912-on-main
Closed

amd-sriram wants to merge 1 commit into
mainfrom
rocm/rebase-6912-on-main

Conversation

@amd-sriram

Copy link
Copy Markdown
Owner

Test vehicle only. ROCm#6912 (eppaneamd, draft) no longer applies on main after ROCm#6609 (gfx1250 FlashKDA). This is its first commit cherry-picked on main with the conflicts resolved by keeping both sides:

The bench_flash_kda.py commit is left out (benchmark only). Used so DockerMaker images on current AITER main still carry ROCm#6912. Close once ROCm#6912 is rebased upstream.

chunk_kimi_delta_attn read cu_seqlens back to the host twice per new
tensor on the FlashKDA route (prepare_chunk_indices and _seq_bounds),
and on a descriptor-cache miss uploaded the segment tables with two
blocking copies. The first KDA layer of every serving step therefore
waited for all work queued before it.

- Accept fla's cu_seqlens_cpu on chunk_kimi_delta_attn and thread it
  to chunk_delta_attn_fwd and flash_kda_fwd. With it, cu_seqlens is
  never read back; without it, it is read once per tensor.
- Build the chunk indices and the segment descriptors from the host
  bounds and upload them with one non-blocking copy from pinned
  memory, cached on the bounds' contents. A hit from another stream
  waits on the uploading stream and records the buffer on its own. A
  miss during graph capture raises; a hit keeps its buffer for the
  life of the process, so cache eviction cannot free it under a graph.
- prepare_chunk_indices now numbers chunks by their sequence's
  position in cu_seqlens. The old cumsum-of-chunk-starts formula
  skipped empty sequences, so an empty sequence before a non-empty
  one sent the later sequences' chunks to the wrong bounds. The fix
  covers both the FlashKDA route and the default pipeline.

Tests: a call with host bounds makes no synchronizing call under
torch.cuda.set_sync_debug_mode("error") on a metadata-cache miss, the
same call with device bounds does, and both give bit-identical output
and state; prepare_chunk_indices numbers empty sequences like a
repeat_interleave reference.

Signed-off-by: Rony Leppänen <rony.leppanen@amd.com>
Co-authored-by: Claude <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Oct 27, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: eb2f3074-2fd5-4ee0-a4cb-188bde2846c8
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@amd-sriram

Copy link
Copy Markdown
Owner Author

Rony rebased ROCm#6912 on main (head 5478ffb, mergeable); new recipes use the upstream PR. Images already built with this fork PR keep it for their A/Bs.

@amd-sriram amd-sriram closed this Oct 27, 2026
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.

2 participants