bUILDING gpu accelerated llm inference libraries with tornadovm

Enterprise Java teams can now run local LLM inference with GPU acceleration without leaving the JVM or writing a single line of CUDA. TornadoVM and GPULlama3.java have fundamentally changed what’s possible for Java developers in the AI era, enabling pure-Java transformer inference. This isn’t experimental research; it’s open-source, LICENSE, production-ready technology already deployed at the European Space Agency (ESA) for mission-critical astronomical data processing.

This article aims to showcase the key TornadoVM features used to build GPULlama3.java, the first GPU-accelerated LLM inference library in pure modern Java, which is already integrated within projects such as LangChain4j and Quarkus LangChain4j.

What is TornadoVM?

TornadoVM is an open-source plugin for the Java Virtual Machine (JVM) that enables standard Java programs to be automatically compiled and accelerated on multi-core CPUs, GPUs, and FPGAs, without requiring developers to write CUDA or OpenCL. It interoperates with OpenJDK and other JDK distributions, extends the JVM’s just-in-time compilation using the Graal compiler, and generates device-specific code (e.g., OpenCL C, NVIDIA PTX, or SPIR-V) so that parallel parts of Java applications can run efficiently on different hardware accelerators. At the same time, the TornadoVM runtime handles data movement and execution scheduling in a platform-agnostic manner.

The TornadoVM Design as “VM-inside-a-VM”

TornadoVM is designed following a nested virtual machine architecture that sits atop the JVM rather than replacing it. This design preserves full Java compatibility while enabling automatic hardware acceleration. The framework maintains its own set of bytecodes (TornadoVM Bytecodes) as a means to seamlessly orchestrate the JIT compilation, device exploration, data management, and live task migration between accelerators.

Regarding compilation, TornadoVM leverages JVMCI (Java Virtual Machine Common Interface), available since Java 9, to compile Java bytecode at runtime into three different formats: OpenCL C source code, NVIDIA PTX assembly, and SPIR-V binary. To generate code in these three different formats, TornadoVM has three backends; each built upon the Graal Intermediate Representation. Hence, TornadoVM JIT compiler is a superset of the GraalVM JIT compiler and harnesses all  architecture-agnostic optimizations offered by Graal before generating device-specific code.

Compilation proceeds through distinct phases. The Sketcher phase performs high-level optimizations, such as,  data-flow analysis, loop parallelization exploration which are common across all backends. After Sketcher, each backend performs the generation of code, which GPU or FPGA drivers compile into final binaries. These binaries are stored into TornadoVM’s code cache, ready for repeated invocation without recompilation.

Hardware support spans the heterogeneous computing landscape. The OpenCL backend targets multi-core CPUs (x86 and ARM), GPUs from NVIDIA, AMD, Intel, and ARM Mali, plus FPGAs from Intel and Xilinx. The PTX backend generates native NVIDIA CUDA assembly, while the SPIR-V backend dispatches via Level Zero for Intel Arc GPUs and integrated graphics. This breadth means code written once runs across diverse hardware where developers achieve GPU acceleration without vendor lock-in.

TornadoVM API makes parallel programming feel like Ordinary Java

TornadoVM offers an Application Programming Interface (API) that exposes two Java objects:

  • TaskGraph: To define what computation should be launched for hardware acceleration, including the definition of the input/output data. At this stage, developers can also combine multiple computations that should be executed in-order on the same device.
  • TornadoExecutionPlan: To define how the execution of the TaskGraph should be planned. At this stage, developers can configure if they want to run with the TornadoVM profiler, or they want to launch a specific grid on the target device.

Except for those two objects, TornadoVM offers two complementary approaches for expressing parallel computations inside Java methods:

  • Loop Parallel API:  It is designed for developers with little or no GPU programming experience. It exposes a small set of annotations (@Parallel, @Reduce) that allow developers to express data parallelism directly in standard idiomatic Java code. Those annotations act as hints to the TornadoVM JIT compiler, which analyzes the annotated code and generates teh corresponding parallel implementation for the target accelerator. The @Parallel annotation is applied to loop indices to signify that loop iterations are data-independent and can be executed in parallel on different data. Whereas, the @Reduce is applied to method parameters that accumulate results from parallel execution (e.g., sums, min/max), enabling TornadoVM to generate the appropriate reduction logic. 
  • Kernel API: It is designed for developers with GPU programming experience. Instead of relying on annotations, the Kernel API exposes a KernelContext object that allows developers to explicitly control GPU-style execution directly from Java. This API follows familiar OpenCL and CUDA concepts, giving experienced users fine-grained control over thread indexing, local memory, and synchronization. In contrast to the higher-level Loop Parallel API, the Kernel API enables writing Java methods that closely resemble traditional GPU kernels.

Example of Defining a TaskGraph

A TaskGraph object is used to select specific Java methods (“tasks“) together with their explicit data transfer directives, and to combine into a single executable unit for execution on the accelerator. Data transfers are configured using the DataTransferMode enum, which specifies when host-device memory copies occur: FIRST_EXECUTION transfers read-only data only once (ideal for model weights), while EVERY_EXECUTION handles mutable state that changes between invocations:

var taskGraph = new TaskGraph("inference")
     // Copy read-only data just only once
    .transferToDevice(DataTransferMode.FIRST_EXECUTION, weights)
     // Copy input stream on every execution
    .transferToDevice(DataTransferMode.EVERY_EXECUTION, input)   
     // Define the method to offload along with it's arguments
    .task("forward", Model::forward, weights, input, output)
     // Output: every time
    .transferToHost(DataTransferMode.EVERY_EXECUTION, output);    

Example of Defining a Tornadoexecutionplan

Once a TaskGraph has been defined, a TornadoExecutionPlan object specifies how the TaskGraph will be executed. While the TaskGraph describes what should run and how data is transferred, the TornadoExecutionPlan determines how and where the execution takes place.

Importantly, the TornadoExecutionPlan operates on an immutable version (a snapshot) of the TaskGraph. By invoking snapshot() on a TaskGraph object, developers obtain an ImmutableTaskGraph, ensuring that the version of the code selected for JIT compilation cannot be modified. This guarantees stability during compilation and execution, enabling predictable optimizations and reproducible behavior.

This design also allows developers to programmatically construct and append multiple TaskGraph instances, generate different variations, and then execute them together. Since the execution plan compiles the immutable snapshot, these TaskGraphs can be compiled once and safely reused without the risk of runtime mutation.

ImmutableTaskGraph immutableTaskGraph = taskGraph.snapshot();

try (var executionPlan = new TornadoExecutionPlan(immutableTaskGraph)) {
    executionPlan.withProfiler(ProfilerMode.CONSOLE).execute();
}

Using off-heap data types

TornadoVM uses the Foreign Function and Memory (FFM) API derived from Project Panama to provide a collection of off-heap data types (e.g., FloatArray, HalfFloatArray, IntArray, Matrix2DFloat, etc.). These data types are specifically designed to be GPU-compatible while avoiding garbage collection overhead.

In addition, the TornadoMath library supplies mathematical functions with automatic precision fallback, ensuring compatibility with devices that lack FP64 support.

Both the TornadoVM data types and the TornadoMath library are intended for use within TornadoVM tasks, as shown in the examples below.

Example of using the Loop Parallel API

Within TornadoVM, Java methods that are registered as tasks in a TaskGraph can be annotated to express data-parallel execution. The @Parallel annotation allows developers to indicate that specific loops inside these task methods can be parallelized, provided there are no data dependencies between iterations.

When such a task is about to be executed on the accelerator, The TornadoVM JIT compiler analyzes the annotated loops and maps them directly to ND-Range execution in the OpenCL, CUDA, or SPIR-V backends. The number of paralell threads is automatically derived from the loop bounds.

The following example shows a Java method intended to be used as a task in a TaskGraph. The @Parallel annotation enables parallel execution of the loop iterations to perform element-wise vector-multiplication:

public static void vectorMultiply(FloatArray a, FloatArray b, FloatArray result) {
 for (@Parallel int i = 0; i < result.getSize(); i++) {
  result.set(i, a.get(i) * b.get(i));
 }
}

Nested @Parallel loops within a task are mapped to 2D and 3D parallel execution when deployed on the hardware device. This pattern is common in image processing and matrix-based operations. For example:

private static void matrixMultiplication(final FloatArray A,final FloatArray B, final FloatArray C, final int size) {
        for (@Parallel int i = 0; i < size; i++) {
            for (@Parallel int j = 0; j < size; j++) {
                float sum = 0.0f;
                for (int k = 0; k < size; k++) {
                    sum += A.get((i * size) + k) * B.get((k * size) + j);
                }
                C.set((i * size) + j, sum);
            }
        }
    }

Example of using the Kernel API

Alternativelly to the Loop Parallel API, developers with GPU programming experience can use the Kernel API to construct Java methods that follow familiar GPU programming principles. The KernelContext object exposes GPU programming constructs familiar to CUDA and OpenCL developers. Thread indices, local memory allocation, and barriers translate naturally between paradigms, as shown in the table below.

TornadoVMOpenCLCUDA

context.threadIdx

get_global_id(0)

threadIdx.x + blockIdx.x * blockDim.x

context.localdx

get_local_id(0)

threadIdx.x

context.allocateFloatLocalArray()

__local float[]

__shared__ float[]


context.localBarrier()

barrier()

__syncthreads()

This API gives developers explicit control over execution configuration and memory hierarchy, making it suitable for performance-critical kernels or when fine-tuned optimization is required. Such concerns are discussed in the following paragraphs.

Local memory and tiled computation unlock GPU memory hierarchy performance

The matrix multiplication implementation with the Loop Parallel API, as shown above, works correctly but there is still room for extracting more performance. GPUs have a memory hierarchy composed of a global memory (device VRAM) which has high latency and limited bandwidth, awhile local memory (shared memory in CUDA terminology) which offers much faster access within a workgroup (i.e., a group of GPU threads). A developer can take advantage of the above with pure idiomatic Java using the TornadoVM Kernel API. As shown earlier, the KernelContext object provides methods that expose the GPU memory hierarchy, enabling the same tiled algorithms that make CUDA implementations fast to be expressed in Java.

The optimization principle: Instead of each thread independently fetching elements from global memory, workgroups cooperatively load tiles (e.g., chunks) into fast local memory, then all threads in the group perform the computation against the cached tile. This reduces global memory accesses from O(N) per thread to O(N/TS) where TS is the tile size.

private static final int TS = 16; // Tile size: 16x16 threads per workgroup
public static void matrixMultiplicationLocalMemory(
KernelContext context, final FloatArray A, final FloatArray B, final FloatArray C, final int size) {

// Thread identifiers within the workgroup (0 to TS-1)
int row = context.localIdx;    // Local row ID
int col = context.localIdy;    // Local col ID

// Global position in the output matrix
int globalRow = TS * context.groupIdx + row;  // Row ID of C (0..M)
int globalCol = TS * context.groupIdy + col;  // Col ID of C (0..N)

// Allocate local memory tiles - shared across all threads in workgroup
float[] aSub = context.allocateFloatLocalArray(TS * TS);
float[] bSub = context.allocateFloatLocalArray(TS * TS);

float sum = 0;

// Loop over all tiles along the K dimension
int numTiles = size / TS;
for (int t = 0; t < numTiles; t++) {
    // Each thread loads ONE element of the tile into local memory
    int tiledRow = TS * t + row;
    int tiledCol = TS * t + col;
    aSub[col * TS + row] = A.get(tiledCol * size + globalRow);
    bSub[col * TS + row] = B.get(globalCol * size + tiledRow);

    // BARRIER: Wait for ALL threads to finish loading the tile
    context.localBarrier();

    // Compute partial dot product using the cached tile
    for (int k = 0; k < TS; k++) {
        sum += aSub[k * TS + row] * bSub[col * TS + k];
    }
    
    // BARRIER: All threads finished computing before loading next tile
    context.localBarrier();
}

// Store the final accumulated result
C.set((globalCol * size) + globalRow, sum);

}

Understanding the memory access pattern reveals why this optimization matters. In the naive version, computing one element of C requires reading an entire row of A and a column of B from global memory – 2N memory accesses per output element. With N² output elements, that’s 2N³ global memory accesses total.

The tiled version groups threads into workgroups of TS×TS threads, and each workgroup loads two TS×TS tiles (2×TS² elements), then performs TS³ multiply-accumulate operations against local memory. Across N/TS tiles, each workgroup performs (N/TS)×2×TS² = 2×N×TS global memory accesses while computing TS²×N multiply-adds. The ratio of computation to memory access improves by a factor of TS – typically 16x or 32x depending on tile size.

The context.localBarrier() calls are used to add synchronization barriers in order to ensure correctness. Without the first barrier, some threads might start computing before others have finished loading their tile elements – reading uninitialized or stale data. Without the second barrier, fast threads might overwrite tile data with the next iteration’s values while slow threads would still need the current values. These barriers correspond directly to intrinsic functions, such as __syncthreads() in CUDA and barrier(CLK_LOCAL_MEM_FENCE) in OpenCL.

The following code snippet shows the definition of a workerGrid that enables developers to define the number of GPU threads (identified as GlobalWork) and the size of the workgroups (i.e., LocalWork) following the sizes used in the method scope. In this example, a two-dimensional workerGrid is defined with size that matches the output matrix dimensions, while the local work group is configured to be 16. 

Once a WorkerGrid is defined, a GridScheduler must be created to associate that grid configuration with the corresponding TornadoVM tasks. The scheduler links the WorkerGrid to a specific task by its fully qualified name, which consists of the TaskGraph identifier followed by the task identifier (e.g., “matmul.tiled”). The final step is to configure the TornadoExecutionPlan and pass the GridScheduler instance to the .withGridScheduler() method. This ensures that the specified grid configuration is used when executing the computation defined by the “matmul.tiled” task.java

var workerGrid = new WorkerGrid2D(size, size); 
workerGrid.setLocalWork(TS, TS, 1); // 16x16 threads per workgroup

var gridScheduler = new GridScheduler("matmul.tiled", workerGrid);

var taskGraph = new TaskGraph("matmul") .transferToDevice(DataTransferMode.FIRST_EXECUTION, A, B) .task("tiled", MyClass::matrixMultiplicationLocalMemory, context, A, B, C, size) .transferToHost(DataTransferMode.EVERY_EXECUTION, C);

var plan = new TornadoExecutionPlan(taskGraph.snapshot()).withGridScheduler(gridScheduler);`

What is GPULlama3.java

GPULlama3.java is an open-source pure Java framework for running LLM (large language model) inference on GPUs by leveraging TornadoVM’s GPU acceleration meaning you can load and execute models like Llama 3 entirely in Java without writing CUDA, OpenCL, or other native GPU code. At the same time, it delivers the performance benefits of the underlying GPU hardware.At its core, GPULlama3.java builds on the Java open-source LLM ecosystem (e.g., llama3.java) and seamlessly offloads heavy computation, such as attention and matrix ops, to GPUs, leveraging TornadoVM’s ability to compile Java bytecode into high-performance parallel kernels. The outcome is GPU-accelerated inference for models in GGUF format (currently including Llama 3, Mistral, Qwen 2.5, Qwen 3, Phi-3, and IBM Granite) while keeping all code in the JVM. GPULlama3.java is a GPU inference engine integrated in LangChain4j and Quarkus LangChain4j.

GPULlama3.java implements transformer layers as composable TaskGraphs

GPULlama3.java demonstrates TornadoVM’s maturity through a complete LLM inference implementation. The architecture decomposes transformer layers into three TaskGraph categories: an activation layer for token embeddings and initial normalization, FFN layers implementing the transformer blocks, and a logits layer for final vocabulary projection.The FP16LayerPlanner class orchestrates execution by combining these TaskGraphs with a unified GridScheduler:

protected final void setupTornadoForwardPlan() {
    List<ImmutableTaskGraph> allTaskGraphs = new ArrayList<>();
    GridScheduler masterScheduler = new GridScheduler();

    // Activation: embeddings + initial normalization
    allTaskGraphs.add(activationLayer.getImmutableTaskGraph());
    activationLayer.updateGridScheduler(masterScheduler);

    // FFN: N transformer layers (model-dependent)
    allTaskGraphs.addAll(ffnLayers.getFfnLayerTaskGraphs());
    ffnLayers.updateGridScheduler(masterScheduler);

    // Logits: final projection to vocabulary
    allTaskGraphs.add(logitsLayer.getTaskGraph().snapshot());
    logitsLayer.updateGridScheduler(masterScheduler);

    this.immutableTaskGraphs = allTaskGraphs;
    this.gridScheduler = masterScheduler;
}

Each FFN layer TaskGraph includes QKV projections, rotary position embeddings, attention computation, and feed-forward network operations. The setup method chains these as distinct tasks with explicit data dependencies:

// Query, Key, Value matrix multiplications
.task("qmatmul", TransformerComputeKernels::matrixVectorGeneric, context,
    state.wrapXb, state.wrapQ, weights.wqLayered[layer].asHalfFloatArray(),
    config.dim(), config.dim(), LOCAL_WORK_GROUP_SIZE)
.task("kmatmul", TransformerComputeKernels::matrixVectorGeneric, context,
    state.wrapXb, state.wrapK, weights.wkLayered[layer].asHalfFloatArray(),
    config.dim(), config.kvDim(), LOCAL_WORK_GROUP_SIZE)
.task("vmatmul", TransformerComputeKernels::matrixVectorGeneric, context,
    state.wrapXb, state.wrapV, weights.wvLayered[layer].asHalfFloatArray(),
    config.dim(), config.kvDim(), LOCAL_WORK_GROUP_SIZE)
// Rotary position embedding
.task("rope", TransformerComputeKernels::ropeRotation, context,
    state.positionHolder, state.wrapQ, state.wrapK, config.kvDim(), config.headSize())
// Multi-head attention
.task("attention", TransformerComputeKernels::processHeadsParallel,
    state.wrapQ, state.wrapKeyCache, state.wrapValueCache, state.wrapXb,
    config.numberOfHeads(), config.headSize(), config.kvDim(), config.kvMul(),
    config.contextLength(), state.positionHolder, state.wrapAtt, layer)

Each of these Tasks corresponds to of the key algorithms of the underlaying transformer architecture. For example, the attention kernel implements scaled dot-product attention with explicit numerical stability handling. This is the same algorithm that powers every modern transformer, expressed in pure Java:

private static void processHeadTornado(FloatArray Q, FloatArray keyCache,
        FloatArray valueCache, FloatArray output, int head, int headSize,
        int kvDim, int kvMul, long layerOffset, int pos, FloatArray attScores) {

    int headOffset = head * (pos + 1);

    // Step 1: Compute attention scores Q·K^T / sqrt(d_k)
    for (int t = 0; t <= pos; t++) {
        int kvHeadIdx = head / kvMul;
        int keyOffset = (int)(layerOffset + t * kvDim + kvHeadIdx * headSize);
        float score = 0.0f;
        for (int i = 0; i < headSize; i++) {
            score += Q.get(head * headSize + i) * keyCache.get(keyOffset + i);
        }
        attScores.set(headOffset + t, score / TornadoMath.sqrt(headSize));
    }

    // Step 2: Softmax with numerical stability (max subtraction)
    float maxScore = attScores.get(headOffset);
    for (int t = 1; t <= pos; t++) {
        maxScore = TornadoMath.max(maxScore, attScores.get(headOffset + t));
    }
    float sum = 0.0f;
    for (int t = 0; t <= pos; t++) {
        float exp = TornadoMath.exp(attScores.get(headOffset + t) - maxScore);
        attScores.set(headOffset + t, exp);
        sum += exp;
    }
    for (int t = 0; t <= pos; t++) {
        attScores.set(headOffset + t, attScores.get(headOffset + t) / sum);
    }

    // Step 3: Weighted sum of values
    for (int i = 0; i < headSize; i++) {
        float weightedSum = 0.0f;
        for (int t = 0; t <= pos; t++) {
            int valueOffset = (int)(layerOffset + t * kvDim + (head/kvMul) * headSize);
            weightedSum += attScores.get(headOffset + t) * valueCache.get(valueOffset + i);
        }
        output.set(head * headSize + i, weightedSum);
    }
}

FP16 (half-precision) support reduces  memory bandwidth requirements by half while also improving computational throughput. Model weights are loaded as HalfFloatArray objects using TornadoVM’s off-heap types, and  the asHalfFloatArray() accessor converts them into a GPU-compatible format. Benchmarks indicate approximately a 30% inference speedup when dequantization is fused directly into the compute operations within the kernels.

LangChain4j and Quarkus integration enables enterprise deployment patterns

GPULlama3.java achieved official LangChain4j model provider status since version 1.7.1, making GPU-accelerated inference a first-class option alongside cloud APIs. The library implements ChatLanguageModel and StreamingChatLanguageModel interfaces through builder-pattern APIs that mirror other providers:

// Synchronous inference
GPULlama3ChatModel model = GPULlama3ChatModel.builder()
    .modelPath(Paths.get("llama-3.2-1b-instruct-fp16.gguf"))
    .temperature(0.9)
    .topP(0.9)
    .maxTokens(2048)
    .onGPU(Boolean.TRUE)  // Toggle GPU/CPU execution
    .build();

ChatResponse response = model.chat(ChatRequest.builder()
    .messages(UserMessage.from("Explain quantum entanglement"))
    .build());

The onGPU(Boolean) parameter provides transparent switching between GPU-accelerated TornadoVM execution and CPU-based Vector API execution using the underlying Llama3.java implementation. This enables graceful degradation on systems without GPU support.

Streaming responses support real-time chat interfaces:

GPULlama3StreamingChatModel streamingModel = GPULlama3StreamingChatModel.builder()
    .modelPath(modelPath)
    .onGPU(true)
    .build();

streamingModel.chat(request, new StreamingChatResponseHandler() {
    @Override
    public void onPartialResponse(String token) {
        System.out.print(token);  // Stream tokens as generated
    }
    @Override
    public void onCompleteResponse(ChatResponse response) { }
    @Override
    public void onError(Throwable error) { }
});

Quarkus integration via quarkus-langchain4j-gpu-llama3 enables declarative configuration and automatic model downloading:

# application.properties
quarkus.langchain4j.gpu-llama3.enable-integration=true
quarkus.langchain4j.gpu-llama3.chat-model.model-name=unsloth/Llama-3.2-1B-Instruct-GGUF
quarkus.langchain4j.gpu-llama3.chat-model.quantization=F16
quarkus.langchain4j.gpu-llama3.chat-model.temperature=0.7
quarkus.langchain4j.gpu-llama3.chat-model.max-tokens=1024

The extension auto-injects ChatModel beans, enabling AI Services without explicit wiring:

@Path("chat")
public class ChatResource {
    private final ChatModel chatModel;  // Injected automatically

    public ChatResource(ChatModel chatModel) {
        this.chatModel = chatModel;
    }

    @GET
    @Path("blocking")
    public String chat(@QueryParam("q") String question) {
        return chatModel.chat(question);
    }
}

Streaming endpoints leverage Mutiny’s reactive types for non-blocking responses. One critical limitation: TornadoVM does not support GraalVM Native Image compilation, so Quarkus applications must run in JVM mode with TornadoVM’s JVM arguments specified at launch.

Production deployments that prove enterprise readiness

TornadoVM’s most prominent production deployment supports the European Space Agency’s Gaia mission through the AERO (Accelerated European Cloud) project. Gaia surveys 1.8 billion stellar objects with 24 micro-arcsecond positional precision, generating massive computational loads – the third data release required 534 days of computation across 135 machines. The processing pipeline runs in Java, making TornadoVM’s GPU acceleration directly applicable without rewriting in CUDA.The primary optimization target is the Period Search algorithm for analyzing irregularly sampled time series, computing periodograms across 300,000-600,000 frequencies per source. With 12 million stellar objects and complexity scaling with frequency count times series length, each 50ms improvement per source saves 166 hours of total computation time.

On the contrary, GPULlama3.java performance varies on different hardware devices and model sizes. On an NVIDIA RTX 5090 GPU, Llama-3.2-1B-Instruct achieves 96.65 tokens/second; on an NVIDIA RTX 4090 GPU, 66.07 tok/s; and on an NVIDIA RTX 3070 GPU, 52 tok/s. On an Intel Arc A770 GPU, it reaches 15.65 tok/s while on Apple M4 Pro achieves 16.77 tok/s via OpenCL. Note: At the current state of the project, GPULlama3.java does not utilize Tensor Cores. Support for using these NVIDIA specialized units is coming in the near future.


Conclusion: Java’s competitive position in GPU computing solidifies

TornadoVM and GPULlama3.java together demonstrate that Java can compete directly with Python for GPU-accelerated AI workloads. There is no need for awkward bindings, but through a coherent programming model that feels native to the language. The TaskGraph abstraction, annotation-based parallelism, and off-heap memory allocation via its integration with Project Panama, provide ergonomics comparable to NumPy and PyTorch while maintaining Java’s type safety and tooling ecosystem.

The key insight is not raw performance, native CUDA implementations with Tensor Core support will remain faster for specific hardware. Instead, the real milestone is that Java developers can now build fully GPU-accelerated libraries that they understand, integrate them with mainstream frameworks, such as LangChain4j and Quarkus, and deploy them in production environments ranging from IoT edge devices to powerful servers. This write-once, run-on-heterogeneous-hardware model reduces vendor lock-in while enabling incremental and pragmatic adoption of GPU acceleration within existing Java ecosystems.

TornadoVM’s evolution to version 3.0.0, with support for JDK 21 and JDK 25 after almost a decade of sustained development, confirms that GPU acceleration in Java is no longer experimental, but a permanent and integral expansion of the JVM ecosystem.

Quick start:

Get started with GPU-accelerated Java with SDKMAN :

# Install TornadoVM with SDKMAN
sdk install tornadovm 2.2.0-opencl

# Verify devices
tornado --devices

# Verify version
tornado --version

# Run a your first Java program onto a GPU
java @$TORNADOVM_HOME/tornado-argfile -cp $TORNADOVM_HOME/share/java/tornado/tornado-examples-2.2.0.jar uk.ac.manchester.tornado.examples.compute.MatrixVectorRowMajor
Acknowledgements

This work is supported by the European Union’s Horizon Europe Programme under grant agreements 101070670 (ENCRYPT), 101092850 (AERO), 101093069 (P2CODE), and 101070052 (TANGO), and by UK Research and Innovation (UKRI) under the UK Government’s Horizon Europe funding guarantee (ENCRYPT: 10039809; AERO: 10048318; P2CODE: 10048316; TANGO: 10039107).

This article is part of the JAVAPRO special magazine issue:

Java in the Age of AI

Explore how AI is transforming the way we build, secure, and operate software with Java.
From AI agents and new architectural patterns to security, data, and team dynamics—this edition brings together real-world insights for building intelligent, production-ready systems.

Discover the edition →

Total
0
Shares
Previous Post

BoxLang AI 3.4.0: Gateways, Human-in-the-Loop, and a Full Security Stack

Next Post

Stay Updated with Every New Free PDF Edition!

Related Posts