Docs / jax4j-engine-cuda / com.nablatensor.jax4j.backend.cuda
final class
CudaBackend
NVIDIA CUDA backend. All math runs in custom kernels that are compiled to PTX at runtime with NVRTC and launched through the CUDA Driver API. Tensors stay resident in device memory between operations.
Phase-0 note: a single driver context is created on first use; the notebook exercises the backend from one thread. Per-thread primary-context handling is tracked for a later phase.
Methods
Broadcasts entirely on-device: source strides (0 for dims being broadcast) and target dims are computed on the host (cheap, just a few ints) and passed as kernel scalars, capped at MAX_BROADCAST_RANK dims (padded with size-1/stride-0 entries) - every shape this project produces is rank <= 2. No download/upload round trip, unlike the previous host-side implementation.
Runs a whole elementwise expression chain as one generated kernel launch, instead of one launch (and one intermediate device buffer) per op. The compiled kernel is cached by its generated source, so repeated fused calls for the same op chain (any shape) reuse it without recompiling.