How vshiva27/cuda-transformer-performance works
This repository is a CUDA Transformer-inference kernel library and its GPT-2 integration. The user-facing inference path loads a Hugging Face model, prepares weights and cache state, then generates tokens through a Python runner, C++ bindings, and CUDA kernels. Separate branches cover CPU reference operations, kernel benchmarking against PyTorch/cuBLAS, and Nsight profiling. The README documents these capabilities; sampled source confirms selected CPU-reference and GPT-2 binding behavior, but not every benchmark or kernel call path.
Main entry points: gpt2_ops.cpp PyTorch bindings · benchmark CUDA benchmarks · run_gpt2.py GPT-2 runner · gemv.cu Decode GEMV
Components 19
Inference Kernels
- Decode GEMV
kernels/gemv.cu - Fused attention
kernels/attention.cu - LayerNorm
kernels/layernorm.cu - Softmax
kernels/softmax.cu - GEMM variants
kernels/matmul_basic.cu - Tiled GEMM
kernels/matmul_tiled.cu - Register GEMM
kernels/matmul_register.cu - WMMA GEMM
kernels/matmul_wmma.cu - Vector add
kernels/vector_add.cu
GPT-2 Integration
- GPT-2 runner
llm/run_gpt2.py - PyTorch bindings
llm/gpt2_ops.cpp
Evaluation
- CPU references
src/cpu/cpu_ops.cpp - CUDA benchmarks
src/benchmark - PyTorch baseline
python/pytorch_baseline.py - Nsight profiling
profiling - Benchmark reports
benchmarks
Other components
- Inference user
- Hugging Face model
- NVIDIA GPU
Connections 22
- Inference user → GPT-2 runner: runs
README.md - GPT-2 runner → Hugging Face model: loads and verifies
README.md - GPT-2 runner → PyTorch bindings: invokes
llm/gpt2_ops.cpp - PyTorch bindings → Decode GEMV: dispatches linear
llm/gpt2_ops.cpp - PyTorch bindings → Fused attention: dispatches attention
llm/gpt2_ops.cpp - PyTorch bindings → LayerNorm: dispatches normalization
llm/gpt2_ops.cpp - PyTorch bindings → Softmax: uses in integration
llm/gpt2_ops.cpp - Decode GEMV → NVIDIA GPU: executes on
README.md - Fused attention → NVIDIA GPU: executes on
README.md - LayerNorm → NVIDIA GPU: executes on
README.md - Softmax → NVIDIA GPU: executes on
README.md - GEMM variants → NVIDIA GPU: executes on
README.md - Tiled GEMM → NVIDIA GPU: executes on
README.md - Register GEMM → NVIDIA GPU: executes on
README.md - WMMA GEMM → NVIDIA GPU: executes on
README.md - Vector add → NVIDIA GPU: executes on
README.md - CPU references → CUDA benchmarks: provides reference
README.md - CUDA benchmarks → NVIDIA GPU: times kernels
README.md - PyTorch baseline → CUDA benchmarks: provides comparison
README.md - CUDA benchmarks → Benchmark reports: writes measurements
README.md - NVIDIA GPU → Nsight profiling: profiled with
README.md - Nsight profiling → Benchmark reports: produces reports
README.md