Repository navigation
Kernel Programming Model
Bogdan edited this page Jun 21, 2026
·
2 revisions
This page describes the supported Java subset for @GPU entry methods.
- arithmetic, comparisons, logical operators
- casts
if / else-
for,while,do-while switch / case- compound assignments
++ / --- primitive arrays and scalars
- helper methods via
@CCode - pointer wrappers
- vector wrappers
@GPUStruct- atomics
- local memory helpers
- images and samplers
- OpenCL attributes
- OpenCL address spaces
@net.sixik.ga_utils.javatogpu.api.anotations.GPU
public static void saxpy(
@GPUGlobal float[] input,
@GPUGlobal float[] output
) {
int id = GPU.get_global_id(0);
output[id] = GPU.sin(input[id]) + 2.0f;
}ifif / elseforwhiledo-whileswitch / casebreakcontinue- compound assignments and
++ / --
-
@GPUentry methods should bestatic - current entry-point support is
voidonly - array and scalar parameters are the normal calling convention
- supported wrappers such as pointers, vectors, structs, images, and samplers can also participate where explicitly supported
JavaToGpu is intentionally strict.
The goal is not "run arbitrary Java on GPU", but "accept a well-defined GPU-safe Java subset and fail fast on everything else".
- non-
void@GPUentry methods - arbitrary object allocation
- arbitrary Java method calls
- arbitrary JVM bytecode in ASM frontend