Skip to content

RepoOMP: Repository-Aware Hotspot OpenMP Parallelization via Dependency-Aware Context Reduction

Source: arXiv:2608.05855 · Published 2026-08-06 · By Yongjie Qian, Ke Gao, Zhibin Zhang, Shaohui Peng, Ling Li

TL;DR

The paper addresses the challenge of automatically parallelizing hotspots in mature software repositories using OpenMP, where loop safety and optimization potential depend on non-local dependency evidence scattered across files and functions. Traditional rule-based parallelization tools are conservative and under-parallelize due to lack of global evidence, while end-to-end LLM agent approaches struggle when retrieval omits critical dependencies or floods the model with unrelated code, leading to unsafe transformations or failures. RepoOMP proposes a hybrid framework that first constructs a Multi-granularity Attributes Performance graph (MAP), an abstraction encoding repository-level dependency and performance evidence, then routes hotspot candidates to either deterministic rule-based parallelization or an LLM agent using a failure-mode aware routing policy. For the LLM path, it constructs a Structured Transformation Context (STC) that distills relevant dependency facts into a bounded prompt. Their evaluation covers 951 profiled hotspots from real-world repositories including NPB, BOTS, FFmpeg, NCNN, and GROMACS. RepoOMP accepts 372 candidates after verification, including 330 from actual repositories, achieving substantial speedups (average 8.23× on NPB, 8.96× on BOTS) and outperforming an unstructured Claude Code baseline in speedup and prompt token cost. The work provides a concrete evidence-guided workflow for safe, high-yield hotspot parallelization in large, realistic codebases.

Key findings

  • Out of 951 profiled hotspots, 372 transformations passed compilation, workload validation, and yielded positive speedup, including 330 from real-world repositories.
  • RepoOMP achieved average speedups of 8.23× on the NPB benchmark suite and 8.96× on BOTS, substantially improving parallel performance.
  • For nine detailed real-world kernels, RepoOMP yielded a cross-backbone mean speedup of 5.25×, improving over unstructured Claude Code by 18–28%.
  • Agent-side prompt token cost was reduced by 47–68% compared to unstructured baseline approaches, enabling more efficient LLM usage.
  • Median speedup across 330 accepted real-world hotspots was 2.25×, indicating robust performance improvements on practical workloads.
  • Rule-Agent routing based on propagated dependency confidence effectively triaged candidates: high-confidence cases used deterministic rules, middle-confidence used LLM agents, and low-confidence cases conservatively skipped transformation.
  • Verification workflow combining compilation checks, workload-specific output correctness, and performance measurement ensured correctness and prevented unsafe transformations.
  • Propagation of dependency risk through the Multi-granularity Attributes Performance graph (MAP) enabled identification of hidden cross-file side effects critical for safe parallelization.

Threat model

The adversary is the inherent complexity and opacity of large-scale software repositories where critical parallelization dependencies are distributed across multiple files and call chains, making local static analysis and naive retrieval insufficient. The system must prevent unsafe transformations that introduce data races or semantic errors despite incomplete knowledge, but it does not consider malicious attackers altering the code. The threat is accidental incorrect parallelization due to missing or irrelevant dependency evidence rather than adversarial code tampering.

Methodology — deep read

  1. Threat model and assumptions: The adversary is the complexity of real software repositories where loop parallelization safety depends on distributed, non-local, transitive dependencies such as file-scope variables, indirect calls, and shared mutable state. The system assumes no adversarial attackers but must guard against unsafe parallelization that introduces data races or semantic regressions. It cannot rely solely on local loop analysis or unrestricted LLM prompting due to incomplete context and token budget.

  2. Data: Experiments covered 951 profiled computational hotspots collected from mature, publicly available benchmarks and repositories: NPB (Nas Parallel Benchmarks), BOTS, FFmpeg, NCNN, and GROMACS. Hotspots were identified via runtime profiling and annotated for acceptance based on dynamic checks and speedup criteria. The repository source code served as raw input; no additional synthetic datasets were created.

  3. Architecture / algorithm:

  • The core is the construction of the Multi-granularity Attributes Performance graph (MAP), a directed property graph with nodes at repository, file, and function granularity capturing attributes like runtime hotspots, static variables, control-flow, and data dependencies.
  • Dependency-risk cues (shared writes, I/O, serial control) are propagated bottom-up along the call graph to assign a parallelization confidence level to each hotspot candidate.
  • The Rule-Agent Router deterministically routes candidates: high-confidence to rule-based deterministic OpenMP parallelizers; middle-confidence to an LLM agent guided by a Structured Transformation Context (STC); low-confidence candidates are rejected or conservatively handled.
  • The STC construction extracts three components: the source span of the transformation target; relevant file-scope definitions and static variables; and LLM-generated concise summaries of transitive callees critical to dependency reasoning, avoiding prompt flooding.
  • The LLM agent receives the STC as a fixed template prompt specifying transformation constraints, buildability, and semantic preservation.
  1. Training regime: The LLM agent leverages Claude Code, a pretrained model; no further training or fine-tuning is reported. The system interacts with the LLM through prompting only. Rule engines use conventional static analysis tools.

  2. Evaluation protocol:

  • For each candidate transformation, three verification stages are required to accept the patch: (a) compilation, (b) workload-specific executable checks comparing output correctness against oracles, and (c) performance measurement on multithreaded configurations (typically 16 threads).
  • Speedup is averaged over five repeated runs. Token usage on agent path and speedups are compared to an unstructured baseline (Claude Code without MAP/STC).
  • A ThreadSanitizer dynamic concurrency audit supplements correctness evaluation on nine real-world kernels.
  1. Reproducibility:
  • The authors provide an open-source repository including tooling to construct MAP and STC, router implementation, and the verification workflows.
  • Full replay requires repository snapshots, compilation wrapper scripts, profiling logs, and workload assets. All intermediate artifacts per candidate are logged for traceability.
  • The approach is deterministic except for LLM generation stochasticity; no explicit random seeds or hyperparameters are described for the LLM prompting.

Concrete example: Consider a hotspot loop that appears independent locally but calls compute(item) which internally invokes update_stats() that writes to a shared statistics array at file scope. Conventional rule tools reject parallelization due to unsafe shared writes unclear locally. The MAP captures this transitive dependency and propagates a shared-state hazard flag to the top-level loop node. The router assigns it to the LLM agent path, which receives a STC containing the loop code, definitions of the shared array, and summarized callee dependency effects. The LLM issues an OpenMP pragma insertion with semantic restructuring to safely parallelize with correct synchronization. Subsequent compilation, functional validation, and speedup measurements confirm the transformation is safe and beneficial, so it is accepted.

Technical innovations

  • Design of the Multi-granularity Attributes Performance graph (MAP) to capture repository-, file-, and function-level dependency and performance evidence specialized for OpenMP hotspot parallelization.
  • A deterministic Rule-Agent Router that uses propagated dependency-risk signals in MAP to explicitly triage hotspot candidates between rule-based and LLM-based parallelization, balancing safety and opportunity.
  • Construction of a Structured Transformation Context (STC) that extracts and condenses relevant dependency facts into a bounded, stable prompt for LLM-guided code transformation, avoiding prompt flooding and missing evidence.
  • A full verification loop combining compilation checks, workload-specific output validation, and performance measurement to ensure produced parallelizations are both correct and beneficial in real repository scenarios.

Datasets

  • NPB benchmarks — 951 profiled hotspots — public benchmark suite
  • BOTS benchmarks — included in 951 hotspots — public benchmark suite
  • FFmpeg repository — included in 951 hotspots — real-world open-source
  • NCNN repository — included in 951 hotspots — real-world open-source
  • GROMACS repository — included in 951 hotspots — real-world open-source

Baselines vs proposed

  • Unstructured Claude Code LLM baseline: median speedup on accepted real-world hotspots = approximately 1.8× vs RepoOMP median speedup = 2.25×
  • Unstructured Claude Code on nine detailed real-world kernels: speedup improvement of 18–28% achieved by RepoOMP
  • Agent prompt token costs reduced by 47–68% relative to unstructured Claude Code prompting across nine kernels
  • Rule-based deterministic engine alone achieves fewer accepted hotspots and lower speedups than RepoOMP hybrid approach

Figures from the paper

Figures are reproduced from the source paper for academic discussion. Original copyright: the paper authors. See arXiv:2608.05855.

Fig 1

Fig 1: Running example motivating repository-context evidence recovery. A locally independent-looking loop reaches a hidden

Fig 2

Fig 2: Overview of the RepoOMP framework. The workflow consists of three stages: Global Navigation constructs the

Limitations

  • The rule-agent router relies on handcrafted heuristics rather than learned classifiers, which may misclassify edge cases.
  • LLM-based transformations depend on prompt quality and remaining boundedness of STC; unclear how the approach scales to extremely large or highly dynamic codebases.
  • Verification uses workload-specific correctness checks, which may not cover all semantic regressions or concurrency bugs beyond tested scenarios.
  • No adversarial evaluation is reported to test robustness against malicious or extremely complex dependency patterns.
  • The approach assumes availability of accurate compilation databases and profiling data, which can be challenging for some repositories or build systems.
  • Token cost reductions are reported, but absolute prompt sizes and LLM latency/compute costs are not analyzed in detail.

Open questions / follow-ons

  • Can the Rule-Agent routing heuristic be improved or replaced with a learned model for more adaptive and accurate candidate triage?
  • How well does RepoOMP generalize to very large, highly dynamic repositories with frequent code churn or less structured codebases?
  • Can the MAP and STC abstractions be extended to handle other parallelization paradigms beyond OpenMP, such as task-based or GPU offloading?
  • How sensitive is the approach to the quality and completeness of the underlying static analysis and profiling data used to build MAP?

Why it matters for bot defense

RepoOMP provides a concrete methodology for hybrid parallelization that balances static analysis (rules) and large language model (LLM) reasoning by structuring and bounding context with dependency-aware evidence recovery. For bot-defense and CAPTCHA practitioners working on program analysis or optimization tasks in large repositories, the concepts of graph-backed context condensation (MAP + STC), failure-mode aware routing between deterministic and generative components, and strict validation loops are directly applicable to reduce unsafe overgeneralizations or undercoverage in code transformation workflows. While the domain is different, the principles of layered evidence recovery, context modeling, and verification bear strong relevance for leveraging LLMs safely and efficiently in complex software-engineering pipelines that must avoid both false negatives (missed valid actions) and false positives (unsafe transformations). The token usage and context bounding strategies suggest practical ways to integrate large models without overwhelming them with noise. In sum, this work models a robust hybrid approach to applying LLMs in large-scale code analysis and rewriting with sound engineering guardrails, a pattern potentially useful for securing or automating CAPTCHA-generation code or defense logic at scale.

Cite

bibtex
@article{arxiv2608_05855,
  title={ RepoOMP: Repository-Aware Hotspot OpenMP Parallelization via Dependency-Aware Context Reduction },
  author={ Yongjie Qian and Ke Gao and Zhibin Zhang and Shaohui Peng and Ling Li },
  journal={arXiv preprint arXiv:2608.05855},
  year={ 2026 },
  url={https://arxiv.org/abs/2608.05855}
}

Read the full paper

Articles are CC BY 4.0 — feel free to quote with attribution