write-int8-quantized-kernel

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

A coding guide for implementing INT8 quantized matrix multiplication or linear-layer kernels for inference, where calculations use smaller integer values.

In plain words
What is it for?
It is for reducing memory use or improving inference speed on suitable Turing-or-newer GPUs, not for training workloads.
Why use it?
It helps choose quantization details, handle scaling and conversion correctly, and decide whether custom code is worthwhile compared with established libraries.

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

README.md
[![agentmods](https://agentmods.dev/badge/skills/tensormux/kernel-skills/write-int8-quantized-kernel.svg)](https://agentmods.dev/skills/tensormux/kernel-skills/write-int8-quantized-kernel)
Your own site
<a href="https://agentmods.dev/skills/tensormux/kernel-skills/write-int8-quantized-kernel"><img src="https://agentmods.dev/badge/skills/tensormux/kernel-skills/write-int8-quantized-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,233 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.03233
Opus 5 $0.00000 $0.01617
Sonnet 5 $0.00000 $0.00647
Haiku 4.5 $0.00000 $0.00323

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

Security

Grade A, and why

write-int8-quantized-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 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/quantization/write-int8-quantized-kernel/SKILL.md · 117 lines

How it starts

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

Skill: Write an INT8 Quantized Kernel

Purpose

Guide the agent through designing and implementing an INT8 quantized matrix multiplication or linear layer kernel for inference, covering quantization scheme selection, scale computation, int32 accumulation, dequantization epilogue, and the decision between custom code and library solutions.

Use this when

  • Writing an inference kernel that needs to reduce memory bandwidth and/or increase throughput by operating on INT8 weights and activations.
  • Implementing a quantized linear layer where scales and zero-points are known at kernel call time (static or dynamic).
  • The hardware is Turing (sm_75) or later, where the dp4a INT8 dot product instruction is available.
  • Evaluating whether a custom INT8 GEMM is justified versus using cuBLAS INT8 (cublasGemmEx with CUDA_R_8I) or CUTLASS INT8 GEMM templates.

Do not use this when

  • The target hardware is pre-Turing (sm_70 or earlier) — there is no hardware INT8 dot product instruction and the implementation falls back to emulation, which is unlikely to outperform fp16.
  • The workload is training (not inference) — INT8 gradients require careful handling that is a separate design problem.
  • The accuracy budget cannot tolerate INT8 quantization error. Evaluate accuracy first before committing to INT8.
  • cuBLAS cublasGemmEx with CUDA_R_8I inputs and CUDA_R_32I compute already satisfies the performance requirement. Use the library unless there is a specific reason (custom epilogue, non-standard quantization scheme, latency constraints) that the library does not meet.

Inputs the agent should gather first

  • Quantization granularity: per-tensor (one scale for the entire tensor), per-channel (one scale per output channel of the weight), or per-token (one scale per token/row of the activation). This determines the dequantization operation.
  • Symmetric vs asymmetric quantization: symmetric maps the range [-127, 127] to [-max_abs, max_abs] with zero-point = 0. Asymmetric maps [0, 255] (or [-128, 127]) to an arbitrary range with a non-zero zero-point. Symmetric is strongly preferred for inference because zero-point handling adds extra arithmetic to the hot loop.
  • Accumulation dtype: INT32 is mandatory. INT8 accumulation overflows for any practical dot product length.
  • Output dtype: FP32 or FP16 after dequantization. This determines the epilogue.
  • Scale dtype and location: are scales stored as fp32 scalars, fp32 tensors, or fp16? Are they computed offline (static quantization) or at kernel launch time (dynamic quantization)?
  • Hardware target: compute capability (sm_75 for Turing dp4a, sm_80 for Ampere, sm_89 for Ada).
  • Weight layout: are weights already quantized and stored as INT8? Are they in row-major or column-major order?
  • Activation layout: contiguous rows? Are activations quantized offline or online (at each forward pass)?

Read the full file on GitHub · 117 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 · 117 lines · 0 tokens per session scan A 28c2e0192369

Subscribe to this mod's changes

write-int8-quantized-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,233 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

prompt-engineering

Prompt engineering techniques and patterns. Use when writing agent commands, hooks, skills, subagent prompts, or any LLM interaction: optimizing prompts, improving output reliability, and designing production-grade prompt templates. Trigger words: prompt engineering, prompt, prompt optimization, LLM interaction.

MagicKidd/Rokid-agentic-workflow · 0 tokens

llm-torch-profiler-analysis

Unified LLM torch-profiler triage skill for sglang, vllm, TensorRT-LLM, and TokenSpeed. Use it to inspect an existing trace.json(.gz) or profile directory, or to drive live profiling against a running server when supported and return one three-table report with kernel, overlap-opportunity, and fuse-pattern tables.

sgl-project/sglang · 84 tokens

compute-mamba-ratio

Compute the optimal --mamba-full-memory-ratio (or --max-mamba-cache-size pin) for a hybrid attention + linear-attention (Mamba / GDN / KDA) model's two serving memory pools, from the workload and serving config. Use when a user asks what ratio to set, why concurrency is clamped, or how to size the state vs KV pools…

sgl-project/sglang · 88 tokens

sglang-diffusion-benchmark-profile

Use when benchmarking denoise latency or profiling a diffusion bottleneck in SGLang.

sgl-project/sglang · 26 tokens

experimental-design

Best practices for designing reproducible ML experiments. Use when planning ablations, baselines, or controlled experiments.

aiming-lab/AutoResearchClaw · 25 tokens

mixed-precision

Use FP16/BF16 mixed precision to accelerate training and reduce memory. Use when optimizing GPU performance.

aiming-lab/AutoResearchClaw · 25 tokens