Skip to main content

Module policy

Module policy 

Source
Expand description

ComputePolicy — the one shared dispatch surface the whole engine calls (HARDWARE_BACKEND_AUTOSELECT_PLAN.md §4).

A STEM call site asks policy.select(class, problem_bytes) and runs the returned Plan. No module embeds a device decision; they all defer to the measured per-class matrix. select is O(1) and zero-heap (it reads an already-built matrix and returns a Copy plan) — the heavy probe ran once at boot. CPU is always a valid plan and never hard-fails (plan §7).

This wraps the existing vendor-neutral hetero_dispatch helpers (precision, tiling, zero-copy) rather than duplicating them, and adds the part they cannot do alone: the measured per-class backend/circuit choice from the matrix.

Structs§

ComputePolicy
The shared compute policy: a measured per-class matrix plus the host’s precision/VRAM envelope. Built once at startup; select is the hot, O(1) call.
Plan
The resolved execution plan for one kernel dispatch. Copy, zero-heap — it names the backend/circuit and the precision/tiling/transfer policy, all of which are small scalars. The human-readable circuit label stays in the matrix.