| name | accelerator-kernel-optimization |
| description | Review and optimize kernels and data movement for CUDA, Triton, Metal, OpenCL, SIMD, and accelerator-style workloads. Use when diagnosing throughput gaps, memory bandwidth limits, launch overhead, occupancy issues, kernel fusion tradeoffs, or host-device transfer bottlenecks in ML and systems research. |
Accelerator Kernel Optimization
Use this skill when a compute kernel underperforms and you need a disciplined performance model.
Core Workflow
- State the target hardware and workload shape.
- Build a simple bound:
- compute,
- memory,
- launch,
- transfer.
- Identify the main limiter before rewriting code.
- Inspect memory access patterns, parallelism shape, synchronization, and numerical constraints.
- Benchmark the smallest kernel that isolates the issue.
Execution Rules
- Use a roofline-style mindset even if you do not draw the full plot.
- Separate compilation issues from runtime bottlenecks.
- Treat layout, padding, and transfer volume as algorithm choices.
- Never claim a speedup without the baseline kernel, input shape, and hardware context.
Output Contract
Return:
- Bottleneck model.
- Suspected limiting factors.
- Microbenchmark plan.
- Candidate optimizations.
- Validation risks.