fla-correctness-coverage

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

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

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? When adding or modifying a Triton kernel in the Flash Linear Attention library, it is hard to know which test combinations are missing and which low-level implementation pitfalls (grid width, integer overflow, deprecated APIs) can silently break correctness on NVIDIA, AMD, or Intel hardware. ## Core Features & Use Cases - Coverage Matrix Checklist: Enumerates test axes such as varlen layout, forward/backward, gate modes, GVA, head dimensions, and backend verifiers so you can spot missing combinations. - Triton Safety Rules: Enforces int64 address arithmetic, narrow program-ID handling, and avoidance of deprecated tl.make_block_ptr. - 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: Before submitting an MR that changes the KDA kernel's varlen offsets, use this Skill to list the coverage matrix, add the missing varlen backward tests in tests/ops/test_kda.py, and run pytest to verify. ## 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 or run before opening the merge request.

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 Flash Linear Attention?

Run the op-specific pytest target such as pytest tests/ops/test_kda.py -v, plus context-parallel variants under tests/context_parallel and model-level tests under tests/models. Compare results against the reference implementation and torch.autograd.gradcheck.

What test coverage should a new fla kernel have?

Cover dense and varlen layouts, forward and backward passes, safe and non-safe gate modes, raw and post-sigmoid beta, L2-normalized and unnormalized QK, initial and final state passing, GVA on and off, and unequal qk/v head dimensions.

Why does my Triton kernel fail on AMD but pass on NVIDIA?

On non-NVIDIA backends every grid dimension may be narrow, so program IDs can overflow in address arithmetic. Cast program IDs and all pointer math to tl.int64, including block bases, strides, and varlen offsets.

Can I use tl.make_block_ptr in new fla kernels?

No. Triton marks tl.make_block_ptr as deprecated. 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 fla.utils.device and fla.utils.device_platform plus the IS_NVIDIA, IS_NVIDIA_HOPPER, IS_NVIDIA_BLACKWELL, IS_AMD, and IS_INTEL flags from fla.utils. Do not add new direct torch.cuda checks; add a helper in fla.utils if none exists.