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.
npx agentmods add skills/tensormux/kernel-skills/write-cuda-layernorm-kernelnpx skills add tensormux/kernel-skills --skill write-cuda-layernorm-kernelgit clone --depth 1 https://github.com/tensormux/kernel-skillsWrote 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.
[](https://agentmods.dev/skills/tensormux/kernel-skills/write-cuda-layernorm-kernel)<a href="https://agentmods.dev/skills/tensormux/kernel-skills/write-cuda-layernorm-kernel"><img src="https://agentmods.dev/badge/skills/tensormux/kernel-skills/write-cuda-layernorm-kernel.svg" alt="Measured on agentmods" height="20"></a>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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5 | $0.00000 | $0.03507 |
| Opus 5 | $0.00000 | $0.01754 |
| Sonnet 5 | $0.00000 | $0.00701 |
| Haiku 4.5 | $0.00000 | $0.00351 |
Grade A, and why
write-cuda-layernorm-kernel 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 5d 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.
How it starts
The opening of the file, as written. The whole thing — 127 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Skill: Write CUDA LayerNorm Kernel
Purpose
Guide the agent through designing and implementing a correct, efficient CUDA LayerNorm (and RMSNorm) kernel, covering mean/variance computation strategies, Welford online accumulation, epsilon placement, affine transform application, backward pass structure, and decomposition for non-power-of-two hidden dimensions.
Use this when
- You need a custom LayerNorm kernel with a non-standard normalization axis, fused activation, or non-standard epilogue
- You are implementing RMSNorm (no mean subtraction, only variance normalization) and need a custom kernel
- You need the backward pass and require explicit control over the gradient computation for numerical accuracy or fusion
- The hidden dimension size does not match the assumptions of library implementations, or you need custom handling of non-power-of-two sizes
- You are fusing LayerNorm with a preceding or following operation and need to avoid extra memory round-trips
Do not use this when
- Standard forward-only LayerNorm with affine parameters on common hidden dimensions: use
torch.nn.LayerNorm(which calls into cuDNN or a well-tuned CUDA kernel) or APEX'sFusedLayerNorm - You are using PyTorch with autograd: the built-in LayerNorm already has a correct, optimized backward pass
- The normalization is applied over batch dimensions (BatchNorm): this skill covers LayerNorm (normalization over the last D dimensions within a single sample)
Inputs the agent should gather first
- Input shape: [batch, seq, hidden] or [N, D] where D is the normalization dimension. What is the hidden dimension size? Is it always the same or variable at runtime?
- Normalization axis: which dimension(s) are normalized? LayerNorm normalizes over the last D dimensions; confirm this assumption.
- Dtype: fp32, fp16, or bf16 for input/output. What dtype are the gamma/beta parameters? (Usually fp32 even when input is fp16.)
- Affine parameters: are gamma (scale) and beta (shift) parameters present (LayerNorm) or absent (plain normalization)?
- Epsilon: what value? Typically 1e-5 for LayerNorm, 1e-6 for RMSNorm. Is it applied inside or outside the sqrt?
- Forward only vs forward + backward: does the kernel need to support gradient computation? If yes, what tensors need to be saved from the forward pass?
- RMSNorm variant: should mean subtraction be skipped (RMSNorm only divides by the root mean square, not the standard deviation)?
- Hardware target: SM architecture.
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.
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.
- 5d ago First seen · 127 lines · 0 tokens per session scan A 4a5b3c51e9ad
write-cuda-layernorm-kernel is a skill published in the GitHub repository tensormux/kernel-skills (73 stars, last pushed 2mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 3,507 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.
Other skills, from other repositories
cv-classification
Best practices for image classification tasks. Use when working on CIFAR, ImageNet, or other classification benchmarks.
experimental-design
Best practices for designing reproducible ML experiments. Use when planning ablations, baselines, or controlled experiments.
mixed-precision
Use FP16/BF16 mixed precision to accelerate training and reduce memory. Use when optimizing GPU performance.
cv-detection
Best practices for object detection tasks. Use when working on COCO, VOC, or detection architectures like YOLO and DETR.
perf-torch-cuda-graphs
Apply CUDA Graphs to PyTorch workloads — API selection (torch.compile, PyTorch makegraphedcallables, TE makegraphedcallables, MCore CudaGraphManager, FullCudaGraphWrapper, manual torch.cuda.graph), code compatibility, capture workflows, dynamic pattern handling, and troubleshooting. Triggers: CUDA graph…
math-model-code
数学建模团队「建模+编程」岗技能。当用户要求做数学建模、题目分析、选模型、写代码求解、跑结果、画图、生成复现清单,或按团队 Gitee 协同方式在你的 member 文件夹内完成建模编程交付时使用。覆盖建模阶段与编程阶段、质量门禁,以及只提交自身文件夹的 Gitee 操作。.