What problem does it solve?
Writing high-performance C++ CPU kernels with SIMD intrinsics is error-prone and slow to iterate on. This Skill provides an autonomous two-phase workflow — correctness first, then branching performance exploration — with deterministic scripts for analysis, validation, benchmarking, and profiling of x86 CPU kernels in the Hugging Face kernels ecosystem.
Core Features & Use Cases
- Two-Phase Optimization Workflow: Phase 1 builds correct kernels tier by tier (generic ATen fallback → optional AVX2 → AVX512); Phase 2 runs a branching trial loop with backtracking until a target speedup or max trials is reached.
- Deterministic Tooling: Scripts for op analysis (analyze_op.py), static validation (validate_cpu_kernel.py), correctness and speedup benchmarking (benchmark_cpu.py), perf stat profiling (cpu_profiler.py), and trial-tree management (trial_manager.py).
- GEMM Acceleration Guidance: Covers quantized GEMM (INT4/NF4/FP4/FP8/MXFP4), Flash Attention, and MoE kernels using tinygemm for small M and at::native::cpublas::brgemm (oneDNN/AMX) for large M.
- Use Case: Optimize an RMSNorm kernel for Intel Xeon — the agent analyzes the op, builds the kernel with kernel-builder, benchmarks against a PyTorch baseline, profiles with perf stat, and iterates trials until reaching the configured speedup target.
Quick Start
Ask the agent to write and optimize an AVX512 CPU kernel for a given PyTorch baseline such as RMSNorm, providing the baseline file and target shapes.