Skip to main content

Module driver

Module driver 

Source
Expand description

Hardware-agnostic compute driver trait.

The Driver trait exposes low-level compute primitives (GEMM, layer-norm, activations, etc.) that each hardware backend implements. Model architectures are generic over D: Driver and compose these primitives into a forward pass.

§Design

  • Associated type Tensor: each driver defines its own opaque tensor handle (Metal: buffer+offset, CUDA: device pointer, CPU: ndarray).
  • Not object-safe: architectures use D: Driver generics so the compiler can monomorphize and inline driver calls.
  • Send + Sync: drivers are shared across the pipeline.

Structs§

BatchInputs
Batch input tensors on device, produced by Driver::prepare_batch.

Traits§

Driver
Hardware-agnostic compute primitives for BERT inference.