xlite-dev/LeetCUDA

An Open-source book with Modern CUDA learning Notes for Beginners - BF16/FP8/FP4, HGEMM, CuTe, Flash-Attention, etc.

What it solves

LeetCUDA provides a comprehensive, structured learning path for mastering modern CUDA programming, specifically targeting the high-performance requirements of AI and LLM kernels. It bridges the gap between basic CUDA knowledge and the implementation of state-of-the-art operators like FlashAttention and high-performance GEMM (General Matrix Multiply).

How it works

The project is organized as an open-source book and a corresponding repository of over 200 CUDA kernels. It guides users through a tiered difficulty system (Easy to Hard++), moving from simple element-wise operations to complex Tensor Core implementations using MMA PTX instructions. Each topic follows a workflow of implementing a custom CUDA kernel, creating PyTorch Python bindings, and running tests.

Who it’s for

It is designed for developers and researchers who want to learn how to write high-performance GPU kernels for deep learning, ranging from beginners to those looking to optimize advanced LLM components.

Highlights

  • Extensive Kernel Library: Includes over 200 kernels covering element-wise ops, reductions, and advanced matrix multiplications.
  • Tensor Core Mastery: Detailed implementations of HGEMM and FlashAttention-2 using pure MMA PTX, achieving performance close to cuBLAS.
  • Agentic Integration: Provides a leetcuda-cpp-kernel skill that can be integrated with coding agents like GitHub Copilot and Claude Code.
  • Comprehensive Documentation: A 600+ page open-source book with 40+ chapters of detailed explanations.

Related

  • Project
  • Dispatch
  • Project
  • Project
  • Project