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

final class

HipCompute

Public facade over the package-private HipRuntime, for code outside this module that needs a raw ROCm/HIP compute surface: HIPRTC compilation, device allocation, host<->device double transfers and a 1-D kernel launch.

The AAD ROCm replay engine (com.nablatensor.engine.rocm) is the intended caller; it mirrors com.nablatensor.backend.vulkan.VulkanCompute.

Methods

static boolean isAvailable()

Whether a usable HIP device is present. Never throws.

static boolean reliable()

Whether nablatensor should select the ROCm path automatically here: a usable device whose architecture is not one of the known-unstable consumer APUs. Set -Dnablatensor.rocm.allow_unsupported=true (or env NABLATENSOR_ROCM_ALLOW_UNSUPPORTED=1) to opt an APU back in for deliberate benchmarking. Never throws.

static String deviceName()

Device name for diagnostics, or a placeholder if the context is unavailable.

static String arch()

The --offload-arch target HIPRTC will build for (e.g. gfx1103).

static long compile(String source, String kernelName)

Compiles HIP/CUDA-C source with HIPRTC and returns a launchable function handle for kernelName. Callers should cache the handle by source; this does not.

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

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

static double[] downloadDoubles(long pointer, int count)
static void launch(long function, int grid, int block, Object... arguments)

Launches a 1-D grid of grid blocks of block threads. Arguments are Long (device pointers / 64-bit scalars), Integer or Float, matched positionally to the kernel.

static void synchronize()