kernels
How prime-rl vendors, builds, and ships CUDA kernels (the `deps/prime-kernels` submodule and the `prime-kernels` wheel).
Skill by PrimeIntellect-ai
Install
Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.
npx agentmarket install skill/primeintellect-ai-kernels
Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.
Get the weekly diff
The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.
About
Use cases: ci-cd
Reviews
Write a reviewNo reviews yet. Installed it? Reviews come from verified installers only. How reviews work
Permissions
What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.
- Tools
- No tools found
- Secrets
- None asked for
- Install scripts
- None found
Network hosts it talks to 1
codeload.github.com· found in install command
Files it touches
~/.claude/skills/kernels
What's inside
- Skill name
kernels- Description
- How prime-rl vendors, builds, and ships CUDA kernels (the `deps/prime-kernels` submodule and the `prime-kernels` wheel). Use when adding a kernel, building it locally, calling one from training code, or publishing prebuilt wheels.
- License
- Apache-2.0
- Instructions
- 175 lines in SKILL.md · view on GitHub
Files (1)
- SKILL.md
SKILL.md (first lines)
# CUDA kernels
CUDA kernels live in their own monorepo,
[prime-kernels](https://github.com/PrimeIntellect-ai/prime-kernels), checked out here as the
git submodule `deps/prime-kernels`, alongside prime-rl's other submodules. That repo is the
wheel root (`setup.py`, `pyproject.toml`) and `prime_kernels/` inside it is the importable
package: one folder per kernel, holding the
kernel's Python surface and, for compiled kernels, its C++/CUDA sources under `csrc/`, all declared in the single
manifest `prime_kernels/kernels.toml`. See `deps/prime-kernels/README.md` once the submodule
is initialized.
Nothing about a kernel lives in prime-rl. prime-rl pins a prime-kernels commit for local
source builds and a prime-kernels release for installs. prime-kernels builds and publishes
its own wheels. prime-rl stays a pure-Python wheel; never add compiled extensions to it.
Living under `deps/` means `tool.ruff.extend-exclude = ["deps"]` in `pyproject.toml`
already covers it — prime-rl lints none of it.
## Calling a kernel from prime-rl
Kernels are compiled for exact compute capabilities and may not be built at all, so always
gate. Never import `prime_kernels.<name>` directly in training code:
```python
import prime_kernels
if prime_kernels.is_available("flash_moe"):
flash_moe = prime_kernels.load("flash_moe")
```
`prime_kernels.status()` maps every kernel to `"available"` or the reason it is not — log
it once at startup rather than failing a run halfway through. `unavailable_reason(name)` is
the same answer for one kernel (`None` when it is usable), which is what a test's skip guard
wants; `is_available` is just that call compared to `None`.
`flash_moe` is a compiled fused MoE forward kernel (bf16 + mxfp8) on Blackwell
tcgen05. Its trainer integration is dormant. `mxfp8_moe` is a Python-only registered
kernel package for MXFP8 grouped GEMM and torch EP transport on SM100; it owns the
MoE-specific torchao-derived orchestration and exports explicit BF16 boundaries instead
of tensor-subclass interception.
What a kernel requires of its inputs — block sizes, alignments, shape constraints — belongs
to prime-kernels, which exports it: `flash_moe.BLOCK_M`, `flash_moe.MXFP8_SCALE_BLOCK`, and
`flash_moe.unsupported_shape_reason(dim, hidden_dim, mxfp8=...)`. When the trainer integration
is restored, call this once during setup so an unsupported model fails before training rather
than mid-step. Never hardcode a `128` on this side: then every requirement change is a change
in both repos.
## Building locally
`uv sync --extra kernels` installs the prebuilt wheel (see "Pinning installs at the prebuilt
wheels"); building from source is for changing kernels. It is manual by design — no `uv sync`
may compile CUDA, so the extra resolves to release wheels, never to this source tree:
```bash
git submodule update --init deps/prime-kernels
uv pip install --no-build-isolation -e deps/prime-kernels
```
Requirements: `nvcc` on `CUDA_HOME` with the **same CUDA major as torch** (torch refuses to
build extensions otherwise).
Kernels whose toolkit is unsuitable are skipped with a message and reported unavailable at
runtime — the build still succeeds. `PRIME_KERNELS=a,b` builds a subset;
`PRIME_KERNELS_REQUIRE=1` turns any skip into an error.
## Changing or adding a kernel
The work happens in the prime-kernels repo, not here. Inside `deps/prime-kernels/`:
1. Commit the sources under `prime_kernels/<name>/csrc/`.
2. Add a `[<name>]` table to `prime_kernels/kernels.toml` — `sources`, `include-dirs`,
`arch`, `cxx-std`; paths are relative to the kernel folder. A vendored Python kernel
uses `python-only = true`, may declare import checks in `requires`, and omits compiled
extension fields.
3. Write `prime_kernels/<name>/__init__.py` — `from . import _C`, then per op a wrapper
calling `torch.ops.<ns>.<op>` and a `torch.library.register_fake`. No
`torch.library.custom_op` decorator: that defines a *Python* op, and `TORCH_LIBRARY`
has already defined these C++ side — only the fake (meta) kernel is missing. A kernel
used in training also needs `torch.library.register_autograd`, since a schema carries
no backward. `flash_moe` is forward only and currently has no trainer integration.
4. Nothing else: `setup.py` and the runtime registry both read the manifest.
Rules the build assumes:
- The extension is always `prime_kernels.<name>._C`, so the C++ side defines
`PYBIND11_MODULE(_C, m)` and registers ops with `TORCH_LIBRARY*`.
- `arch` matches the device **exactly** at runtime (`10.0a` runs only on sm_100a); no PTX is
shipped to JIT from.
- Two packages registering the same `torch.ops` namespace collide. If a kernel's sources are
also installed as a standalone package (e.g. `prime_moe` from prime-flash-moe, where
`flash_moe` originally came from), uninstall it.
- Only the Python surface and the compiled `_C` ship in the wheel; `csrc/` is build input.
Then land it in prime-rl as a submodule bump.
## Bumping the pin
Kernel sources are pinned by the submodule commit, so picking up any kernel change — yours
or someone else's — is a bump:
```bash
git -C deps/prime-kernels fetch origin
git -C deps/prime-kernels log --oneline HEAD..origin/main
git -C deps/prime-kernels checkout origin/main
git add deps/prime-kernels
```
Then, in order:
- Read the diff for **host-side contract changes**, not just kernel internals. A change to
what the caller must pass (weight layout, scale packing, argument order) is silently wrong
numbers, not a build error, and prime-rl's call sites have to absorb it.
- Rebuild and re-run the kernel repository's numerical coverage plus every PrimeRL runtime
path that calls the changed kernel; the ABI is not checked for you.
- The bump alone ships nothing: installs resolve `prime-kernels` from a release wheel, so the
new code only reaches users once a release rebuilds the wheels and the pin below moves.
## Prebuilt wheelsFrom PrimeIntellect-ai/prime-rl, Apache-2.0.
More from PrimeIntellect-ai/prime-rl
- 0.832score
configs
PrimeIntellect-ai
How the prime-rl config system works — TOML files, CLI overrides, composition, and special patterns.
SkillAFreshness: A★ 2.2KClaude Code +9 - 0.832score
release
PrimeIntellect-ai
How to prepare and publish GitHub releases for prime-rl.
SkillAFreshness: A★ 2.2KClaude Code +9 - 0.832score
eval
PrimeIntellect-ai
Launch and monitor prime-rl evals — the `uv run eval` entrypoint, its config and CLI shorthands, run directory, resume, logs and metrics.
SkillAFreshness: A★ 2.2KClaude Code +9 - 0.832score
dashboard
PrimeIntellect-ai
Find, start, use, and stop the local run dashboard for metrics, configs, traces, logs, and reports.
SkillAFreshness: A★ 2.2KClaude Code +9 - 0.827score
install
PrimeIntellect-ai
How to install prime-rl and its optional dependencies.
SkillAFreshness: A★ 2.2KClaude Code +9 - 0.826score
training
PrimeIntellect-ai
Launch and monitor prime-rl training runs.
SkillAFreshness: A★ 2.2KClaude Code +9 - 0.609score
AGENTS.md · PrimeIntellect-ai/prime-rl
PrimeIntellect-ai
AGENTS.md from PrimeIntellect-ai/prime-rl: 66 lines covering Writing code, Running code, Docs, Skills and more.
TemplateAFreshness: A★ 2.2KCodex +5
Signals
- Stars
- 2,190
- Forks
- 472
- Open issues
- 38
- Last commit (this folder)
- Aug 29, 2026 (2 months ago)
- Last release
- Oct 13, 2026 (14 days ago)
From GitHub (fetched Oct 24, 2026).
Details
- License
- Apache-2.0
- Repository
- github.com/PrimeIntellect-ai/prime-rl
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
Same skill elsewhere
Copies of this SKILL.md published by others; search shows only one of them.
More from PrimeIntellect-ai
- 0.865score
prime-intellect
PrimeIntellect-ai
Work with Prime Intellect products via the prime CLI and Python SDKs - verifiers environments and the Environments Hub, evaluations (local and hosted), Hosted…
SkillAFreshness: A★ 22.3KClaude Code +9 - 0.865score
skill-creator
PrimeIntellect-ai
Create, validate, and install Prime Agent skills - both markdown skills and Python-backed skills callable from the Python kernel.
SkillAFreshness: A★ 22.3KClaude Code +9 - 0.859score
rlm-heartbeat
PrimeIntellect-ai
Manage agent-owned RLM heartbeats from the Python REPL.
SkillAFreshness: A★ 22.3KClaude Code +9 - 0.859score
refine
PrimeIntellect-ai
Trigger continual harness refinement from the Python REPL.
SkillAFreshness: A★ 22.3KClaude Code +9 - 0.859score
goal
PrimeIntellect-ai
Manage the persistent thread goal from the Python REPL.
SkillAFreshness: A★ 22.3KClaude Code +9 - 0.859score
compact
PrimeIntellect-ai
Check context usage and compact the conversation from the Python REPL.
SkillAFreshness: A★ 22.3KClaude Code +9
Cite this page
kernels skill. Agent Mart. https://agentmart.dev/skills/primeintellect-ai-kernels (last updated 2026-10-24)