File size: 2,454 Bytes
e279649
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
---
license: apache-2.0
task_categories:
- other
language:
- en
tags:
- triton
- gpu-kernels
- verification
- numerical-analysis
- reward-model
- rl-environments
pretty_name: Litmus Kernel Verification Corpus
size_categories:
- n<1K
configs:
- config_name: kernels
  data_files: kernels.jsonl
- config_name: bug_pairs
  data_files: bug_pairs.jsonl
---

# Litmus Kernel Verification Corpus

Correct and deliberately-broken Triton kernels, each broken one shipped **with
the input that exposes it**.

The corpus exists to measure one thing: how much of what a fixed-shape
`torch.rand()` `allclose` test calls "correct" actually is.  On this corpus the
answer is that **88% of the planted bugs pass that test**.

## Columns

| column | meaning |
|---|---|
| `name` | kernel identifier |
| `family` | elementwise / reduction / softmax / layernorm / matmul / attention |
| `bug_class` | `none` for correct kernels, otherwise one of six planted defect families |
| `triton_source` | the kernel, annotated with its buffer contract |
| `correct` | ground-truth label |
| `numerically_observable` | `false` when the defect has **no** numerical signature at any shape |
| `why_standard_misses` | why the fixed-shape `allclose` test lets this bug through |
| `witness_inputs` | JSON arrays: the exposing input (buggy kernels only) |
| `witness_dims` | the shape the witness uses |
| `witness_max_abs_error` | deviation from the float64 oracle on the witness |
| `standard_test_detects` | did `allclose(rtol=1e-2)` on the fixed shape catch it? |
| `litmus_verdict` | `accept` / `reject` / `unknown` at build time |

## Bug families

- **`dtype_promotion`** — 2 kernels
- **`mask_leak`** — 4 kernels
- **`no_max_subtract`** — 2 kernels
- **`race`** — 3 kernels
- **`reduction_init`** — 3 kernels
- **`stride`** — 2 kernels

## Caveat

The corpus is deliberately bug-heavy (16 buggy, 9 correct), so the
absolute "fraction correct" is a property of this corpus, not of kernels in
general.  The finding is the **gap** between the standard test's pass rate and
the truth.

## Reproduce

```bash
git clone https://github.com/NagaYu/litmus && cd litmus
pip install -e ".[dev]"
python benchmarks/run.py        # regenerates the numbers above
```

Built by [Litmus](https://github.com/NagaYu/litmus) -- error bounds, symbolic GPU safety checks and targeted
falsification for Triton kernels. Interactive demo: [Space](https://huggingface.co/spaces/NagaYu/litmus).