deepseek-ai/DeepGEMM
DeepGEMM: clean and efficient BLAS kernel library on GPU
What it solves
DeepGEMM is a high-performance CUDA kernel library designed to optimize the core computational primitives of modern large language models (LLMs). It addresses the need for efficient matrix multiplication (GEMM) and Mixture-of-Experts (MoE) operations, providing performance that matches or exceeds expert-tuned libraries while remaining simpler and more accessible for learning GPU kernel optimization.
How it works
The library provides a unified codebase for various tensor core kernels, including support for FP8, FP4, and BF16 precisions. It uses a system called DeepJIT to compile kernels at runtime, eliminating the need for CUDA compilation during installation. Key features include:
- Diverse GEMM Support: Implements non-grouped, contiguous grouped, and masked grouped GEMMs tailored for different LLM phases (training, prefilling, and decoding).
- Mega MoE: A fused mega-kernel that overlaps NVLink communication with tensor core computation, combining EP dispatch, linear layers, SwiGLU, and EP combine into one operation.
- MQA Kernels: Specialized scoring kernels for the lightning indexer used in DeepSeek v3.2.
- Hardware Optimization: Specifically optimized for NVIDIA SM90 and SM100 architectures.
Who it’s for
DeepGEMM is intended for developers and researchers working on LLM inference and training infrastructure, specifically those using NVIDIA H800 or similar high-end GPUs (SM90/SM100) who need maximum throughput and low-latency MoE operations.
Highlights
- Extreme Performance: Achieves up to 1550 TFLOPS on H800 GPUs.
- Runtime Compilation: Uses DeepJIT for on-the-fly kernel compilation to simplify installation.
- Fused MoE: The Mega MoE kernel significantly reduces overhead by overlapping communication and computation.
- Broad Precision Support: Supports FP8, FP4, and BF16 formats.
- Simplified Design: Avoids heavy reliance on complex CUTLASS templates, making the codebase cleaner and easier to study.
Related
- Project
- Project
- Project
- Project
- Project