debug-cuda-kernel-correctness

debug-cuda-kernel-correctness is a skill for Claude Code, Codex from tensormux/kernel-skills. It costs 0 tokens per session (2,976 once invoked), scanned A, original, MIT.

A troubleshooting guide for CUDA programs that calculate data on NVIDIA GPUs. It focuses on finding cases where the result is wrong, inconsistent, or unsafe.

In plain words
What is it for?
Use it to investigate incorrect CUDA results, run-to-run differences, failures on certain input sizes or GPU models, and NaN or infinity outputs.
Why use it?
It gives a systematic way to separate indexing mistakes, memory errors, synchronization problems, layout issues, and numerical differences.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/tensormux/kernel-skills/debug-cuda-kernel-correctness
Any agent
npx skills add tensormux/kernel-skills --skill debug-cuda-kernel-correctness
Clone the repo
git clone --depth 1 https://github.com/tensormux/kernel-skills

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for debug-cuda-kernel-correctness

README.md
[![agentmods](https://agentmods.dev/badge/skills/tensormux/kernel-skills/debug-cuda-kernel-correctness.svg)](https://agentmods.dev/skills/tensormux/kernel-skills/debug-cuda-kernel-correctness)
Your own site
<a href="https://agentmods.dev/skills/tensormux/kernel-skills/debug-cuda-kernel-correctness"><img src="https://agentmods.dev/badge/skills/tensormux/kernel-skills/debug-cuda-kernel-correctness.svg" alt="Measured on agentmods" height="20"></a>
Per session 0 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,976 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00000 $0.02976
Opus 5 $0.00000 $0.01488
Sonnet 5 $0.00000 $0.00595
Haiku 4.5 $0.00000 $0.00298

Measured 4d ago against content hash f5df8c37153a, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

debug-cuda-kernel-correctness scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 4d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/cuda/debug-cuda-kernel-correctness/SKILL.md · 129 lines

How it starts

The opening of the file, as written. The whole thing — 129 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Skill: Debug CUDA Kernel Correctness

Purpose

Guide the agent through a systematic process of isolating, reproducing, and diagnosing correctness errors in CUDA kernels — covering indexing bugs, layout mismatches, synchronization races, reduction errors, numerical drift, and out-of-bounds memory access.

Use this when

  • A CUDA kernel produces wrong output compared to a CPU or high-precision reference.
  • The kernel output differs between runs (non-determinism indicating a race condition or uninitialized memory read).
  • The kernel produces correct results for small inputs but fails for large inputs or non-power-of-two sizes.
  • Correctness errors appear only on specific hardware (sm_80 vs sm_86) or with specific compilation flags.
  • The kernel produces NaN, Inf, or suspiciously exact-zero outputs.
  • A previously correct kernel starts failing after a layout, dtype, or tiling change.

Do not use this when

  • The kernel is numerically close to the reference but not bit-exact — evaluate whether the error is within acceptable floating-point tolerance before treating it as a correctness bug.
  • The issue is performance, not correctness (use profiling skills instead).
  • The bug is in the host-side launch configuration wiring, not the kernel body itself — check grid/block dimensions, stream assignments, and argument passing before diving into kernel internals.

Inputs the agent should gather first

  • Reference implementation: what is the expected correct result? Is there a CPU fp64 reference, a PyTorch equivalent, or a known-correct CUDA baseline?
  • Input shapes and dtypes: exact M, N, K (or equivalent dimensions), dtype (fp32, fp16, bf16, int8), memory layout (row-major, column-major, strided, non-contiguous).
  • Hardware and driver: CUDA compute capability, CUDA toolkit version, driver version. Some bugs are toolkit-specific (e.g., compiler optimizations that break on certain SM targets).
  • Reproducibility: does the error appear on every run with the same inputs, or is it intermittent? Intermittent = likely race condition. Deterministic = likely logic or indexing bug.
  • Error characterization: is the error localized (specific output elements wrong), global (all elements wrong by a constant factor), or structured (wrong values along a row/column/diagonal boundary)?
  • Last known-good change: what changed between the last correct version and the current buggy version?

Read the full file on GitHub · 129 lines

Files

What ships with it

1 file beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 4d ago First seen · 129 lines · 0 tokens per session scan A f5df8c37153a

Subscribe to this mod's changes

debug-cuda-kernel-correctness is a skill published in the GitHub repository tensormux/kernel-skills (72 stars, last pushed 2mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 2,976 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories