# Bernini Inference Optimization Benchmarks Measured on 2026-07-01 with 8x H100, Ulysses 8, CFG batching, PyTorch 2.5.1+cu124, BF16, seed 42, 81 frames, 480x848, 16 fps, 50 diffusion steps, 25 semantic-planning steps, and the repository T2V demo prompt. In this first-round experiment approximate methods were opt-in and the reference path was dense BF16/FA3; the current launcher recommendation is documented below. This file records the first-round module and single-prompt experiments. The six-prompt result and the final CPU-master stack are documented in [inference_optimization_summary.md](inference_optimization_summary.md). Baseline terminology follows [inference_baseline_naming.md](inference_baseline_naming.md). In the table below, the dense BF16/FA3 row is the experiment-local `optimized-stack baseline`; it is not the upstream `pristine baseline`. ## Module Microbenchmarks The GEMM dimensions are the actual per-rank Bernini hot shapes. FP8 uses per-tensor E4M3 weights and dynamically quantized E4M3 activations. | Projection (M x K x N) | BF16 | FP8 dynamic | Speedup | | --- | ---: | ---: | ---: | | Q/K/V/out (12522 x 5120 x 5120) | 0.8138 ms | 1.0721 ms | 0.759x | | FFN up (12522 x 5120 x 13824) | 2.6793 ms | 1.9229 ms | 1.393x | | FFN down (12522 x 13824 x 5120) | 2.4610 ms | 2.6521 ms | 0.928x | | Cross KV (512 x 5120 x 5120) | 0.0562 ms | 0.0828 ms | 0.679x | | Cross KV (1024 x 5120 x 5120) | 0.0852 ms | 0.1237 ms | 0.689x | Only FFN-up passed the dynamic-quantization gate and is integrated behind `BERNINI_FP8_FFN_UP=1`. Prequantized FP8 GEMMs were 1.76x-1.96x faster, but that upper bound excludes activation quantization. PISA was measured on the packed self-attention shape `[100170, 5, 128]`, split into three independent 33390-token CFG branches. Timings include layout copies, routing/top-k, sparse attention, and output concatenation. | HYD density | Dense FA3 | PISA end-to-end | Speedup | Relative RMSE | | ---: | ---: | ---: | ---: | ---: | | 0.10 | 12.1849 ms | 4.5552 ms | 2.675x | 0.5859 | | 0.15 | 12.1849 ms | 7.9036 ms | 1.542x | 0.6010 | | 0.30 | 12.1849 ms | 12.7882 ms | 0.953x | 0.6049 | ## Full Video Results SSIM/PSNR compare decoded frames with the `dense quality reference` generated from the same prompt and seed. Diffusion time is the renderer's `video_diffusion` stage; request totals are not compared because preprocessing and first-use caches vary with matrix order. | Method | Configuration | Skipped steps | Diffusion | Speedup | PSNR | SSIM | | --- | --- | ---: | ---: | ---: | ---: | ---: | | Experiment-local optimized-stack baseline | dense BF16 + FA3 | 0/50 | 106.343 s | 1.000x | inf | 1.000000 | | PISA HYD | density 0.15, layers 4+ | n/a | 84.586 s | 1.257x | 15.538 | 0.632802 | | TeaCache | threshold 0.05 | 0/50 | 95.833 s | no cache hit | inf | 1.000000 | | TeaCache | threshold 0.15 | 18/50 | 80.417 s | 1.322x | 31.624 | 0.953897 | | EasyCache | threshold 0.05, retain 5+last 1 | 11/50 | 82.264 s | 1.293x | 38.798 | 0.977598 | | EasyCache Wan2.2 setting | threshold 0.06, retain 7+last 1 | 12/50 | 83.930 s | 1.267x | 37.067 | 0.974997 | FP8 FFN-up reduced the warm denoising-step median from about 1.15 s to 1.12 s (about 1.03x), but lazy weight quantization added about 31.5 s across the two experts and the 10-step video comparison was SSIM 0.927980. It is not a useful one-shot default. The PISA module kernel is fast, but it changes the seed-aligned generation trajectory substantially. TeaCache's Wan2.1-14B polynomial transfers imperfectly to Bernini's two experts. The later six-prompt sweep selected EasyCache `0.08/4` as the recommended fidelity tier. ## Reproduction ```bash python scripts/bernini/bench_fp8_gemm.py PYTHONPATH=/path/to/compatible/pisa/python-packages:$PWD \ python scripts/bernini/bench_pisa_attention.py \ --implementation hyd --density 0.10 --density 0.15 --density 0.30 BERNINI_OPTIMIZATION_PROFILE=recommended_easycache \ bash scripts/bernini/run_t2v.sh ``` The current PISA checkout's README asks for newer Torch/Triton than Bernini's production environment. The isolated overlay uses Triton 3.5.1 with the production PyTorch 2.5.1 build because this exact kernel combination passed the module and full-model tests; it is not an officially supported dependency set. References: [PISA](https://github.com/xie-lab-ml/piecewise-sparse-attention), [TeaCache](https://github.com/ali-vilab/TeaCache), and [EasyCache](https://github.com/H-EmbodVis/EasyCache).