fla-correctness-coverage

Guides correctness testing and coverage analysis for Triton kernels in fla/ops.

Updated Sep 11, 2026
One-click install
npx skills add https://github.com/swiss-ai/flash-linear-attention --skill fla-correctness-coverage-swiss-ai
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: fla-correctness-coverage
Source: https://github.com/swiss-ai/flash-linear-attention/tree/main/.agents/skills/fla-correctness-coverage
Command: npx skills add https://github.com/swiss-ai/flash-linear-attention --skill fla-correctness-coverage-swiss-ai

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Kernel changes in fla/ops often ship with incomplete test coverage across sequence layouts, directions, gate modes, and backends, leading to silent numerical bugs on NVIDIA, AMD, or Intel hardware. This Skill provides a systematic checklist for verifying kernel correctness and closing coverage gaps before submitting a merge request. ## Core Features & Use Cases - Coverage Matrix Audit: Compares existing tests against nine coverage axes including varlen layout, forward/backward direction, gate and beta modes, QK normalization, state passing, GVA, and head dimension variants. - Triton Safety Checks: Enforces int64 address arithmetic, narrow grid-dimension handling on non-NVIDIA backends, and avoidance of deprecated tl.make_block_ptr APIs. - Platform-Aware Test Style: Directs use of fla.utils device helpers and IS_NVIDIA/IS_AMD/IS_INTEL flags instead of hard-coded torch.cuda checks. - Use Case: When modifying the Gated DeltaNet kernel, use this Skill to identify missing varlen backward tests, add them under tests/ops/test_gdn.py, and run pytest to confirm correctness. ## Quick Start Ask the assistant to review the test coverage for the kernel you just modified in fla/ops and suggest which tests to add before opening the MR.

Frequently Asked Questions about fla-correctness-coverage

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

FAQPage Schema
How do I test Triton kernel correctness in fla/ops?

Test Triton kernel correctness by comparing against a reference implementation, running torch.autograd.gradcheck, and adding backend-specific sanity checks. Cover both forward and backward passes across dense and varlen sequence layouts, then run pytest on the relevant tests/ops file.

What test coverage should a linear attention kernel have?

A linear attention kernel should cover nine axes: dense and varlen layouts, forward and backward, safe and non-safe gates, raw and post-sigmoid beta, QK L2 normalization, initial and final state, GVA on and off, differing qk and v head dims, and multiple backend verifiers.

Why do Triton kernels fail on AMD or Intel GPUs?

Triton kernels fail on non-NVIDIA backends when grid dimensions or program IDs are treated as wide integers, since every grid dimension may be narrow on AMD, Ascend, or Intel. Cast program IDs to tl.int64 before address arithmetic and keep all pointer math in int64.

Should I use tl.make_block_ptr in new Triton kernels?

No, tl.make_block_ptr is deprecated by Triton and should not be introduced in new code. Use TensorDescriptor or tl.make_tensor_descriptor when descriptor semantics are needed, or explicit tl.load and tl.store pointer arithmetic following an existing validated kernel pattern.

How do I write platform-specific test skips in fla?

Use IS_NVIDIA, IS_NVIDIA_HOPPER, IS_NVIDIA_BLACKWELL, IS_AMD, and IS_INTEL from fla.utils for platform-specific skips or branches. Avoid adding new direct torch.cuda checks; if no helper covers your condition, add a small helper in fla.utils first.