Skip to main content
QUICK REVIEW

[Paper Review] A Two-Stage GPU Kernel Tuner Combining Semantic Refactoring and Search-Based Optimization

Qiuyi Qu, Yicheng Sui|arXiv (Cornell University)|Jan 19, 2026
Parallel Computing and Optimization TechniquesComputer Science0 citations
TL;DR

The paper presents a two-level GPU code tuner that first refactors kernels into parameterizable templates and then performs guided, hardware-constrained search to optimize performance while preserving correctness, improving over Astra and achieving up to 3.55× speedups over SGLang.

ABSTRACT

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.

Motivation & Objective

  • Motivate the need for automated, reproducible GPU kernel optimization under hardware constraints.
  • Propose a two-level optimization workflow that couples semantics-preserving refactoring with parameterized search.
  • Ensure correctness while maximizing performance through a constrained, iterative multi-agent loop.
  • Evaluate the approach on real-world CUDA kernels from SGLang and compare against baselines.

Proposed method

  • Formalize kernel optimization as correctness-constrained speedup maximization over a parameterized template space.
  • Introduce a four-agent, closed-loop pipeline (planning, generation, tuning, testing) guiding semantic refactoring and template-based tuning.
  • Refactor kernels into parameterizable templates at the semantic level to expose tunable execution strategies.
  • Derive a feasible parameter space under hardware resource constraints and perform on-device, feed-forward search to minimize runtime.
  • Validate correctness against a baseline, measure performance through repeated runs, and update plans based on measurement signals.

Experimental results

Research questions

  • RQ1How can semantics-preserving refactoring be integrated with resource-aware parameter search to reach high-performance GPU kernels?
  • RQ2Does template-based parameterization plus search improve generalization and reproducibility over pure multi-agent rewriting?
  • RQ3How does the two-level tuner perform across shapes and kernels under hardware constraints?

Key findings

  • The method achieves 1.09×–3.55× speedup over SGLang baseline across three kernels; Astra alone achieves 1.06×–2.89×.
  • Our approach outperforms Astra on all three kernels, with Kernel-1 showing the largest relative gain (about 22.8%).
  • Templateization exposes key execution degrees of freedom and enables a higher performance ceiling when combined with search-based autotuning.
  • Across shapes, the general configuration improves robustness and cross-shape performance compared to Astra, though gains vary with problem size and structure.
  • Correctness is preserved for all optimized kernels, with outputs matching the baseline within the specified tolerance.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.