mtt-s80-build #3

Merged
software merged 6 commits from mtt-s80-build into main 2026-11-20 13:04:45 -05:00
Owner
No description provided.
- fattn.cu: when the S80 attention kernel handles a FLASH_ATTN_EXT node, don't
  reserve upstream's f16 K/V copy in the compute buffer (4 KB/position per
  context: 512 MiB at 128k in both the model and MTP draft contexts). Compute
  buffers at 128k: 720 -> 250 MiB (model), 538 -> 196 MiB (MTP).
- 27B preset now defaults to a 128k window (peak 15.6 of 16.4 GB with a
  94.5k-token prompt).
- 94.5k-token prompt: 32.6 min (48 t/s, was 62.5 min), decode 7.2 t/s at depth.
- 9B Q4_0 + grafted MTP measured (23.6 t/s, slower than Q8_0's 26.7; reasons
  documented).
- bench.sh passes all LLAMA_* / GGML_* env; longctx_bench.sh SRV_LOG.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Q4_0: new 256-k superblock tile layout (in place), split-K kernel, prompt-size
  decoder (was: prototype 7-token kernel, N>7 looped it). Q4_1 and Q5_K added
  (small-batch + prompt kernels). q4_0,q4_1,q5_k now on by default (no effect on
  the 27B, which has none of these types).
- Q4_0/Q4_1/Q8_0: row sums exchanged once per superblock, activations of both
  halves loaded up front (~5%); Q8_0 keeps the per-block variant for LM-head-size
  matrices.
- 9B Q4_0: 4-token pass 127 -> 59.5 ms, pp512 207 -> 358 t/s; Q4_0 + MTP 14.8 ->
  24.6-29.2 t/s (Q8_0 + MTP 26.5-26.6, still recommended). KLD vs stock: Q4_0
  0.002, Q8_0 0.0005. 27B unchanged (10.04 t/s, 248.5 ms/step).
- FINDINGS: small-batch matmuls are instruction-bound per 32-block, not
  byte-bound; what helped and what did not.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- fattn-musa.cu: fmusa_pass1_mma + fmusa_q_quant. From 8192 cached positions,
  few-token q4_0 attention computes K*Q^T on the int8 MMA (K read straight from
  the cache, Q int8 per 32 dims), softmax on the MMA layout, P*V in FP32.
  Per layer at 94k: 4-token verify 10.08 -> 4.89 ms, 1-token draft 3.68 -> 3.03 ms.
- 27B decode at 94.5k context 7.18 -> 8.72 t/s; at 44k 10.59 t/s. Short context
  unchanged. GGML_MUSA_FA_MMA=0 disables, GGML_MUSA_FA_ATTR=1 prints kernel attrs.
- test-backend-ops: 94208-position perf cases (1 and 4 tokens).
- FINDINGS: MMA operand lanes outside the documented ranges must be zero; runtime
  index into a register array -> local memory; occupancy beats spills.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
fmusa_pass1_mma now computes P*V on the int8 tensor cores as well: V's
per-position scale is folded into P (one scale per 32-dim block per
256-position chunk), the 4-bit V values are the A operand, and all-ones
MMAs remove the unsigned offsets. The kernel uses 4 warps per block on this
path (half the per-thread state, 12-16 warps per MP instead of 8), stages V
per 16-position step in shared memory, and issues all operand loads before
the MMAs (on mp_21 a load waits for every MMA in flight). The chunk-combine
kernel uses 4 chunk groups per (head, token): 0.41-0.48 -> 0.10-0.20 ms.

Per layer at 94k positions: MTP verify 4.89 -> 3.81 ms, draft 3.02 -> 1.79 ms.
27B at a 94.5k-token context: 8.72 -> 9.61 t/s; short context unchanged
(10.01 t/s, 249.9 ms/step). KLD vs the FP32 P*V path 0.0035 (f16 vs q4_0 KV
cache: 0.0041). GGML_MUSA_FA_PVMMA=0 restores the FP32 P*V loop.

Also: tools/mma/mma_lds.mu (load/MMA serialization microbenchmark),
kprof2 flushes pending events at exit and can report after N launches.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The tensor-core attention kernel kept one 64-bit pointer per K row tile
(16 registers); 32-bit offsets from the head base cut its spills and the
per-layer time at 94k positions: draft 1.79 -> 1.73 ms, verify 3.81 ->
3.76 ms. Guarded: the kernel is only used when n_kv*nb1 fits in int32.

FINDINGS: the K loads in the score phase cost at most ~0.34 ms per layer
(~2% of a decode step); staging K through shared memory, two blocks per
batch and prefetching all lost to register pressure.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
software/S80-Optimization!3
No description provided.