/loom:loom-optimizefrom loom
Optimizes Loom LLM port performance (decode, prefill, long context, concurrency) while proving correctness. Uses roofline targets, per-kernel HAL profiles, bucket budgets, and parallel fuse-by-default designs with perf-only iteration rounds and gates.
Ships in loom. 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.
Bundled paths ? first shell action. Before running commands, set LOOM_SKILL_DIR in the shell to the
absolute directory containing this SKILL.md, using its path from the skill listing or read tool.
In Claude Code, run export LOOM_SKILL_DIR="${CLAUDE_SKILL_DIR}" (the host substitutes the path).
In Codex, Pi or another host, export LOOM_SKILL_DIR to the loaded file's directory. Use a
shell-compatible absolute path (Git Bash on Windows). Rebind before using another skill's commands
and in every new shell; it is not the working directory or SDK root. On Windows, use native C:/...
paths for file tools; /c/... paths belong to Git Bash. Never run an unresolved placeholder. Run bundled commands by quoted absolute path; do not run scripts/... from the working directory
or change into the installed skill tree. Install the complete Loom suite: sibling paths are required.
This skill is the process. Every fact (a lever, its numbers, what did not help, tool recipes, SDK limits) is in the knowledge base at the most specific node; route before you design and write what you learn back there.
loom-port-llm + loom-benchmark), a baseline row in perf_log.jsonl (perf.py), the
baseline engine on the same checkpoint and workloads (llama.cpp ROCm for a GGUF card, vLLM ROCm for a safetensors card; methodology
in loom-benchmark), and the ceilings from loom-roofline (bench/roofline.json; qualify.sh writes it). No target given: run
loom-roofline first, announce targets and budget, then loop here; don't ask for a number.loom-kb):
python3 "${LOOM_SKILL_DIR}/../loom-kb/kb.py" route --config PKG/llm_config.json --device DEVICE --topic optimize-loop,prefill,decode
(add speculative,spec-tuning,long-context,concurrency,roofline for those levers, kernels-ir,sdk before writing kernels). Read
what it prints; never re-run an A/B a node already settled. Start from a published package's settled choices: topic reference.optimize-loop; the
sections named below are its headings.loom-fleet reference campaign.md, "Model selection and dispatch".
Apply the engineer row to lanes that own an optimization through validation. Use the support row for prescribed checks and bounded tasks.
Use the highest available version of the assigned family and medium reasoning effort.
Run alternative designs of one lever in parallel lanes, each with its own worktree, switch and A/B; the bucket's measurement decides,
not the first design to land.campaign.md, "DevLab".For every card row (prefill 1k-32k, decode by prompt class, long-context decode, 4 streams), write down: the best published number on
the same device class and a comparable workload (engine, weight format, drafting on or off; find and read the leader's own
benchmark docs and code, do not guess), Loom's number, and the loom-roofline ceiling. The row's target is the leader where the
ceiling allows it, the roofline target otherwise. Work on the row with the most milliseconds of gap, not the most percent.
optimize-loop, "Profiling"; DevLab step profile:V). One session per scenario (pf2k, pf8k, drafted decode); two prefill
lengths separate per-token from per-request cost; decode in ms per verify step and tokens per step.dropped_records, every launch in a family (an unnamed family hid 12 % of a prefill), device busy
vs request wall (the difference is launch/idle overhead; it decides whether launch count is a lever at all).optimize-loop, "Ablation: known distortions").
Hardware counters are not available on gfx11/gfx12 with the current SDK (topic sdk).optimize-loop, "Local pre-flight").1000 / leader tok/s = the ms/token budget; the GEMM bucket's share
is the GEMM FLOPs per token at the best GEMM rate measured on this device (yours or the leader's); the non-GEMM budget is the rest.
Drafted decode: the step's weight bytes at the measured bandwidth are the floor; the leader's ms per accepted token, times the
tokens per step, minus the floor is the budget of everything else (proposals, recurrent state, producers, attention, head).optimize-loop, "Pricing a design".loom-opt over them (catches type/symbol errors in about a minute); read the ISA of a
schedule or load change before timing it.ab_kernel.py (old kernel beside new, negative control) with serving-shaped cases (topic optimize-loop, "Step 4").devlab-kbench, or one local GPU). A kernel that does not beat its noise in
isolation does not go end to end; one that does still has to convert (step 6).ab_perf.py on one loom-serve (topic
optimize-loop, "Fast iteration"); on DevLab the iterate preset (build + ktest + perf + c4 + smoke, no gates, no reference engine).LEVEL=dev gates.sh locally, the final preset on DevLab, both against the
cached references (reference engines are invariant inputs; never reload them per round).perf.py with a label (--reverted for a discarded build) and bench/decisions.jsonl (topic optimize-loop, "Step 6").kb-authoring), opt-in by scope; the lesson, not the diary.List the levers of each over-budget bucket. A lever is finished only with one of these stop reasons, each with its numbers:
| Stop reason | Evidence required |
|---|---|
| At the roof | bandwidth-bound kernels at >= 90 % of the measured device bandwidth; compute kernels where zero-operand / no-op ablations show the rest is power or issue, and 3+ restructurings moved < 3 % |
| Ceiling below 1 % | the family's profiled share x the most any design could remove < 1 % of the row (e.g. launch gaps 2.5 % of a step cap persistent kernels at ~1 %) |
| Diminishing returns | after 2+ structurally different designs, the last three each within end-to-end noise (+-2 %) or < 3 % on the lever's kernels in isolation |
| Leader's net is zero | the source measured ~0 for the technique on comparable hardware, and your A/B confirms |
| Correctness | no exact or gate-passing form found; the variant stays opt-in with the failing evidence |
| Costs another row more | measured: context, memory, another prompt class, or the 4-stream row |
Not stop reasons: the first design lost (ablate the loser, write what bound it, design the next one from that: a fused kernel that lost because its serial loop waited on global loads won once it prefetched); a kernel win that ties end to end (re-price; the share was too small); "diminishing returns" judged per kernel instead of per bucket; implementation effort.
A row is done when it meets its target (>= the leader on the same kind of workload and the roofline target), or when every lever of
every bucket over budget has a stop reason from the table. Locally, act on the verdict perf.py prints (CONTINUE, REVIEW: re-profile,
then pivot or stop with loom-roofline's plateau review, BUDGET, DONE). Stopping short of the target is a result: report the
remaining gap per bucket with the stop reasons.
Declare the scope first, work only inside it, opt in by scope, run fleet/scope_lint.py before the PR, stop on out-of-mandate
needs: loom-kb/SKILL.md ("Mandate rules").
Per row: Loom, the leader (source, date, workload), the baseline engine measured in the same job, the roofline ceiling and % of it,
met or not, and the stop reason when not; numbers only from one machine, one checkpoint, the same workloads and session (loom-benchmark),
with the gate summary. Add the calibration row to the device's roofline node (kb.py route --topic roofline).
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub loom-fun/loom-skills --plugin loom11 skills in this plugin
/loomEntry point for AMD Loom work (hrx-loom SDK, loom-serve, loom-fetch, Loom IR kernels) on AMD GPUs/NPUs such as Strix Halo — installing, serving catalog models, the demo web UI, porting a new LLM to Loom, optimizing it while preserving correctness, and benchmarking against llama.cpp. Use whenever the user mentions Loom, loom-serve, loom-fetch, hrx-loom, .loom files, or evaluating/porting models for Loom./loom-benchmarkCorrectness and performance methodology for Loom models vs llama.cpp ROCm — golden token-by-token comparison with log-prob near-tie analysis, a multi-turn tool-calling (agent) gate, a native-context admission check, batching consistency, decode/prefill/long-context/concurrency throughput on real-text workloads, and how to report results honestly (tables, executive artifact). Use for "benchmark", "compare with llama.cpp", "is the port correct", "performance report"./Other plugins' skills for the same job