Docs / nablatensor-core / com.nablatensor.engine

interface

DeviceRuntime

The small accelerator surface DeviceAadExecutable needs: compile a kernel from source, allocate and move linear device buffers, launch a 1-D grid, and make prior work host-visible. Each accelerator backend supplies one adapter over its own runtime facade (CUDA CudaJit, ROCm HipCompute, OpenCL OpenClCompute); the replay bookkeeping that used to be copied into every *AadKernel lives once in DeviceAadExecutable.

Handles are opaque longs (device pointers / kernel functions) and are only ever passed back to the same runtime instance.

Methods

long compile(String source, String kernelName)

Compile source and return a launchable handle for kernelName.

long malloc(long bytes)
void free(long pointer)
void uploadDoubles(long pointer, double[] data)

Host-to-device copy into an already-allocated pointer.

double[] downloadDoubles(long pointer, int count)
void launch(long kernel, int groups, int local, Object... args)

Launch a 1-D grid of groups work-groups of local work-items. Arguments are matched positionally: Long (device buffer handle or 64-bit scalar), Integer or Float.

void synchronize()

Ensure the launched kernel has finished and its results are host-visible. A runtime whose downloadDoubles already blocks on prior work may leave this empty.

String compileKey()

Extra text folded into the kernel cache key, for a runtime whose compiled output depends on more than the source string (e.g. build options). Empty for CUDA and ROCm.