Skip to content

[RFC] Roadmap: NPU support for flash-linear-attention #942

Description

@zheliuyu

Thanks to the flash-linear-attention community for merging our native NPU support PR.

This roadmap outlines upcoming plans for native NPU support. Feedback and discussion are welcome.

Native NPU Support in flash-linear-attention

Native support is built on top of flash-linear-attention's dispatch system:

We have validated this approach for NPU adaptation work:

The following diagram illustrates the flow for adapting kernels under fla/modules/:

User / model code (unchanged)
        │
        ▼
fla/modules/<module>.py              # Public API + @dispatch('modules') hooks only
        │
        ▼
fla/ops/backends                     # Runtime backend selection (BackendRegistry)
        │
        ▼
fla/modules/backends/triton_ascend/  # NPU Triton kernels + launchers
        ├── __init__.py              # TritonAscendBackend registration
        ├── rotary.py
        ├── fused_cross_entropy.py
        ├── fused_linear_cross_entropy.py
        ├── activations.py
        ├── fused_kl_div.py
        ├── layernorm.py
        ├── grpo.py
        └── causal_conv1d.py

Dependency Installation

Note that flash-linear-attention already supports other devices such as XPU and AMD:

NPU CI Setup

Future native adaptations will introduce a substantial amount of triton-ascend code, making NPU CI especially important. We plan to use the CI tooling provided by ascend-gha-runners:

Reference:

This is our top priority at the current stage, and work is still in progress.

Adaptation Order

At a high level, adaptation work is organized as follows:

For the remaining work, we propose the following order within fla/ops/:

Skills

Because triton-ascend differs from upstream triton in programming model and performance characteristics, migrating kernels to NPU requires additional tuning time. We plan to capture reusable migration skills to improve efficiency over time.

Hardware Coverage

For current migration work, we recommend validating on the following hardware:

  • Atlas 800T A2 (32G, x86)
  • Atlas 800T A3 (64G, x86)

We expect to publish validation results on additional hardware platforms in future updates.

Integration with Training Frameworks

Once native NPU adaptation of flash-linear-attention reaches a sufficient level of maturity, we need to demonstrate real-world usability by running end-to-end SFT or RL workflows in production training frameworks. We plan to validate integration through the following projects:

tilelang-ascend Support

flash-linear-attention also provides a tilelang DSL backend. Ascend offers tilelang-ascend, and native support may be feasible in the future. Whether we start this effort will depend on community feedback. For now, the primary focus remains on triton-ascend.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions