Skip to content
Bogdan edited this page Jun 24, 2026 · 6 revisions

JavaToGpu Wiki (WIP)

JavaToGpu is a source-first Java-to-OpenCL pipeline with an additional structured ASM frontend for advanced integrations.

Pages

Short Summary

  • write kernels in Java with @GPU
  • reuse GPU helpers with @CCode
  • use pointer wrappers, vectors, and @GPUStruct
  • map kernel parameters to OpenCL address spaces
  • compile through source or structured ASM frontends

How It Works

When you mark a method with @GPU, JavaToGpu:

  1. parses the Java source,
  2. validates it against the supported GPU subset,
  3. lowers it to an internal IR,
  4. emits OpenCL C,
  5. generates a launcher,
  6. rewrites direct calls so runtime execution goes through GpuRuntime.

Main Features

  • source-first Java kernel authoring
  • reusable GPU helper methods
  • OpenCL math, indexing, atomics, fences, and barriers
  • pointer wrappers for mutable helper-style code
  • vector wrappers for OpenCL vector types
  • @GPUStruct for user-defined data layouts
  • structured ASM frontend for compiler and generator integrations

Suggested Reading Order

If you want to write kernels by hand:

  1. Getting Started
  2. Kernel Programming Model
  3. Helpers, Pointers, Vectors, Structs
  4. OpenCL Features
  5. Runtime Dispatch and ABI

If you want to integrate another compiler:

  1. ASM Frontend
  2. Kernel Programming Model
  3. Examples and References

Clone this wiki locally