agentleFS
korniakornia/kornia-rs/.claude/skills/kornia-simd/SKILL.md

kornia-simd

Skill748 starsChanged 7 days agoApache-2.0View on GitHub

Use when adding or optimizing SIMD (NEON/AVX2) or performance-critical kernels in kornia-imgproc — module layout, dispatch, cross-arch testing, benchmarking and correctness-vs-scalar checks. Trigger on "SIMD", "NEON", "AVX2", "benchmark", "speed up".

We split this skill into the rules it gives an agent

4 rules. About 0 are common, 2 are distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    Distinctive · estimate

    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
  1. Distinctive:

    Always keep a scalar fallback.

    line 20
  2. Very specific:

    Every unsafe intrinsic block has // SAFETY:.

    line 21
  3. Very specific:

    Test cross-arch with qemu/binfmt as described in SIMD.md or pixi run rust-cross-test-aarch64.

    line 25
  4. Distinctive:

    Avoid allocations in hot paths.

    line 30

≈ “Common” is an estimate: at least 1 in 5 of the 308,232 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

SIMD / performance in kornia-imgproc

The authoritative guide is crates/kornia-imgproc/SIMD.md; read it first.

Layout

  • Multi-kernel op: subdirectory with mod.rs (public Image API + sealed-trait dispatch) and kernels.rs (slice-level NEON/AVX2/scalar). Canonical example: crates/kornia-imgproc/src/color/gray/.
  • Single-dtype op: a flat .rs file is fine.
  • Shared helpers live in crates/kornia-imgproc/src/simd/ and parallel.rs.

Rules

  • Always keep a scalar fallback; SIMD output must match scalar (assert in tests).
  • Every unsafe intrinsic block has // SAFETY:; gate with #[cfg(target_arch = ...)]; runtime dispatch reads crate::simd::cpu_features(), never is_x86_feature_detected! directly (it is compile-time-sensitive under -Ctarget-cpu, see SIMD.md).
  • Test cross-arch with qemu/binfmt as described in SIMD.md or pixi run rust-cross-test-aarch64.
  • Benchmark before and after (cargo bench, best-of-N rounds). Report numbers in the PR. iai-callgrind runner version must exactly match the iai-callgrind dev-dependency version.
  • Avoid allocations in hot paths; mind rayon row chunking.

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.