flashinfer-ai/flashinfer

★ 6,461⑂ 0

FlashInfer: Kernel Library for LLM Serving

About flashinfer-ai/flashinfer

flashinfer-ai/flashinfer is an open-source project on GitHub, mainly written in Cuda. FlashInfer: Kernel Library for LLM Serving It currently holds 6,461 stars and 0 forks with 0 open issues, and was last pushed on an unknown date (repository created unknown).

Project Overview

AI Homed tracks it on the AI Models & LLM Tools board.

GitHub Repository Details

Repository flashinfer-ai/flashinfer · default branch - · size 0 KB · watchers 0 · source: GitHub REST API and repository README

README

https://github.com/flashinfer-ai/flashinfer/blob/HEAD/FlashInfer

High-Performance GPU Kernels for Inference

| Documentation | Latest Release | Blog | Slack | Discussion Forum |

Build Status Documentation

FlashInfer is a library and kernel generator for inference that delivers state-of-the-art performance across diverse GPU architectures. It provides unified APIs for attention, GEMM, and MoE operations with multiple backend implementations including FlashAttention-2/3, cuDNN, CUTLASS, and TensorRT-LLM.

Why FlashInfer?

Core Features

Attention Kernels

GEMM & Linear Operations

Mixture of Experts (MoE)

Sampling & Decoding

Communication

Other Operators

GPU Support

| Architecture | Compute Capability | Example GPUs | |--------------|-------------------|------| | Turing | SM 7.5 | T4, RTX 20 series | | Ampere | SM 8.0, 8.6 | A100, A10, RTX 30 series | | Ada Lovelace | SM 8.9 | L4, L40, RTX 40 series | | Hopper | SM 9.0 | H100, H200 | | Blackwell | SM 10.0, 10.3 | B200, B300 | | Blackwell | SM 11.0 | Jetson Thor | | Blackwell | SM 12.0, 12.1 | RTX 50 series, DGX Spark |

Note: Not all features are supported across all compute capabilities.

News

Latest: GitHub Release

Notable updates:

Getting Started

Installation

Quickstart:

pip install flashinfer-python

Package Options:

For faster initialization and offline usage, install the optional packages to have most kernels pre-compiled:

pip install flashinfer-python
flashinfer install-cubin-wheel
flashinfer install-jit-cache-wheel

For Blackwell (SM100+) CuTe DSL kernels, install with the CUDA 13 extra to enable Blackwell-optimized kernels:

pip install flashinfer-python[cu13]

Verify Installation

flashinfer show-config

Basic Usage

import torch
import flashinfer

Single decode attention

q = torch.randn(32, 128, device="cuda", dtype=torch.float16) # [num_qo_heads, head_dim] k = torch.randn(2048, 32, 128, device="cuda", dtype=torch.float16) # [kv_len, num_kv_heads, head_dim] v = torch.randn(2048, 32, 128, device="cuda", dtype=torch.float16)

output = flashinfer.single_decode_with_kv_cache(q, k, v)

See documentation for comprehensive API reference and tutorials.

Install from Source

git clone https://github.com/flashinfer-ai/flashinfer.git --recursive
cd flashinfer
python -m pip install -v .

For development, install in editable mode:

python -m pip install --no-build-isolation -e . -v
Note: When using --no-build-isolation, pip does not automatically install build dependencies. FlashInfer requires setuptools>=77. If you encounter an error like AttributeError: module 'setuptools.build_meta' has no attribute 'prepare_metadata_for_build_editable', upgrade pip and setuptools first:
> python -m pip install --upgrade pip setuptools

Build optional packages:

# flashinfer-cubin
python -m build --no-isolation --wheel flashinfer-cubin
python -m pip install flashinfer-cubin/dist/*.whl

Build one JIT-cache provider for the target GPU, then build a shim that depends on that provider. The example below builds an SM90a provider; both wheels must use the same version settings.

export FLASHINFER_JIT_CACHE_PROVIDER_ARCH=9.0a
python -m build --no-isolation --wheel flashinfer-jit-cache-provider

export FLASHINFER_JIT_CACHE_PROVIDER_ARCHS="9.0a" python -m build --no-isolation --wheel flashinfer-jit-cache

python -m pip install \ flashinfer-jit-cache-provider/dist/*.whl \ flashinfer-jit-cache/dist/*.whl

For more details, see the Install from Source documentation.

Nightly Builds

pip install -U --pre flashinfer-python --index-url https://flashinfer.ai/whl/nightly/ --no-deps
pip install flashinfer-python  # Install dependencies from PyPI
flashinfer install-cubin-wheel --nightly
flashinfer install-jit-cache-wheel --nightly

CLI Tools

FlashInfer provides several CLI commands for configuration, module management, and development:

# Verify installation and view configuration
flashinfer show-config

List and inspect modules

flashinfer list-modules flashinfer module-status

Manage artifacts and cache

flashinfer download-cubin flashinfer install-cubin-wheel flashinfer install-jit-cache-wheel flashinfer download-kernels flashinfer clear-cache

For developers: generate compile_commands.json for IDE integration

flashinfer export-compile-commands [output_path]

For complete documentation, see the CLI reference.

API Logging

FlashInfer provides comprehensive API logging for debugging. Enable it using environment variables:

# Enable logging (levels: 0=off (default), 1=basic, 3=detailed, 5=statistics)
export FLASHINFER_LOGLEVEL=3

Set log destination (stdout (default), stderr, or file path)

export FLASHINFER_LOGDEST=stdout

For detailed information about logging levels, configuration, and advanced features, see Logging in our documentation.

Custom Attention Variants

Users can customize their own attention variants with additional parameters. For more details, refer to our JIT examples.

CUDA Support

Supported CUDA Versions: 12.9, 13.0, and 13.4 (PyTorch nightly)

Note: FlashInfer strives to follow PyTorch's supported CUDA versions plus the latest CUDA release.
CUDA 13.4 wheels are built with the preview toolkit and PyTorch nightly; runtime CI currently covers CUDA 12.9 and 13.0.

Adoption

FlashInfer powers inference in:

Acknowledgement

FlashInfer is inspired by FlashAttention, vLLM, stream-K, CUTLASS, and AITemplate.

Citation

If you find FlashInfer helpful in your project or research, please consider citing our paper:

@article{ye2025flashinfer,
    title = {FlashInfer: Efficient and Customizable Attention Engine for LLM Inference Serving},
    author = {
      Ye, Zihao and
      Chen, Lequn and
      Lai, Ruihang and
      Lin, Wuwei and
      Zhang, Yineng and
      Wang, Stephanie and
      Chen, Tianqi and
      Kasikci, Baris and
      Grover, Vinod and
      Krishnamurthy, Arvind and
      Ceze, Luis
    },
    journal = {arXiv preprint arXiv:2501.01005},
    year = {2025},
    url = {https://arxiv.org/abs/2501.01005}
}

GitHub Stars & Activity

6,461Stars
0Forks
0Open issues
CudaLanguage

GitHub Popularity

GitHub stars6,461
Forks0
Open issues0
Primary languageCuda
License-
Stars gained today0
Created-
Last pushed-

Trending History

Trending statusnot on today's boards

Related AI Projects

1

ollama / ollama

Go★ 181,329⑂ 0
2

huggingface / transformers

Python★ 166,453⑂ 0
3

langgenius / dify

TypeScript★ 156,633⑂ 0
4

TauricResearch / TradingAgents

Python★ 107,797⑂ 0
5

infiniflow / ragflow

Go★ 91,066⑂ 0
6

PaddlePaddle / PaddleOCR

Python★ 89,891⑂ 0
7

rtk-ai / rtk

Rust★ 81,154⑂ 0
8

More AI Rankings