[論文レビュー] A Two-Stage GPU Kernel Tuner Combining Semantic Refactoring and Search-Based Optimization
この論文は、まずカーネルをパラメータ化可能なテンプレートへリファクタリングし、次にハードウェア制約下でのガイド付き探索を行い、正確性を維持しつつ性能を最適化する二段階のGPUコードチューナーを提案する。Astraを上回り、SGLangに対して最大3.55×の高速化を達成。
GPU code optimization is a key performance bottleneck for HPC workloads as well as large-model training and inference. Although compiler optimizations and hand-written kernels can partially alleviate this issue, achieving near-hardware-limit performance still relies heavily on manual code refactoring and parameter tuning. Recent progress in LLM-agent-based kernel generation and optimization has been reported, yet many approaches primarily focus on direct code rewriting, where parameter choices are often implicit and hard to control, or require human intervention, leading to unstable performance gains. This paper introduces a template-based rewriting layer on top of an agent-driven iterative loop: kernels are semantically refactored into explicitly parameterizable templates, and template parameters are then optimized via search-based autotuning, yielding more stable and higher-quality speedups. Experiments on a set of real-world kernels demonstrate speedups exceeding 3x in the best case. We extract representative CUDA kernels from SGLang as evaluation targets; the proposed agentic tuner iteratively performs templating, testing, analysis, and planning, and leverages profiling feedback to execute constrained parameter search under hardware resource limits. Compared to agent-only direct rewriting, the template-plus-search design significantly reduces the randomness of iterative optimization, making the process more interpretable and enabling a more systematic approach toward high-performance configurations. The proposed method can be further extended to OpenCL, HIP, and other backends to deliver automated performance optimization for real production workloads.
研究の動機と目的
- ハードウェア制約下で自動化・再現性のあるGPUカーネル最適化の必要性を動機づける。
- セマンティクスを preserving したリファクタリングとパラメータ化探索を結ぶ二段階最適化ワークフローを提案する。
- 制約を伴う反復的なマルチエージェントループを通じて正確性を保ちつつ性能を最大化する。
- SGLangの実世界CUDAカーネルでアプローチを評価し、ベースラインと比較する。
提案手法
- カーネル最適化を、パラメータ化テンプレート空間に対する正確性制約付きのスピードアップ最大化として formalize する。
- 四エージェントのクローズドループパイプライン(計画、生成、チューニング、テスト)を導入し、セマンティックリファクタリングとテンプレートベースのチューニングをガイドする。
- セマンティックレベルでカーネルをパラメータ化可能なテンプレートへリファクタリングし、調整可能な実行戦略を露出する。
- ハードウェアリソース制約の下で実現可能なパラメータ空間を導出し、デバイス上でフィードフォワード探索を行い実行時間を最小化する。
- ベースラインに対する正確性を検証し、繰り返し実行で性能を測定し、測定信号に基づき計画を更新する。
実験結果
リサーチクエスチョン
- RQ1セマンティクスを preserving するリファクタリングをリソース認識型パラメータ探索と統合して高性能なGPUカーネルを実現する方法は?
- RQ2テンプレートベースのパラメータ化と探索は、純粋なマルチエージェント書き換えより一般化と再現性を向上させるか?
- RQ3二段階チューナはハードウェア制約下で形状・カーネル間でどのように性能を発揮するか?
主な発見
| Index | SGL (baseline, μs) | Astra (Speedup) | Our method (Speedup) |
|---|---|---|---|
| Kernel-1 | 199.15 | 2.89× | 3.55× |
| Kernel-2 | 163.76 | 1.06× | 1.09× |
| Kernel-3 | 45.83 | 1.95× | 2.03× |
- 本手法は三つのカーネルに対してSGLangベースラインより1.09×–3.55×のスピードアップを達成;Astra単独は1.06×–2.89×。
- 我々のアプローチは三つのカーネルすべてでAstraを上回り、Kernel-1 が最大の相対利得(約22.8%)を示す。
- テンプレート化は主要な実行自由度を露出し、探索ベースの自動チューニングと組み合わせると性能上限を高める。
- 形状を跨いでも、全体的な設定はAstraと比較して堅牢性と形状横断の性能を改善するが、利得は問題サイズと構造に依存する。
- 正確性はすべての最適化カーネルで維持され、出力は指定された許容範囲以内にベースラインと一致。
より良い研究を、今すぐ始めましょう
論文設計から論文執筆まで、研究時間を劇的に削減しましょう。
クレジットカード登録不要
このレビューはAIが作成し、人間の編集者が確認しました。