backend

package
v1.20.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 8, 2026 License: MIT Imports: 2 Imported by: 0

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

View Source
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

func Base() kernel.Set

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

func For(tier string) *kernel.Set

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.

func Lookup

func Lookup(tier string) (kernel.Set, bool)

Lookup returns the backend for a tier, and whether one exists.

func Tiers

func Tiers() []string

Tiers returns every registered tier name. Order is unspecified.

Types

type Declared

type Declared struct {
	Group   string
	Field   string
	RefFunc string
	CName   string
}

Declared is one kernel the manifest declares: the dispatch group it belongs to, the field inside that group, and the name of the portable implementation the generated guard falls back to below its threshold.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL