Repository navigation
Conversation
There was a problem hiding this comment.
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.
| **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 | ||
| ``` |
There was a problem hiding this comment.
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
- Install CANN and set environment variables (
sourcethe CANNset_env.shscript). - Install
torchandtorch_npubuilds that match your CANN version. - Install
triton-ascend. - Install other required dependencies (
pip install einops transformers datasets). - 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-depsThere was a problem hiding this comment.
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.
|
A better approach was mentioned here@#937 — let's wait for that PR to land. |
|
fyi #937 (currently in review) decouples the backend torch/triton from base deps via extras, including a new 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. |
Summary
flakernels also run on Ascend NPUs via triton-ascend, but the default install path still pulls upstream CUDAtritonfrompyproject.toml. This PR documents the NPU-specific setup so users do not mix the two Triton packages in one environment.Changes
torch/torch_npu→ uninstalltriton→triton-ascend) and an example command block.Docs-only change; no code or dependency updates.