TL;DR
When optimizing GPU code, waiting in line for actual hardware just to profile your changes is a major bottleneck. This paper shows that off-the-shelf LLMs—especially when fed compiled assembly code alongside source files—can look at GPU code statically and reliably tell you whether it is bottlenecked by math or memory movement, without ever touching a GPU. While predicting exact memory traffic remains tough due to complex cache behaviors, LLM-generated estimates are plenty good enough to screen and prioritize optimization candidates while your cluster job sits in the queue.
What Problem Does This Paper Address?
Imagine writing high-performance GPU code—or using an AI agent to generate dozens of optimized code variants. Your first big question is always: Should I optimize the math, or should I optimize how data moves?
To answer this, developers rely on the Roofline model, which centers on a single metric: Roofline Arithmetic Intensity (RAI)—the ratio of floating-point operations (FLOPs) performed to bytes of memory transferred. Compare your code’s RAI to your GPU's hardware "balance point," and you instantly know if your kernel is compute-bound (waiting on math) or bandwidth-bound (waiting on data).
Normally, getting RAI requires running the code on the target GPU in isolation using hardware profilers. But target GPUs are often locked behind hours-long cluster queues, and AI coding loops can easily generate hundreds of variants waiting for their turn on a single chip. Can off-the-shelf LLMs act as "static profilers," estimating FLOPs, memory bytes, and RAI just by reading the code?
Methods
Without doing any task-specific fine-tuning, the authors test three cost-effective, reliable off-the-shelf models (deepseek-v4-flash, gemini-3.7-flash, and gpt-5.6-sol—selected after pruning ten candidates under a $2,000 budget). Every prompt includes execution inputs, compilation flags, and target GPU specs (like cache sizes), asking the LLM to output structured predictions for launch bounds, FLOPs, and device-memory bytes read/written.
They compare three static strategies:
- Zero-Shot Source (
ZS-Code): Giving the LLM only the raw source code. - Zero-Shot with Compiler Artifacts (
ZS-ISA): Supplementing the source code with post-compilation assembly dumps (NVIDIA SASS or AMD GCN instructions) plus static instruction-mix counts. - Agentic Sandbox (
AG): Dropping the LLM into a GPU-less Linux container with source files, assembly dumps, compilers, and Python, letting it write custom analysis scripts (for up to 100 steps) to calculate its answer.
To ensure the LLMs aren't just reciting memorized benchmark numbers from training data, the authors test four code variants for every kernel: Original, altered Compiler flags/Inputs, stripped comments with Renamed neutral variables, and Renamed with swapped floating-point Datatypes (e.g., FP32 to FP64).
Datasets
Because the models are evaluated strictly out-of-the-box, no training datasets are used. For evaluation, the authors build a matrix of 179 test cases:
- Kernels: Five diverse kernel families (
inversek2j,lavaMD,particlefilter,particles, andsrad) selected from 254 profiled programs in HeCBench (originating from Rodinia, AxBench, and NVIDIA SDK samples), specifically chosen because their performance sits near GPU balance points or flips between compute- and bandwidth-bound across hardware. - Hardware & Runtimes: Tested across four GPUs (NVIDIA A10, A100, H100; AMD MI300X) and four parallel runtimes (CUDA, HIP, OpenMP, and Rodinia/ported OpenCL), paired with four anti-memorization code variants.
Key Insights and Ideas
- Assembly bridges the compiler gap: Compilers heavily transform source code—unrolling loops, fusing operations, and eliminating dead math. Handing the LLM compiled ISA instructions takes the guesswork out of what the compiler did, letting the model focus purely on dynamic execution counts.
- You don't need exact numbers to get the right diagnosis: An LLM can misjudge exact RAI by more than 20% and still land on the right side of the GPU's Roofline balance point. Coarse numerical intuition often survives to give the exact right optimization advice.
- Caches are an LLM's blind spot: Counting FLOPs from assembly is mostly mechanical multiplication across threads. Estimating memory traffic, however, means predicting how threads share cache lines, when caches evict data, and what actually crosses the L2-to-DRAM boundary. That dynamic hardware dance is by far the biggest source of error.
- More agency isn't always better: Giving weaker or mid-tier agentic models an open-ended bash terminal often causes them to spin their wheels, burn through their step limits, and fail to return an answer—all while racking up massive token bills.
Key Results
Across 8,055 total evaluation runs (counting incomplete runs as misses):
- ISA artifacts dramatically boost precision: Predicting numerical RAI within a strict $1.20\times$ tolerance jumps from 8–14% with source code alone (
ZS-Code) to 26–32% with assembly (ZS-ISA), and reaches 48–60% within a $2\times$ tolerance. - FLOPs vs. Memory: Under
ZS-ISA, models predict total FLOPs within $1.20\times$ in 59–88% of runs (gpt-5.6-soljumps from 16% to 88%). Device-memory byte predictions lag behind at 36–40%. - Strong regime classification: Despite numerical misses,
ZS-ISAcorrectly classifies kernels as bandwidth- or compute-bound in 78–92% of runs. For the 40 trickiest cases sitting within $2\times$ of the hardware balance point, ISA boostsgpt-5.6-sol’s classification accuracy from 42.5% to 79.5%. - Memorization resilience: Compiler-artifact gains hold up across all renamed and datatype-swapped code variants.
- Agentic tradeoffs: Sandboxed analysis (
AG) pushesgpt-5.6-sol’s numerical RAI accuracy up by 6.5 percentage points (to 38.9%)—in some cases even writing custom Python cache simulators on the fly—at $3.6\times$ the median cost and $2.5\times$ the latency. Meanwhile,deepseekandgeminisee $6.7\text{–}17.7\times$ higher costs, drop in completion rates (down to 63.9% forgemini), and show no statistically clear accuracy gain.
Limitations and Future Work
Due to the $2,000 API budget cap, the study prioritizes depth across hardware, runtimes, and code variants over workload breadth, limiting evaluation to five kernel families and three LLMs using fixed prompt wording. Furthermore, 109 of the 179 test cases naturally sit more than $4\times$ away from the GPU balance point, where regime classification is inherently more forgiving, and the authors do not benchmark the LLMs directly against traditional static analysis tools. For future work, the authors suggest equipping LLMs with dedicated analytical memory-traffic or cache-simulation tools to conquer the L2/DRAM traffic estimation bottleneck.
Summary updated