Core FFI Bridge

FFI is the bridge between PHP orchestration and native compute. The engine is designed to minimize boundary overhead while preserving safety.

Engine initialization

TensorEngine::get() is the central entry point.

JIT boundary minimization

Error handling

Pointer ownership

Example

$ffi = Pml\Lib\TensorEngine::get();
$ptr = $ffi->tensor_zeros(2, $ffi->new('int[2]')); // sample API shape
// wrap into a PHP tensor
$tensor = Pml\Tensor::wrap($ptr);

C definitions exposed

The FFI header includes:

Performance notes

When to use