hipfire-kernel-tuning
Land real kernel perf wins without inventing a universal gate, shipping
measurement noise, or silently regressing an adjacent arch.
This skill is workflow only. Mutable numbers, noise bands, admission
policy, and claim→route maps live in canonical owners under docs/. Do not
copy those tables into commits or skill prose.
When to use
- A profile (
HIPFIRE_PROFILE, Kernel Atlas, or rocprof) names a hot kernel
and you need the right lever.
- You have one candidate change (multi-row, deeper K-tile, wave64, chip
override, barrier-free path, hipcc flag) and must prove it on the target
arch without breaking others.
- A "should-be-no-op" dispatch refactor needs clean-baseline bisect after a
speed-floor warning.
- You have hardware for a chip (e.g. gfx1201) and want an arch-specific
fast path beyond a family port.
Read order
playbook.md — profile → root-cause → one lever → source/ISA inspect
→ adjacent-arch boundaries → correctness route → fresh-process measure →
reject/log. Start here.
levers.md — catalog of patterns that shipped or failed in this tree,
with kernel paths under kernels/src/ and commits to read.
cross-arch.md — file tags, dispatch fall-through, "no unreachable
branches", and when not to flip public dispatch without hardware.
case-studies.md — worked wins, fake wins, null results, and silent
corruption. Calibrate what "real" looks like before claiming.
Non-negotiable rules
- One hypothesis, one lever, one commit. Bundle three speculative
changes and you cannot bisect a fake win.
- Profile before editing. No "this feels slow" optimizations.
- Inspect source + ISA before claiming the bottleneck class. Occupancy,
spills, BW%, launch count, and matrix-op mix decide the lever family.
- Capability predicates gate ISA correctness; they never select a perf
sub-variant. Perf picks are measured arch allowlists with a conservative
default — see
docs/methodology/perf-arch-discipline.md.
- Correctness route is claim-scoped. Pick the narrowest row in
docs/VALIDATION.md. There is no
universal GPU gate. Retired coherence-gate-*.sh batteries are not
acceptance.
- Perf claims need the protocol, not a one-shell A/B:
docs/methodology/perf-benchmarking.md.
Fresh process, warmup, binary/prompt md5, repeated/raw samples, and a
surface-matched harness — not bare probe_commits.sh / gates.sh --perf
alone (see Supporting tools).
- Negative results ship. Log the rejection (commit message and/or
Atlas task ledger) so the next pass does not re-burn the same hours.
- No unverified promotion. A local delta is measured, not product
default, floor, or admission. Admissions stay in
docs/admissions.yml (fail closed when empty).
What's not in this skill
| Concern |
Go here instead |
| New arch / new WMMA builtin port |
.agents/skills/hipfire-arch-port/ |
| ISA Fit View / Atlas collect-eval loop |
.agents/skills/hipfire-kernel-atlas/ + docs/methodology/kernel-atlas.md |
| Bring-up / smoke matrix |
.agents/skills/hipfire-tester/ |
| Runtime hang / missing kernel triage |
.agents/skills/hipfire-autoheal/ / .agents/skills/hipfire-diag/ |
| Spec-decode algorithm tuning (n-gram, draft, prompt shape) |
runtime DFlash sources — not ISA levers |
| Redline / retained-replay certification |
docs/REDLINE.md |
Canonical owners (link; do not duplicate)
Supporting tools (claim-scoped)
Use only when the claim class needs them — full roles in VALIDATION.md:
- Profile:
HIPFIRE_PROFILE=1, optional rocprof kernel-trace, Atlas
collect-ar / collect-dflash with --profile-* and --isa-*.
- Compile matrix:
scripts/compile-kernels.sh for touched chip/family tags.
- Numeric kernel check:
target/release/examples/test_kernels (build via
hipfire-runtime test_kernels example).
- Speed floor (when policy applies):
scripts/speed-gate.sh vs
tests/speed-baselines/<arch>.txt.
- Fresh-process A/B: prefer surface-matched harness with repeated refs and
raw samples.
scripts/probe_commits.sh is Qwen3.5/in-process only (one
sample per ref) — not protocol-complete alone. Do not treat
scripts/gates.sh --perf as complete evidence (single baseline/HEAD sample
plus unrelated Redline/serve arms).
- Path-specific parity oracles: arch-owned
dump_*_hidden_states /
graph-parity examples when the change can break state — blocked if no
oracle exists for that surface.
- Serve semantics only:
scripts/serve_harness.py / LFM
scripts/serve_harness.py — never numerical parity substitutes.
.agents/skills/hipfire-kernel-tuning/ is the sole executable root for this
skill.
1---2name: hipfire-kernel-tuning3description: Optimize hipfire HIP/compute kernels — pick one tuning lever (multi-row, K-tile depth, prefetch, wave-size port, WMMA/MFMA, fused projections, ISA flags) and validate it with profile → ISA → fresh-process measurement. Use when a hot kernel is identified, you want a real perf win, and you must not regress adjacent archs or promote unverified deltas. Codifies the methodology from this repo's perf history (wave64 CDNA3 port 4105035, nontemporal-load revert 34eb024, gfx12 WMMA PR4---56# hipfire-kernel-tuning78Land real kernel perf wins without inventing a universal gate, shipping9measurement noise, or silently regressing an adjacent arch.1011This skill is **workflow only**. Mutable numbers, noise bands, admission12policy, and claim→route maps live in canonical owners under `docs/`. Do not13copy those tables into commits or skill prose.1415## When to use1617- A profile (`HIPFIRE_PROFILE`, Kernel Atlas, or rocprof) names a hot kernel18 and you need the right lever.19- You have one candidate change (multi-row, deeper K-tile, wave64, chip20 override, barrier-free path, hipcc flag) and must prove it on the target21 arch without breaking others.22- A "should-be-no-op" dispatch refactor needs clean-baseline bisect after a23 speed-floor warning.24- You have hardware for a chip (e.g. gfx1201) and want an arch-specific25 fast path beyond a family port.2627## Read order28291. **`playbook.md`** — profile → root-cause → one lever → source/ISA inspect30 → adjacent-arch boundaries → correctness route → fresh-process measure →31 reject/log. Start here.322. **`levers.md`** — catalog of patterns that shipped or failed in this tree,33 with kernel paths under `kernels/src/` and commits to read.343. **`cross-arch.md`** — file tags, dispatch fall-through, "no unreachable35 branches", and when **not** to flip public dispatch without hardware.364. **`case-studies.md`** — worked wins, fake wins, null results, and silent37 corruption. Calibrate what "real" looks like before claiming.3839## Non-negotiable rules40411. **One hypothesis, one lever, one commit.** Bundle three speculative42 changes and you cannot bisect a fake win.432. **Profile before editing.** No "this feels slow" optimizations.443. **Inspect source + ISA before claiming the bottleneck class.** Occupancy,45 spills, BW%, launch count, and matrix-op mix decide the lever family.464. **Capability predicates gate ISA correctness; they never select a perf47 sub-variant.** Perf picks are measured arch allowlists with a conservative48 default — see [`docs/methodology/perf-arch-discipline.md`](../../../docs/methodology/perf-arch-discipline.md).495. **Correctness route is claim-scoped.** Pick the narrowest row in50 [`docs/VALIDATION.md`](../../../docs/VALIDATION.md). There is **no**51 universal GPU gate. Retired `coherence-gate-*.sh` batteries are not52 acceptance.536. **Perf claims need the protocol**, not a one-shell A/B:54 [`docs/methodology/perf-benchmarking.md`](../../../docs/methodology/perf-benchmarking.md).55 Fresh process, warmup, binary/prompt md5, repeated/raw samples, and a56 surface-matched harness — not bare `probe_commits.sh` / `gates.sh --perf`57 alone (see Supporting tools).587. **Negative results ship.** Log the rejection (commit message and/or59 Atlas task ledger) so the next pass does not re-burn the same hours.608. **No unverified promotion.** A local delta is **measured**, not product61 default, floor, or admission. Admissions stay in62 [`docs/admissions.yml`](../../../docs/admissions.yml) (fail closed when empty).6364## What's not in this skill6566| Concern | Go here instead |67|---|---|68| New arch / new WMMA builtin port | `.agents/skills/hipfire-arch-port/` |69| ISA Fit View / Atlas collect-eval loop | `.agents/skills/hipfire-kernel-atlas/` + [`docs/methodology/kernel-atlas.md`](../../../docs/methodology/kernel-atlas.md) |70| Bring-up / smoke matrix | `.agents/skills/hipfire-tester/` |71| Runtime hang / missing kernel triage | `.agents/skills/hipfire-autoheal/` / `.agents/skills/hipfire-diag/` |72| Spec-decode *algorithm* tuning (n-gram, draft, prompt shape) | runtime DFlash sources — not ISA levers |73| Redline / retained-replay certification | [`docs/REDLINE.md`](../../../docs/REDLINE.md) |7475## Canonical owners (link; do not duplicate)7677| Concern | Owner |78|---|---|79| Claim → validation route | [`docs/VALIDATION.md`](../../../docs/VALIDATION.md) |80| Warmup, fresh-process, prompt md5, speed-floor use | [`docs/methodology/perf-benchmarking.md`](../../../docs/methodology/perf-benchmarking.md) |81| Capability vs perf-variant selection | [`docs/methodology/perf-arch-discipline.md`](../../../docs/methodology/perf-arch-discipline.md) |82| Channel + speed for *arch ports* | [`docs/methodology/arch-port-validation.md`](../../../docs/methodology/arch-port-validation.md) |83| Atlas rows, ISA manifests, suggest/task/eval | [`docs/methodology/kernel-atlas.md`](../../../docs/methodology/kernel-atlas.md) |84| Quant math before touching quant kernels | [`docs/QUANTIZATION.md`](../../../docs/QUANTIZATION.md) |85| Crate / dispatch overview | [`docs/ARCHITECTURE.md`](../../../docs/ARCHITECTURE.md) |86| Docs lifecycle / ownership map | [`docs/INDEX.md`](../../../docs/INDEX.md) |8788## Supporting tools (claim-scoped)8990Use only when the claim class needs them — full roles in `VALIDATION.md`:9192- Profile: `HIPFIRE_PROFILE=1`, optional rocprof kernel-trace, Atlas93 `collect-ar` / `collect-dflash` with `--profile-*` and `--isa-*`.94- Compile matrix: `scripts/compile-kernels.sh` for touched chip/family tags.95- Numeric kernel check: `target/release/examples/test_kernels` (build via96 `hipfire-runtime` `test_kernels` example).97- Speed floor (when policy applies): `scripts/speed-gate.sh` vs98 `tests/speed-baselines/<arch>.txt`.99- Fresh-process A/B: prefer surface-matched harness with repeated refs and100 raw samples. `scripts/probe_commits.sh` is Qwen3.5/in-process only (one101 sample per ref) — not protocol-complete alone. Do not treat102 `scripts/gates.sh --perf` as complete evidence (single baseline/HEAD sample103 plus unrelated Redline/serve arms).104- Path-specific parity oracles: arch-owned `dump_*_hidden_states` /105 graph-parity examples when the change can break state — **blocked** if no106 oracle exists for that surface.107- Serve semantics only: `scripts/serve_harness.py` / LFM108 `scripts/serve_harness.py` — never numerical parity substitutes.109110`.agents/skills/hipfire-kernel-tuning/` is the sole executable root for this111skill.