Navigation
๐Ÿ”ง

CUDA & Kernel Engineering

From writing your first CUDA kernel to implementing FlashAttention โ€” making one GPU go fast.

0 / 23 chapters

CUDA Programming

01

CUDA Programming Modelcoming soon

Threads, warps, blocks, grids, and streaming multiprocessors โ€” how code maps to hardware.

02

CUDA Memory Modelcoming soon

Registers, shared memory, L1/L2 cache, global memory (HBM) โ€” capacity, bandwidth, and access rules.

03

Warp Execution & Schedulingcoming soon

Warp divergence, instruction-level parallelism, latency hiding through occupancy.

04

CUDA Streams, Events & Graphscoming soon

Asynchronous execution, reducing launch overhead, persistent kernels.

05

Environment Setupcoming soon

Driver/toolkit installation, version compatibility, and verification.

Memory & Performance Optimization

06

Memory Coalescingcoming soon

How thread access patterns map to memory transactions โ€” the #1 optimization.

07

Shared Memory & Bank Conflictscoming soon

Using shared memory effectively and avoiding bank conflicts.

08

Occupancy & Resource Allocationcoming soon

The balance between registers, shared memory, and active warps per SM.

09

Tiling Strategiescoming soon

Breaking large problems into shared-memory-sized chunks to maximize data reuse.

10

Synchronization & Atomic Operationscoming soon

Thread synchronization primitives and when to use atomics.

Core Kernel Implementation

11

Parallel Reductioncoming soon

Warp-level primitives, avoiding bank conflicts โ€” the foundation of many kernels.

12

GEMM Optimizationcoming soon

Naive โ†’ tiled โ†’ double-buffered โ†’ Tensor Core aware โ€” understanding the connection to cuBLAS.

13

Softmax Implementationcoming soon

Naive โ†’ online/stable โ†’ fused with scaling โ€” numerical stability meets performance.

14

Operator Fusioncoming soon

Eliminating intermediate tensors by chaining operations โ€” principles, limits, and compilation complexity.

Attention Kernels

15

Naive Attentioncoming soon

Full Nร—N materialization โ€” why it is memory-bound and where the bottleneck is.

16

FlashAttention V1coming soon

Tiled computation with online softmax โ€” no materialization of the attention matrix.

17

FlashAttention V2coming soon

Improved parallelism and warp partitioning for higher GPU utilization.

18

FlashInfercoming soon

Page-level attention for heterogeneous request handling in serving engines.

19

Block-Sparse & Linear Attention Kernelscoming soon

Attention patterns beyond dense: sparse masks, linear attention, and their kernel implementations.

Compilers & Profiling

20

AI Compilerscoming soon

Triton, TVM, XLA, torch.compile/Inductor โ€” automated tiling, fusion, and scheduling.

21

Nsight Systemscoming soon

Timeline profiling โ€” finding launch overhead, memory copy stalls, and idle gaps.

22

Nsight Computecoming soon

Kernel-level analysis โ€” roofline charts, memory throughput, compute utilization.

23

PyTorch Profilercoming soon

Trace collection, operator-level timing, and bottleneck identification.