write-fp8-kernel

write-fp8-kernel is a skill for Claude Code, Codex from tensormux/kernel-skills. It costs 0 tokens per session (3,674 once invoked), scanned A, original, MIT.

A guide for designing and implementing FP8 GPU kernels. FP8 is an 8-bit floating-point format used to reduce memory use and increase throughput on supported NVIDIA GPUs, with scaling and conversion steps to preserve accuracy.

In plain words
What is it for?
Use it for inference or training kernels such as matrix multiplication, attention, or linear layers on NVIDIA Hopper or Ada GPUs, including fused quantization and dequantization.
Why use it?
It helps choose FP8 formats and scaling methods while accounting for the limits of Hopper and Ada hardware. It also helps decide when FP8 is unsuitable because the target hardware or data range cannot support it well.

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/write-fp8-kernel
Any agent
npx skills add tensormux/kernel-skills --skill write-fp8-kernel
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 write-fp8-kernel

README.md
[![agentmods](https://agentmods.dev/badge/skills/tensormux/kernel-skills/write-fp8-kernel.svg)](https://agentmods.dev/skills/tensormux/kernel-skills/write-fp8-kernel)
Your own site
<a href="https://agentmods.dev/skills/tensormux/kernel-skills/write-fp8-kernel"><img src="https://agentmods.dev/badge/skills/tensormux/kernel-skills/write-fp8-kernel.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 3,674 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.03674
Opus 5 $0.00000 $0.01837
Sonnet 5 $0.00000 $0.00735
Haiku 4.5 $0.00000 $0.00367

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

Security

Grade A, and why

write-fp8-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 3d 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/quantization/write-fp8-kernel/SKILL.md · 126 lines

How it starts

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

Skill: Write an FP8 Kernel

Purpose

Guide the agent through designing and implementing FP8 compute kernels for inference and training on NVIDIA Hopper (sm_90) and Ada Lovelace (sm_89) hardware, covering FP8 format selection, scaling strategy, tensor core usage via WGMMA or cuBLAS, and dequantization epilogue design.

Use this when

  • Writing a high-throughput GEMM, attention, or linear layer kernel targeting H100 or H200 (sm_90a) hardware where FP8 tensor cores provide 2x the throughput of FP16.
  • Implementing FP8 training (forward pass in E4M3, gradient computation in E5M2) following the transformer engine or similar recipe.
  • Evaluating whether FP8 achieves sufficient accuracy for a given model and activation distribution.
  • Fusing quantization, GEMM, and dequantization into a single pass to avoid expensive fp32 ↔ fp8 conversion round-trips in memory.

Do not use this when

  • The target hardware is pre-Ada (sm_80 or earlier) — FP8 tensor core instructions do not exist. fp16 or bf16 is the correct choice.
  • The activation range is highly dynamic or the per-tensor scale would need to be recomputed at sub-batch granularity with prohibitive overhead.
  • Numerical accuracy has not been validated for the target model. FP8 E4M3 has a much narrower dynamic range than fp16; overflows and underflows silently corrupt outputs without per-tensor or per-channel scaling.
  • The simpler option (FP16 GEMM via cuBLAS or CUTLASS with a Flash Attention kernel) already meets the performance target.

Inputs the agent should gather first

  • Hardware target: H100/H200 (sm_90a), RTX 4090/Ada (sm_89), or other. WGMMA instructions are H100-specific (sm_90a). Ada exposes FP8 via cuBLAS/CUTLASS but without WGMMA.
  • FP8 format: E4M3 (4-bit exponent, 3-bit mantissa, max representable value ≈ 448) for forward pass weights and activations; E5M2 (5-bit exponent, 2-bit mantissa, max ≈ 57344) for gradients. Clarify which is needed.
  • Scaling strategy: per-tensor (one scale for the whole tensor), per-channel/per-row (one scale per row or column), or delayed scaling (track amax history across steps and update scales at a fixed interval). Transformer Engine uses delayed scaling.
  • Accumulation dtype: fp32 is mandatory for FP8 tensor core accumulation. DO NOT use fp16 accumulators with FP8 inputs — precision loss is severe.
  • Output dtype: fp16, bf16, or fp32 after dequantization. This determines the epilogue.
  • Operation type: GEMM only, GEMM + bias, attention (QK^T scaling), or custom fused operation.
  • Whether cuBLAS FP8 API or CUTLASS FP8 templates are acceptable: these should be the default choice unless there is a specific reason for a custom kernel.

Read the full file on GitHub · 126 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. 3d ago First seen · 126 lines · 0 tokens per session scan A f9e5baece1be

Subscribe to this mod's changes

write-fp8-kernel 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 3,674 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

setup-timescaledb-hypertables

Use this skill when creating database schemas or tables for Timescale, TimescaleDB, TigerData, or Tiger Cloud, especially for time-series, IoT, metrics, events, or log data. Use this to improve the performance of any insert-heavy table. Trigger when user asks to: Create or design SQL schemas/tables AND…

timescale/pg-aiguide · 219 tokens

maintaining-macos-health

Hands-on playbook for macOS disk cleanup, dev-machine optimization, and proactive health alerting. Use when the Mac is full or slow, when a process persistently burns CPU, when a kernel panic / watchdog timeout / vm-compressor-space-shortage / Jetsam event happened, when the user asks to free disk space, audit…

CodeAlive-AI/ai-driven-development · 157 tokens

maintaining-windows-health

Hands-on playbook for Windows 11 disk cleanup, dev-machine optimization, and proactive health alerting. Use when the PC is full or slow, when a BSOD / Kernel-Power 41 / crash dump / commit-memory pressure happened, when the user asks to free disk space, audit storage, set up disk/memory alerts, or restore the same…

CodeAlive-AI/ai-driven-development · 191 tokens

pull_style_cutedsl_megakernel

This tree vendors the kernel team's SM90 FP8 MegaMoE drop — a fork of the same kernel repo that kernelsrc/cutedslmegamoe vendors (Bangyu's SM100 tree). The SM90 work (Vincent's hoppermegamoe branch) moved the shared runtime forward, so this tree duplicates common/, src/, and moenvfp4swapab/ at its own revision instead…

flashinfer-ai/flashinfer · 0 tokens

embedded-systems

Resource-constrained development, real-time patterns, interrupt handling, memory management, RTOS patterns, and hardware abstraction layers.

irahardianto/awesome-agv · 28 tokens

hip-kernel-optimization

This skill should be used when writing or tuning HIP kernels on AMD/NVIDIA GPUs, covering memory coalescing, shared-memory tiling, bank conflict avoidance, warp primitives, occupancy, vectorization, async ops, loop unrolling, and profiling.

AMD-AGI/Apex · 56 tokens