# Per-Layer OI/CF Roofline — Llama-3.1-8B on H100 (Section 4.4) Per-component operational intensity (OI) and capacity footprint (CF) roofline decomposition for a Llama-3.1-8B decoder layer on a single H100-SXM5-80GB (bf16, TP=1). Backs Section 4.4 "Layer-Level Roofline Decomposition" and Figure `per_layer_oi_cf_8b_h100.pdf`. ## Files - `analytical/` — Per-component OI computed from model dimensions. B=1 prefill (C=1, memory-limited) and B=80 prefill (C=80, compute-saturated). - `ncu/` — NCU v2024.3.2 kernel traces (`--set full`) on 8 decoder layers (indices 1–8) at bs=1 prefill. Clean run, 52 us total GPU time across 8 unique kernel types. Reproduce with: ``` CUDA_VISIBLE_DEVICES=0 ncu --set full --csv --profile-from-start no \ --target-processes all -o output \ python3 scripts/roofline/_ncu_target_simple.py ``` - `per_layer_oi_cf_8b_h100.pdf` — Two-panel figure: (a) per-component OI on H100 roofline, (b) capacity footprint sweep C=1..80. - `per_layer_table.tex` — LaTeX table classifying each component as compute-bound (OI > 295 FLOP/byte) or bandwidth-bound. ## Key findings | Component | Wt (MB) | OI (C=1) | OI (C=80) | Bound | |-----------|---------|----------|-----------|-------| | GEMM projections (Q,K,V,O,Gate,Up,Down) | 436 | 315–441 | 803–2956 | COMPUTE | | RMSNorm (in/out), RoPE, SiLU, Gate×Up | — | 0–1 | 0–1 | BANDWIDTH | | Flash attention | — | 64 | 64 | BANDWIDTH | | **Layer total** | **436** | **330** | **878** | **COMPUTE** | NCU validation: at C=1, GEMM = 10.8% of GPU time, memory ops = 65%, confirming the layer is barely compute-bound (OI=330 vs ridge=295). System capacity-bound at 32K context: C ≥ 16 (KV cache + weights > 80 GB HBM). ## Citation AgentPerfBench: A Benchmarking and Evaluation Suite for Inference Performance of Agentic LLMs. NeurIPS 2026.