Manuscript Offprint
arXiv:2611.02752HPC-Bench: A Comprehensive Benchmark for High Performance Computing Codes
Bowen Cui
George Mason University bcui2@gmu.edu
Junyu Yin
George Mason University jyin7@gmu.edu
Tejas Ramesh
George Mason University tramesh2@gmu.edu
Leo Lim
TJHSS reverileo@gmail.com
Oscar Hernandez
Oak Ridge National Lab oscar@ornl.gov
Keren Zhou
George Mason University kzhou6@gmu.edu
Abstract
Large Language Models (LLMs) have shown strong capabilities in code generation and reasoning, motivating extensive benchmarks for evaluating functional correctness. However, performance optimization in High-Performance Computing (HPC) poses fundamentally different challenges that are not captured by existing evaluations: HPC performance depends on low-level code, intricate memory access patterns, and computational kernels embedded within sophisticated execution contexts. We introduce HPC-Bench, a performance-grounded benchmark for evaluating LLMs as optimizers of computational kernels in realistic HPC workloads, including 114 workloads across 16 HPC computational motifs. HPC-Bench provides a fully automated, end-to-end evaluation pipeline that combines program-level correctness verification with two correctness-gated metrics, Fast@k and Speedup@k, to characterize reliability and speedup under a fixed sampling budget. Our evaluation of three representative LLMs across serial CPU, OpenMP, and CUDA settings shows that stricter speedup requirements substantially reduce the probability of finding a correct and fast optimization. HPC-Bench is available at https://github.com/Deep-Learning-Profiling-Tools/HPC-Bench.
1 Introduction
Large Language Models (LLMs) have become widely used for code generation, completion, and reasoning, motivating extensive benchmarks for evaluating their programming capabilities [1–4]. Existing benchmarks span tasks from single-function code generation, such as HumanEval [5], to repository-scale development tasks, such as CoderEval [6], HumanEvo [7], and RepoEval [8]. However, these evaluations primarily measure functional correctness, while runtime efficiency is often treated as secondary or omitted entirely.
While recent code benchmarks have begun to target efficiency, they are limited either in scale (e.g., EffiBench [9] and EvalPerf [10]) or to narrowly defined, well-structured problems (e.g., Kernel-Bench [11] and TritonBench [12]). Performance optimization in High-Performance Computing (HPC) code is a different challenge compared to these tasks. HPC efficiency is shaped by a complex interplay of low-level code (e.g., C/C++, FORTRAN), various programming models (e.g., OpenMP, CUDA), memory access patterns, and sophisticated execution contexts, where the main computational kernels are deeply embedded within their surrounding code context. Even minor code modifications, such as loop reordering [13], can induce substantial runtime differences.
There have been some preliminary studies on benchmarking LLMs for HPC tasks, such as evaluations of DeepSeek and GPT-4 on classic solvers [14], assessments of OpenAI Codex on GEMM and
Preprint.
SpMV kernels [15], and studies on MPI+OpenMP code generation [16]. However, these studies typically focus on only a narrow set of HPC codes and lack a standardized, performance-grounded benchmarking pipeline.
To fill this gap, we introduce HPC-Bench, a performance-grounded benchmark for evaluating LLMs as local optimizers of profiling-identified computational kernels in realistic HPC programs. We focus on local kernel rewriting rather than whole application rewriting, with the goal of evaluating standalone LLMs' optimization capability under a fixed sampling budget rather than evaluating agent-based workflows.
Challenges and Solutions. Building HPC-Bench involves four main challenges: (i) Hotspots are deeply embedded in large HPC applications and are context- and input-dependent; (ii) HPC applications span diverse computational motifs; (iii) Optimization effectiveness depends on both the programming model and hardware; (iv) Correctness and performance are coupled.
To address the above challenges, we make the following contributions in this paper:
- Evaluation Framework. We identify computation hotspots through profiler-guided selection and manual filtering, and we recover the inputs and context necessary to reproduce performance hotspots in real HPC applications.
- Suite. We curate a comprehensive benchmark of 114 workloads across 16 computational motifs with standardized inputs, builds, and automated program-level correctness checking.
- Experiments. We benchmark representative LLMs under serial CPU, OpenMP, and CUDA optimization settings and analyze their strengths and failure modes across motifs, structural complexity stratum, and sampling budgets.
- Metrics and Reporting. We report sampling-aware, correctness-gated metrics (e.g., Fast@k and Speedup@k) to capture the reliability-speedup tradeoff under a fixed sampling budget.
In our experiments, we identified that LLM-based HPC optimization is limited by the rapidly diminishing probability of producing correct optimizations as task structural complexity and speedup requirements increase. This trend manifests consistently across CPUs and GPUs, while its severity varies with computational motifs and benchmark structural complexity.
Despite their success in evaluating functional correctness and general programming ability, these benchmarks are largely correctness-oriented and are not designed to evaluate performance optimization on computationally intensive HPC kernels, where efficiency is tightly coupled with hardware characteristics, memory behavior, and parallel execution.
LLMs for Code Optimization and Kernel-Level Benchmarks. Recent efforts have tapped into the use of LLMs for optimizing code performance, ranging from kernel-level to application-level optimization [21]. Prior studies such as PIE [22] and AlphaDev [23] demonstrate that LLMs can discover efficient implementations for specific algorithms or low-level routines. More recently, kernel-centric benchmarks such as KernelBench [11] and TritonBench [12] have been proposed to evaluate LLMs on generating high-performance GPU kernels, particularly for machine learning workloads. ParEval [24] evaluates LLM-generated parallel code across scientific computing tasks and programming models, reporting both correctness and performance metrics, including @k and speedup@k. ENAMEL [25] evaluates generated code efficiency through eff@k and expert-optimized reference implementations.
Unlike KernelBench [11] and TritonBench [12], which evaluate standalone GPU kernels primarily for ML workloads, HPC-Bench focuses on profiling-identified main computational kernels from real HPC benchmark programs. ParEval [24] and ENAMEL [25] instead evaluate newly generated solutions rather than local optimizations of existing HPC code.
HPC Performance Benchmarking. The HPC community has long relied on benchmark suites to evaluate architectures, compilers, and runtime systems under controlled and reproducible workloads. Representative suites span both kernel-centric and application-level settings, including PolyBench [26] for static-control-flow numerical kernels, Rodinia [27] for CPU/GPU workloads, PARSEC [28] for multithreaded applications, MiBench [29] for embedded programs, and accelerator-centric suites such as MachSuite [30] and Parboil [31] for CUDA/OpenCL implementations for CPU/GPU performance comparison. Recent LLM-based HPC systems further highlight the importance of measurement-in-the-loop evaluation: ParaCodex [32], for example, operationalizes an HPC-engineering workflow with compilation/testing gates and profiling-driven feedback, using profiler-reported GPU time (kernel execution plus transfers) as a performance signal; AlphaEvolve [33] also explores iterative, evaluator-guided code improvements for scientific and computational problems. Such systems are complementary to our setting: they study agentic, feedback-driven optimization workflows, whereas HPC-Bench isolates the single-model local optimization setting under a fixed sampling budget. In contrast to traditional benchmarking or autotuning, HPC-Bench treats LLMs as stochastic local optimizers operating on annotated main computational kernels and evaluates the resulting replacements within the original benchmark harness using automated program-level correctness verification and kernel-runtime metrics.
3 HPC-Bench: A Framework for HPC Code Optimization
HPC-Bench evaluates LLMs as local optimizers of profiling-identified computational kernels embedded in complete HPC programs. The suite contains 92 CPU/OpenMP workloads across 16 computational motifs and 22 benchmarks for CUDA. It standardizes kernel annotations, inputs, builds, correctness checking, and correctness-gated performance metrics.
3.1 Overview and Pipeline

Figure 1: HPC-Bench Workflow.
Given a benchmark with curated optimization metadata, HPC-Bench constructs a benchmark-specific prompt containing the LLM role, compilation environment, optimization setting, task constraints, required output format, annotated code region, and minimal compilation context. For each model and benchmark, HPC-Bench samples candidate replacements from the same prompt. Each candidate is extracted, spliced back into the original benchmark source, compiled, executed, checked against the baseline output, and timed, as illustrated in Figure 1. Candidates that fail compilation, execution, or correctness checking are recorded as failures; only correct candidates contribute to the correctness-gated speedup metrics in Section 3.4.
3.2 Task Format
HPC-Bench poses kernel-centric optimization tasks. The LLM rewrites only the annotated editable region while the original benchmark scaffold remains responsible for input construction, data-structure initialization, compilation, execution, and program-level correctness checking. The editable region contains at least one complete function; in a few benchmarks, it spans multiple closely related functions when the performance-critical logic cannot be optimized in isolation. The generated
[System Prompt] You are a code optimization assistant. Output compilable code only. (e.g., target hardware, compiler, and OS specified.) [Task Prompt] Optimize the code below under given constraints (e.g., serial/OpenMP/CUDA). [Input Code] /* START_LINE / void atmux(...) { // main computational kernel } / END_LINE */ [Output Format] <<CODE>>> <optimized code between START_LINE and END_LINE> <<END-CODE>>
Listing 1: Input Format
replacement is wrapped in fixed delimiters for automatic extraction and insertion, as illustrated in Listing 1. The full prompt templates are provided in Appendix B.
3.3 Benchmark Suite
Benchmark Sources and Coverage. The benchmarks in HPC-Bench are curated from widely used HPC benchmark suites, including Rodinia [27], PolyBench [26], MiBench [29], MachSuite [30], PARSEC [28], Codee [34], and Parboil [31]. They cover 16 computational motifs: Dense Linear Algebra (DLA), Sparse Linear Algebra (SLA), Stencil/Scientific Computing (SC), Graph Algorithms (GA), Dynamic Programming (DP), N-body Methods (NBM), Image and Video Processing (IVP), Clustering/Machine Learning (CML), Statistical Computations (STC), Spectral Methods (SM), Computational Fluid Dynamics (CFD), Monte Carlo Methods (MCM), Cryptography/Encoding (CE), Sorting/Search (SS), Medical/Scientific Computing (MSC), and Utility Benchmarks (UB).
The selection is intended to cover representative HPC workloads rather than randomly sample a single suite. Within each motif, benchmarks differ in access pattern, dependency structure, and optimization opportunity: DLA includes dense matrix kernels such as gemm, sgemm, and matmul, where blocking and cache reuse are central, dense matrix-vector kernels such as atax, bicg, and gesummv, but also factorization and triangular kernels such as cholesky, lu, ludcmp, and trisolv, where dependencies constrain valid transformations; SLA consists of format-specific SpMV kernels (spmv, spmv-crs, and spmv-ellpack), where indirect indexing limits simple vectorization; SC spans 1D to 3D structured-grid kernels such as jacobi-1d, jacobi-2d, hotspot, and heat-3d, which differ in dimensionality, neighbor structure, and update dependencies. Extended motif-level details are reported in Appendix E.
For CUDA-based optimization, we construct a dedicated CUDA benchmark set drawn from Rodinia [27]. This set partially overlaps with the Rodinia benchmarks used in the CPU/OpenMP evaluations, while additionally including five GPU-oriented workloads (dwt2d, nn, gaussian, huffman, and hybridsort) that are not included in the CPU/OpenMP version.
Kernel Selection and Context Curation. We seed kernel selection with external profilers: HPC-Toolkit [35] for CPU/OpenMP workloads and Nsight Systems [36] for CUDA workloads. We then manually filter non-computational hotspots such as printing, file I/O, initialization, timing instrumentation, and cleanup code. The optimization target is usually the hottest computational function after filtering; when the hotspot spans tightly coupled caller-callee logic, such as in b+tree, we annotate the smallest necessary multi-function region.
For each selected target, we curate the minimal compilation context required by the annotated region, including helper functions, macros/constants, typedefs/structs, and headers. This context is included in the prompt, while the generated replacement is inserted back into the unmodified benchmark source. Thus, the LLM optimizes a local code region while the full benchmark driver provides the execution context and correctness verification.
Table 1: Structural Complexity Stratum Statistics
| Structural Complexity | #LOC | #func | #branch | #loop |
|---|---|---|---|---|
| (66.3%) | 34.34 | 1.46 | 0.72 | 2.61 |
| (18.5%) | 100.47 | 1.71 | 5.18 | 3.12 |
| (9.8%) | 139.33 | 2.22 | 11.89 | 4.56 |
| (5.4%) | 316.00 | 4.00 | 19.80 | 19.00 |
Structural Complexity Stratification. Each benchmark is assigned to a structural complexity stratum from d1 (lowest structural complexity) to d4 (highest structural complexity) using a static structural complexity proxy. Let , and denote branch count, lines of code (LOC), maximum loop nesting depth, and function count within the annotated region, respectively. The branch count includes if, case, and ternary operators. Each raw metric is min-max scaled to [0, 10] using the 5th and 95th percentiles across the 92 CPU/OpenMP benchmarks:
The composite score is
We bucket the score as , , , and . Loop nesting depth and function count are extracted using Lizard; LOC and branch count are computed by custom parsers on the annotated region. This score is a static proxy for optimization structural complexity: it correlates with optimization outcomes but is not a direct measure of headroom, which also depends on baseline runtime, memory behavior, and available parallelism. Table 1 reports the per-category statistics for the 92 CPU/OpenMP benchmarks. The CUDA benchmark labels in Appendix A are assigned using the same structural complexity definition for metadata consistency, but the CUDA set is not used for structural complexity stratum analysis because it contains only 22 benchmarks.
Standardization across Benchmarks. To reduce confounders, we remove pre-existing OpenMP parallelization to enforce a uniform serial baseline for CPU experiments. We standardize inputs into five scales: mini, small, medium, large, and extra-large; when original benchmark inputs are unavailable, we construct missing splits manually and validate that the baseline program produces valid reference outputs. LLMs are not used for input generation or correctness judging. Runtime is measured with warmup runs followed by repeated timed trials, using the annotated kernel mean runtime as the primary signal. Unless otherwise stated, the main paper reports metrics using annotated kernel runtime; total runtime is recorded for Appendix F.6 reporting.
3.4 Evaluation Metrics
HPC-Bench evaluates models with correctness-gated, sampling-aware metrics that separate reliability from the magnitude of achieved speedup. Intuitively, Fast@k measures the probability that at least one candidate among samples is both correct and sufficiently fast, while Speedup@k measures the expected best correctness-gated speedup among samples. Full notation, auxiliary statistics, and extended visualization details are deferred to Appendix D.
For benchmark , candidate , the number of threads , and runtime type , we define correctness-gated speedup as
where is the baseline runtime, is the runtime of candidate , and incorrect implementations receive zero speedup.
Fast@k. A threshold requires a correct non-slowdown, while imposes a minimum speedup requirement. Given a speedup threshold , let

Figure 2: Fast@3/Speedup@3 versus the speedup threshold , aggregated over all benchmarks and dataset sizes for EX1–EX3.
be the number of generated candidates that are both correct and achieve a correctness-gated speedup of at least . Sampling candidates uniformly without replacement,
Speedup@k. While Fast@k captures the probability of finding a qualifying candidate, it does not capture the magnitude of the best speedup. We therefore define
A benchmark whose sampled candidates do not satisfy contributes 0, not the baseline value 1.0. This convention makes Speedup@k monotonically non-increasing as increases. We compute this expectation exactly by enumerating the subsets.
Unless otherwise stated, reported aggregate metrics are macro-averaged across benchmarks within the corresponding stratum, such as motif, structural complexity stratum, or dataset size, when applicable.
4 Experimental Setup
We conduct experiments on HPC-Bench to evaluate the ability of LLMs to optimize performance-critical code under realistic workflows. Specifically, we evaluate three settings that differ in their optimization constraints and target hardware: serial CPU optimization (EX1), OpenMP CPU parallelization (EX2), and CUDA GPU optimization (EX3).
Optimization Settings. EX1 permits only single-thread CPU transformations, such as loop restructuring, scalar hoisting, and memory-access optimization. EX2 extends EX1 with OpenMP parallelization, while forbidding in-source thread-count control; instead, thread counts () are set externally via OMP_NUM_THREADS. EX1 and EX2 use the same 92-benchmark suite. EX3 evaluates CUDA optimization on the 22-benchmark CUDA set drawn from Rodinia.
Models and Sampling. We evaluate GPT-5.1 [37], Claude Sonnet 4.5 [38], and Qwen3-Coder-480B-A35B-Instruct [39]. A per-setting API cost breakdown is provided in Appendix H. For each benchmark, setting, and model, we generate candidates using the same prompt and decoding protocol. Unless otherwise stated, we report sampling-aware metrics at across speedup thresholds . For EX2, we report the 16-thread setting in the main paper and defer the full sweep to Appendix F.5.
Hardware. EX1 and EX2 run on a dual-socket AMD EPYC 7543 system with 64 physical cores and simultaneous multithreading disabled, compiled with GCC/G++ 14.2 on Enterprise Linux 8. EX3 runs on an NVIDIA A100 GPU, with CUDA code compiled by nvcc 12.4. Host code is compiled with the same compiler toolchain used in the CPU experiments. Full per-benchmark compilation and link flags are detailed in Appendix C.1.
5 Evaluation
We evaluate LLMs on HPC-Bench from three complementary perspectives: reliability, magnitude of performance gains, and robustness across motifs, structural complexity strata, and sampling budgets.
5.1 Research Questions
Our evaluation is guided by three questions:
- RQ1 (Reliability). How reliably can models produce correct and sufficiently fast optimizations under a limited sampling budget?
- RQ2 (Performance Gains). When useful optimizations are found, how large are the achieved performance gains?
- RQ3 (Sensitivity and Robustness). How do reliability and performance gains vary across computational motifs and structural complexity strata, and as the sampling budget changes?
5.2 RQ1: Reliability Under a Sampling Budget
Answer: Models can often find correct or modestly faster candidates, but Fast@3 drops sharply as the required speedup threshold increases, especially in the CUDA setting.
The top row of Figure 2 reports Fast@3 across speedup threshold for EX1-EX3, macro-averaged over all benchmarks and the five standardized dataset sizes. Across all models and execution settings, Fast@3 decreases sharply as the required increases. At , serial CPU optimization remains relatively reliable: averaged across the five dataset sizes, Fast@3 is 0.72 for Claude Sonnet 4.5, 0.69 for GPT-5.1, and 0.67 for Qwen. However, requiring at least speedup reduces EX1 reliability to 0.17, 0.17, and 0.10, respectively.
The same threshold sensitivity appears in EX2 and EX3. For EX2 at 16 threads, average Fast@3 drops from 0.35-0.36 for Claude Sonnet 4.5/GPT-5.1 at to roughly 0.24-0.25 at , while Qwen3-Coder decreases from 0.27 to 0.15. EX3 is especially threshold-sensitive: although average Fast@3 at is still 0.45-0.54, it falls to about 0.09-0.11 at ; across all model-dataset pairs, the range at this threshold is only 0.05–0.17. At high thresholds, the model curves also become close to each other, suggesting that CUDA optimization is dominated by the structural complexity of producing any correct and sufficiently fast candidate rather than by small differences in model ranking.
5.3 RQ2: Correctness-Gated Performance Gains
Answer: HPC-Bench contains genuine high-speedup opportunities, but correctness-gated gains are concentrated in a subset of workloads that current LLMs can optimize reliably.
The bottom row of Figure 2 reports Speedup@3 as a function of . At , EX1 achieves average correctness-gated speedups of for Claude Sonnet 4.5, for GPT-5.1, and for Qwen3-Coder. At , these values decrease to , , and , respectively, because many benchmarks no longer contribute a qualifying candidate. EX3 follows a similar threshold-sensitive pattern: at , average Speedup@3 ranges from to , but at it drops to .
EX2 behaves differently. At , Claude and GPT-5.1 reach and on average, while Qwen3-Coder reaches ; at , these values remain comparatively stable at , , and . This slower decay does not mean that EX2 is uniformly easy. Rather, the EX2 Best-of- kernel speedup distribution (Appendix F.2) is highly polarized: a small set of highly parallelizable kernels achieve very large speedups and survive all thresholds, while many short-running kernels fail to exceed even modest thresholds because OpenMP overhead dominates execution. As a result, Fast@3 drops with increasing , but Speedup@3 remains relatively flat because the macro-average continues to be anchored by the same high-contributing kernels, e.g., matmul (), haccmk (), coulomb (), hotspot3D (), and particlefilter ().
Representative High-speedup Cases. The aggregate curves are pulled up by a small set of benchmarks where models discover qualitatively stronger transformations rather than incremental cleanups. We highlight three cases from Claude Sonnet 4.5. In EX1, matmul reaches speedup by applying loop tiling, changing the loop order from i-j-k to i-k-j, and hoisting A[i][k] into a scalar, improving cache locality and removing redundant loads. In EX2, hotspot3D reaches speedup by adding #pragma omp parallel for collapse(2) schedule(static), hoisting time-step-invariant expressions such as dt / Cap and ct * amb_temp, and precomputing neighbor offsets for the innermost stencil loop. In EX3, particlefilter reaches speedup by replacing a per-thread linear CDF scan with binary search, reducing the search complexity from to .
These cases illustrate three recurring sources of large gains in HPC-Bench: cache/locality-aware loop restructuring, OpenMP parallelization with overhead reduction, and improvements in algorithmic complexity.
5.4 RQ3: Robustness Across Motifs, Structural Complexity, and Sampling Budgets
Answer: Reliability and speedup vary across computational motifs, structural complexity strata, and sampling budgets. Compute-heavy and data-parallel motifs benefit most, while irregular access patterns, dependencies, and high structural complexity code reduce optimization success; increasing the sampling budget mainly helps models find stronger candidates, but only modestly changes whether any qualifying candidate exists.
5.4.1 Motif-level Outcomes Track Motif-level Structure
Motif-level results show that the aggregate trends are not uniform across the suite. On the medium dataset at , averaged across the three models, EX1 achieves the highest Speedup@3 on NBM (), SC (), MCM (), and DLA (). These motifs expose transformations such as loop reordering, scalar hoisting, locality improvement, and arithmetic restructuring. By contrast, motifs such as CFD (), IVP (), MSC (), SM (), SLA (), GA (), and CML () show more limited gains, often because the bottleneck is dominated by memory traffic, irregular access, or benchmark-specific data dependencies.
In EX2, the top motifs at 16 threads are NBM (), DLA (), MCM (), IVP (), and CFD (). This confirms that motifs with abundant data parallelism and sufficient runtime scale benefit most from OpenMP. In contrast, SLA and SM both average near zero, while SS (), STC (), CE (), and UB () are muted by limited parallelism, irregular access, or overhead-sensitive execution. Selected motif-level visualizations for Fast@3 and Speedup@3 are reported in Appendix F.3; EX3 motif-level macro-averages are omitted from the main analysis because the 22-benchmark CUDA benchmark set is too small for stable per-motif conclusions.
What Models Try, and Where They Fail, per Motif. Generated programs show motif-conditioned behavior. In DLA and SC, models often attempt loop reordering, scalar extraction, pointer caching, and constant hoisting, but failures arise when factorization dependencies or floating-point-order changes break correctness. In SLA and GA, models are more conservative: indirect sparse layouts, pointer chasing, and traversal dependencies make deeper restructuring risky. This explains why the same model performs better on compute-regular kernels than on irregular or dependency-heavy workloads.
5.4.2 Structural Complexity Stratum Analysis: Structural Complexity Interacts with Optimization Headroom
For EX1 and EX2, the structural complexity score predicts optimization outcomes in some settings, but its relationship with performance is also influenced by runtime-scale factors. We omit EX3 because its 22-benchmark CUDA set is too small for stable structural complexity stratum analysis. In EX1, strata with lower structural complexity generally have higher Fast@3 and Speedup@3 than strata with higher structural complexity, suggesting that simpler annotated regions are easier for LLMs to optimize correctly. However, EX2 demonstrates that structural simplicity alone does not imply large parallel optimization headroom. At 16 threads on the medium dataset, 41 out of 61 benchmarks (67%) fail to reach even speedup, even though is structurally simple. Their median baseline kernel runtime is only 7.33 ms, and several representative cases are much shorter: gesummv runs in roughly 152 s, stencil1-2d-mach in roughly 11 s, and spmv-crs-mach in roughly 3.8 s. For such kernels, OpenMP overhead dominates computation, so parallelization can easily slow the program down.
By contrast, and benchmarks have longer median baseline kernel runtimes (1.05 s and 1.37 s, respectively) and therefore provide more opportunity for thread-level parallelism. Only benchmarks and benchmarks fail to reach speedup, and representative kernels such as hotspot (5.34), b+tree (8.49), nw (7.39), and hotspot3D (13.27) show substantial OpenMP gains. The group is small (5 benchmarks) but exhibits heterogeneous outcomes that reinforce the score's role as a complexity proxy. Longer baseline runtimes coexist with correctness-side failures: cutcp and lbm produce no correct candidates, while heartwall, susan-c-mibench, and susan-e-mibench reach substantial speedups of up to , , and , respectively. Hence and the hardest cases fail for different reasons: is often overhead-limited by short kernel runtimes, whereas the hardest cases are more often correctness-limited by structural complexity. An aggregate breakdown by structural complexity stratum supporting this interpretation is provided in Appendix F.3, with a focused diagnostic of the benchmarks in Table 15.
5.4.3 Sampling-Budget Sensitivity

(a) Fast@k versus

(b) Speedup@k versus
Figure 3: Fast@k and Speedup@k versus for EX1 when .
Figure 3 reports Fast@k and Speedup@k as functions of the sampling budget for EX1 on the medium dataset at . Increasing has only a modest effect on Fast@k: all three models remain in a relatively narrow band, indicating that most benchmarks that can produce at least one correct and slightly faster candidate already do so with a small number of samples. In contrast, Speedup@k grows more noticeably with , especially for Claude Sonnet 4.5, showing that additional samples are more useful for finding a stronger candidate than for substantially changing the probability of finding any qualifying candidate. Corresponding sensitivity curves for EX2 and EX3 are reported in Appendix F.4.
5.5 Correctness and Failure Modes
Table 2: Correctness and failure statistics across optimization settings. CF denotes compilation failures, RF denotes runtime failures, and CE denotes incorrect executions. Percentages are computed over all generated trials within each EX setting.
| EX | #Bench. | Trials | CF | CF (%) | RF | RF (%) | CE | CE (%) | Correct | Correct (%) |
|---|---|---|---|---|---|---|---|---|---|---|
| EX1 | 92 | 2760 | 249 | 9.0 | 50 | 1.8 | 339 | 12.3 | 2122 | 76.9 |
| EX2 | 92 | 2760 | 574 | 20.8 | 13 | 0.5 | 477 | 17.3 | 1696 | 61.4 |
| EX3 | 22 | 660 | 232 | 35.2 | 32 | 4.8 | 140 | 21.2 | 256 | 38.8 |
Table 2 summarizes correctness outcomes across EX1–EX3, with detailed failure breakdowns in Appendix G. Correctness decreases from 76.9% in EX1 to 61.4% in EX2, and 38.8% in EX3, reflecting the additional challenges of preserving semantics under OpenMP parallelism and CUDA-specific memory/synchronization constraints.
Most failures are not simple formatting artifacts. Compilation failures are dominated by syntax/type/declaration errors, while malformed outputs account for 8.0%, 3.5%, and 34.1% of compilation failures in EX1–EX3, respectively. All runtime failures in EX1 and EX2 are memory errors, whereas 96.9% of runtime failures in EX3 are CUDA errors. Correctness errors include floating-point mismatches, element mismatches, and missing outputs; incorrect outputs account for 79.1%, 86.4%, and 100.0% of correctness errors in EX1–EX3, respectively. Thus, simple output post-processing can address only a limited subset of failures.
6 Conclusions
We present HPC-Bench, an end-to-end benchmark for evaluating LLMs as performance optimizers of profiling-identified computational kernels embedded in realistic HPC programs. HPC-Bench combines standardized benchmark construction, automated compilation and correctness checking, reproducible runtime measurement, and correctness-gated metrics that jointly capture optimization reliability and achieved speedup under a fixed sampling budget. Across serial CPU, OpenMP, and CUDA settings, our evaluation shows that current LLMs can occasionally discover substantial performance improvements, including locality-aware loop restructuring, effective OpenMP parallelization, and algorithmic improvements. However, these gains are unevenly distributed and are constrained by reliability: stricter speedup thresholds, structural complexity, and more complex optimization settings make it harder to obtain a correct and sufficiently fast candidate. Motif level and structural complexity stratum analyses further show that compute-regular and data-parallel workloads are more amenable to LLM optimization, whereas irregular access patterns, dependency-heavy kernels, short-running parallel regions, and CUDA integration constraints remain challenging. These results suggest that progress in LLM-based HPC optimization should be measured not only by peak speedups on successful cases, but also by the probability of obtaining correct, robust, and practically useful optimizations across realistic workloads.
Acknowledgments and Disclosure of Funding
This work is supported by the National Science Foundation under Award Nos. 2411134 and DOE Genesis Mission Award DE-FOA-0003612. We acknowledge Anthropic and OpenAI for providing LLM APIs credits used for our experiments. We also thank the anonymous reviewers for their valuable feedback. The authors declare no competing interests.
References
[1] Soneya Binta Hossain and Matthew Dwyer. Togll: Correct and strong test oracle generation with llms. arXiv preprint arXiv:2405.03786, 2024.
[2] Xinyi Hou, Yanjie Zhao, Yue Liu, Zhou Yang, Kailong Wang, Li Li, Xiapu Luo, David Lo, John Grundy, and Haoyu Wang. Large language models for software engineering: A systematic literature review. ACM Transactions on Software Engineering and Methodology, 33(8):1–79, 2024.
[3] Binyuan Hui, Jian Yang, Zeyu Cui, Jiaxi Yang, Dayiheng Liu, Lei Zhang, Tianyu Liu, Jiajun Zhang, Bowen Yu, Keming Lu, et al. Qwen2. 5-coder technical report. arXiv preprint arXiv:2409.12186, 2024.
[4] Yihong Dong, Xue Jiang, Jiaru Qian, Tian Wang, Kechi Zhang, Zhi Jin, and Ge Li. A survey on code generation with llm-based agents. arXiv preprint arXiv:2508.00083, 2025.
[5] Mark Chen. Evaluating large language models trained on code. arXiv preprint arXiv:2107.03374, 2021.
[6] Hao Yu, Bo Shen, Dezhi Ran, Jiaxin Zhang, Qi Zhang, Yuchi Ma, Guangtai Liang, Ying Li, Qianxiang Wang, and Tao Xie. Codereval: A benchmark of pragmatic code generation with generative pre-trained models. In Proceedings of the 46th IEEE/ACM International Conference on Software Engineering, pages 1–12, 2024.
[7] Dewu Zheng, Yanlin Wang, Ensheng Shi, Ruikai Zhang, Yuchi Ma, Hongyu Zhang, and Zibin Zheng. Humanevo: An evolution-aware benchmark for more realistic evaluation of repository-level code generation. arXiv preprint arXiv:2406.06918, 2024.
[8] Fengji Zhang, Bei Chen, Yue Zhang, Jacky Keung, Jin Liu, Daoguang Zan, Yi Mao, Jian-Guang Lou, and Weizhu Chen. Repocoder: Repository-level code completion through iterative retrieval and generation. arXiv preprint arXiv:2303.12570, 2023.
[9] Dong Huang, Yuhao Qing, Weiyi Shang, Heming Cui, and Jie M Zhang. Effibench: Benchmarking the efficiency of automatically generated code. Advances in Neural Information Processing Systems, 37:11506–11544, 2024.
[10] Jiawei Liu, Songrun Xie, Junhao Wang, Yuxiang Wei, Yifeng Ding, and Lingming Zhang. Evaluating language models for efficient code generation. arXiv preprint arXiv:2408.06450, 2024.
[11] Anne Ouyang, Simon Guo, Simran Arora, Alex L Zhang, William Hu, Christopher Ré, and Azalia Mirhoseini. Kernelbench: Can llms write efficient gpu kernels? arXiv preprint arXiv:2502.10517, 2025.
[12] Jianling Li, Shangzhan Li, Zhenye Gao, Qi Shi, Yuxuan Li, Zefan Wang, Jiacheng Huang, Haojie Wang, Jianrong Wang, Xu Han, Zhiyuan Liu, and Maosong Sun. Tritonbench: Benchmarking large language model capabilities for generating triton operators, 2025.
[13] Vivek Sarkar and Radhika Thekkath. A general framework for iteration-reordering loop transformations. SIGPLAN Not., 27(7):175–187, July 1992.
[14] Noujoud Nader, Patrick Diehl, Steve Brandt, and Hartmut Kaiser. Llm & hpc: Benchmarking deepseek's performance in high-performance computing tasks. In International Conference on High Performance Computing, pages 626–638. Springer, 2025.
[15] William Godoy, Pedro Valero-Lara, Keita Teranishi, Prasanna Balaprakash, and Jeffrey Vetter. Evaluation of openai codex for hpc parallel programming models kernel generation. In Proceedings of the 52nd International Conference on Parallel Processing Workshops, pages 136–144, 2023.
[16] Patrick Diehl, Noujoud Nader, and Deepti Gupta. Llm-hpc++: Evaluating llm-generated modern c++ and mpi+ openmp codes for scalable mandelbrot set computation. arXiv preprint arXiv:2512.17023, 2025.
[17] Kaixin Wang, Tianlin Li, Xiaoyu Zhang, Chong Wang, Weisong Sun, Yang Liu, and Bin Shi. Software development life cycle perspective: A survey of benchmarks for code large language models and agents. arXiv preprint arXiv:2505.05283, 2025.
[18] Jacob Austin, Augustus Odena, Maxwell Nye, Maarten Bosma, Henryk Michalewski, David Dohan, Ellen Jiang, Carrie Cai, Michael Terry, Quoc Le, et al. Program synthesis with large language models. arXiv preprint arXiv:2108.07732, 2021.
[19] Xueying Du, Mingwei Liu, Kaixin Wang, Hanlin Wang, Junwei Liu, Yixuan Chen, Jiayi Feng, Chaofeng Sha, Xin Peng, and Yiling Lou. Classeval: A manually-crafted benchmark for evaluating llms on class-level code generation. arXiv preprint arXiv:2308.01861, 2023.
[20] Srinivasan Iyer, Ioannis Konstas, Alvin Cheung, and Luke Zettlemoyer. Mapping language to code in programmatic context. arXiv preprint arXiv:1808.09588, 2018.
[21] Alex Gu, Naman Jain, Wen-Ding Li, Manish Shetty, Yijia Shao, Ziyang Li, Diyi Yang, Kevin Ellis, Koushik Sen, and Armando Solar-Lezama. Challenges and paths towards ai for software engineering. arXiv preprint arXiv:2503.22625, 2025.
[22] Alexander Shypula, Aman Madaan, Yimeng Zeng, Uri Alon, Jacob Gardner, Milad Hashemi, Graham Neubig, Parthasarathy Ranganathan, Osbert Bastani, and Amir Yazdanbakhsh. Learning performance-improving code edits. arXiv preprint arXiv:2302.07867, 2023.
[23] Daniel J Mankowitz, Andrea Michi, Anton Zhernov, Marco Gelmi, Marco Selvi, Cosmin Paduraru, Edouard Leurent, Shariq Iqbal, Jean-Baptiste Lespiau, Alex Ahern, et al. Faster sorting algorithms discovered using deep reinforcement learning. Nature, 618(7964):257–263, 2023.
[24] Daniel Nichols, Joshua H Davis, Zhaojun Xie, Arjun Rajaram, and Abhinav Bhatele. Can large language models write parallel code? In Proceedings of the 33rd International Symposium on High-Performance Parallel and Distributed Computing, pages 281–294, 2024.
[25] Ruizhong Qiu, Weiliang Zeng, James Ezick, Christopher Lott, and Hanghang Tong. How efficient is llm-generated code? a rigorous & high-standard benchmark. In International Conference on Learning Representations, volume 2025, pages 2233–2261, 2025.
[26] Scott Grauer-Gray, Lifan Xu, Robert Searles, Sudhee Ayalasomayajula, and John Cavazos. Auto-tuning a high-level language targeted to gpu codes. In 2012 innovative parallel computing (InPar), pages 1–10. Ieee, 2012.
[27] Shuai Che, Michael Boyer, Jiayuan Meng, David Tarjan, Jeremy W Sheaffer, Sang-Ha Lee, and Kevin Skadron. Rodinia: A benchmark suite for heterogeneous computing. In 2009 IEEE international symposium on workload characterization (IISWC), pages 44–54. Ieee, 2009.
[28] Christian Bienia, Sanjeev Kumar, Jaswinder Pal Singh, and Kai Li. The parsec benchmark suite: Characterization and architectural implications. In Proceedings of the 17th international conference on Parallel architectures and compilation techniques, pages 72–81, 2008.
[29] Matthew R Guthaus, Jeffrey S Ringenberg, Dan Ernst, Todd M Austin, Trevor Mudge, and Richard B Brown. Mibench: A free, commercially representative embedded benchmark suite. In Proceedings of the fourth annual IEEE international workshop on workload characterization. WWC-4 (Cat. No. 01EX538), pages 3–14. IEEE, 2001.
[30] Brandon Reagen, Robert Adolf, Yakun Sophia Shao, Gu-Yeon Wei, and David Brooks. MachSuite: Benchmarks for accelerator design and customized architectures. In Proceedings of the IEEE International Symposium on Workload Characterization, Raleigh, North Carolina, October 2014.
[31] John A Stratton, Christopher Rodrigues, I-Jui Sung, Nady Obeid, Li-Wen Chang, Nasser Anssari, Geng Daniel Liu, and Wen-mei W Hwu. Parboil: A revised benchmark suite for scientific and commercial throughput computing. Center for Reliable and High-Performance Computing, 127(7.2), 2012.
[32] Erel Kaplan, Tomer Bitan, Lian Ghrayeb, Le Chen, Tom Yotam, Niranjan Hasabnis, and Gal Oren. Para-codex: A profiling-guided autonomous coding agent for reliable parallel code generation and translation. arXiv preprint arXiv:2601.04327, 2026.
[33] Alexander Novikov, Ngân Vũ, Marvin Eisenberger, Emilien Dupont, Po-Sen Huang, Adam Zsolt Wagner, Sergey Shirobokov, Borislav Kozlovskii, Francisco JR Ruiz, Abbas Mehrabian, et al. Alphaevolve: A coding agent for scientific and algorithmic discovery. arXiv preprint arXiv:2506.13131, 2025.
[34] Codee. performance-demos. https://github.com/codee-com/performance-demos, 2025. [Online; accessed 21-Jan-2026].
[35] Keren Zhou, Laksono Adhianto, Jonathon Anderson, Aaron Cherian, Dejan Grubisic, Mark Krentel, Yumeng Liu, Xiaozhu Meng, and John Mellor-Crummey. Measurement and analysis of gpu-accelerated applications with hpctoolkit. Parallel Computing, 108:102837, 2021.
[36] NVIDIA. NVIDIA Nsight Systems. https://developer.nvidia.com/nsight-systems, 2026.
[37] OpenAI. GPT-5.1. https://openai.com, 2025. Accessed: 2026-01.
[38] Anthropic. Claude Sonnet 4.5. https://www.anthropic.com, 2025. Accessed: 2026-01.
[39] Alibaba Cloud. Qwen3-Coder-480B-A35B-Instruct. https://modelscope.cn, 2025. Accessed: 2026-01.
A Full Benchmark Lists
This appendix lists all benchmarks used in HPC-Bench: 92 workloads across 16 motifs for EX1 and EX2, and 22 CUDA benchmarks for EX3.
A.1 Benchmark List for EX1 and EX2
Table 3 lists the 92 CPU/OpenMP benchmarks used by EX1 and EX2, including each benchmark's source suite, motif, structural complexity stratum, and a brief description.
Table 3: Benchmark list used in HPC-Bench for EX1 and EX2
| Benchmark | Source | Structural Complexity | Motif | Brief Introduction |
|---|---|---|---|---|
| 2mm | polybench | d1 | DLA | Two matrix multiplications chain |
| 3mm | polybench | d1 | DLA | Three matrix multiplications chain |
| adi | polybench | d1 | SC | Alternating direction implicit |
| aes | machsuite | d1 | CE | Advanced Encryption Standard |
| atax | polybench | d1 | DLA | Matrix transpose and vector multiplication |
| atmux | codee | d1 | UB | ATM mux simulation |
| b+tree | rodinia | d3 | GA | B+ tree operations |
| backprop | rodinia | d1 | CML | Neural network backpropagation |
| basicmath-mibench | mibench | d1 | UB | Basic math operations |
| bfs | rodinia | d3 | GA | Breadth-first search |
| bfs-bulk-mach | machsuite | d1 | GA | BFS with bulk processing |
| bfs-queue-mach | machsuite | d2 | GA | BFS with queue |
| bicg | polybench | d1 | DLA | Biconjugate gradients |
| bilateral | rodinia | d1 | IVP | Bilateral filter |
| bitcount-mibench | mibench | d1 | UB | Bit counting operations |
| canneal-parsec | parsec | d1 | CML | Simulated annealing optimization |
| cfd | rodinia | d2 | CFD | Computational fluid dynamics solver |
| cholesky | polybench | d1 | DLA | Cholesky decomposition |
| correlation | polybench | d1 | STC | Correlation coefficient |
| coulomb | codee | d1 | NBM | Coulombic potential calculation |
| covariance | polybench | d1 | STC | Covariance matrix |
| cutcp | parboil | d4 | NBM | Cutoff Coulombic potential |
| deriche | polybench | d1 | IVP | Deriche edge detector |
| dijkstra-mibench | mibench | d1 | GA | Dijkstra algorithm |
| doitgen | polybench | d1 | STC | Multi-resolution analysis |
| durbin | polybench | d1 | STC | Durbin's algorithm |
| fdtd-2d | polybench | d1 | SC | 2D finite-difference time-domain |
| fft-strided-mach | machsuite | d1 | SM | FFT with strided access |
| fft-transpose-mach | machsuite | d2 | SM | FFT with transpose |
| floyd-warshall | polybench | d1 | DP | All-pairs shortest paths |
| gemm | polybench | d1 | DLA | General matrix-matrix multiplication |
| gemm-blocked-mach | machsuite | d1 | DLA | Blocked matrix multiplication |
| gemm-ncubed-mach | machsuite | d1 | DLA | Naive O(n^3) matrix multiplication |
| gemver | polybench | d1 | DLA | Matrix-vector operations |
| gesummv | polybench | d1 | DLA | Scalar-matrix-vector multiplication |
| gramschmidt | polybench | d1 | DLA | Gram-Schmidt orthogonalization |
| haccmk | codee | d1 | NBM | HACC short-range force kernel |
| heartwall | rodinia | d4 | MSC | Heart wall motion tracking |
| heat-3d | polybench | d1 | SC | 3D heat equation solver |
| histo | parboil | d2 | UB | Image histogram computation |
| hotspot | rodinia | d3 | SC | 2D thermal simulation |
| hotspot3D | rodinia | d2 | SC | 3D thermal simulation |
| jacobi-1d | polybench | d1 | SC | 1D Jacobi iteration |
| jacobi-2d | polybench | d1 | SC | 2D Jacobi iteration |
| kmeans | rodinia | d2 | CML | K-means clustering |
| kmp-mach | machsuite | d2 | SS | Knuth-Morris-Pratt string matching |
| lavaMD | rodinia | d1 | NBM | Molecular dynamics simulation |
| lbm | parboil | d4 | CFD | Lattice Boltzmann method |
| leukocyte | rodinia | d1 | IVP | Leukocyte tracking |
| lu | polybench | d1 | DLA | LU decomposition |
| lud | rodinia | d1 | DLA | LU decomposition (variant) |
| ludcmp | polybench | d1 | DLA | LU decomposition complete |
| matmul | codee | d1 | DLA | Basic matrix multiplication |
Continued on next page
| Benchmark | Source | Structural Complexity | Motif | Brief Introduction |
|---|---|---|---|---|
| md-grid-mach | machsuite | d2 | NBM | Molecular dynamics with grid |
| md-knn-mach | machsuite | d1 | NBM | Molecular dynamics with k-NN |
| mri-gridding | parboil | d3 | MSC | MRI gridding reconstruction |
| mri-q | parboil | d1 | MSC | MRI Q-space reconstruction |
| mvt | polybench | d1 | DLA | Matrix-vector transpose operations |
| myocyte | rodinia | d1 | MSC | Cardiac myocyte simulation |
| nussinov | polybench | d2 | DP | RNA secondary structure prediction |
| nw | rodinia | d3 | DP | Needleman-Wunsch sequence alignment |
| nw-mach | machsuite | d2 | DP | Needleman-Wunsch variant |
| particlefilter | rodinia | d2 | MCM | Particle filter tracking |
| pathfinder | rodinia | d2 | DP | Dynamic programming path finding |
| patricia-mibench | mibench | d2 | GA | Patricia trie operations |
| pi | codee | d2 | MCM | Monte Carlo estimation |
| qsort-mibench | mibench | d3 | SS | Quick sort |
| sad | parboil | d3 | IVP | Sum of absolute differences |
| seidel-2d | polybench | d1 | SC | 2D Gauss-Seidel iteration |
| sgemm | parboil | d1 | DLA | Single-precision matrix multiplication |
| sort-merge-mach | machsuite | d1 | SS | Merge sort |
| sort-radix-mach | machsuite | d1 | SS | Radix sort |
| spmv | parboil | d1 | SLA | Sparse matrix-vector multiplication |
| spmv-crs-mach | machsuite | d1 | SLA | spmv with CRS format |
| spmv-ellpack-mach | machsuite | d1 | SLA | spmv with ELLPACK format |
| srad_v1 | rodinia | d2 | SC | Speckle-reducing anisotropic diffusion v1 |
| srad_v2 | rodinia | d3 | SC | Speckle-reducing anisotropic diffusion v2 |
| stencil | parboil | d1 | SC | General stencil operation |
| stencil-2d-mach | machsuite | d1 | SC | 2D stencil pattern |
| stencil-3d-mach | machsuite | d1 | SC | 3D stencil pattern |
| streamcluster | rodinia | d3 | CML | Stream clustering algorithm |
| stringsearch-mibench | mibench | d1 | SS | String search algorithm |
| susan-c-mibench | mibench | d4 | IVP | SUSAN corner detection |
| susan-e-mibench | mibench | d4 | IVP | SUSAN edge detection |
| susan-s-mibench | mibench | d2 | IVP | SUSAN smoothing |
| symm | polybench | d1 | DLA | Symmetric matrix multiplication |
| syr2k | polybench | d1 | DLA | Symmetric rank-2k update |
| syrk | polybench | d1 | DLA | Symmetric rank-k update |
| tpacf | parboil | d2 | MCM | Two-point angular correlation |
| trisolv | polybench | d1 | DLA | Triangular system solver |
| trmm | polybench | d1 | DLA | Triangular matrix-matrix multiplication |
| viterbi-mach | machsuite | d1 | CE | Viterbi decoding algorithm |
A.2 Benchmark List for EX3
Table 4 lists the 22 Rodinia CUDA benchmarks used by EX3. This set partially overlaps with the Rodinia benchmarks in the CPU/OpenMP suite, and also includes the five GPU workloads (dwt2d, nn, gaussian, huffman, hybridsort) that are not included in the CPU/OpenMP version.
Table 4: Benchmark list used in HPC-Bench for EX3
| Benchmark | Source | Structural Complexity | Motif | Brief Introduction |
|---|---|---|---|---|
| b+tree | rodinia | d3 | GA | B+ tree operations on GPU |
| bfs | rodinia | d3 | GA | Breadth-first search |
| bilateral | rodinia | d1 | IVP | Bilateral filter for image processing |
| cfd | rodinia | d2 | CFD | Computational fluid dynamics solver |
| dwt2d | rodinia | d2 | SM | 2D discrete wavelet transform |
| gaussian | rodinia | d1 | DLA | Gaussian elimination |
| heartwall | rodinia | d4 | MSC | Heart wall motion tracking |
| hotspot | rodinia | d3 | SC | 2D thermal simulation |
| hotspot3D | rodinia | d2 | SC | 3D thermal simulation |
| huffman | rodinia | d2 | CE | Huffman encoding/decoding |
| hybridsort | rodinia | d2 | SS | Hybrid sorting algorithm |
| kmeans | rodinia | d2 | CML | K-means clustering |
| lavaMD | rodinia | d1 | NBM | Molecular dynamics simulation |
| leukocyte | rodinia | d1 | IVP | Leukocyte tracking in video |
| lud | rodinia | d1 | DLA | LU decomposition |
Continued on next page
| Benchmark | Source | Structural Complexity | Motif | Brief Introduction |
|---|---|---|---|---|
| myocyte | rodinia | d1 | MSC | Cardiac myocyte simulation |
| nn | rodinia | d1 | CML | K-nearest neighbor search |
| particlefilter | rodinia | d2 | MCM | Particle filter tracking |
| pathfinder | rodinia | d2 | DP | Dynamic programming path finding |
| srad_v1 | rodinia | d2 | SC | Speckle-reducing anisotropic diffusion v1 |
| srad_v2 | rodinia | d3 | SC | Speckle-reducing anisotropic diffusion v2 |
| streamcluster | rodinia | d3 | CML | Stream clustering algorithm |
A.3 Benchmark Structural Complexity Metadata
The structural complexity score in Section 3.3 is computed from four structural metrics measured on the annotated optimization region: branch count (if, case, ternary operators), lines of code, maximum loop nesting depth, and function count. Loop nesting depth and function count are extracted using Lizard; LOC and branch count are computed by custom parsers on the annotated region. Each metric is min-max scaled to [0, 10] using the 5th and 95th percentiles computed from the 92 CPU/OpenMP benchmarks before being combined into a weighted composite score. The labels of CUDA workload's structural complexity use the same scaling statistics, scoring rule, and bucket boundaries as the CPU/OpenMP benchmarks. The final structural complexity labels are released with the benchmark metadata, as shown in Table 3 and Table 4.
B Prompt Templates
The exact prompts used for EX1, EX2, and EX3 are provided below. All prompts within a setting share the same template; only the annotated kernel region and the minimal compilation context differ between benchmarks. Each setting's template specifies the model role, target environment, optimization constraints, and output format using the fixed delimiters <<CODE>> and <<END-CODE>> (see Listing 1).
B.1 EX1: Serial CPU Optimization Prompt
Prompt Template for EX1
System Prompt (Common for EX1 and EX2)
You are a code generation/optimization assistant. Your task is to take a prompt and input code and generate an optimized version of the code. Your output must strictly follow the output format specified in the task prompt. The computation environment is a Linux system (Enterprise Linux 8, kernel version 4.18.0-348.7.1) and a dual-socket AMD EPYC 7543 system with 64 physical cores total, SMT disabled.
The available C/C++ compilers are: GCC/G++ v14.2.0 and CLANG/CLANG++ v19.1.3.
Prompt for EX1 (Serial Optimization)
Provide the optimized C code with serial optimizations for above input code, ensuring that none of the existing functions or header files are removed, and no new functions or print statements are added. Wrap the generated optimized C code between <<CODE>> and <<END-CODE>>. Then provide an explanation of why this optimization was made, and wrap the explanation between <<NOTE>> and <<END-NOTE>>. Ensure that the optimized code contains only compilable source code, and the explanation contains only plain text or code snippets as needed. Do not emit any extra commentary before or after these markers. Example format: <<CODE>> static void foo() { // optimized code body } <<END-CODE>>
<<NOTE>> Explain the optimization rationale here. <<END-NOTE>>
B.2 EX2: OpenMP CPU Parallelization Prompt
The EX2 prompt explicitly forbids omp_set_num_threads and any modification of the timing instrumentation in the source; thread counts are controlled externally via the OMP_NUM_THREADS environment variable.
Prompt Template for EX2
// System Prompt (Common for EX1 and EX2)
You are a code generation/optimization assistant. Your task is to take a prompt and input code and generate an optimized version of the code.
Your output must strictly follow the output format specified in the task prompt.
The computation environment is a Linux system (Enterprise Linux 8, kernel version 4.18.0-348.7.1) and a dual-socket AMD EPYC 7543 system with 64 physical cores total, SMT disabled.
The available C/C++ compilers are: GCC/G++ v14.2.0 and CLANG/CLANG++ v19.1.3.
# Prompt for EX2 (Serial + Parallel Optimization with OpenMP)
Provide the optimized C code with both serial and parallel optimizations, ensuring that none of the existing functions or header files are removed, and no new functions or print statements are added.
The file already contains an '_OPENMP'-guarded '#include <omp.h>'; keep it intact and feel free to use OpenMP pragmas/API directly, but never insert 'omp_set_num_threads' (thread counts come from the runtime via 'OMP_NUM_THREADS').
Do not modify, relocate, or duplicate any time-measurement instrumentation ('clock_gettime', 'omp_get_wtime', kernel-time accumulators, or related globals); if you restructure control flow, ensure the function still reaches the existing end-of-function timing accumulation (avoid early returns by storing results first).
Avoid adding printf/logging inside parallel regions so multi-threaded output stays deterministic.
Wrap the generated optimized C code between <<CODE>> and <<END-CODE>>. Then provide an explanation of why this optimization was made, and wrap the explanation between <<NOTE>> and <<END-NOTE>>.
Ensure that the optimized code contains only compilable source code, and the explanation contains only plain text or code snippets as needed.
Do not emit anything outside those markers.
Example:
<<CODE>>
/* optimized code */
<<END-CODE>>
<<NOTE>>
Explain the optimization rationale here.
<<END-NOTE>>
B.3 EX3: CUDA GPU Optimization Prompt
The EX3 prompt specifies the CUDA / nvcc environment and constrains the LLM to preserve the host-device memory layout, the external interfaces, and the timing/instrumentation hooks of the original benchmark.
Prompt Template for EX3
# System Prompt for EX3 (CUDA Main Computational Kernel Optimization)
You are a CUDA kernel optimization expert. Your output must strictly follow the output format specified in the task prompt. Work on Linux (RHEL 8, kernel 4.18.0-348.7.1) with an AMD EPYC 7543 host CPU. Host code compiles with GCC/G++ 14.2 or Clang/Clang++ 19.1. All GPU code must compile with NVIDIA nvcc 12.4 (CUDA Toolkit 12.4, driver 550.99), targeting NVIDIA A100-class GPUs.
Your task is to optimize the annotated CUDA computational kernel region. The <<CODE>> block must contain only compilable CUDA C/C++ source code. Do not emit extra commentary outside the requested markers.
Prompt for EX3 (CUDA Main Computational Kernel Optimization)
Target file: <benchmark-specific CUDA source file>. Optimize the annotated CUDA kernel region and any benchmark-provided wrapper code included in the prompt. Do not change external interfaces, host--device memory layouts, kernel launch semantics, input/output parameter lists, or timing/instrumentation hooks outside the annotated region.
Goals:
- Improve memory efficiency: maximize coalesced global-memory loads/stores, reduce redundant memory traffic, use shared memory when it is beneficial and safe, and add restrict qualifiers only when legally valid.
- Improve parallel execution efficiency: reduce unnecessary thread divergence, improve occupancy when possible, avoid excessive register/shared-memory usage, and use warp-level primitives only when they preserve correctness.
- Preserve synchronization and memory semantics: keep required __syncthreads() barriers, do not remove boundary checks unless they are provably redundant, and do not introduce races or out-of-bounds accesses.
- Preserve correctness and integration: do not change host-side allocation, data transfer, logging, timing code, or benchmark I/O behavior. Do not insert cudaDeviceSynchronize unless it is required for correctness and does not interfere with existing timing instrumentation.
- Preserve output format: comments are allowed inside the code block, but the generated code must be directly compilable after being inserted back into the original benchmark source.
Wrap the optimized CUDA code between <<CODE>> and <<END-CODE>>. If you provide rationale, wrap it between <<NOTE>> and <<END-NOTE>> with plain text only. The evaluator will extract and compile only the <<CODE>> block.
Example: <<CODE>> global void optimized_kernel(...) { // optimized CUDA kernel body } <<END-CODE>> <<NOTE>> Briefly explain the main optimization idea. <<END-NOTE>>
C Reproducibility Details
Compilation flags, input construction, and timing protocols for each setting are detailed below.
C.1 Compilation and Link Flags
Table 5 reports compilation and link flags for EX1 (Serial CPU). EX2 (Table 6) uses the same flags with -openmp added to compilation and linking; thread counts are set through OMP_NUM_THREADS. EX3 (Table 7) lists the CUDA additions for each benchmark on top of a common nvcc 12.4 base configuration with -generate-line-info, host -03, and link flags -lcudart -lnvToolsExt.
Table 5: EX1 (Serial CPU) compilation flags. Compiler: GCC/G++ 14.2.0, Enterprise Linux 8. haccmk uses -02 for driver, -03 for kernel.
| Benchmark | Suite | CC | Compilation Flags | Link Flags |
|---|---|---|---|---|
| 2mm | PolyBench | gcc | -03 | -1m |
| 3mm | PolyBench | gcc | -03 | -1m |
| adi | PolyBench | gcc | -03 | -1m |
| atax | PolyBench | gcc | -03 | -1m |
| bicg | PolyBench | gcc | -03 | -1m |
| cholesky | PolyBench | gcc | -03 | -1m |
| correlation | PolyBench | gcc | -03 | -1m |
| covariance | PolyBench | gcc | -03 | -1m |
| deriche | PolyBench | gcc | -03 | -1m |
| doitgen | PolyBench | gcc | -03 | -1m |
| durbin | PolyBench | gcc | -03 | -1m |
| fdtd-2d | PolyBench | gcc | -03 | -1m |
| floyd-warshall | PolyBench | gcc | -03 | -1m |
| gemm | PolyBench | gcc | -03 | -1m |
| gemver | PolyBench | gcc | -03 | -1m |
| gesummv | PolyBench | gcc | -03 | -1m |
| gramschmidt | PolyBench | gcc | -03 | -1m |
| heat-3d | PolyBench | gcc | -03 | -1m |
| jacobi-1d | PolyBench | gcc | -03 | -1m |
| jacobi-2d | PolyBench | gcc | -03 | -1m |
| lu | PolyBench | gcc | -03 | -1m |
| ludcmp | PolyBench | gcc | -03 | -1m |
| mvt | PolyBench | gcc | -03 | -1m |
| nussinov | PolyBench | gcc | -03 | -1m |
| seidel-2d | PolyBench | gcc | -03 | -1m |
| symm | PolyBench | gcc | -03 | -1m |
| syr2k | PolyBench | gcc | -03 | -1m |
| syrk | PolyBench | gcc | -03 | -1m |
| trisolv | PolyBench | gcc | -03 | -1m |
| trmm | PolyBench | gcc | -03 | -1m |
| backprop | Rodinia | gcc | -03 | -1m |
| bfs | Rodinia | g++ | -03 | -1m |
| bilateral | Rodinia | g++ | -03 | -1m |
| b+tree | Rodinia | gcc | -03 -w | -1m |
| cfd | Rodinia | g++ | -03 | -1m |
| heartwall | Rodinia | gcc | -03 | -1m |
| hotspot | Rodinia | g++ | -03 -w | -1m |
| hotspot3D | Rodinia | gcc | -03 | -1m |
| kmeans | Rodinia | gcc | -03 | -1m |
| lavaMD | Rodinia | gcc | -03 | -1m |
| leukocyte | Rodinia | gcc | -03 | -1m |
| lud | Rodinia | gcc | -03 | -1m |
| myocyte | Rodinia | gcc | -03 | -1m |
| nw | Rodinia | g++ | -03 | -1m |
| particlefilter | Rodinia | gcc | -03 | -1m |
| pathfinder | Rodinia | g++ | -03 | -1m |
| srad_v1 | Rodinia | gcc | -03 | -1m |
| srad_v2 | Rodinia | g++ | -03 | -1m |
| streamcluster | Rodinia | g++ | -03 | -lpthread -1m |
| cutcp | Parboil | gcc | -03 | -1m -lpthread |
| histo | Parboil | gcc | -03 | -1m -lpthread |
| lbm | Parboil | gcc | -03 | -1m -lpthread |
Continued on next page...
| Benchmark | Suite | CC | Compilation Flags | Link Flags |
|---|---|---|---|---|
| mri-gridding | Parboil | gcc | -03 -w | -1m -lpthread |
| mri-q | Parboil | g++ | -03 -ffast-math-funroll-loops -w | -1m |
| sad | Parboil | gcc | -03 | -1m -lpthread |
| sgemm | Parboil | g++ | -03 -w | -1m -lstdc++ |
| spmv | Parboil | gcc | -03 | -1m -lpthread |
| stencil | Parboil | gcc | -03 | -1m -lpthread |
| tpacf | Parboil | gcc | -03 | -1m -lpthread |
| aes | MachSuite | gcc | -03 -Wall -Wno-unused-label | — |
| bfs-bulk-mach | MachSuite | gcc | -03 -Wall -Wno-unused-label | — |
| bfs-queue-mach | MachSuite | gcc | -03 -Wall -Wno-unused-label | — |
| fft-strided-mach | MachSuite | gcc | -03 -Wall -Wno-unused-label | — |
| fft-transpose-mach | MachSuite | gcc | -03 -Wall -Wno-unused-label | — |
| gemm-blocked-mach | MachSuite | gcc | -03 -Wall -Wno-unused-label | — |
| gemm-ncubed-mach | MachSuite | gcc | -03 -Wall -Wno-unused-label | — |
| kmp-mach | MachSuite | gcc | -03 -Wall -Wno-unused-label | — |
| md-grid-mach | MachSuite | gcc | -03 -Wall -Wno-unused-label | — |
| md-knn-mach | MachSuite | gcc | -03 -Wall -Wno-unused-label | — |
| nw-mach | MachSuite | gcc | -03 -Wall -Wno-unused-label | — |
| sort-merge-mach | MachSuite | gcc | -03 -Wall -Wno-unused-label | — |
| sort-radix-mach | MachSuite | gcc | -03 -Wall -Wno-unused-label | — |
| spmv-crs-mach | MachSuite | gcc | -03 -Wall -Wno-unused-label | — |
| spmv-ellpack-mach | MachSuite | gcc | -03 -Wall -Wno-unused-label | — |
| stencil-2d-mach | MachSuite | gcc | -03 -Wall -Wno-unused-label | — |
| stencil-3d-mach | MachSuite | gcc | -03 -Wall -Wno-unused-label | — |
| viterbi-mach | MachSuite | gcc | -03 -Wall -Wno-unused-label | — |
| basicmath-mibench | MiBench | gcc | -03 -w | -1m |
| bitcount-mibench | MiBench | gcc | -03 | — |
| dijkstra-mibench | MiBench | gcc | -03 -w -std=gnu89 | — |
| patricia-mibench | MiBench | gcc | -03 -w -std=gnu89 | — |
| qsort-mibench | MiBench | gcc | -03 | -1m |
| stringsearch-mibench | MiBench | gcc | -03 -w | — |
| susan-c-mibench | MiBench | gcc | -03 -w | -1m |
| susan-e-mibench | MiBench | gcc | -03 -w | -1m |
| susan-s-mibench | MiBench | gcc | -03 -w | -1m |
| canneal-parsec | PARSEC | g++ | -03 -std=c++11 | -1m |
| atmux | CODEE | gcc | -std=c99 -03 | -1m -lrt |
| coulomb | CODEE | gcc | -03 | -1m |
| haccmk | CODEE | gcc | -02 (main) / -03 (kernel) | -1m |
| matmul | CODEE | gcc | -03 | — |
| pi | CODEE | gcc | -03 | -1m |
Table 6: EX2 (OpenMP CPU) compilation flags. EX2 uses identical flags to EX1 (Table 5) with -fopenmp added to both compilation and link flags for all 92 benchmarks. Thread counts are controlled at runtime via OMP_NUM_THREADS.
Table 7: EX3 (CUDA GPU) compilation flags. Common base: nvcc 12.4, -generate-line-info, host -03, link -lcudart -lnvToolsExt. Only per-benchmark additions are listed.
| Benchmark | Additional NVCCFLAGS | Additional Link Flags |
|---|---|---|
| bfs | — | — |
| bilateral | — | — |
| b+tree | — | -1m -lstdc++ |
| cfd | — | — |
| Benchmark | Additional NVCCFLAGS | Additional Link Flags |
|---|---|---|
| dwt2d | -DOUTPUT -w | — |
| gaussian | — | — |
| heartwall | — | — |
| hotspot | — | — |
| hotspot3D | — | — |
| huffman | -w | — |
| hybridsort | -w | — |
| kmeans | -w | — |
| lavaMD | -w | — |
| leukocyte | -w | -lm -lstdc++ |
| lud | -w | — |
| myocyte | -w | -lm |
| nn | — | — |
| particlefilter | -w | -lm |
| pathfinder | -w | — |
| srad_v1 | -w | — |
| srad_v2 | -w | — |
| streamcluster | -w | — |
C.2 Input Construction and Correctness Checking
We use the original benchmark inputs where available and manually construct the missing sizes among the five standardized scales (mini, small, medium, large, extra-large). LLMs are not used for input generation or correctness checking. Each valid input has a reference produced by the current baseline program. Each candidate is checked against the reference using benchmark-specific comparisons: numerical tolerances for numeric results, exact matching for text, and binary comparison for image or binary outputs. Only candidates that pass the comparison receive correctness credit; skipped checks, failed checks, crashes, and timeouts count as incorrect.
C.3 Hardware, Timing, and Runtime Measurement
Hardware. EX1 and EX2 run on a dual-socket AMD EPYC 7543 with 64 physical cores total (32 per socket), simultaneous multithreading disabled, under Enterprise Linux 8. EX3 runs on an NVIDIA A100 GPU using CUDA Toolkit 12.4 / nvcc 12.4. Host code in EX3 uses the same GCC toolchain as EX1/EX2.
Timing Protocol. For each benchmark and configuration, we perform warmup iterations followed by repeated timed trials and report the mean runtime. Warmup and trial counts are selected adaptively from a preliminary run to accommodate different runtime scales.
Reported Quantities. We report three quantities:
-
Kernel Runtime is the runtime of the annotated optimization region and is the primary signal for all metrics in the main paper;
-
Total Program Runtime is the full benchmark execution time (input setup + allocation + I/O + kernel + cleanup), used for comparison in Appendix F.6;
-
Evaluation Cost is the API cost for generation, reported in Appendix H.
EX2 Thread Control. EX2 thread counts are set at runtime through OMP_NUM_THREADS, with source-level overrides prohibited. The main paper reports EX2 results at threads; the full sweep over is in Appendix F.5.
Compute Resource Usage. Across all evaluated models and input sizes, the reported experiments required approximately 300 CPU node-hours for EX1 (Serial), 1200 CPU node-hours for EX2 (OpenMP), and 100 GPU-hours for EX3 (CUDA). These estimates cover compilation, correctness verification, and performance measurement.
D Full Metric Definitions
This section provides metric notation, auxiliary statistics, and the aggregation protocol for Fast@k and Speedup@k.
D.1 Notation
Table 8 lists the symbols used in the metric definitions.
Table 8: Notation used in the metric definitions. All metrics are computed per benchmark and then macro-averaged across the relevant stratum.
| Symbol | Description |
|---|---|
| Benchmark index | |
| Model index (Claude Sonnet 4.5, GPT-5.1, Qwen3-Coder) | |
| Structural complexity stratum of benchmark | |
| Computational motif of benchmark | |
| Candidate index (we use ) | |
| Number of generated candidates per (benchmark, model) | |
| Sampling budget; (we use unless noted) | |
| Thread count (relevant only for EX2; ) | |
| Runtime measurement type | |
| Baseline runtime of benchmark under runtime type and threads | |
| Runtime of candidate under runtime type and threads | |
| Correctness indicator (matches reference output: 1, otherwise 0) | |
| Correctness-gated speedup (defined below) | |
| Speedup threshold, ; requires no slowdown, while imposes a minimum speedup |
D.2 Correctness-Gated Speedup
Candidates that fail compilation, execution, or correctness checking receive zero speedup:
Failed candidates remain in the sample pool of size and contribute zero to all sampling-aware metrics. This convention makes Speedup@k monotonically non-increasing in (Section 3.4).
D.3 Auxiliary Metrics
We report three auxiliary statistics.
Pass Rate. The fraction of generated candidates that are functionally correct is
Best-of- Speedup (Correct-only). The maximum correctness-gated speedup over all candidates is
Mean Runtime Over Correct Candidates.
(9) which is undefined if no correct candidate is generated.
Aggregated values for these auxiliary statistics at the EX level are reported in Table 9, Table 10, and Table 11.
Table 9: Auxiliary metrics for EX1 (Serial CPU optimization), averaged over all benchmarks at the medium dataset size. Pass rate, best-of-N speedup, and MeanT are first computed per benchmark and then macro-averaged. MeanT reports the average runtime over correct candidates only.
| Model | Pass rate | Best-of-N speedup | MeanT (s) |
|---|---|---|---|
| GPT-5.1 | 0.76 | 2.16 | 1.88 |
| Claude | 0.80 | 2.13 | 2.10 |
| Qwen | 0.74 | 1.44 | 2.00 |
Table 10: Auxiliary metrics for EX2 (OpenMP CPU parallelization), averaged over all benchmarks at the medium dataset size. Pass rate, best-of-N speedup, and MeanT are first computed per benchmark and then macro-averaged. MeanT reports the average runtime over correct candidates only.
| Model | Pass rate | Best-of-N speedup | MeanT (s) |
|---|---|---|---|
| GPT-5.1 | 0.59 | 3.65 | 1.18 |
| Claude | 0.65 | 3.49 | 1.54 |
| Qwen | 0.59 | 2.68 | 1.48 |
Table 11: Auxiliary metrics for EX3 (CUDA GPU optimization), averaged over all benchmarks at the medium dataset size. Pass rate, best-of-N speedup, and MeanT are first computed per benchmark and then macro-averaged. MeanT reports the average runtime over correct candidates only.
| Model | Pass rate | Best-of-N speedup | MeanT (s) |
|---|---|---|---|
| GPT-5.1 | 0.36 | 3.53 | 0.12 |
| Claude | 0.42 | 2.76 | 0.30 |
| Qwen | 0.38 | 2.49 | 0.44 |
D.4 Aggregation and Stratified Reporting
Unless otherwise stated, aggregate values are macro-averaged across benchmarks within a stratum. Given a grouping criterion , define . For a metric stratified by ,
For figures aggregated over input sizes, we compute the metric at each of the five scales (mini, small, medium, large, extra-large) and then average across scales. For sensitivity analyses with respect to , results are reported on the medium dataset unless otherwise noted.
E Motif-Level Characterization
Table 12 summarizes the 16 motifs in HPC-Bench by their dominant performance bottleneck, representative access and dependency patterns, parallelization structure, common optimization opportunities, and representative kernels.
Table 12. Motif-level HPC characterization. For each computational motif we summarize the dominant bottleneck, representative access/dependency pattern, parallelization structure, typical optimization opportunities, and representative kernels from the benchmark suite.
| Motif | # | Dominant Bottleneck | Representative Access / Dependency Pattern | Parallelization Structure | Representative Optimization Opportunities | Representative HPC-Bench Kernels |
|---|---|---|---|---|---|---|
| Cryptography/Encoding (CE) | 2 | Compute-bound | Sequential, no-level | Sequential (block/state dep.) | Lockup tables, SIMD | ars, vithb-mach |
| Comp. Fluid Dynamics (CFD) | 2 | Bandwidth/Compute-bound | Structured grid | Data-parallel | Cache blocking, SIMD | cld, thm |
| Clustering/ML (CML) | 4 | Compute/Memory-bound | Iterative convergence, random access | Data-parallel / barrier-synchronized | Convergence optimization, reduction | kmeans, backprop, streamcluster |
| Dense Linear Algebra (DLA) | 22 | Compute-bound | Regular (GEMM, matvec) to triangular (factor.) | Data-parallel to level-sequential | Loop tiling/rower, blocked algorithms | gemm, choledky, trisolv |
| Dynamic Programming (DP) | 5 | Compute-bound | Wirefront, anti-diagonal | Wirefront | Memorization, loop-restructuring | bfop-starball, rvc, rev-mach |
| Graph Algorithms (GA) | 6 | Memory-bound | Irregular, pointer-chasing | Task-parallel | Queue optimization, frontier-based | bf, btree, dijkstra-milbench |
| Image/Video Processing (IVP) | 7 | Memory-bound | 2D spatial / separable recursive | Data-parallel | Window optimization, vectorization | bilateral, dertiche, sad |
| Monte Carlo Methods (MCM) | 3 | Compute-bound | Random, independent samples | Enlargement parallel | RNG optimization, reduction | ps, particellifer, tpcd |
| Medical/Scientific Comp. (MSC) | 4 | Compute/Memory-bound | ODD time-stepping / grid / scatter-gather | Sequential to data-parallel | Loop restructuring, vectorization | myocope, nri-q, nri-gridding |
| N-Body Methods (NBM) | 6 | Compute-bound | Pairwise, | Enlargement parallel | Cartoff radius, spatial decomposition | lancM3, coulomb, cusp |
| Stencil/Scientific Comp. (SC) | 13 | Bandwidth/Compute-bound | Regular, neighbor stencil | Data-parallel (impl. solver variants) | Temporal blocking, tiling, vectorization | jacobs-2d, hotspot, adl |
| Sparse Linear Algebra (SLA) | 3 | Memory-bound | Irregular (indirect indexing) | Row-parallel (index constrained) | Format conversion, prefetch, layout opt. | spn, spm-crs-mach, spn-ellpack-mach |
| Spectral Methods (SM) | 2 | Memory-bound | Strided, transpose | Bufferify stages | Memory layout optimization | rf-striided-mach, fl-transpose-mach |
| Sorting/Linear (S) | 5 | Memory-bound | Data-dependent | Sequential to task-level | Branch reduction, restructuring | sort-radic-mach, lmp-mach, quest-milbench |
| Statistical Comp. (STC) | 4 | Reduction-dominated | Regular, reduction | Data-parallel | Loop fusion, reduction optimization | correlation, covariance, dolfin |
| Utility Benchmarks (UB) | 4 | Compute/Memory-bound | Scalar / random-scatter / indirect | Sequential to reduction-based | Intrinsic, thread-local reduction | bitcount-milbench, basicmulti-milbench, amux |
F Additional Evaluation Results
This section provides additional analysis for RQ1, RQ2, and RQ3. It examines input-size effects, speedup distributions, motif and structural complexity differences, sampling budgets, OpenMP thread counts, and total runtime. Unless otherwise stated, results use kernel runtime and the correctness gating defined in Appendix D.
F.1 Input-Size Sensitivity
Figures 4 and 5 separate the five input sizes aggregated in the main paper Figure 2. Across sizes, Fast@3 falls as increases, with a sharper drop in EX3.
F.2 EX1 & EX2 Speedup@3 Plateau Analysis
To examine the EX2 Speedup@3 plateau (Section 5.3), we compare per-benchmark best-of- kernel speedups in EX1 and EX2. For each model and benchmark on the medium dataset, we take the maximum over correctness-gated candidates. Figure 6 shows the distributions for all three models, and Table 13 reports summary statistics for Claude.
EX1 (top of Figure 6) is concentrated near baseline: roughly two-thirds of benchmarks fall in , including 28% in the no-gain band. At most three benchmarks per model exceed . As rises, middle-range cases cease to qualify and the macro-average declines.
EX2 (bottom) has 44–53 of 92 benchmarks per model in , consistent with high OpenMP overhead relative to short baseline runtimes (Section 5.4). The no-gain band contains only 5–12 benchmarks (versus 26–39 in EX1), and about 6% fall in . At the other extreme, some kernels exceed , with matmul reaching for Claude. These large gains keep the EX2 Speedup@3 macro-average near over the tested thresholds.
Across broader speedup bins, EX2 places 73% of benchmarks at , 6% in , and 18% at . For EX1, 35% are in , 30% in , and approximately 4% reach at least .
Table 13: Summary statistics for Claude’s per-benchmark best-of- kernel speedup on the medium dataset ( benchmarks).
| Statistic (Claude) | EX1 (Serial) | EX2 (OpenMP, 16t) |
|---|---|---|
| median | 1.07 | 0.05 |
| mean | 1.90 | 2.43 |
| std | 4.99 | 6.45 |
| 1.00 / 1.32 / 2.09 | 0.00 / 1.09 / 8.55 | |
| fraction in (no-gain) | 28.3% | 8.7% |
| fraction | 10.9% | 18.5% |
| fraction in (extremes) | 28.3% | 82.6% |

Figure 4: Fast@3 versus by input size (columns) for EX1, EX2 (16 threads), and EX3 (rows).

Figure 5: Speedup@3 versus by input size (columns) for EX1, EX2 (16 threads), and EX3 (rows).
F.3 Motif- and Structural Complexity-Stratified Results
Figure 7 shows motif-stratified Fast@3 and Speedup@3 for EX1 and EX2 on the medium dataset, selecting 7 motifs with the highest Speedup@3 at in each setting (EX1: NBM, SC, MCM, DLA, DP, STC, UB; EX2: NBM, DLA, MCM, IVP, CFD, SC, CML). The remaining 9 motifs are listed in Table 12 but omitted from the figure for clarity. Figure 8 shows the corresponding results across all four structural complexity strata ().
EX1 generally follows the structural complexity trend, with lower structural complexity strata achieving higher Fast@3 and Speedup@3. In EX2, short-running kernels are more affected by OpenMP overhead, while longer kernels benefit from parallelization, as discussed in Section 5.4. Table 14 provides the per structural complexity stratum aggregate results, and Table 15 gives the per-benchmark breakdown.


Figure 6: Per-benchmark best-of-N kernel speedup distribution () for EX1 (top) and EX2 at 16 threads (bottom) on the medium dataset, with 92 benchmarks per model. Bin widths are non-uniform; the shaded column marks the no-gain band.
Per-Structural-Complexity-Stratum Aggregate. Table 14 reports baseline kernel runtime, the count below Best-of-N speedup at 16 threads, and the largest speedups for each structural complexity stratum. All 92 CPU/OpenMP benchmarks have valid single-thread baselines on the medium dataset. The group has the largest fraction below (67%), but also includes matmul (), haccmk (), and lavaMD (). These outcomes reflect differences in runtime scale and available parallelism within the same structural complexity stratum.
Table 14: Per-structural complexity stratum EX2 outcomes at 16 threads on the medium dataset, restricted to benchmarks with valid EX2 single-thread baselines. “Fail ” counts benchmarks whose best-of-N kernel speedup over all 30 trials ( per model) does not reach .
| Structural Complexity | #B | Median 1t baseline | Fail <1.05× | Top speedup | Top-3 kernels (best-of-N) |
|---|---|---|---|---|---|
| 61 | 7.33 ms | 41 (67%) | 49.63× | matmul 49.6×,haccmk 30.7×,lavaMD 21.5× | |
| 17 | 1.05 s | 5 (29%) | 13.27× | hotspot3D 13.3×,kmeans 12.8×,particlefilter 12.4× | |
| 9 | 1.37 s | 1 (11%) | 8.49× | b+tree 8.5×, nw 7.4×, hotspot 5.3× | |
| 5 | 6.27 s | 2 (40%) | 8.79× | heartwall 8.8×,susan-e-mibench 8.3×,susan-c-mibench 7.3× |
Per-benchmark Breakdown. Table 15 reports EX2 results for the benchmarks.

(a) Fast@3, EX1
(b) Speedup@3, EX1

(c) Fast@3, EX2 (16 threads)
(d) Speedup@3, EX2 (16 threads)
Figure 7: Motif-stratified Fast@3 and Speedup@3 on the medium dataset, macro-averaged across the three models. For legibility, each row shows the top-7 motifs by Speedup@3 at within that setting (EX1: NBM, SC, MCM, DLA, DP, STC, UB; EX2: NBM, DLA, MCM, IVP, CFD, SC, CML); the remaining motifs are listed in Table 12.
Table 15: benchmark outcomes under EX2 at 16 threads on the medium dataset. Each benchmark has 30 candidate trials ( per model). NC = no successful candidate output (compilation or runtime failure); CE-incorrect = produced output but failed correctness check; correct = passed correctness check. “Best correct spd” is the maximum kernel speedup over all correct candidates.
| Benchmark | Motif | 1t baseline | NC | CE-incorrect | Correct | Best correct spd |
|---|---|---|---|---|---|---|
| cutcp | NBM | 6.27 s | 22/30 | 8/30 | 0/30 | — |
| 1bm | CFD | 9.26 s | 21/30 | 9/30 | 0/30 | — |
| heartwall | MSC | 21.73 s | 24/30 | 0/30 | 6/30 | (GPT-5.1) |
| susan-c-mibench | IVP | 590.60 ms | 19/30 | 2/30 | 9/30 | (Claude) |
| susan-e-mibench | IVP | 939.61 ms | 12/30 | 0/30 | 18/30 | (Claude) |
cutcp and 1bm produce no correct candidates, while only GPT-5.1 produces correct heartwall candidates (6/10, mean kernel speedup 6.43×, range from 1.90 to 8.79×); Claude and Qwen each fail to compile all 10 candidates. The two MiBench susan variants achieve correct fractions of 9/30 and 18/30, with best speedups of 7.33× and 8.34×. Thus, high structural complexity does not always imply low correctness.
F.4 Sampling-Budget Sensitivity for EX2 and EX3
Section 5.4.3 presents the sampling-budget sensitivity results for EX1, while Figures 9 and 10 show the corresponding Fast@k and Speedup@k curves for EX2 (16 threads) and EX3 on the medium dataset, with and .
In EX2, Fast@k at is roughly stable as k increases, while Speedup@k grows noticeably with k, dominated by the same high-parallel-speedup kernels identified in Appendix F.2. In EX3, both metrics change modestly with k, and the three models remain close.

(a) Fast@3, EX1
(b) Speedup@3, EX1

(c) Fast@3, EX2 (16 threads)
(d) Speedup@3, EX2 (16 threads)
Figure 8: Structural complexity-stratified Fast@3 and Speedup@3 on the medium dataset, macro-averaged across the three models.

(a) Fast@k vs. k, EX2 (16 threads)
(b) Speedup@k vs. k, EX2 (16 threads)
Figure 9: EX2 sampling-budget sensitivity at on the medium dataset.
F.5 Thread-Count Sensitivity for EX2
The main paper reports EX2 results at 16 threads, while Figure 11 compares EX2 with threads on the medium dataset at . Speedup@3 peaks around and decreases beyond , consistent with increasing core contention and OpenMP overhead for moderate-runtime kernels. Fast@3 peaks at and declines at larger thread counts, as parallelization overhead prevents more short-running kernels from reaching the speedup threshold. Both decline at higher thread counts, consistent with OpenMP overhead affecting short-running kernels. At , the OpenMP runtime remains active.
F.6 Total Runtime
The main paper reports kernel-time speedups because HPC-Bench optimizes the annotated kernel regions. Figures 12 and 13 report the corresponding Fast@3 and Speedup@3 results using total

(a) Fast@k vs. k, EX3
(b) Speedup@k vs. k, EX3
Figure 10: EX3 sampling-budget sensitivity at on the medium dataset.

(a) Fast@3 vs. n, EX2
(b) Speedup@3 vs. n, EX2
Figure 11: EX2 thread-count sensitivity at on the medium dataset, with .
program runtime. Total-runtime speedups are generally lower because they include input setup, allocation, I/O, and, for EX3, PCIe transfers and CUDA context initialization, which occur outside the LLM-edited regions. The qualitative trends remain similar, including the distinction between optimization reliability and achieved speedup. For EX3, total-runtime Speedup@3 falls to nearly zero beyond , as much of the execution time is spent outside the optimized kernels.

Figure 12: Fast@3 versus using total program runtime for EX1–EX3 across all input sizes (EX2: 16 threads).

Figure 13: Speedup@3 versus using total program runtime for EX1–EX3 across all input sizes (EX2: 16 threads).
G Correctness and Failure Breakdown
Tables 16 to 18 provide detailed subcategory counts and percentages for compilation failures (CF), runtime failures (RF), and correctness errors (CE), respectively.
Table 16: Compilation failure (CF) sub-category breakdown. Syntax Error: code fails to parse due to malformed statements, incorrect pragma usage, or structural issues. Type/Decl Error: undeclared identifiers, type conflicts, missing headers, or redefinitions. Malformed Output: LLM output contains raw delimiters or natural-language text instead of source code.
| EX1 | EX2 | EX3 | Post-proc? | |
|---|---|---|---|---|
| Syntax Error | 212 (85.2%) | 462 (80.5%) | 124 (53.4%) | No |
| Type/Decl Error | 17 (6.8%) | 92 (16.0%) | 29 (12.5%) | Partial |
| Malformed Output | 20 (8.0%) | 20 (3.5%) | 79 (34.1%) | Yes |
| Total | 249 | 574 | 232 |
Table 17: Runtime failure (RF) sub-category breakdown. Memory Error: illegal memory access or host-side heap corruption. CUDA Error: CUDA runtime API errors or other GPU-side execution failures.
| EX1 | EX2 | EX3 | Post-proc? | |
|---|---|---|---|---|
| Memory Error | 50 (100.0%) | 13 (100.0%) | 1 (3.1%) | No |
| CUDA Error | 0 (0.0%) | 0 (0.0%) | 31 (96.9%) | No |
| Total | 50 | 13 | 32 |
Table 18: Correctness error (CE) sub-category breakdown. Incorrect Output: program executes but produces results that differ from the baseline reference. No Output: program produces no output file or output cannot be parsed for comparison.
| EX1 | EX2 | EX3 | Post-proc? | |
|---|---|---|---|---|
| Incorrect Output | 268 (79.1%) | 412 (86.4%) | 140 (100.0%) | No |
| No Output | 71 (20.9%) | 65 (13.6%) | 0 (0.0%) | No |
| Total | 339 | 477 | 140 |
H API Cost
A single full evaluation pass is 92 benchmarks × N=10 samples = 920 generation calls per (model, EX) for EX1 and EX2, and 22 × 10 = 220 calls for EX3. The API cost for GPT-5.1, Claude Sonnet 4.5, and Qwen3-Coder-480B-A35B-Instruct is approximately 33.1 / 24.6 / 9.1 for EX2, and 8.3 / 150.
I License for Existing Assets
HPC-Bench draws kernels from existing HPC benchmark suites and evaluates optimizations generated by LLMs accessed through their official APIs. External profiling tools are used to identify computational hotspots. Table 19 summarizes the source, version, license, and URL of the third-party benchmark assets used in this work. The released artifact contains benchmark metadata, kernel annotations, prompt templates, build scripts, and evaluation code; upstream suites are referenced at their original URLs rather than redistributed in full.
Compliance. For licensed upstream benchmark suites, we retain the original copyright headers, license notices, and non-endorsement terms required by the corresponding licenses. We also cite
Table 19: Licenses of existing benchmark assets used in HPC-Bench.
| Asset | Version | License | URL |
|---|---|---|---|
| Benchmark suites | |||
| Rodinia [27] | 3.1 | University of Virginia BSD-style permissive license | https://github.com/JuliaParallel/rodinia |
| PolyBench/C [26] | 4.2.1 | Ohio State University Software Distribution License | https://github.com/MatthiasJReisinger/PolyBenchC-4.2.1 |
| MiBench [29] | 1.0 | GPL-3.0, for the reference GitHub distribution | https://github.com/ekut-es/mibench |
| MachSuite [30] | 1.0 | BSD-compatible; per-file licenses include BSD-3 and ISC | https://github.com/breagen/MachSuite |
| PARSEC [28] | 3.0 | Princeton University BSD-3-Clause-style permissive license | https://github.com/bamos/parsec-benchmark |
| Parboil [31] | 2.5 | University of Illinois/NCSA Open Source License | https://github.com/yuhc/gpu-parboil/ |
| Codee performance-demos [34] | main (commit-pinned) | Redistributed under explicit permission granted through a prior research collaboration with Codee. | https://github.com/codee-com/performance-demos |
the original papers or project pages where available. The released artifact is available at https://github.com/Deep-Learning-Profiling-Tools/HPC-Bench.
J Limitations and Scope
The evaluation has the following limitations:
- EX3 coverage is narrower. The CUDA benchmark set has 22 benchmarks, drawn primarily from Rodinia. Motif-level macro-averages are therefore less stable for EX3 than for EX1/EX2 and are omitted from the main analysis.
- Hardware/software dependence. Reported speedups are tied to a fixed AMD EPYC 7543 + NVIDIA A100 stack with GCC 14.2, NVCC 12.4, and -03. Absolute numbers may shift across architectures, compiler versions, and runtime settings.
- Model and prompting dependence. The evaluation uses three models (GPT-5.1, Claude Sonnet 4.5, Qwen3-Coder-480B) at a fixed sampling budget (, default ) and fixed prompt templates. Results may not generalize directly to smaller open models or to substantially different prompting strategies.
- Kernel-time vs. total-time gap. Kernel-time speedups can substantially exceed total-time speedups when setup, I/O, allocation, or PCIe transfers dominate wall-clock time (Appendix F.6); we report kernel time as the primary signal because the LLM only edits the kernel region.