gpu
cheatah-gpu v0.5.1-alpha — Biome Standard 0.6.3-alpha
Concepts
BackendKind— Constrains a template parameter to the GPU Backend enum — the concept-checked, static style the rest of the interface follows.
Functions
The lowercase name of a backend — for logs, a doctor report, or diagnostics.
backend | the backend to name. |
"metal" for Backend::metal, otherwise "vulkan".
O(1).
none.
Backend.Namesystests/test_backend_cr_query.purrThe name of the backend this binary was compiled for.
the active backend's name (see active_backend).
O(1).
none.
Backend.Activesystests/test_backend_cr_query.purrParse a backend name — the optional pattern cheatah-gpu uses for fallible lookups: a missing value is an empty optional, never an exception or a sentinel.
name | a backend name, "vulkan" or "metal" (case-sensitive). |
the matching Backend, or std::nullopt when name is neither.
O(1).
none.
Backend.FromNamesystests/test_backend_cr_query.purrWhether backend is the one this binary was compiled for — a concept-constrained, compile-time comparison (the real interface gates backend-specific code on exactly this).
backend | the backend to test. |
true iff backend equals active_backend.
O(1).
none.
Backend.IsActivesystests/test_backend_cr_query.purrOne-shot guard so the runtime backend notice is printed at most once per process.
a reference to the process-wide "already printed" flag.
O(1).
none.
User-controlled mute.
Once true, warn_backend_selection stays quiet.
a reference to the process-wide "silenced" flag.
O(1).
none.
Silence the runtime backend notice from here on.
The first notice is deliberately loud, but using (say) Vulkan on macOS on purpose is perfectly fine — call this, or set the environment variable CHEATAH_GPU_SILENCE_BACKEND_WARNING, or build with -DCHEATAH_GPU_NO_BACKEND_WARNING, to make it stop. This is a CHOICE the user owns, not a forced nag.
silence | true to mute (the default), false to re-enable. |
O(1).
none.
Backend.Silencesystests/test_backend_cr_warn.purrPrint the runtime backend notice — at most once — if the build was auto-switched or is using a suboptimal backend.
Never silent by default: a suboptimal GPU API chosen behind the user's back is a performance bug. But the notice is dismissable — it is suppressed if silence_backend_warning was called, if CHEATAH_GPU_SILENCE_BACKEND_WARNING is set in the environment, or if built with CHEATAH_GPU_NO_BACKEND_WARNING — and the message itself says how. No-op when the selection is optimal. The switched/suboptimal message paths cannot run in an optimally-selected build; they are exercised by scripts/metal_gate.sh's backend auto-resolution stage, which compiles this header with the wrong backend forced for the platform and asserts the warning is raised.
out | where to write the notice (defaults to stderr). |
true iff a notice was printed by this call.
O(1) — the constant-length notice; the first switched/suboptimal call also does one std::getenv lookup, linear in the process environment size.
none.
Backend.WarnSwitchedsystests/test_backend_cr_warn.purrConstants & variables
The backend selected for THIS binary at compile time (see the CHEATAH_GPU_BACKEND_* macros).
Whether native Metal can run on this platform (Apple only). Vulkan is assumed available everywhere.
The backend the build REQUESTED (the platform default counts as a request), before auto-correction.
True iff the requested backend could not run here and was auto-switched to active_backend.
True iff the active backend runs here but is not the platform's preferred (e.g. Vulkan on Apple).
Types
The native GPU API a build targets. Exactly one is active per binary, chosen at compile time.
