Skip to content

Runtime Dispatch and ABI

Bogdan edited this page Jun 21, 2026 · 2 revisions

Runtime Flow

  1. compile @GPU
  2. generate OpenCL
  3. generate launcher
  4. rewrite direct calls
  5. dispatch through GpuRuntime

Typical Backend Setup

try (OpenClGpuRuntimeBackend backend = new OpenClGpuRuntimeBackend()) {
    GpuRuntime.setBackend(backend);
    Demo.kernel(input, output);
} finally {
    GpuRuntime.setBackend(GpuRuntime.defaultBackend());
}

ABI Debug

  • -Ajavatogpu.debugAbi=true
  • -Djavatogpu.opencl.debugAbi=true

What The Flags Mean

Use -Ajavatogpu.debugAbi=true when you want compile-time diagnostics about how parameters and struct fields are interpreted by the processor.

Use -Djavatogpu.opencl.debugAbi=true when you want runtime diagnostics about final OpenCL-side marshalling and layout before launch.

This is especially useful for:

  • @GPUStruct
  • vector arrays
  • packed and aligned data
  • launcher argument mismatches

Gradle Examples

Processor diagnostics:

tasks.withType(JavaCompile).configureEach {
    options.compilerArgs += ['-Ajavatogpu.debugAbi=true']
}

Runtime diagnostics:

tasks.withType(Test).configureEach {
    jvmArgs '-Djavatogpu.opencl.debugAbi=true'
}

tasks.withType(JavaExec).configureEach {
    jvmArgs '-Djavatogpu.opencl.debugAbi=true'
}

See Also

Clone this wiki locally