performance-optimization
Skill773 starsChanged 32 days agoApache-2.0View on GitHub
Measurement-driven workflow for making Buddy-MLIR faster - kernels, generated code, runtime, model builds. Use when optimizing latency or throughput, investigating a slowdown, deciding whether an optimization is worth doing, or comparing Buddy against llama.cpp or another baseline.
125 other projects use a version of this.
Adopted by
Most recently taken up by
- valentinesamuel/claude-skillstheir own version, first seen Nov 8, 2026
- ishandutta2007/Awesome-Claude-Skillstheir own version, first seen Nov 8, 2026
- ishandutta2007/Awesome-Agent-Skillstheir own version, first seen Nov 8, 2026
- paramcodes/skillstheir own version, first seen Nov 8, 2026
- nisarth/claude-skills-storetheir own version, first seen Nov 8, 2026
- DnsQueen/orcinus-skillstheir own version, first seen Nov 8, 2026
Used with
Projects with it also use constraint-driven-development, git-workflow-and-versioning and 10 more.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
MrCipherSmithSkillconstraint-driven-development
Use when a project needs a persistent, measurable quality bar — starting a project without documented standards, 'set up constraints', or when coverage/perf/a11y thresholds get re-debated per-PR. Produces CONSTRAINTS.md with enforceable numbers, ratchets, and a guard against silent weakening. NOT for throwaway prototypes or a one-off CI setup.
Also in 15 projects that use this
LLl0k0laDSkillgit-workflow-and-versioning
Use when making any code change. Use when committing, branching, resolving conflicts, or when you need to organize work across multiple parallel streams.
Also in 42 projects that use this
LLl0k0laDSkillusing-agent-skills
Use when starting a session or when you need to discover which skill applies to the current task. This is the meta-skill that governs how all other skills are discovered and invoked.
Also in 33 projects that use this
HK-hubSkilldeprecation-and-migration
Manages deprecation and migration. Use when removing old systems, APIs, or features. Use when migrating users from one implementation to another. Use when deciding whether to maintain or sunset existing code.
Also in 39 projects that use this
ukanwatSkillinput-systems
Architect game input — action mapping (abstracting keys into named actions), rebinding with conflict detection and persistence, multi-device support (keyboard, gamepad, touch), analog deadzones, and feel features like input buffering and coyote time, plus accessibility. Engine-neutral. Use when the user mentions input mapping, rebind controls, gamepad support, deadzone, input buffering, coyote time, or accessible controls.
Also in 4 projects that use this
HK-hubSkillobservability-and-instrumentation
Instruments code so production behavior is visible and diagnosable. Use when adding logging, metrics, tracing, or alerting. Use when shipping any feature that runs in production and you need evidence it works. Use when production issues are reported but you can't tell what happened from the available data.
Also in 31 projects that use this
- +6 more from LLl0k0laD
Other versions125 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 125
- addyosmani/agent-skills★ 114ksame name
- sanity-io/sanity★ 6.4ksame name
- gamedev-skills/awesome-gamedev-agent-skills★ 6.4ksame name
- compozy/compozy★ 2.9ksame name
- ollaya-dev/ollaya★ 1.4ksame name
- ThibautBaissac/rails_ai_agents★ 665same name
- derHaken/SuperAntigravity★ 439same name
- ukanwat/aaabench★ 399same name
- ukanwat/overtime★ 399same name
- ukanwat/selfstarter★ 399same name
115 more not listed
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository6 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- hardware-targetsSkill
- llm-inference-optimizationSkill
- riscv-rvv-optimizationSkill
- upstream-prSkill
The file
We split this skill into the rules it gives an agent
4 rules. 0 are common, 2 are distinctive, and 2 are very specific to this project.
0
Common
Most of the 110 edited versions we read keep these.
2
Distinctive
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 17
Run at least twice, alternating baseline and candidate (A B A B), not all of A then all of B: boards drift with temperature and background …
- Distinctive: line 33
If the best case is a few percent, say so and propose something else instead of implementing it.
- Very specific: line 48
Before any timing, confirm the generated artifact changed: grep the generated MLIR, or disassemble the object (llvm-objdump -d) and count …
- Very specific: line 63
Run ninja -C build check-buddy and the tests of the touched code.
“Common” is measured: kept by at least 6 in 10 of the 110 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Performance optimization
Work from measurements, one mechanism per change. The steps below are the order; skip none of them.
1. Baseline
- Build the baseline from the exact commit the change will be based on, with the same spec, build options and run command as the candidate.
- Record: commit, spec, hardware, thread count, command, inputs (prompt lengths), and the output (text or a hash of it).
- Run at least twice, alternating baseline and candidate (A B A B), not all of A then all of B: boards drift with temperature and background load.
2. Upper bound before work
Estimate what the change can gain at best before writing it:
- Profile (
perf record/perf report --sort sym) and get the share of the total time T that the part takes inside the measured window (exclude loading): its time ispart = share x T. - Compute the floor of the part, as a time: bytes / bandwidth for bandwidth-bound work, instruction latency x count for latency-bound work.
- At best the change saves
part - floor, i.e. a fractionshare x (1 - floor / part)of T; the best speedup is1 / (1 - that fraction). Example: T = 100 ms, part = 50 ms (share 0.5), floor = 25 ms: at most 25 ms saved, 25% of T, 1.33x. - If the best case is a few percent, say so and propose something else instead of implementing it.
Classify the bottleneck: DRAM bandwidth, cache / load-path bandwidth,
instruction latency (in-order cores, reductions), register spills,
synchronization / load imbalance, runtime overhead (copies, allocation,
thread start). references/methodology.md has the procedures.
3. Hypothesis, then the smallest change
State the mechanism ("the unrolled block spills; looping it removes the spills") and the expected gain. Implement only that.
4. Check that the build contains the change
Before any timing, confirm the generated artifact changed: grep the
generated MLIR, or disassemble the object (llvm-objdump -d) and count the
instructions that should change. Stale imports and stale build directories
silently produce "no speedup" (references/pitfalls.md).
5. Correctness and numerics
Decide which class the change is in (references/numerics-policy.md):
- bit-identical: same operations in the same order. Prove it (identical output bytes / text hash vs the baseline) and say so in the PR.
- numerics change: different rounding (summation order, precision, quantization). Measure accuracy (perplexity), report it, and get the maintainer's agreement.
Run ninja -C build check-buddy and the tests of the touched code.
6. Benchmark and explain
Report baseline, candidate and the delta per input size, with the run-to-run spread. A delta inside the spread is not a speedup. Explain why it is faster, with the evidence (profile share, instruction counts, a microbenchmark).
Record the result, positive or negative, in the platform's reference file
(e.g. llm-inference-optimization/references/spacemit-k3-*.md), including
the ideas that were measured and rejected.
References
references/methodology.md: profiling, microbenchmarks, upper-bound estimates, reading disassembly.references/numerics-policy.md: bit-identical vs numerics-changing changes and how to validate each.references/pitfalls.md: mistakes that produced wrong conclusions before.- Platform facts: the
hardware-targetsskill.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

