NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Can We Run in Parallel? Automating Loop Parallelization for TornadoVM

Rishi Sharma, Shreyansh Kulshreshtha, Manas ThakurarXiv 2022 · DOI

Abstract

AutoTornado is a hybrid "static+JIT" tool that automates loop parallelization for Java programs running on TornadoVM. By combining static program analysis with formal constraint solving via the Z3 theorem prover, AutoTornado eliminates the need for manual code annotations. Experimental results across 14 benchmarks demonstrate that the tool achieves an average speedup of 3.99x with near-zero runtime overhead, successfully identifying over 60% of parallelizable loops without introducing false positives.

Introduction

Modern hardware architectures, including GPUs, FPGAs, and multi-core CPUs, offer immense parallel processing potential. However, exploiting this power remains a significant challenge for developers. In the Java ecosystem, TornadoVM provides a framework for offloading computation to heterogeneous hardware using the @Parallel annotation. While effective, manual annotation is error-prone and requires deep expertise in data dependency analysis.

Performing this analysis automatically during Just-In-Time (JIT) compilation is computationally expensive. Complex checks—such as determining if non-linear array accesses overlap—can introduce significant latency, potentially negating the performance benefits of parallelization. AutoTornado addresses this by decoupling heavy analysis from the runtime execution.

The AutoTornado Architecture

AutoTornado employs a decoupled architecture that splits the workload into a comprehensive static analysis phase and a lightweight runtime phase. This approach allows for sophisticated checks without penalizing program execution time.

The AutoTornado architecture decouples heavy static analysis from the runtime execution environment.

The pipeline consists of several key stages:

  1. Canonical Loop Identification: Utilizing the Soot framework, the tool scans Java bytecode to identify "canonical" for-loops characterized by predictable bounds and increments.
  2. Variable Scoping and Purity Analysis: The system distinguishes between thread-local and non-local variables. A custom interprocedural purity analysis determines if function calls within a loop have side effects that would preclude parallelization.
  3. Constraint Generation and Z3 Solving: For array accesses, AutoTornado generates logical constraints representing potential data dependencies. These are processed by the Z3 theorem prover; if Z3 confirms no conflicting memory accesses occur across iterations, the loop is marked safe.
  4. AnnotationMap Generation: Rather than modifying fragile class files, the tool outputs an AnnotationMap file containing the analysis results.
  5. Runtime Integration: A modified TornadoVM reads this map at startup, automatically applying parallel execution to the verified loops.

Key Insights

A central innovation of AutoTornado is the "Static+JIT" sweet spot. By moving Z3 solving and interprocedural analysis to a static phase, the authors achieve the precision of formal methods without runtime penalties. Furthermore, by parsing the LocalVariableTable in Java bytecode, the tool can reconstruct variable scopes and treat thread-local variables more aggressively.

Unlike traditional compilers that often struggle with non-linear array indices, the use of Z3 allows AutoTornado to reason about complex index math. Additionally, the authors developed a robust purity analysis for modern Java that tracks "read-impurity" and "write-impurity" separately, improving upon existing tools in the Soot framework.

Evaluation and Results

The researchers evaluated AutoTornado using 14 benchmarks from the PolyBench suite, covering kernels for linear algebra, image processing, and physics simulations.

Performance metrics across 14 benchmarks show significant speedups and low analysis overhead.

The evaluation revealed several key findings:

  • Precision and Safety: AutoTornado identified 61.3% of loops manually marked as parallelizable by experts. Crucially, the tool produced zero false positives, ensuring execution safety.
  • Performance Gains: Automatically parallelized loops achieved an average speedup of 3.99x, with matrix multiplication reaching a peak speedup of 23.18x.
  • Efficiency: Static analysis typically completed within 1–4 seconds. The runtime overhead for reading the AnnotationMap was negligible, averaging less than 3ms.

Limitations and Future Work

Despite its success, AutoTornado faces two primary hurdles. First, it conservatively marks JDK library calls (e.g., Math.sqrt()) as "impure" because it cannot statically guarantee the state of the target machine's JDK. Second, unknown loop bounds—where the upper bound is a runtime variable not passed as a parameter—accounted for 83% of the tool's imprecision.

Future research will explore integrating AutoTornado with the PYE framework to enable "conditional" parallelization, allowing the JIT compiler to make final decisions based on runtime values provided by the static analyzer.

Summary updated

BibTeX
@misc{sharma2022can,
  author = {Rishi Sharma and Shreyansh Kulshreshtha and Manas Thakur},
  title = {{Can We Run in Parallel? Automating Loop Parallelization for TornadoVM}},
  year = {2022},
  eprint = {2205.03590},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2205.03590},
}
Figure