agentleFS
DexForceDexForce/EmbodiChain/.agents/skills/implement-performance/SKILL.md

implement-performance

Skill240 starsChanged 11 days agoApache-2.0View on GitHub

Design and implement EmbodiChain computation when task analysis identifies algorithmic complexity, data layout, batching, memory use or synchronization costs as material. Use for new computational capabilities and performance-sensitive changes to existing code.

The file

We split this skill into the rules it gives an agent

9 rules. About 0 are common, 8 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈8

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Use a systems and HPC engineering perspective once task analysis identifies material computational costs.

    line 8
  2. Distinctive:

    Before choosing an implementation, briefly record the relevant workload, expected bottleneck and design tradeoff in the task update or PR:

    line 14
  3. Distinctive:

    Consider compute, memory traffic, allocations, transfers, dispatch and waits.

    line 24
  4. Distinctive:

    Prefer the simplest approach that meets the workload and correctness contracts.

    line 30
  5. Distinctive:

    Consider algorithmic improvements before backend-specific tuning.

    line 31
  6. Very specific:

    Check device-to-host reads such as .item(), .cpu(), .numpy(), tensor truth tests and data-dependent indexing for transfers or …

    line 47
  7. Distinctive:

    Keep device work on the intended stream.

    line 49
  8. Distinctive:

    Use add-test for focused production-contract tests.

    line 64
  9. Distinctive:

    Use benchmark for measurement methodology.

    line 72

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Implement performance-sensitive computation

Use a systems and HPC engineering perspective once task analysis identifies material computational costs. Scale the work to the affected execution path; ordinary configuration and documentation edits do not need performance analysis.

Establish the workload and cost model

Before choosing an implementation, briefly record the relevant workload, expected bottleneck and design tradeoff in the task update or PR:

  • Identify the caller, call frequency, typical and largest supported shapes, dtype/device, and target hardware. Distinguish latency, throughput and memory goals; account for single-item or small batches when callers use them.
  • For existing behavior, establish a baseline and use focused measurements or profiling to locate the dominant cost. For new behavior, estimate time/space complexity and intermediate storage first, then validate the estimate.
  • Trace the execution path from input preparation to result consumption. Consider compute, memory traffic, allocations, transfers, dispatch and waits. State assumptions when workload or hardware evidence is unavailable; keep performance conclusions limited to what was measured.

Choose the implementation

Prefer the simplest approach that meets the workload and correctness contracts. Consider algorithmic improvements before backend-specific tuning. Choose CPU, Torch, Warp or another existing backend from measured or estimated costs, including dispatch and transfers for the actual batch sizes.

  • Define batch axes, strides and ownership at boundaries. Evaluate contiguous access and broadcast views; account for copies introduced by indexing, reshaping or making inputs contiguous. Keep dtype/device conversion at owned boundaries and avoid repeated host/device round trips.
  • Bound intermediate storage as well as arithmetic. Vectorization can create quadratic pairwise or candidate tensors; use bounded chunks, reductions or direct selection when full materialization is unnecessary. Preserve ordering, masks and selection semantics across chunk boundaries.
  • Inspect loops for repeated allocation, conversion and invariant work. Reuse buffers or cache results when useful, with explicit capacity, invalidation and lifetime. Returned results must retain their documented ownership across later calls; protect reuse across callers, threads and streams.
  • Check device-to-host reads such as .item(), .cpu(), .numpy(), tensor truth tests and data-dependent indexing for transfers or synchronization. Keep device work on the intended stream; establish dependencies and storage lifetimes explicitly when interoperating with Warp or other backends.
  • Account for CPU thread pools and native library threads before adding parallel workers. Bound queues and in-flight work; avoid oversubscription. Introduce fusion, compilation, graph capture or custom kernels when expected gains justify startup cost, shape constraints and maintenance.

Shared numerical algorithms and private Warp kernels follow the ownership in AGENTS.md. Runtime adapters own simulation state, configuration and resource lifecycles. For solver buffer changes, read the IK overview and its linked buffer lifecycle before changing reuse or stream behavior.

Verify behavior and performance

Use add-test for focused production-contract tests. Choose relevant checks for numerical tolerance, failure masks, empty/singleton and partial batches, noncontiguous inputs, dtype/device, determinism and gradients where supported. Buffer or concurrency changes need checks that old results remain valid and intended stream/thread use is safe. Do not change precision, convergence, candidate ordering or success criteria merely to claim a speedup.

Use benchmark for measurement methodology. Compare the baseline and proposed implementation on equivalent inputs and quality settings; include typical sizes and memory stress cases within the supported budget. Separate device computation from transfers and end-to-end execution. Evaluate startup/steady-state or tail latency when the caller depends on them.

Report the chosen design, tested workload/hardware, correctness evidence, latency or throughput and memory tradeoffs, including regressions. Hardware that was unavailable remains unvalidated. Stop adding complexity when the workload's needs are met or measurements do not support further optimization.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.