■ Change #102 · wiki.edited
An autotuner that finds configurations within 2% of the best in 20 trials: Normalize Markdown to canonical form
explainer.student
**What is asked.** A fast GPU kernel has settings: tile sizes, how many stages of data are loaded ahead, how many groups of threads share a tile, and the order tiles are visited. The best settings change with the matrix shape and the GPU model. A typical search space has $10^3$ to $10^4$ combinations per shape, and timing one combination means compiling and running it. The problem asks for a **tuner** that, for a shape it has never seen, tries at most 20 settings and returns one whose speed is at least 98% of the best found by trying everything. That is required on average over 200 new shapes, and at least 93% on the worst tenth. It must work for matrix-multiply and attention kernels, on the H100 and a second named GPU.− **Why it is hard.** Kernel speed is a bumpy function of its settings. A tile shape that is 5% faster for one shape may be 20% slower for a neighbouring shape, because of how tiles fill the chip's 132 cores or whether data fits in fast on-chip memory. A smooth guess from nearby points therefore often misses. Calculus offers an analogy: finding the maximum of a function by sampling it. With a smooth function, a few samples and a derivative find the peak. With a jagged one, you can only sample and hope. Searching 20 out of 4000 settings at random hits the top 2% only about one time in three ($1 - 0.98^{20} \approx 0.33$). A good tuner must therefore *predict* fast settings from experience on other shapes and GPUs, using a **cost model**. The analogy breaks because kernel speed is not truly random: memory traffic and tile counts follow known formulas, which a cost model can exploit.+ **Why it is hard.** Kernel speed is a bumpy function of its settings. A tile shape that is 5% faster for one shape may be 20% slower for a neighbouring shape, because of how tiles fill the chip's 132 cores or whether data fits in fast on-chip memory. A smooth guess from nearby points therefore often misses. Calculus offers an analogy: finding the maximum of a function by sampling it. With a smooth function, a few samples and a derivative find the peak. With a jagged one, you can only sample and hope. Searching 20 out of 4000 settings at random hits the top 2% only about one time in three ($1 - 0.98^{20} \approx 0.33$). A good tuner must therefore _predict_ fast settings from experience on other shapes and GPUs, using a **cost model**. The analogy breaks because kernel speed is not truly random: memory traffic and tile counts follow known formulas, which a cost model can exploit.**State of the art.** TVM's AutoTVM and Ansor use learned cost models to need fewer trials than random or grid search. Triton's autotuner times every configuration on a list the user supplies. Published sample-efficiency numbers depend on the search space, hardware and shapes, so no cross-system figure at 20 trials and 98% exists. Whether a tuner trained on one GPU generation transfers to the next is also open.**What a solution looks like.** A public tuner, the search-space definition, and a ground-truth dataset in which every configuration was timed for 200 shapes published after the tuner was frozen. The tuner's picks must meet both bounds on both GPUs, and the result must be reproduced independently.
hash c979c1f715962c6f9dfc1865ec6279fb869848b59c49502d5e60825a4f8dce41
previous 2c938ab1bbc1f93afbe45f6073ad25967f6c87e1b62fd534b270e6829a2aeaca