Claude d9bbef54d8 [OPT] Complete GQA broadcast — V weighted sum also avoids expansion
Previous commit broadcast Q@K^T (saved 1GB/step).
This commit broadcasts scores@V too (saves 2GB/step).

Before: V expanded from [kv_h, padded_len, d] to [H, padded_len, d]
  4×100K×256×4B → 24×100K×256×4B = 400MB → 2.4GB allocation

After: broadcast matmul at kv_h level
  se: [kv_h, gqa, P, 1, part_sz] @ V: [kv_h, 1, P, part_sz, d]
  → [kv_h, gqa, P, 1, d] → reshape to [H, P, d]
  V stays at kv_h size: 400MB (no 2.4GB allocation)

Total per-decode-step memory for 100K context:
  Before all GQA opts: 3.6GB (K expansion + V expansion)
  After: 600MB (6x total reduction from GQA ratio=6)

This is the CCCL insight applied: transform_reduce with a compound type.
Instead of expanding to full head count then reducing, keep the reduction
at the minimal group size and broadcast the grouping dimension.
2026-07-30 16:15:37 +00:00
2026-07-30 17:03:23 +08:00

project_6

Description
No description provided
Readme 427 MiB
Languages
C++ 41.8%
Cuda 31.6%
Python 22.2%
C 2.1%
CMake 1.1%
Other 1.1%