Docs / nablatensor-tensor / com.nablatensor.tensor.spi
interface
ComputeBackend
A compute backend. Implementations are discovered with ServiceLoader and must be registered in META-INF/services/com.nablatensor.tensor.spi.ComputeBackend.
Every numerical operation is executed by a custom kernel owned by the backend (runtime-compiled CUDA/ROCm, or a generated/vectorized CPU kernel).
Methods
Whether this backend can run on the current machine (drivers/GPU present).
Higher wins when Backend.AUTO selects a default (CUDA > Vulkan > ROCm > CPU).
Deterministic counter-based uniform values in [0, 1).
Deterministic counter-based standard-normal values generated with Box-Muller.
Copies one slice from axis zero, removing that axis from the result shape.
Stacks equally-shaped buffers along a new leading axis.
Sums every element, returning a single-element buffer of shape (1).
Maximum over every element, returning a single-element buffer of shape (1).
Sums a rank-2 buffer over axis 0, returning a rank-1 buffer of shape (cols).
Returns axis indices in an F32 buffer. Indices above 2^24 cannot be represented exactly until integer tensor dtypes are supported.
Routes one upstream value per reduced slice to the first maximum input position.
Copies a buffer while changing only its shape. Backends may override this to keep the copy device-local.
2-D convolution, no bias. x is (batch, inC*inH*inW), w is (outC, inC*k*k), result is (batch, outC*outH*outW).
Gradient of conv2d with respect to its input.
Gradient of conv2d with respect to its weights.
Routes upstream through a ReLU: input > 0 ? upstream : 0.
Broadcasts a to target following broadcast's rules.
Executes a fused elementwise expression tree (expr, reading from inputs) as a single unit. The default walks the tree with the primitive unary/binary/scalar ops (no real fusion, one call per node); CUDA/CPU backends override this to run the whole chain as a single kernel launch / pass.
Block until all queued kernels on this backend have completed.
Deterministically frees a buffer now, instead of waiting on GC/Cleaner timing.