Counting Without Running: Evaluating LLMs' Reasoning About Code Complexity
Gregory Bolet, Giorgis Georgakoudis, Konstantinos Parasyris, Harshitha Menon, Niranjan Hasabnis, Kirk W. Cameron, Gal Oren
TL;DR
This work confronts static reasoning about GPU kernel performance by introducing gpuFLOPBench, a dataset of 577 real CUDA kernels with ground-truth SP/DP FLOP counts and eight execution-attribute annotations. It evaluates contemporary closed-source LLMs on two tasks: classifying FLOP workloads and predicting exact FLOP counts without execution, revealing that models excel on straightforward kernels but fail to account for implicit FLOPs arising from division, intrinsics, and common subexpressions due to hardware microcode effects. The results demonstrate gradual improvements in reasoning models over time yet identify a core limitation: current LLMs lack an internal hardware-aware cost model, especially for Mixed workloads, motivating hybrid approaches that combine LLM reasoning with profiling or ISA-level templates. gpuFLOPBench thus provides a focused benchmark to drive development of performance-aware coding assistants that reason about cost with the same rigor as expert GPU developers.
Abstract
Modern GPU software stacks demand developers who can anticipate performance bottlenecks before ever launching a kernel; misjudging floating-point workloads upstream can derail tuning, scheduling, and even hardware procurement. Yet despite rapid progress in code generation, today's Large Language Models (LLMs) are rarely tested on this kind of forward-looking reasoning. We close that gap with gpuFLOPBench, a benchmark that asks models to "count without running" by predicting single and double-precision FLOP counts for 577 CUDA kernels drawn from HeCBench, annotated with ground-truth profiles and eight execution attributes that distinguish trivially analyzable code from kernels whose FLOPs depend on hidden compiler or runtime behavior. Evaluating current closed-source reasoning models shows clear but uneven progress: the newest LLMs achieve perfect classification on straightforward kernels but still incur multiple order-of-magnitude errors whenever implicit FLOPs arise from division, intrinsic math functions, or common subexpressions. These results surface a core limitation of existing code assistants -- the inability to internalize hardware-specific microcode effects -- and position gpuFLOPBench as a focused testbed for developing LLM tooling that can reason about performance with the same rigor as experienced GPU developers. Sources are available at our repository: https://github.com/Scientific-Computing-Lab/gpuFLOPBench
