Researches NKI (Neuron Kernel Interface) documentation for AWS Trainium/Inferentia kernel development. Handles API lookups, tutorials, error codes, architecture guides, and optimization tips.
Ships in neuron. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Research $ARGUMENTS thoroughly:
This skill provides comprehensive access to NKI (Neuron Kernel Interface) documentation for AWS Trainium/Inferentia kernel development. Use this skill to answer questions about NKI APIs, tutorials, hardware architecture, error codes, and optimization techniques.
Route queries to the appropriate documentation based on the query pattern:
| Query Pattern | Start With | Then Read |
|---|---|---|
nl.* or nisa.* or API name | references/indices/symbol-lookup.md | Linked API doc |
| "how to [task]" | references/indices/task-routing.md | Linked tutorial |
| "NCC_*" or error code | references/debugging/error-codes-index.md | Specific error doc |
| gen2/gen3/gen4/trn1/trn2/trn3 | references/architecture/ | Specific arch doc |
| optimize/profile/performance | references/optimization/ | Relevant guide |
| browse/list all docs | references/indices/hierarchical-toc.md | Navigate tree |
references/indices/ to find the exact documentation neededindices/symbol-lookup.md - Alphabetical API function index with direct linksindices/task-routing.md - Task-oriented guide ("I want to...")indices/hierarchical-toc.md - Complete documentation tree structure| Directory | Contents |
|---|---|
references/architecture/ | Hardware architecture guides for Trainium/Inferentia generations |
references/debugging/ | Error codes index and individual error documentation |
references/downloads/ | Valid Python kernel examples (deprecated patterns excluded) |
references/indices/ | Navigation aids and lookup tables |
references/optimization/ | Performance tuning, profiling, migration guides |
references/programming/ | Core NKI concepts, tutorials, and API reference |
references/programming/api/ | Detailed API documentation by category |
references/programming/tutorials/ | Step-by-step kernel implementation tutorials |
references/reference/ | FAQ and release notes |
Data Movement:
nki.isa.dma_copy - Load/store data between HBM and SBUFnki.isa.dma_transpose - Transpose during DMA transferTensor Operations:
nki.isa.nc_matmul - Matrix multiplication on Tensor Enginenki.isa.tensor_tensor - Element-wise operationsnki.isa.tensor_scalar - Broadcast scalar operationsnki.isa.tensor_reduce - Reduction along axesMemory Allocation:
nl.ndarray - Create tensor in SBUFnl.zeros - Create zero-initialized tensorLoop Constructs:
range - Standard loop iterator (recommended)nl.affine_range / nl.sequential_range / nl.static_range - Legacy aliases for range (all have identical effect in NKI 0.3.0+)SPMD:
nl.program_id - Get current program indexnl.num_programs - Get total program countThe documentation uses these standard aliases:
import nki
import nki.language as nl
import nki.isa as nisa
Important: Symbols like nl.exp, nl.sigmoid, nl.tanh, etc. are op specifiers, not standalone callable functions. They must be passed as the op parameter to nisa.activation():
# CORRECT: Use as op parameter
result = nisa.activation(op=nl.exp, data=tensor, scale=scale_tensor, bias=bias_tensor)
# INCORRECT: These are NOT callable functions
# result = nl.exp(tensor) # This does NOT work
Critical limits to remember when answering questions:
| Constraint | Limit | Notes |
|---|---|---|
| Partition dimension (P) | ≤ 128 | First axis of on-chip tensors |
| PSUM free dimension (F) | 512 (gen2/3); gen4: 4096 fp32 / 8192 bf16 | Second axis in PSUM buffer |
The PSUM free-dimension limit is generation- and dtype-gated: 512 on gen2/gen3 (one PSUM bank), and on gen4 up to 4096 for a
float32dstor 8192 for abfloat16dst(the entire PSUM). It is not a queryabletile_sizefield (psum_bank_fmaxis a fixed 512). Authoritative source: thenc_matmul/nc_matmul_mxAPI blocks inprogramming/api/.The per-instruction MatMul K (contraction) limit is the partition dimension: K ≤ 128 (the systolic array is 128×128).
double_row(FP8, gen3/gen4) and Quad-MX (gen4) pack the contraction across the partition dim and a small free dim, giving an effective K of 256 / 512 respectively. Authoritative source: thenc_matmultile-size block inprogramming/api/api-nki-isa-tensor.md. The SBUF free-dimension capacity is a per-partition byte limit (nl.tile_size.sbuf_fmax/sbuf_fmax_bytes, generation- and dtype-dependent), not a fixed element count.
| Generation | Devices | Key Features |
|---|---|---|
| gen2 (v2) | Trn1, Inf2 | Baseline NKI support |
| gen3 (v3) | Trn2 | FP8 support, Double FP8 mode |
| gen4 (v4) | Trn3 | MXFP8/MXFP4, Quad-MX mode |
The Python example files in references/downloads/ use the latest NKI API patterns and can be used as reference implementations:
average_pool2d_nki_kernels.py — 2D average pooling kernelmatrix_multiplication_nki_kernels.py — Tiled matrix multiplication kerneltranspose2d_nki_kernels.py — 2D transpose kernelmamba_nki_kernels.py — Fused Mamba state-space model kerneltest_nki_isa_local_gather.py — Local gather ISA testNote: The
fused_mambatutorial (references/programming/tutorials/fused_mamba.md) still uses Beta 1 syntax (nl.load/nl.store). The optimization concepts (loop reordering, data reuse, tiling for temporal locality) are valid, but do NOT copy its code patterns — usenisa.dma_copyfrom/neuron-nki-writingfor any code generation.
Query: "What is nisa.nc_matmul?"
→ Read indices/symbol-lookup.md → Find link → Read programming/api/api-nki-isa-tensor.md#nki-isa-nc_matmul
Query: "What does NCC_EVRF001 mean?"
→ Read debugging/error-codes-index.md → Read debugging/error-codes/EVRF001.md
Query: "How do I implement matrix multiplication?"
→ Read indices/task-routing.md → Read programming/tutorials/matrix_multiplication.md
Query: "What's different in Trainium3?"
→ Read architecture/trainium3_arch.md
Query: "How do I profile my kernel?"
→ Read optimization/use-neuron-profile.md
When answering NKI documentation queries:
NKI compiler errors follow the pattern NCC_<category><number>:
EOOM* - Out of memory errorsEVRF* - Verification/validation errorsEUOC* - Unsupported operation errorsEBVF* - Backend verification failuresESPP* - Shape/type errorsThe full index is in debugging/error-codes-index.md with individual files in debugging/error-codes/.
| Skill | Purpose |
|---|---|
/neuron-nki-writing | Write NKI kernels from specifications |
/neuron-nki-debugging | Debug compiler errors on device |
/neuron-nki-profiling | Profile kernel performance |
/neuron-nki-profile-querying | Query and analyze kernel profile data |
references/architecture/nki_arch_guides.md (opens in a new tab)references/architecture/trainium2_arch.md (opens in a new tab)references/architecture/trainium3_arch.md (opens in a new tab)references/architecture/trainium_inferentia2_arch.md (opens in a new tab)references/debugging/error-codes-index.md (opens in a new tab)references/debugging/error-codes/EARG001.md (opens in a new tab)references/debugging/error-codes/EBVF030.md (opens in a new tab)references/debugging/error-codes/EHCA005.md (opens in a new tab)references/debugging/error-codes/EOOM001.md (opens in a new tab)references/debugging/error-codes/EOOM002.md (opens in a new tab)references/debugging/error-codes/ESFH002.md (opens in a new tab)references/debugging/error-codes/ESPP004.md (opens in a new tab)references/debugging/error-codes/ESPP047.md (opens in a new tab)references/debugging/error-codes/EUOC002.md (opens in a new tab)references/debugging/error-codes/EVRF001.md (opens in a new tab)references/debugging/error-codes/EVRF004.md (opens in a new tab)references/debugging/error-codes/EVRF005.md (opens in a new tab)references/debugging/error-codes/EVRF006.md (opens in a new tab)references/debugging/error-codes/EVRF007.md (opens in a new tab)references/debugging/error-codes/EVRF009.md (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
13 skills in this plugin
/neuron-explorer-profile-schemaReference for the neuron-explorer profile schema (the parquet tables produced
when `neuron-explorer view`/`ingest` processes a profile). Use when the user
asks "what tables are in the profile", "what fields are in <Table>", "where
does this field come from", "where can I find matmul/source-line info in the
schema", or wants to fetch the canonical schema YAML matching the installed
neuron-explorer version. Companion to /neuron-nki-profile-querying — that
skill writes SQL; this skill explains what the columns mean and where the
data originates.
/neuron-framework-autoportPort a HuggingFace model to NeuronX Distributed Inference for AWS Trainium/Inferentia.
Use when the user says "port model", "autoport", "convert to neuron",
"compile for trainium", or invokes /neuron-framework-autoport. Handles the full workflow:
knowledge base analysis, architecture analysis, NeuronX implementation,
compilation, inference testing, and accuracy validation (95%+ token match).
/neuron-framework-autoport-vllm-neuronPort a HuggingFace model architecture to the vLLM-Neuron Trainium2 backend. Handles architecture research, code generation, and validation./neuron:neuron-nki-docs [query or API name]from neuron
neuron@tsvikas is listed by tsvikas/skills — review the source before installing
npx claudepluginhub tsvikas/skills --plugin neuronOther plugins' skills for the same job