Skip to content

perf(qwen4exp,hip): 2-stream split prefill pipeline and 64-bit Q8_0 WMMA loads - #1058

Merged
davide221 merged 1 commit into
mainfrom
perf/wave2-fnx-2stream-q8-load64
Nov 23, 2026
Merged

davide221 merged 1 commit into
mainfrom
perf/wave2-fnx-2stream-q8-load64

Conversation

@davide221

@davide221 davide221 commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Two targeted, zero-env-var prefill optimizations built on top of main (#1052–#1055):

  1. 2-stream split prefill pipeline (qwen4exp_graph.cpp)
    • Uses n_streams = 2 (8,192 tokens/stream on a 16K chunk) instead of 4 streams (4,096 tokens/stream) in build_pipelined_layers.
    • Cuts expert-weight re-reads on the expert device (71.73 GiB on Strix Halo) in half per 16K chunk while keeping R9700 attention/GDN overlapped with Strix Halo routed experts.
    • Measured scaling on lucebox9 (Qwen 3.8 Flash-Next, 120K long1, HIP graphs):
      • n_streams = 4 (main): 62.95 s (1,898.7 tok/s)
      • n_streams = 3: 60.81 s (1,965.4 tok/s)
      • n_streams = 2: 59.04 s (2,024.4 tok/s, +6.6% over main, +25.4% over original 1,614)
  2. Single 64-bit Q8_0 load in RDNA WMMA attention (paged-attn-rdna-wmma.cuh, fattn-rdna-wmma.cuh)
    • Replaces 4x 16-bit loads in pa_dequant_q8_0_quad / fa_dequant_q8_0_quad with a single 64-bit __builtin_memcpy load (0 B scratch on gfx1201).
    • Microbench (bench_paged_attn_wmma 4096 q8_0 on R9700): -1.0% to -1.7% faster across every KV length (8K: 15.61 -> 15.34 ms / 53.8 TFLOP/s; 16K: 32.04 -> 31.64 ms; 32K: 68.01 -> 67.27 ms; 64K: 140.85 -> 139.53 ms).

Verification

  • test_paged_attn_wmma + compare_paged_attn.py: PASS (max_abs_diff = 4.281998e-03 < 6.0e-03)
  • test_qn_split_fusions: 31/31 PASS
  • ISA audit (gfx1201): paged_attn_rdna_wmma_kernel<Q8_0, SPLIT_D=2, NQ_GROUPS=4> vgpr=238, scratch=0 B

View guided diff

@davide221
davide221 force-pushed the perf/wave2-fnx-2stream-q8-load64 branch from 8f49085 to 095ad9f Compare November 23, 2026 10:37
@davide221
davide221 marked this pull request as ready for review November 23, 2026 11:17
@davide221
davide221 merged commit bb4b3c8 into main Nov 23, 2026
9 of 16 checks passed
@davide221
davide221 deleted the perf/wave2-fnx-2stream-q8-load64 branch November 23, 2026 11:17
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