Devices and backends
AI assistant
Build this with Claude Code, Cursor or Copilot
Copy a Talario-tuned prompt for Devices and backends, grounded in 1 real API signature , into your IDE's AI. No chatbot, just exact context.
A Device is a compute backend, created once and shared across tapes and
parameters.
$dev = new Device('auto'); // 'cpu', 'gpu', or 'auto' echo $dev->name(); // the bound backend/device
The HAL
Talario owns a hardware abstraction layer with two drivers:
- A Vulkan compute driver that executes vendor-neutral SPIR-V kernels. The same
SPIR-V runs on NVIDIA, AMD, Intel, Apple (via MoltenVK) and ARM GPUs;
'auto'selects the optimal driver at runtime. - A CPU/SIMD fallback that implements the same ops, so code runs anywhere even without a GPU, and the two paths are designed to produce matching gradients.
BLAS-shaped primitives (GEMM, AXPY) are delegated to the Tessero numerical core; the element-wise, activation and autograd-accumulation kernels are Talario's own SPIR-V.
Choosing a backend
Pass 'cpu' or 'gpu' explicitly when you want to pin one, or 'auto'/null to
let Talario pick. Because the op set and gradients are the same across backends,
you can develop on CPU and deploy on GPU with no code changes.
Zero-copy ingest
Tape::tensorBytes($blob, $shape) ingests a packed f32 binary string straight
into a device buffer with no intermediate PHP array, which is the fast path for
feeding features on a hot serving or training loop.