Skip to content

[CUDA] Tune hardware-aware split-K decode scheduling - #22190

Open
Gasoonjia wants to merge 1 commit into
codex/stack-d111-causal-maskfrom
codex/stack-d113-persistent-splitk
Open

[CUDA] Tune hardware-aware split-K decode scheduling#22190
Gasoonjia wants to merge 1 commit into
codex/stack-d111-causal-maskfrom
codex/stack-d113-persistent-splitk

Conversation

@Gasoonjia

@Gasoonjia Gasoonjia commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

Stack dependency

Depends on #22189.

Summary

Combine the D113 SM-sized split-K work with the final scheduling policy for the numerically stable online-softmax implementation.

  • Derive split counts from the target GPU SM count, L_kv, and B * H_kv.
  • Keep the launch size static while reading runtime kv_len on device, preserving CUDA graph compatibility.
  • Retune the occupancy target from D113's two waves to 16/9 waves.
  • Cap splits to one per 128 KV elements to limit reduction and empty-CTA overhead.
  • Use contiguous KV partitions instead of D113's persistent strided traversal; profiling showed that contiguous partitions are faster for the online-softmax kernel.
  • Apply the same hardware-aware policy to both decode and small-query split-K paths.
  • Keep scale arithmetic explicitly in FP32.

The policy contains no model-specific or GPU-specific shape hard-coding. It adapts from hardware properties and runtime attention dimensions.

Test plan

  • Triton split-K and FP8 dispatch suite: 47 passed.
  • Standalone D113 decode correctness smoke: 3 passed.
  • Covered runtime KV-length tail exclusion, non-power-of-two split counts, and large-logit stability.
  • Long-context numerical smoke remained finite with online softmax.
  • git diff --check.

@pytorch-bot

pytorch-bot Bot commented Aug 26, 2026

Copy link
Copy Markdown

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/22190

Note: Links to docs will display an error until the docs builds have been completed.

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Aug 26, 2026
@Gasoonjia
Gasoonjia force-pushed the codex/stack-d113-persistent-splitk branch from a92814e to b8ef410 Compare August 26, 2026 21:56
@Gasoonjia Gasoonjia changed the title [CUDA] Make split-K decode persistent and SM-sized [CUDA] Tune hardware-aware split-K decode scheduling Aug 26, 2026
@Gasoonjia
Gasoonjia force-pushed the codex/stack-d113-persistent-splitk branch from b8ef410 to 8c9f0cc Compare August 26, 2026 22:50
Combine the D113 SM-sized split-K work with the final online-softmax scheduling policy. Derive split counts from the target GPU SM count and attention dimensions, target 16/9 waves with an L_kv/128 cap, use contiguous KV chunks, extend the policy to small-query attention, and keep scale arithmetic explicitly in FP32.
@Gasoonjia
Gasoonjia force-pushed the codex/stack-d113-persistent-splitk branch from 8c9f0cc to cfd96e1 Compare August 26, 2026 23:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant