fla-dispatch-backends

Implements and tests runtime backend dispatch for FLA operations using BaseBackend subclasses and verifiers.

Updated Aug 18, 2026
One-click install
npx skills add https://github.com/weichengz0616/fla --skill fla-dispatch-backends-weichengz0616
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: fla-dispatch-backends
Source: https://github.com/weichengz0616/fla/tree/main/.agents/skills/fla-dispatch-backends
Command: npx skills add https://github.com/weichengz0616/fla --skill fla-dispatch-backends-weichengz0616

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Adding or modifying hardware-specific backends in the Flash Linear Attention library requires following a strict dispatch contract; this Skill encodes that contract so backend implementations, verifiers, and tests stay consistent with the runtime dispatch system in fla/ops/backends. ## Core Features & Use Cases - Backend Implementation Checklist: Guides creation of BaseBackend subclasses with correct backend_type, package_name, env_var, default_enable, and priority settings. - Verifier Rules: Enforces cheap, deterministic, side-effect-free verifier functions that return rejection reasons and never mutate global state. - Testing Guidance: Covers accepted dispatch, verifier rejection, fallback paths, and env var control such as FLA_DISABLE_BACKEND_DISPATCH. - Use Case: When adding a TileLang backend for a Gated DeltaNet operation, use this Skill to place the decorator correctly, write the verifier, register the backend, and add rejection tests. ## Quick Start Add a new backend for the kda operation in fla following the dispatch backend workflow, including its verifier, registration, and tests.

Frequently Asked Questions about fla-dispatch-backends

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I add a new backend to an FLA operation?

Create a BaseBackend subclass under the operation's backends package, set backend_type, package_name, env_var, default_enable, and priority, implement the verifier and backend function, then register it in the operation's backends __init__.py and add dispatch tests.

How does FLA backend dispatch select which backend runs?

Dispatch tries registered backends sorted by priority where lower means higher priority. A backend is used only when is_available() and is_enabled() are both true and its verifier returns (True, None); otherwise the next backend or the original implementation runs.

Can I disable FLA backend dispatch for debugging?

Yes, set FLA_DISABLE_BACKEND_DISPATCH=1 to bypass the dispatch decorator entirely. The decorated function remains the semantic fallback, so behavior stays identical to the default implementation.

What rules apply to FLA backend verifier functions?

Verifiers must be cheap, deterministic, and side-effect free, returning (True, None) or (False, reason). They must not mutate registries, environment variables, tensors, RNG state, or caches, and should check dtype, shape, mode, and package requirements.

Why must FLA dispatch logic stay outside torch.compile graphs?

The dispatch wrapper is marked with torch.compiler.disable, so backend selection must happen outside compiled graphs. Compiled work belongs inside the selected backend implementation to keep dispatch torch.compile friendly.