tuning-triton

Tune Triton and Gluon GPU kernels on AMD Instinct using AMD-specific autotune knobs and noise-aware measurement.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires torch, triton.

What problem does it solve? Tuning Triton kernels on AMD Instinct GPUs fails silently in three common ways: AMD-specific knobs (waves_per_eu, matrix_instr_nonkdim, kpack) get rejected as keyword arguments and silently dropped, a wrong autotune key serves configs tuned for different shapes (measured 3.75x slowdowns with no error), and single-pass timing reports wins that are smaller than the measurement noise. This Skill provides the correct method for each. ## Core Features & Use Cases - AMD knob placement: Shows that matrix_instr_nonkdim, kpack, and waves_per_eu must go in the first positional dict of triton.Config, verified via all_kwargs(), with measured gains (e.g. +7.7% TFLOPS for nonkdim=16 on gfx942). - Autotune key correctness: Explains that key= must name every dimension that changes the best config, with measured decode-shape penalties when M is omitted. - Search space pruning and regime splitting: Provides an analytical viability predicate (LDS limits, thread utilization) and shows 34-44% gains from tuning decode and general regimes separately. - Noise-aware measurement: Requires independent repeats with median and spread, refusing to claim gains smaller than the noise floor. - Use Case: You are optimizing a Triton GEMM for LLM decode (M=1) on an MI300X. Use this Skill to build a decode-specific config space with AMD knobs, set key=['M','N','K'], clear the Triton cache, and confirm the winner beats torch.mm beyond the spread. ## Quick Start Ask the AI to tune your Triton kernel on AMD Instinct by building a pruned autotune space with the AMD knobs in the positional config dict, a correct key, and noise-aware re-measurement of the winner.

Frequently Asked Questions about tuning-triton

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

FAQPage Schema
How do I tune Triton kernels on AMD Instinct GPUs?▼

Build a triton.Config list that includes AMD knobs (matrix_instr_nonkdim, kpack, waves_per_eu) in the first positional dict, prune invalid configs analytically before racing, set key= to every shape dimension, and re-measure the winner with independent repeats against the noise floor.

Why does triton.Config reject waves_per_eu with a TypeError?▼

triton.Config accepts only num_warps, num_stages, num_ctas, maxnreg, pre_hook, and ir_override as keywords. AMD knobs like waves_per_eu must be passed inside the first positional dict alongside constexpr block sizes, then verified with cfg.all_kwargs().

What happens if the Triton autotune key is missing a dimension?▼

The autotuner reuses a config tuned for a different shape with no error or warning. Measured on a GEMM, omitting M from the key made an M=1 decode call 3.75x slower on gfx942 because it reused a 256-row tile tuned at M=4096.

Does matrix_instr_nonkdim improve Triton GEMM performance on AMD?▼

Yes, setting matrix_instr_nonkdim=16 gave +7.7% TFLOPS over auto on a 4096-cubed bf16 GEMM on gfx942 and +4.0% on gfx950, with spread under 2%. The value 32 was within noise on both parts, so always measure against the spread.

Why does my Triton autotune rerun ignore my edited config list?▼

Autotune results and compiled binaries are cached under /root/.triton/cache. Clear the cache after editing the space and set TRITON_PRINT_AUTOTUNING=1; if nothing prints, you are on a cached result and your edits did not take effect.

When should I use Gluon instead of Triton for AMD kernels?▼

Use Gluon only after the Triton-level search space is exhausted, since hand-placed layouts add ways to be slow. Note cdna4 (gfx950) features like mfma_scaled do not run on gfx942, and hand-written layouts can pin tile shapes so signature knobs silently stop being tunable.