Docs / nablatensor-engine-opencl / com.nablatensor.backend.opencl

final class

OpenClCompute

Public facade over the package-private OpenClRuntime, for code outside this module that needs a raw OpenCL compute surface: build-from-source compilation, device allocation, host<->device double transfers and a 1-D kernel launch.

The AAD OpenCL replay engine (com.nablatensor.engine.opencl) is the intended caller; it mirrors com.nablatensor.backend.rocm.HipCompute.

Methods

static boolean isAvailable()

Whether a usable OpenCL device is present. Never throws.

static boolean supportsFp64()

Whether the selected device can compute in double. The replay kernel keeps its accumulators and the host-visible partials in double even when the working precision is fp32, so a device without cl_khr_fp64 cannot run it and the engine must decline.

static int maxWorkGroupSize()

Largest work-group the device accepts; the replay kernel needs at least 256.

static String describe()

"<platform> · <device>" for diagnostics, or a placeholder.

static String deviceName()
static long compile(String source, String kernelName)

Builds OpenCL C source and returns a launchable kernel handle for kernelName. Callers should cache the handle by source; this does not.

static long compile(String source, String kernelName, String buildOptions)

As String) but with explicit clBuildProgram flags.

static void releaseKernel(long kernel)
static long malloc(long bytes)
static void free(long buffer)
static void uploadDoubles(long buffer, double[] data)

Blocking host-to-device copy into an already-allocated buffer.

static double[] downloadDoubles(long buffer, int count)
static void launch(long kernel, int groups, int local, Object... arguments)

Launches a 1-D range of groups work-groups of local work-items. Arguments are Long (device buffer handles / 64-bit scalars), Integer or Float, matched positionally.

static void synchronize()