# Register Pressure & Spill Audit

> Detail view. Canonical entry point for all per-kernel comparisons:
> [`docs/inventory.md`](inventory.md).

Auto-generated by `scripts/audit/reg_audit.R`.

Total kernels scanned: **123**
Kernels with register spill (LOCAL > 0): **0**
Kernels using dynamic shared memory: **12**

## Hardware reference (RTX 3070 Ti, GA104, sm_86)

- Registers / SM: **65536** (= 64 K)
- Threads / SM:   **1536** (48 warps)
- Max blocks / SM: **16**
- Max smem / SM:   **100 KB** (dynamic), 48 KB static

## Per-kernel data

Sort: spillers first, then descending registers/thread.

| kernel | regs | block_size | smem_static_KB | smem_dynamic | local | spill? | theo_blocks_SM | warps/SM |
|---|---:|---:|---:|---:|---:|---:|---:|---:|
| igemm_8warp_256x256 | 255 | 256 | 40.0 | no | 0 | no | 1 | 8 |
| igemm_8warp_256x256 | 255 | 256 | 40.0 | no | 0 | no | 1 | 8 |
| igemm_8warp_256x256 | 255 | 256 | 40.0 | no | 0 | no | 1 | 8 |
| igemm_warp_specialized | 255 | 256 | 40.0 | no | 0 | no | 1 | 8 |
| igemm_warp_specialized | 255 | 256 | 40.0 | no | 0 | no | 1 | 8 |
| igemm_warp_specialized | 255 | 256 | 40.0 | no | 0 | no | 1 | 8 |
| igemm_online_quant | 239 | 256 | 48.0 | no | 0 | no | 1 | 8 |
| igemm_persistent | 234 | 256 | 32.0 | no | 0 | no | 1 | 8 |
| igemm_online_quant_inplace | 213 | 256 | 40.0 | no | 0 | no | 1 | 8 |
| igemm_online_quant_bankfree | 211 | 256 | 40.0 | no | 0 | no | 1 | 8 |
| igemm_8warp_256 | 210 | 256 | 32.0 | no | 0 | no | 1 | 8 |
| flash_attn_br16_v2_bc128 | 187 | 128 | 0.0 | yes | 0 | no | 2 | 8 |
| flash_attn_br16_v2_bc128 | 187 | 128 | 0.0 | no | 0 | no | 2 | 8 |
| igemm_register_blocked | 186 | 128 | 8.0 | no | 0 | no | 2 | 8 |
| igemm_pipelined_cpasync_bk64 | 168 | 128 | 16.0 | no | 0 | no | 3 | 12 |
| igemm_pipelined | 168 | 128 | 8.0 | no | 0 | no | 3 | 12 |
| igemm_pipelined | 168 | 128 | 8.0 | no | 0 | no | 3 | 12 |
| igemm_pipelined | 168 | 128 | 8.0 | no | 0 | no | 3 | 12 |
| cross_attn_pipelined | 158 | 128 | 0.0 | yes | 0 | no | 3 | 12 |
| flash_attn_bc128 | 158 | 128 | 0.0 | no | 0 | no | 3 | 12 |
| flash_attn_br16_regpv_pad | 156 | 128 | 0.0 | no | 0 | no | 3 | 12 |
| flash_attn_br16_regpv | 156 | 128 | 0.0 | no | 0 | no | 3 | 12 |
| flash_attn_br16_regpv_pad | 152 | 128 | 0.0 | no | 0 | no | 3 | 12 |
| flash_attn_br16_regpv_pad | 152 | 128 | 0.0 | no | 0 | no | 3 | 12 |
| hgemm_tiled | 148 | 256 | 40.0 | no | 0 | no | 1 | 8 |
| hgemm_tiled_direct | 145 | 256 | 32.0 | no | 0 | no | 1 | 8 |
| flash_attn_br16_regpv_lean_qcache | 144 | 128 | 0.0 | no | 0 | no | 3 | 12 |
| igemm_8warp_tribuf | 144 | 256 | 32.0 | no | 0 | no | 1 | 8 |
| igemm_8warp_tribuf | 144 | 256 | 32.0 | no | 0 | no | 1 | 8 |
| igemm_8warp_tribuf | 144 | 256 | 32.0 | no | 0 | no | 1 | 8 |
| flash_attn_br16_v2_pipeline | 140 | 128 | 0.0 | no | 0 | no | 3 | 12 |
| flash_attn_v2_persistent | 140 | 128 | 0.0 | no | 0 | no | 3 | 12 |
| flash_attn_br16_v2 | 138 | 128 | 0.0 | no | 0 | no | 3 | 12 |
| igemm_8warp | 137 | 256 | 24.0 | no | 0 | no | 1 | 8 |
| igemm_8warp | 137 | 256 | 24.0 | no | 0 | no | 1 | 8 |
| igemm_8warp | 137 | 256 | 24.0 | no | 0 | no | 1 | 8 |
| cross_attn_v2 | 136 | 128 | 0.0 | yes | 0 | no | 3 | 12 |
| flash_attn_br16_regpv_full | 134 | 128 | 0.0 | no | 0 | no | 3 | 12 |
| flash_attn_br16_v2_pipeline_pad | 134 | 128 | 0.0 | no | 0 | no | 3 | 12 |
| flash_attn_v2_persistent_pad | 134 | 128 | 0.0 | no | 0 | no | 3 | 12 |
| cross_attn_v2_pad | 133 | 128 | 0.0 | yes | 0 | no | 3 | 12 |
| flash_attn_br16_v2_pad | 133 | 128 | 0.0 | yes | 0 | no | 3 | 12 |
| flash_attn_br16_v2_pipeline_pad2 | 133 | 128 | 0.0 | yes | 0 | no | 3 | 12 |
| flash_attn_br16_v2_pad | 133 | 128 | 0.0 | no | 0 | no | 3 | 12 |
| flash_attn_br16_v2_pipeline_pad2 | 133 | 128 | 0.0 | no | 0 | no | 3 | 12 |
| flash_attn_br16_regpv_lean | 132 | 128 | 0.0 | no | 0 | no | 3 | 12 |
| flash_attn_fused | 126 | 128 | 0.0 | no | 0 | no | 4 | 16 |
| flash_attn_persistent | 126 | 128 | 0.0 | no | 0 | no | 4 | 16 |
| flash_attn_split_q | 126 | 128 | 0.0 | no | 0 | no | 4 | 16 |
| igemm_pipelined_cpasync | 126 | 128 | 8.0 | no | 0 | no | 4 | 16 |
| igemm_pipelined_cpasync | 126 | 128 | 8.0 | no | 0 | no | 4 | 16 |
| igemm_pipelined_cpasync | 126 | 128 | 8.0 | no | 0 | no | 4 | 16 |
| cross_attn_br16 | 124 | 128 | 0.0 | yes | 0 | no | 4 | 16 |
| hgemm_256x128 | 124 | 512 | 48.0 | no | 0 | no | 1 | 16 |
| flash_attn_br16_pipeline | 122 | 128 | 0.0 | no | 0 | no | 4 | 16 |
| flash_attn_br16 | 122 | 128 | 0.0 | no | 0 | no | 4 | 16 |
| flash_attn_4warp | 96 | 128 | 16.0 | no | 0 | no | 5 | 20 |
| igemm_pipelined_cpasync_perchannel | 95 | 128 | 12.0 | no | 0 | no | 5 | 20 |
| hgemm_16warp_splitk | 91 | 512 | 0.0 | yes | 0 | no | 1 | 16 |
| hgemm_16warp_epi_pad | 89 | 512 | 0.0 | yes | 0 | no | 1 | 16 |
| wmma_gemm_conv | 64 | 128 | 0.0 | yes | 0 | no | 8 | 32 |
| implicit_gemm_conv_v2 | 64 | 512 | 38.9 | no | 0 | no | 2 | 32 |
| conv2d_nhwc | 64 | 128 | 4.5 | no | 0 | no | 8 | 32 |
| hgemm_sparse_naive | 64 | 32 | 0.8 | no | 0 | no | 16 | 16 |
| hgemm_16warp_aligned | 64 | 512 | 37.0 | no | 0 | no | 2 | 32 |
| hgemm_16warp_epi | 64 | 512 | 48.0 | no | 0 | no | 2 | 32 |
| hgemm_16warp_persistent | 64 | 512 | 37.0 | no | 0 | no | 2 | 32 |
| hgemm_16warp | 64 | 512 | 37.0 | no | 0 | no | 2 | 32 |
| igemm_sparse_tiled | 64 | 512 | 30.0 | no | 0 | no | 2 | 32 |
| igemm_sparse_tiled | 64 | 512 | 46.0 | no | 0 | no | 2 | 32 |
| igemm_sparse_tiled_persistent | 64 | 512 | 31.0 | no | 0 | no | 2 | 32 |
| igemm_sparse_tiled | 64 | 512 | 30.0 | no | 0 | no | 2 | 32 |
| igemm_tiled | 64 | 128 | 4.0 | no | 0 | no | 8 | 32 |
| igemm_tiled | 64 | 128 | 4.0 | no | 0 | no | 8 | 32 |
| igemm_tiled | 64 | 128 | 4.0 | no | 0 | no | 8 | 32 |
| igemm_tiled | 64 | 128 | 4.0 | no | 0 | no | 8 | 32 |
| igemm_tiled | 64 | 128 | 4.0 | no | 0 | no | 8 | 32 |
| sgemm_register_blocked | 64 | 256 | 16.4 | no | 0 | no | 4 | 32 |
| hgemm_sparse_tiled | 63 | 512 | 29.0 | no | 0 | no | 2 | 32 |
| flash_attn_multihead | 56 | ? | 16.0 | no | 0 | no | ? | ? |
| flash_attn_1warp | 56 | 128 | 16.0 | no | 0 | no | 6 | 24 |
| implicit_gemm_conv | 56 | 128 | 0.0 | yes | 0 | no | 9 | 36 |
| flash_attn_split_q_reduce | 40 | 128 | 0.0 | no | 0 | no | 12 | 48 |
| conv2d_1x1_nhwc | 40 | 128 | 0.5 | no | 0 | no | 12 | 48 |
| hgemm_wmma | 40 | ? | 0.0 | no | 0 | no | ? | ? |
| igemm_wmma | 40 | ? | 0.0 | no | 0 | no | ? | ? |
| sgemm_naive | 40 | ? | 0.0 | no | 0 | no | ? | ? |
| groupnorm_nchw | 40 | ? | 0.0 | no | 0 | no | ? | ? |
| groupnorm | 40 | ? | 0.0 | no | 0 | no | ? | ? |
| sgemm_tiled | 37 | ? | 8.2 | no | 0 | no | ? | ? |
| gather_sum | 34 | ? | 0.0 | no | 0 | no | ? | ? |
| layernorm_block | 34 | ? | 0.0 | no | 0 | no | ? | ? |
| groupnorm_silu_fused | 32 | ? | 0.0 | no | 0 | no | ? | ? |
| probe_frag_b_col | 30 | ? | 0.5 | no | 0 | no | ? | ? |
| probe_frag_b_row | 30 | ? | 0.5 | no | 0 | no | ? | ? |
| probe_frag_a | 30 | ? | 0.5 | no | 0 | no | ? | ? |
| probe_frag_b_col | 30 | ? | 0.5 | no | 0 | no | ? | ? |
| probe_frag_b_row | 30 | ? | 0.5 | no | 0 | no | ? | ? |
| probe_frag_a | 30 | ? | 0.5 | no | 0 | no | ? | ? |
| im2col_nhwc_fp16 | 28 | 128 | 0.0 | yes | 0 | no | 12 | 48 |
| layernorm_warp | 27 | ? | 0.0 | no | 0 | no | ? | ? |
| timestep_emb_with_silu_scale | 24 | ? | 0.0 | no | 0 | no | ? | ? |
| softmax_block | 23 | ? | 0.0 | no | 0 | no | ? | ? |
| gather_sum | 19 | ? | 0.0 | no | 0 | no | ? | ? |
| residual_add | 18 | ? | 0.0 | no | 0 | no | ? | ? |
| timestep_emb_batch | 16 | ? | 0.0 | no | 0 | no | ? | ? |
| softmax_warp | 16 | ? | 0.0 | no | 0 | no | ? | ? |
| transpose_bhsd | 15 | ? | 0.0 | no | 0 | no | ? | ? |
| transpose_bshd | 15 | ? | 0.0 | no | 0 | no | ? | ? |
| fp16_to_fp32 | 14 | ? | 0.0 | no | 0 | no | ? | ? |
| gelu_fast | 13 | ? | 0.0 | no | 0 | no | ? | ? |
| silu_kernel | 13 | ? | 0.0 | no | 0 | no | ? | ? |
| gelu_fast | 13 | ? | 0.0 | no | 0 | no | ? | ? |
| silu_kernel | 13 | ? | 0.0 | no | 0 | no | ? | ? |
| vecadd | 12 | ? | 0.0 | no | 0 | no | ? | ? |
| fp32_to_fp16 | 12 | ? | 0.0 | no | 0 | no | ? | ? |
| residual_add | 12 | ? | 0.0 | no | 0 | no | ? | ? |
| gelu_kernel | 12 | ? | 0.0 | no | 0 | no | ? | ? |
| gelu_kernel | 12 | ? | 0.0 | no | 0 | no | ? | ? |
| timestep_emb_single | 12 | ? | 0.0 | no | 0 | no | ? | ? |
| vector_add | 12 | ? | 0.0 | no | 0 | no | ? | ? |
| relu_kernel | 10 | ? | 0.0 | no | 0 | no | ? | ? |
| relu_kernel | 10 | ? | 0.0 | no | 0 | no | ? | ? |

## Findings

Kernels with `spill?` = YES need investigation: spill loads/stores
are local-memory traffic that bypasses the register file. Each
spill load is ~400 cycles (DRAM-class latency unless L1/L2 hit).

Kernels with `smem_dynamic = yes` allocate at launch via
`extern __shared__`. cuobjdump's smem_static column will read 0
for those; the actual size lives in the host launch params
(see corresponding `bench_*.cu`).

Re-run: `Rscript scripts/audit/reg_audit.R`