tuning-ck

Races Composable Kernel GEMM instances with ckProfiler and deploys winners through aiter per-op tuners.

178|52|Updated Jul 30, 2025
One-click install
npx skills add https://github.com/AMD-AGI/GEAK --skill tuning-ck-amd-agi
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: tuning-ck
Source: https://github.com/AMD-AGI/GEAK/tree/main/perf_knowledge/expert_skills/tuning/tuning-ck
Command: npx skills add https://github.com/AMD-AGI/GEAK --skill tuning-ck-amd-agi

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Selecting the fastest pre-compiled Composable Kernel (CK) instance for a given GEMM shape on AMD Instinct GPUs is a search problem with a wide spread (up to 7x between best and worst instances), and guessing or trusting default dispatch leaves significant performance on the table. ## Core Features & Use Cases - ckProfiler instance racing: Run positional-argument ckProfiler sweeps across GEMM, batched GEMM, grouped GEMM, and MX-format ops, then decode the winning instance name to understand which tile, MFMA shape, and pipeline the problem wants. - aiter per-op CK tuner deployment: Route tuning results into production through seven aiter CK tuner scripts (fp8, FP4 blockscale, batched bf16, fused MoE) that write config CSVs the runtime reads, with a built-in --compare gate that rejects sub-3% wins. - gfx950/MI355X specifics: Covers device-name-gated instance pools, the gemm_mx op as the only route to MXFP8 on CDNA4, and the FNUZ dtype crash in the shipped MoE tuner input. - Use Case: A serving engineer sees a tall-skinny a8w8 GEMM underperforming in a vLLM workload on MI355X, races it with ckProfiler, tunes it via gemm_a8w8_bpreshuffle_tune.py, re-times the winner cold, and exports AITER_CONFIG_* to deploy a 36% kernel speedup. ## Quick Start Ask the AI to race a 4096x4096x4096 bf16 GEMM with ckProfiler on this AMD GPU, identify the winning CK instance, and explain what its template parameters say about the shape.

Frequently Asked Questions about tuning-ck

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I tune a GEMM with ckProfiler on AMD GPUs?

Run ckProfiler with positional arguments: op name, data type code, layout code, verification and timing flags, then M, N, K and strides. Enable verification (arg4=1) and timing (arg7=1), raise warm-up and iteration counts above defaults, and read the winning instance name to see the tile and pipeline that won.

How do aiter CK tuner scripts deploy tuning results?

Seven per-op tuner scripts under aiter's csrc directory race CK candidates and write config CSVs the runtime reads. Prefer the umbrella entry point aiter/utility/pretune.py, which auto-detects architecture, tags results, and rebuilds the inference library with winners.

Does CK support MXFP8 GEMM on MI355X?

Yes, CK's gemm_mx op is the only route to MXFP8 on gfx950 since the shipped aiter builds lack an MXFP8 operator. It uses its own positional argument list where arg2 selects the format (f4->f16, fp8->f16, fp8->bf16) and instances print ScaleBlockSize: 32.

Why does gemm_moe_tune.py crash on gfx950?

The shipped input file untuned_fmoe.csv contains eleven rows specifying torch.float8_e4m3fnuz, the gfx942 FP8 dialect, which raises a KeyError on gfx950 and aborts the whole run. Filter those rows out with grep -v fnuz before tuning.

Why do aiter CK tuner timings disagree with my own benchmark?

These tuners time on a single operand set with no cache-invalidation knob, so their reported microseconds are warm-cache and were measured up to 23% optimistic on one shape. Re-time every winner cold on an independent harness with rotated buffers before deploying.

What are the limitations of CK instance selection tuning?

Selection only chooses among pre-compiled instances; it cannot reach kernels that do not exist in the shipped library. For shapes needing new tile configurations, CK's tile_engine generates and compiles new instances, which this skill explicitly does not cover.