Agent skill · software engineering · aradotso

flashqla-linear-attention

flashqla-linear-attention — an agent skill for coding agents.

Why this skill is useful

Adds a high-performance linear attention kernel library with executable code for optimized forward and backward passes on NVIDIA Hopper GPUs.

What it needs

Requires cuda, torch installed locally. About 6k tokens when loaded. Last updated 2026-07-09. 70 stars on the source repository.

What this skill does

bash git clone https://github.com/QwenLM/FlashQLA.git cd FlashQLA pip install -v . bash pip install flashlinearattention==0.5.0 pip install flashinfer-python==0.6.9 python import torch from flashqla import chunkgateddeltarule Tensor shapes: q, k: [B, T, Hq, K] - query and key v: [B, T, Hv, V] - value g: [B, T, Hv] - gate (exponential decay) beta: [B, T, Hv] - delta rule beta coefficient initialstate: [B, Hv, K, V] - optional initial recurrent state B, T, Hq, K = 2, 4096, 32, 128 Hv, V = 32, 128 q = torch.randn(B, T, Hq, K, dtype=torch.bfloat16, device='cuda') k = torch.randn(B, T, Hq, K, dtype=torch.bfloat16, device='cuda') v = torch.randn(B, T, Hv, V, dtype=torch.bfloat16, device='cuda') g = torch.randn(B, T, Hv, dtype=torch.bfloat16, device='cuda') beta = torch.randn(B, T, Hv, dtype=torch.bfloat16, device='cuda') scale = K -0.5 o, finalstate = chunkgateddeltarule( q=q, k=k, v=v, g=g, beta=beta, scale=scale, initialstate=None, # optional: [B, Hv, K, V] outputfinalstate=True, # whether to return final recurrent state cuseqlens=None, # optional: for variable-length sequences ) o: [B, T, Hv, V] finalstate: [B, Hv, K, V] python import torch from flashqla import chunkgateddeltarule cuseqlens: cumulative sequence lengths, shape [B+1], dtype int32 Example: batch of 3 sequences with lengths [512, 1024, 768] seqlens = [512, 1024, 768] totaltokens = sum(seqlens) cuseqlens = torch.tensor([0] + list(torch.cumsum(torch.tensor(seqlens), dim=0).numpy()), dtype=torch.int32, device='cuda') Hq, K, Hv, V = 32, 128, 32, 128 Packed tensors: [1, totaltokens, H, D] q = torch.randn(1, totaltokens, Hq, K, dtype=torch.bfloat16, device='cuda') k = torch.randn(1, totaltokens, Hq, K, dtype=torch.bfloat16, device='cuda') v = torch.randn(1, totaltokens, Hv, V, dtype=torch.bfloat16, device='cuda') g = torch.randn(1, totaltokens, Hv, dtype=torch.bfloat16, device='cuda') beta = torch.randn(1, totaltokens, Hv, dtype=torch.bfloat16, device='cuda') o, finalstate = chunkgateddeltarule( q=q, k=k, v=v, g …

How to use it

Reference it in AdaL, Claude Code, Cursor or any coding agent — nothing to install:

@skills aradotso/flashqla-linear-attention

View the source on GitHub

Browse the @skills marketplace