Skip to main content

Module backend

Module backend 

Source
Expand description

Automatic native→fallback backend selection (plan §2).

Plan §2 requires: “If a target-specific native backend (e.g., PTX or MSL) fails to initialize on the host, the Forge must automatically fall back to the next available compilation target (e.g., SPIR-V or WGSL) to ensure the compute pipeline remains operational, albeit at a potentially reduced performance tier.”

This module provides that policy as a pure, deterministic function so it is unit-testable with a mock availability predicate — no GPU or toolchain is required to exercise it. The execution/validation pipeline calls it to pick a runnable backend; source emission (shader generate --target ptx) is deliberately NOT routed through here (an explicit emission target must still emit that target’s source).

Functions§

resolve_execution_backend
Resolve which backend the execution/validation pipeline should actually use, given a preferred target and a predicate reporting whether a given backend’s native toolchain is available on this host.