8a87e378f88a7f03796949f0cc91f4dc80b3f296
CCCL agent_reduce.cuh reveals the key asymmetry in flash attention tiling:
- Q tile stays RESIDENT in registers across the entire K/V loop
- K/V tiles STREAM through: each iteration loads new BLOCK_N, consumes, frees
- Therefore BLOCK_N can differ from BLOCK_M
This is NOT parameter tuning. This is a structural observation from reading
agent_reduce.cuh's ConsumeFullTile: it uses striped loads where the tile
stays resident while data streams through. The same pattern applies to
flash attention's inner loop.
For BI-V100 (SM=16, SMEM=48KB, head_dim=128, fp16):
BLOCK_M=32, BLOCK_N=128 → Q=8KB resident + K=32KB streaming = 40KB (82%)
This maximizes K/V bandwidth utilization per iteration.
Also: removed stale import time / timing code from kernel launch.
Source: cccl_upstream/cub/cub/agent/agent_reduce.cuh lines 195-230
(ConsumeFullTile vectorized vs scalar path)
project_6
Description
Languages
C++
41.8%
Cuda
31.6%
Python
22.2%
C
2.1%
CMake
1.1%
Other
1.1%