Skip to content

[FA3] uv installation support#2458

Open
bbuschkaemper wants to merge 5 commits intoDao-AILab:mainfrom
bbuschkaemper:fa3-package
Open

[FA3] uv installation support#2458
bbuschkaemper wants to merge 5 commits intoDao-AILab:mainfrom
bbuschkaemper:fa3-package

Conversation

@bbuschkaemper
Copy link
Copy Markdown

@bbuschkaemper bbuschkaemper commented Apr 14, 2026

Motivation

FA3, even though in beta, is supported in many downstream frameworks, e.g. megatron-core. To streamline installation using uv and pyproject.toml, the building of the FA3 beta needs to be adapted: Currently, building using uv results in all package files being dropped directly into site-packages/, instead of the corresponding site-packages/flash_attn_3 subfolder.

Existing downstream frameworks like megatron-core need a flash_attn_3 package to work (see here), preventing a clean building solution using a single pyproject.toml and requiring custom build steps.

Solution

To support projects to integrate FA3 correctly, I propose a backwards-compatible change to the package setup, allowing FA3 to be properly built into a package using a pyproject.toml while maintaining existing behaviour.

This change outputs the flash_attn_interface.py and flash_attn_config.py files into both the site-packages/ (for backwards compatibility) and site-packages/flash_attn_3 folders.

Copilot AI review requested due to automatic review settings April 14, 2026 13:10
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds an opt-in build flag to install FlashAttention-3 (FA3) as a flash_attn_3 package (for uv/pyproject.toml workflows) while keeping the default legacy layout unchanged.

Changes:

  • Introduce FLASH_ATTENTION_AS_PACKAGE build flag in hopper/setup.py to install modules under flash_attn_3.* and force source builds (skip cached wheels) when enabled.
  • Ensure flash_attn_config.py is generated in AS_PACKAGE scenarios even when CUDA build is skipped.
  • Document uv installation configuration in README.md.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
hopper/setup.py Adds AS_PACKAGE build mode and adjusts wheel build/config generation to support package-style installs.
README.md Adds uv/pyproject.toml installation instructions using the new build flag.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread hopper/setup.py Outdated
Comment thread README.md
@bbuschkaemper bbuschkaemper marked this pull request as draft April 15, 2026 09:37
Signed-off-by: Björn Buschkämper <bjoern.buschkaemper@gmail.com>
@bbuschkaemper bbuschkaemper marked this pull request as ready for review April 16, 2026 13:05
@bbuschkaemper bbuschkaemper requested a review from Copilot April 16, 2026 13:05
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 5 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread hopper/setup.py Outdated
Comment thread hopper/setup.py Outdated
bbuschkaemper and others added 2 commits April 16, 2026 15:18
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 5 changed files in this pull request and generated 6 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread README.md
Comment thread hopper/setup.py Outdated
Comment thread hopper/setup.py
Comment thread hopper/flash_attn_3/flash_attn_interface.py
Comment thread hopper/flash_attn_3/flash_attn_interface.py
Comment thread README.md
Signed-off-by: Björn Buschkämper <bjoern.buschkaemper@gmail.com>
@bbuschkaemper
Copy link
Copy Markdown
Author

@tridao This PR is supposed to be an easy, backwards-compatible change to allow clean fa3 builds with uv so that packages that require a "flash_attn_3" package instead of a single "flash_attn_interface" module will work with it. If you have a different plan for fa3 building let me know; I can adapt the PR as-needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants