Skip to content

perf(qwen3.6): adaptive combine warps for the hd256 flash-decode (long-context occupancy)#293

Closed
nickmopen wants to merge 1 commit into
gittensor-ai-lab:mainfrom
nickmopen:perf/qwen36-hd256-combine
Closed

perf(qwen3.6): adaptive combine warps for the hd256 flash-decode (long-context occupancy)#293
nickmopen wants to merge 1 commit into
gittensor-ai-lab:mainfrom
nickmopen:perf/qwen36-hd256-combine

Conversation

@nickmopen

Copy link
Copy Markdown
Contributor

Summary

The hd256 (Qwen3.6 full-attention) split-combine launched a fixed NW=4 folding warps regardless of n_splits, so at long context (16k/32k → n_splits=128/256) each of 4 warps serially folds 32–64 split-partials on only num_q_heads × DG = 64 CTAs — badly underfilling the GPU on the exact long-context path #284 just sped up. This mirrors the hd128 path's adaptive dispatch (NW=16 at n_splits≥128, 8 at ≥64, else 4).

Byte-exact: only the fold parallelism changes — the combine result is identical (same as the shipped hd128 adaptive combine), so accuracy is unaffected. Pure long-context occupancy win.

Proof of speedup

  • Tested on RTX 5090 (sm_120)

Decode tok/s (end-to-end, bench/scripts/bench.sh --download --ctx 16384, Qwen3.6-35B-A3B UD-Q4_K_M, bs=1 — long-context optimization; contexts < 8k are unchanged):

decode tok/s
before (main) 364.53
after (this PR) 371.56

At 32k the gain is larger (more splits → worse combine underfill): main 337.76 → this PR 349.86 (+3.6%).

== ctx=16384 ==
before (main, fixed NW=4)  : decode tg  364.53 tok/s  (n=128, ctx=16384, bs=1)
after  (this PR, adaptive) : decode tg  371.56 tok/s  (n=128, ctx=16384, bs=1)
== ctx=32768 ==
before (main, fixed NW=4)  : decode tg  337.76 tok/s  (n=128, ctx=32768, bs=1)
after  (this PR, adaptive) : decode tg  349.86 tok/s  (n=128, ctx=32768, bs=1)

What changed

  • flash_decode_split.cu: instantiate fa_combine_kernel<256,DG,8> / <256,DG,16>, add fa_launch_combine_dispatch_hd256 (adaptive NW by n_splits, mirroring the hd128 dispatch), and route both hd256 combine sites (int8-MMA and tile paths) through it. Accuracy-preserving (byte-exact combine).

…ong context

The hd256 split-combine ran a fixed NW=4 folding warps regardless of n_splits, so at
16k/32k (n_splits=128/256) each of 4 warps serially folds 32-64 split-partials on only
num_q_heads*DG = 64 CTAs -- underfilling the GPU on the exact long-context path gittensor-ai-lab#284 just
sped up. Mirror the hd128 path's adaptive dispatch (NW=16 at n_splits>=128, 8 at >=64,
else 4). Byte-exact combine -- only the fold parallelism changes, same as the shipped
hd128 adaptive combine -- so accuracy is unaffected; this is a pure occupancy win at
long context.
@nickmopen nickmopen closed this Jul 9, 2026
@nickmopen nickmopen reopened this Jul 9, 2026
@nickmopen nickmopen marked this pull request as draft July 9, 2026 13:37
jimcody1995 added a commit to jimcody1995/sparkinfer that referenced this pull request Jul 9, 2026
…anded n_splits

Remove fused-router (gittensor-ai-lab#282) and hd256 combine (gittensor-ai-lab#293) to avoid copycat
containment. Retain two distinct optimizations:
- qknorm_rope_kv_partial_int8 fusion (new kernel, hd256 full-attn path)
- banded n_splits for 8k-12k (distinct from gittensor-ai-lab#194 naive 28× threshold)

Co-authored-by: Cursor <cursoragent@cursor.com>
@skyrocket2026

Copy link
Copy Markdown
Member

Closing due to inactivity (>2 days since last update). Reopen or push new commits when ready to continue.

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