Learning series · first draft

16 notes / Performance model → TensorRT-LLM

高性能计算、CUDA 算子与推理系统

从“时间到底花在哪里”开始,建立 latency、throughput、bandwidth、arithmetic intensity 与 scaling 的共同语言;再进入 CPU cache/SIMD、GPU SIMT、CUDA memory/streams、并行算法与深度学习核心算子,最后把自定义 kernel、编译、多 GPU 通信和 TensorRT/LLM serving 连成一条生产链。

16 篇独立文章4 层:硬件、算子、系统、部署资料快照:2026-08-30

Part I · 先建立硬件无关的性能语言

01Performance

性能模型与扩展定律

latency、throughput、FLOPS、bandwidth、Amdahl/Gustafson、strong/weak scaling 和 tail latency。

02CPU HPC

CPU Cache、SIMD 与 NUMA

cache line、vectorization、线程、OpenMP/MPI、false sharing 与 memory locality 为什么仍是 GPU 系统的地基。

03GPU

GPU 架构与 SIMT

SM、warp、thread/block/grid、scheduler、divergence、register 和 occupancy 的硬件映射。

04Roofline

内存层级与 Roofline

HBM/L2/shared/register、数据搬运、arithmetic intensity,以及 compute-bound 与 memory-bound 的判断。

Part II · CUDA 与并行算子的核心

05CUDA

CUDA 编程模型

host/device、kernel launch、索引、同步、memory allocation、error handling 与第一个可靠 kernel。

06Kernel tuning

Coalescing、Tiling 与 Occupancy

shared-memory tile、bank conflict、register pressure、latency hiding 和 fusion 的真实权衡。

07Async

Streams、Events 与 CUDA Graphs

异步 launch、copy/compute overlap、pinned memory、依赖、隐式同步与降低 launch overhead。

08Algorithms

并行 Primitives 与 HPC Kernels

map、reduce、scan、sort、histogram、stencil、FFT、sparse 和 atomics 的通用设计模式。

09Dense compute

GEMM、Convolution 与 Tensor Cores

三级 tiling、MMA、epilogue、implicit GEMM,以及 cuBLAS/cuDNN/CUTLASS 为什么难以随手超越。

10Numerics

精度与数值稳定性

FP32/TF32/FP16/BF16/FP8/INT8/FP4、accumulation、overflow、reduction order 和量化误差。

Part III · 从一个想法变成可组合、可分析的算子

11Custom op

CUDA Extension、Triton 与 CUTLASS

何时写 CUDA C++、Triton 或 CUTLASS/CuTe,怎样接 PyTorch autograd、FakeTensor 与动态 shape。

12Compiler

Graph Compiler、Fusion 与 PyTorch

Dynamo/FX/Inductor/Triton、graph break、shape specialization、fusion、AOT 与 runtime compilation。

13Measure

Profiling、Debugging 与 Benchmark

Nsight Systems/Compute、NVTX、CUDA events、warmup、同步、correctness 与可复现实验。

14Distributed

多 GPU 通信与扩展

PCIe/NVLink/InfiniBand、NCCL collectives、ring/tree、data/tensor/pipeline parallel 与 overlap。

Part IV · 把模型编译成生产推理系统

15TensorRT

TensorRT Build 与 Runtime

ONNX/network、builder、tactics、engine、execution context、dynamic profiles、plugins、量化与 trtexec。

16Serving

TensorRT-LLM 与在线 Serving

prefill/decode、paged KV cache、in-flight batching、quantization、parallelism、TTFT/TPOT 与生产容量规划。

全系列的主线:

algorithm → work/data movement → kernel → launch/communication → compiled engine → request scheduler。任何一层都可能成为瓶颈;“GPU 利用率高”或“TFLOPS 高”都不是端到端快的充分条件。