Skip to main content
File added late

1 file was added to this release more than 14 days after its initial publication. Inspect the release files before installing.

Flash-Attention-3 Forward-Only Kernel

This repository bundles the Flash-Attention-3 forward-only kernel and the tooling required to build a lightweight Python wheel. It is intended for inference scenarios where backward operators and optional features are unnecessary.

Highlights

  • Ships only the Flash-Attention-3 forward path while disabling backward kernels, local attention, paged KV cache, FP16 kernels, and other extras to minimize the wheel size.
  • Applies a patch that renames the public interface to fa3_fwd_interface, making the forward kernel easy to import from Python.

Prerequisites(same as upstream)

  • Python: 3.9 or later
  • PyTorch: 2.10
  • Build dependencies: ninja, packaging, wheel

Quick Start

  1. Clone the repository and initialize submodules:

    git clone --recursive <repo-url>
    cd fa3-fwd
    # If --recursive was omitted during clone, run:
    git submodule update --init --recursive
    
  2. Create a Python virtual environment and install dependencies:

    uv venv --python 3.12 --seed
    source .venv/bin/activate
    uv pip install -r requirements.txt
    
  3. Build the forward-only wheel:

    bash build_fa3.sh
    

    The script:

    • Sources set_compile_env.sh to compute MAX_JOBS and NVCC_THREADS
    • Applies the custom patch and interface rename inside the Flash-Attention submodule
    • Runs python setup.py bdist_wheel under flash-attention/hopper
  4. Install the generated wheel (example):

    pip install build/*.whl
    

Python Usage Example

import torch
from fa3_fwd_interface import flash_attn_func

# Inputs must already live on CUDA and satisfy Flash-Attention-3 constraints
out = flash_attn_func(q, k, v, causal=True)

This package exposes only the forward kernel. For backward support or additional features, depend on the upstream Flash-Attention project instead.

Troubleshooting

  • Out-of-memory during compilation: The build script already throttles concurrency, but you can enforce MAX_JOBS=1 NVCC_THREADS=1 before running bash build_fa3.sh.
  • CUDA mismatch errors: Confirm that nvcc --version aligns with torch.version.cuda.

Repository Layout

Customize further by editing environment variables in the build script or modifying the submodule before the patch is applied (for example to re-enable additional datatypes or kernels).

Release files for fa3-fwd 0.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

File added late

1 file was uploaded more than 14 days after the first file in this release.

While project maintainers occasionally add legitimate files to an existing release, late additions can also indicate a security compromise.

We recommend inspecting the release files before installing.

Built distributions (wheels)

Table of built distributions (wheels) for fa3-fwd 0.0.3
File Interpreter ABI Platform
fa3_fwd-0.0.3-cp39-abi3-manylinux_2_24_x86_64.whl CPython 3.9 abi3 Linux glibc 2.24+ x86-64 Details
fa3_fwd-0.0.3-cp39-abi3-manylinux_2_24_aarch64.whl CPython 3.9 abi3 Linux glibc 2.24+ ARM64 Details

Total release size: 55.5 MB

Release files / fa3_fwd-0.0.3-cp39-abi3-manylinux_2_24_x86_64.whl

Download URL fa3_fwd-0.0.3-cp39-abi3-manylinux_2_24_x86_64.whl
Size 27.6 MB
Tags CPython 3.9 Linux glibc 2.24+ x86-64 abi3
SHA-256 checksum
How to use checksums
44d26c6cfc69dde5a0f9c6bebbccbb96ed20e97bc8b9ddda638b0bf62e91b93d
BLAKE2b-256 checksum
How to use checksums
eda6a4a31f4e500a3ac787cadf4c172aaf9fc74fb81f6ed78778fc8158384f00
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.11

Release files / fa3_fwd-0.0.3-cp39-abi3-manylinux_2_24_aarch64.whl

File added late

This file was uploaded more than 14 days after the first file in this release.

While project maintainers occasionally add legitimate files to an existing release, late additions can also indicate a security compromise.

We recommend inspecting the release file before installing.

Download URL fa3_fwd-0.0.3-cp39-abi3-manylinux_2_24_aarch64.whl
Size 27.9 MB
Tags CPython 3.9 Linux glibc 2.24+ ARM64 abi3
SHA-256 checksum
How to use checksums
1e0e51f2b4b094e8dd0526a5e4291a0f2d0366cc55e89b27c6b8bb469dd05cfa
BLAKE2b-256 checksum
How to use checksums
75b061b7888b1699efc8299f2027c7d18130a35fc7f3819ad98c2f85317d3b1d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.20

Release history Release notifications | RSS feed

This release

0.0.3 This release

2 release files

0.0.2

2 release files

0.0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page