Documentation
¶
Overview ¶
Package backend is the registry that connects generated assembly to the dispatcher.
The generated code lives in internal/<arch> and the dispatcher lives in the root package. Neither can reference the other directly — the root package would need build-tagged imports of every architecture, and the architecture packages would import the root package they are part of. A small registry both sides import breaks the cycle.
Registration happens from an init function in the architecture package, so the only thing the root package needs is a blank import guarded by the same build tag as the generated files.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Inventory = []Declared{}/* 906 elements not displayed */
Inventory is every kernel the manifest declares, sorted, one entry per group and field.
It exists so a test can assert that each declared slot is actually filled — in the assembled dispatch table AND in the reference set, which is where the hole that panicked under -tags purego was. A kernel can be declared here and still be absent from a given tier: the generator drops what a target cannot support, and the dispatcher fills the slot from the reference. What may not happen is the slot being empty in both.
Functions ¶
func Base ¶
Base returns a fresh copy of the portable reference set.
Generated code starts from this and overrides only the kernels it actually has. That is what lets kernels land a few at a time: a backend is always complete, with the reference standing in for everything not yet written, so there is never a nil function to call. A partial backend that left holes would be a crash waiting for whichever operation nobody got to yet.
func For ¶
For returns the backend being assembled for a tier, creating it from the portable reference on first use.
Several generated files contribute to one tier — there is a C source per operation family, and each produces its own registration — so they add to a shared set rather than each installing a complete one. Starting from the reference is what makes that safe at any point: a tier is always a complete set of kernels, with the portable implementation standing in for whatever has not been generated for it.