Skip to content

[Docs] Add Ascend NPU installation section to README - #938

Closed
zheliuyu wants to merge 2 commits into
fla-org:mainfrom
zheliuyu:main
Closed

zheliuyu wants to merge 2 commits into
fla-org:mainfrom
zheliuyu:main

Conversation

@zheliuyu

@zheliuyu zheliuyu commented Jun 5, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

fla kernels also run on Ascend NPUs via triton-ascend, but the default install path still pulls upstream CUDA triton from pyproject.toml. This PR documents the NPU-specific setup so users do not mix the two Triton packages in one environment.

Changes

  • Mention NPU in the intro platform list.
  • Split Installation into NVIDIA / AMD / XPU (unchanged upstream content) and Ascend NPU.
  • Add recommended install order (CANN → editable install → torch/torch_npu → uninstall triton → triton-ascend) and an example command block.
  • Add TOC links for both installation subsections.

Docs-only change; no code or dependency updates.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request updates the README.md to add installation instructions for Ascend NPU using triton-ascend. The reviewer suggested optimizing the installation sequence to prevent redundant and heavy downloads of standard PyPI packages (like torch and triton) by installing the correct NPU-compatible dependencies first and then installing the repository with the --no-deps flag.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread README.md
Comment on lines +162 to +179
**Recommended order**

1. Install CANN and set environment variables (`source` the CANN `set_env.sh` script).
2. Clone this repo and run `pip install -e ./`.
3. Install `torch` and `torch_npu` builds that match your CANN version.
4. Uninstall triton: `pip uninstall -y triton`.
5. Install `triton-ascend`.

**Example**

```sh
git clone https://github.com/fla-org/flash-linear-attention.git
cd flash-linear-attention
pip install -e ./
pip install torch==2.7.1 torch_npu==2.7.1
pip uninstall -y triton
pip install triton-ascend==3.2.0
```

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

Running pip install -e ./ first will trigger the download and installation of the standard torch and triton packages from PyPI (which are very large). Immediately after, the instructions ask the user to install torch_npu (which overwrites torch) and uninstall triton to install triton-ascend. This results in redundant downloads of several gigabytes and significantly slower installation times.

Instead, we can recommend installing the correct dependencies (torch, torch_npu, triton-ascend, and other requirements) first, and then installing the repository with --no-deps.

Here is a suggested improvement for the recommended order and example:

Recommended order

  1. Install CANN and set environment variables (source the CANN set_env.sh script).
  2. Install torch and torch_npu builds that match your CANN version.
  3. Install triton-ascend.
  4. Install other required dependencies (pip install einops transformers datasets).
  5. Clone this repo and install it with --no-deps: pip install -e . --no-deps.

Example

git clone https://github.com/fla-org/flash-linear-attention.git
cd flash-linear-attention
pip install torch==2.7.1 torch_npu==2.7.1
pip install triton-ascend==3.2.0
pip install einops transformers datasets
pip install -e . --no-deps

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

We considered this installation approach. In the end, we decided that while installing triton and then uninstalling it is a bit redundant, it serves as a reminder that triton and triton-ascend are incompatible with each other.

@zheliuyu
zheliuyu marked this pull request as ready for review June 5, 2026 03:29
@zheliuyu

zheliuyu commented Jun 9, 2026

Copy link
Copy Markdown
Collaborator Author

A better approach was mentioned here@#937 — let's wait for that PR to land.

@kashif

kashif commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

fyi #937 (currently in review) decouples the backend torch/triton from base deps via extras, including a new [npu] extra that pulls torch-npu + triton-ascend directly. after that lands, the pip uninstall triton; pip install triton-ascend step in this guide is no longer needed and pip install flash-linear-attention[npu] covers it in one shot.

happy to either rebase this one onto 937 once it merges, or fold an updated npu section into 937 if that's easier. flagging early so we don't end up with two install paths in the readme.

@zheliuyu zheliuyu closed this Jun 13, 2026
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