Search papers, labs, and topics across Lattice.
This paper introduces SpecGen, an innovative system for agentic kernel optimization that enhances GPU kernel tuning through speculative generation, which allows for the simultaneous production and validation of candidate kernels while reasoning is ongoing. By addressing inefficiencies such as long generation latencies and insufficient profiling feedback, SpecGen effectively increases the number of candidate kernels generated per iteration and optimizes resource utilization. Experimental results demonstrate that SpecGen significantly reduces end-to-end optimization time while improving profiling feedback and kernel performance compared to baseline systems.
SpecGen accelerates GPU kernel optimization by generating candidate kernels in parallel with reasoning, cutting down latency and boosting resource efficiency.
Agentic kernel optimization automates manual GPU kernel tuning via iterative generation, validation, and profiling with reasoning LLMs, casting the optimization task as feedback-guided search. However, our workload characterization reveals three system-level inefficiencies that limit search efficiency: (1) long generation latency due to LLM reasoning, (2) insufficient profiling feedback, and (3) underutilized validation/profiling resources. Our key insight is that the ongoing reasoning generation exposes a window for producing additional candidate kernels before it completes, allowing the system to terminate reasoning early once a satisfactory kernel appears. We present SpecGen, an agentic kernel optimization system with \emph{speculative generation}. First, SpecGen forks non-reasoning generations at well-chosen trigger points in the reasoning trace to yield kernels, increasing the candidate kernel count per iteration. These kernels are validated and profiled in parallel with the ongoing reasoning, increasing profiling feedback, and keeping resources busy during generation. When a kernel meets the termination criterion, SpecGen terminates the reasoning generation early to reduce the generation latency. Second, SpecGen dynamically reallocates validation and profiling GPU pools based on the arrival rate and prioritizes requests to reduce profiling feedback latency under bursty speculative generation load. Furthermore, SpecGen utilizes spare memory of the validation/profiling GPUs as remote KV cache storage to eliminate prefix recomputation of speculative generations under limited memory budget. Experiments with two reasoning LLMs on H200 show that SpecGen reduces end-to-end time over three baseline systems, while producing more profiling feedback, increasing resource utilization, and improving kernel speedup under a fixed time and token budget.