/triton-optimizer:triton-npu-optimizefrom triton-optimizer
Iteratively optimizes a Triton Ascend NPU operator through validated rounds with correctness and performance gates. Tracks multi-round experiments, profiles, and IR analysis for deeper investigation.
Ships in triton-optimizer. 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.
[!IMPORTANT] MANDATORY READING: Before performing any task with this skill, you MUST first read
references/index.mdto identify which script to use for your current task. The script index maps every workflow operation (Gen Test, Run Eval, Profile Operator, Analyze IR, Repair Guide, etc.) to its reference document.
Optimize one Triton Ascend NPU operator through validated rounds anchored to a canonical baseline/.
Use this skill when the user wants the operator itself improved rather than only generating or running tests and benchmarks.
Optimize target modes:
kernel: optimize the Triton Ascend NPU kernel path itself. Compare rounds with a kernel-oriented compare-perf view, but if the comparison falls back to total-op for some cases, record the resolved effective_metric_source and surface that mismatch as a warning instead of discarding the round outright.operator: optimize end-to-end operator latency. Wrapper logic, data movement, scheduling, pre-processing, post-processing, and kernel code are all valid optimization surfaces as long as the Triton Ascend NPU computation path remains real. Show both kernel and total-op compare-perf views, but use the total-op view as the canonical round conclusion.baseline/opt-round-N/## Overall Summary in opt-note.mdprofile/, ir/, perf-analysis.md, or compiler-analysis.md artifacts when deeper investigation is neededbaseline/opt-round-N/, initialize round strategy state through optimize-state start-round, and start attempts.mdprobe-bench when the available run-eval surface exposes itbaseline/ only when it remains canonical for the current operator workspace.opt-round-1/.baseline/ before treating any opt-round-N/ directory as a completed optimization round.opt-round-N/ from a validated parent candidate and keep parent-child traceability explicit.start-round subcommand to initialize the active round's round_strategy, analysis_policy, and reason before the first code change in that round.attempts.md immediately so every meaningful attempt and measurement is recorded.State Update blocks in attempts.md as script-written workflow history; do not manually duplicate the same round_strategy, analysis_policy, and reason bookkeeping in both attempts.md and summary.md.opt-round-1/attempts.md before the first code change.attempts.md.summary.md.Primary analysis level, and record Supporting evidence separately.opt-note.md as the top-level round ledger plus final ## Overall Summary.set-current-round-state subcommand instead of silently changing the round contract in prose only.Optimize analysis is layered.
pattern triage -> profiling diagnosis -> IR attribution -> compiler-source escalation.Primary analysis level distinct from Supporting evidence in round records.attempts.md, for example Primary analysis level: profiling diagnosis.Escalation: <from> -> <to> and Escalation reason: <why the previous level was insufficient>.profile/, ir/, or perf-analysis.md to imply the current level; state it directly.Inspect current code structure and benchmark behavior before choosing a direction.
Use optimize-knowledge as the generic optimize knowledge library.
Read optimize-knowledge pattern_index.md before detailed pattern references.
Read only the one or two most relevant detailed pattern files under optimize-knowledge patterns/ directory after the generated index has narrowed the candidate set.
When code structure is still unclear at pattern triage, inspect the operator file directly and narrow candidates with the generated pattern index.
Do not leave the chosen pattern implicit in free-form prose; write it down explicitly in attempts.md, and carry the final named pattern direction into summary.md when it guided the round.
Very strongly consider using subagents to read pattern references, scan for potentially useful optimization ideas, and report back which patterns look promising for the current kernel.
When subagents are available, prefer using them to broaden pattern exploration before committing to the round hypothesis.
Pattern references are helpful guidance, not the only allowed source of ideas.
If your own Triton, Ascend NPU, or kernel-optimization knowledge suggests a stronger direction than the current pattern library, you may use that direction directly as long as you still record the hypothesis clearly and validate it with the same correctness and benchmark gates.
You do not need an existing pattern file to justify every optimization round.
When the kernel is structurally matmul-like, read optimize-knowledge patterns/classic-matmul.md before rewriting the hot loop so the round records the standard tiled-matmul shape, dtype, and masking rules explicitly.
Do not treat pattern triage as permission for aimless pattern search without tying the candidate patterns back to the kernel structure or observed evidence.
opt-round-N/perf-analysis.md, especially for scalar/vector/cube imbalance, transfer-heavy behavior, or suspected pipeline overlap issues.profile-only diagnosis or profile-plus-IR diagnosis.opt-round-N/perf-analysis.md when the deeper round-analysis flow is used.opt-round-N/perf-analysis.md when the round deepens from profiler evidence into IR-backed attribution.opt-round-N/ir/.capture_ir.py --ir-dir opt-round-N/ir --bench-file bench_<operator>.py --operator-file opt-round-N/<optimized-operator>.py
inspect_ir.py list-stages --ir-dir opt-round-N/ir --sort-by interesting --limit 20
opt-round-N/compiler-analysis.md.tl.maximum() and tl.minimum() across the operator, not only the lines touched by the primary optimization.propagate_nan, you may add propagate_nan=tl.PropagateNan.ALL as a consistency repair when the intended semantics are explicit NaN propagation.probe-bench flow as a fast baseline-vs-candidate screen when you need a cheap directional signal before paying canonical benchmark cost.probe-bench only when the active run-eval surface actually exposes it. If the current surface does not expose probe-bench, skip the screen and continue with canonical validation.probe-bench as non-canonical screening evidence only. Do not use its output as the official round perf artifact, do not write probe artifacts into round-state.json, and do not claim round speedups from probe output alone.probe-bench to reject clearly bad candidates early or to justify keeping a clearly promising direction long enough to run canonical benchmarking.opt_<original-operator>.py.opt_<original-operator>_perf.txt, ensure that file is generated by run-eval run-bench flow, and record that exact filename in round-state.json.baseline/<operator>_perf.txt for canonical optimize-session performance comparisons, even when the current round also compares locally against its parent.compare-perf.probe-bench reports likely_gain or likely_regression, still run canonical run-bench and compare-perf before recording any official round conclusion.compare-perf flow as the only authority for claimed benchmark deltas and speedups, including Avg improvement, Geomean speedup, and any claimed benchmark delta.round-state.json as effective_metric_source, using kernel, total-op, or mixed.kernel target mode, prefer the kernel-oriented comparison result, but if compare-perf falls back to total-op for some or all cases, keep the round eligible and record that fallback as a warning.operator target mode, show both kernel and total-op comparison results so you can diagnose whether kernel improvements translated end-to-end, then record effective_metric_source: total-op for the official round conclusion.submit-round subcommand to submit the current round (with --min-rounds <N> when the session has a minimum round requirement) and repair the round until it passes before continuing or stopping.guideline field for the exit signal: if minimum rounds are satisfied, the session may stop after this round.start-round subcommand to re-check the one-round-at-a-time and no-blind-sweep workflow constraints.attempts.md: chronological round log for the current round, including the script-written State Update history, Primary analysis level, Supporting evidence, the starting hypothesis, selected pattern candidates and pivots when pattern triage is used, escalation reasons, meaningful code changes, correctness failures, probe-screening outcomes when probe-bench is used, and canonical benchmark outcomes.summary.md: round conclusion, optimization points that mattered, the final selected pattern direction when one guided the round, the final analysis level, supporting evidence that decided the round, and unresolved questions if deeper analysis may still be needed. Do not duplicate the full round strategy state history here.opt-note.md: top-level round ledger plus final ## Overall Summary.Maintain learned_lessons.md in the operator workspace as a strict reusable optimization-knowledge distillation log.
Admission criteria:
Append a lesson only when it passes all admission criteria:
Use learned_lessons.md for concise distilled rules such as:
Do not use learned_lessons.md for round narrative, local command failures, failed guesses, temporary troubleshooting notes, file names, shape-specific details, or summaries of what happened in one round.
Put round-local narrative, temporary troubleshooting notes, command failures, and shape-specific details in opt-round-N/attempts.md, opt-round-N/summary.md, or opt-note.md instead.
autotune over burning multiple optimization rounds on hand-tuned parameter sweeps.num_warps for Ascend NPU targets; it is CUDA-oriented and is not a meaningful Ascend launch knob.references/artifacts.md (opens in a new tab)references/index.md (opens in a new tab)references/triton-npu-analyze-compiler-source/analyze-compiler-source.md (opens in a new tab)references/triton-npu-analyze-ir/analyze-ir.md (opens in a new tab)references/triton-npu-analyze-round-performance/analyze-round-performance.md (opens in a new tab)references/triton-npu-analyze-round-performance/triton-npu-architecture-notes.md (opens in a new tab)references/triton-npu-analyze-round-performance/triton-npu-optimization-guidance.md (opens in a new tab)references/triton-npu-analyze-round-performance/triton-npu-profiling-analysis.md (opens in a new tab)references/triton-npu-gen-bench/bench-spec.md (opens in a new tab)references/triton-npu-gen-bench/gen-bench.md (opens in a new tab)references/triton-npu-gen-test/gen-test.md (opens in a new tab)references/triton-npu-gen-test/test-differential-spec.md (opens in a new tab)references/triton-npu-gen-test/test-standalone-spec.md (opens in a new tab)references/triton-npu-optimize-knowledge/optimize-knowledge.md (opens in a new tab)references/triton-npu-optimize-knowledge/pattern_index.md (opens in a new tab)references/triton-npu-optimize-knowledge/patterns/a5-force-simt-only-discrete-access.md (opens in a new tab)references/triton-npu-optimize-knowledge/patterns/a5-simt-sliding-window-tuning.md (opens in a new tab)references/triton-npu-optimize-knowledge/patterns/accumulator-layout-alignment.md (opens in a new tab)references/triton-npu-optimize-knowledge/patterns/algebraic-optimization.md (opens in a new tab)references/triton-npu-optimize-knowledge/patterns/attention-cv-pipeline.md (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub catman626/cannbot-skills --plugin triton-optimizer2 skills in this plugin
2 plugins in one repository ship this exact skill · first indexed Oct 20, 2026
Other plugins' skills for the same job