TornadoVM exposes two parallel systems for controlling runtime behaviour: CLI flags passed directly to theDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/Deepak-Sangle/TornadoVM/llms.txt
Use this file to discover all available pages before exploring further.
tornado Python wrapper (e.g. --printKernel), and JVM system properties passed with the -D prefix via --jvm (e.g. -Dtornado.printKernel=true). CLI flags are convenience shortcuts — each one maps internally to one or more -D properties. The properties themselves are all defined in TornadoOptions.java inside the tornado-runtime module. Understanding which flag to use and when is key to diagnosing compilation failures, profiling kernel execution time, and tuning device scheduling.
In flag examples below,
s0 refers to a task graph name and t0 to a specific task within that graph. These match the names you use when constructing TaskGraph objects in your application code.Basic Usage
Debugging and Logging
- CLI Flags
- JVM Properties
| Flag | Description |
|---|---|
--fullDebug | Enables full debug mode. Maps to -Dtornado.fullDebug=true. |
--debug | Enables basic debug output: compilation status, device info, execution events. |
--printKernel | Prints the generated OpenCL/CUDA/Metal kernel source to stdout. |
--threadInfo | Displays the number of threads (global and local work sizes) used for each kernel launch. |
--devices | Lists all available hardware devices across all enabled backends. |
Debugging Workflow: Printing Generated Kernels
When a kernel behaves unexpectedly, the first step is to inspect the generated source:Profiling
- CLI Flags
- JVM Properties
| Flag | Description |
|---|---|
--enableProfiler console | Enables profiling and prints metrics as JSON to stdout after execution. |
--enableProfiler silent | Collects profiling metrics internally; access them via the TornadoVM Profiler API. |
--dumpProfiler FILENAME | Saves profiling output (JSON) to the specified file. |
Profiling Workflow: Measuring Kernel Execution Time
Device Selection
- CLI Flags
- JVM Properties
| Flag | Description |
|---|---|
--devices | Prints all available backends and devices with their index pairs (B:D). |
Performance and Scheduling
Work-group size tuning
Work-group size tuning
| Property | Description |
|---|---|
-Ds0.t0.global.workgroup.size=X,Y,Z | Sets a custom global work-group size for task t0 in graph s0. |
-Ds0.t0.local.workgroup.size=X,Y,Z | Sets a custom local (thread-block) work-group size. |
-Dtornado.scheduler.block=true | Partitions the iteration space into blocks, one per visible CPU core (default: false). Useful for CPU OpenCL devices. |
-Dtornado.concurrent.devices=true | Enables concurrent execution of tasks across multiple devices (default: false). |
Memory and buffer management
Memory and buffer management
| Property | Description |
|---|---|
-Dtornado.reuse.device.buffers=false | Disables reusing device buffers across executions of the same task graph (default: true). |
-Dtornado.deallocate.buffers=false | Disables freeing device resources when the execution plan closes (default: true). |
-Dtornado.ns.time=true | Uses nanoseconds for all timing measurements (default: true). |
Optimizations
Math and FMA optimizations
Math and FMA optimizations
| Property | Default | Description |
|---|---|---|
-Dtornado.enable.fma=true | true | Enables fused multiply-add instructions. May cause precision differences on some platforms. |
-Dtornado.enable.mathOptimizations=true | true | Enables math simplifications, e.g. 1/sqrt(x) → rsqrt. |
-Dtornado.enable.fastMathOptimizations=true | true | Enables aggressive fast-math optimisations. |
-Dtornado.enable.nativeFunctions=true | true | Enables native math intrinsics in the generated kernel. |
-Dtornado.experimental.partial.unroll=true | false | Enables partial loop unrolling. Combine with -Dtornado.unroll.factor=N (default: 4). |
CUDA C Backend
These flags apply only when using the CUDA C backend (make BACKEND=cuda).
CUDA compiler flags
CUDA compiler flags
| Property | Description |
|---|---|
-Dtornado.cuda.compile.profile=PROFILE | Named NVRTC compilation profile. Options: default (no extra flags), fast (--use_fast_math --extra-device-vectorization), debug (-lineinfo for Nsight profiling), repro (--fmad=false for reproducibility). |
-Dtornado.cuda.compiler.flags=FLAGS | Appends additional flags to the NVRTC compiler invocation. Applied after the profile flags. |
-Dtornado.cuda.host.pinning=false | Disables host memory pinning for host↔device transfers (default: true). Pinned memory enables faster DMA transfers. |
Code cache (shared with OpenCL)
Code cache (shared with OpenCL)
Metal Backend (macOS / Apple Silicon)
These flags apply only when using the Metal backend (make BACKEND=metal) on macOS.
| Property | Default | Description |
|---|---|---|
-Dtornado.metal.fastmath=true | false | Compiles Metal kernels with fast/relaxed math. Trades some FP precision for speed. |
-Dtornado.metal.threadgroupHint=true | false | Emits a max_total_threads_per_threadgroup attribute when the local work-group size is statically known, helping the Metal compiler tune occupancy. |
-Dtornado.metal.profiling.enable=false | true | Disables Metal GPU profiling. |
-Dtornado.metal.compiler.flags=FLAGS | (none) | Passes additional flags to the Metal compiler. |
Common Debugging Workflows
Inspect the generated kernel
float vs double), and that @Parallel loops map to the expected get_global_id() calls.Check thread and work-group configuration
Profile execution time breakdown
Enable full debug for compiler diagnostics
Quick-Reference: CLI Flags Summary
All CLI flags at a glance
All CLI flags at a glance
| CLI Flag | JVM Equivalent | Category |
|---|---|---|
--fullDebug | -Dtornado.fullDebug=true | Debug |
--debug | -Dtornado.debug=true | Debug |
--printKernel | -Dtornado.printKernel=true | Debug |
--threadInfo | -Dtornado.threadInfo=true | Debug |
--devices | (prints device list and exits) | Device info |
--enableProfiler console | -Dtornado.profiler=true | Profiling |
--enableProfiler silent | -Dtornado.log.profiler=true | Profiling |
--dumpProfiler FILE | -Dtornado.profiler.dump.dir=FILE | Profiling |
--jvm "FLAGS" | (passes FLAGS directly to the JVM) | JVM pass-through |
-cp CLASSPATH | (classpath) | Launch |
-m MODULE/CLASS | (module-qualified main class) | Launch |