include/vecmat/backend.h file

Runtime _ptr table (VECMAT_DISPATCH_LIST) and vm_backend_register().

Classes

struct vm_backend_ops
Function table for a registered backend.
struct vm_backend
External SIMD backend.

Enums

enum (anonymous) { VM_BACKEND_OK = 0, VM_BACKEND_ERR_INVAL = -1, VM_BACKEND_ERR_NODISPATCH = -2, VM_BACKEND_ERR_FULL = -3, VM_BACKEND_ERR_CONFLICT = -4 }

Typedefs

using vm_backend_ops = struct vm_backend_ops
Function table for a registered backend.
using vm_backend = struct vm_backend
External SIMD backend.

Functions

auto vm_backend_register(const vm_backend* backend) -> int
Register an external backend.
auto vm_backend_builtin(vm_cpu_features_t isa) -> const vm_backend_ops*
Built-in op table for a compiled ISA, or NULL.

Defines

#define VECMAT_DISPATCH_LIST(X)
#define VECMAT_BACKEND_OP(name, params, args)
#define VM_BACKEND_MAX

Typedef documentation

typedef struct vm_backend_ops vm_backend_ops

Function table for a registered backend.

Layout follows VECMAT_DISPATCH_LIST below. New slots are appended; existing slots are never reordered.

typedef struct vm_backend vm_backend

External SIMD backend.

Register before the first vm_cpu_init() (or from it). The implementation must only register when the kernels can run on this CPU. Public code does not dlopen.

Function documentation

int vm_backend_register(const vm_backend* backend)

Register an external backend.

Parameters
backend Backend descriptor; must outlive the process.
Returns VM_BACKEND_OK or a negative VM_BACKEND_ERR_* code.

Idempotent for the same backend pointer. Rejects a NULL name, NULL ops, or any NULL slot. Same name with a different pointer is a conflict.

const vm_backend_ops* vm_backend_builtin(vm_cpu_features_t isa)

Built-in op table for a compiled ISA, or NULL.

Optional CPU backends copy this and override slots, then call vm_backend_register(). The table matches this TU's float width. Returns NULL if that ISA was not compiled. NEON, SVE, and SVE2 are provided. They are not part of the default library. See doc/modules.md.