Expand description
GPU-accelerated matching via wgpu. GPU-accelerated batch inference for the MoE classifier via wgpu compute shaders.
Processes N feature vectors in a single GPU dispatch, achieving ~10-100x throughput over CPU for large batches. Falls back to CPU when no GPU is available or for batches smaller than the crossover threshold.
Architecture mirrors ml_scorer.rs exactly:
- Gate: Linear(41→6) + softmax
- 6 experts: Linear(41→32)+ReLU → Linear(32→16)+ReLU → Linear(16→1)
- Output: sigmoid(weighted sum of expert logits)
§Feature-gating in the lean build
Every entry point that would touch wgpu / vyre-driver-wgpu directly is
wrapped in #[cfg(feature = "gpu")]. With the gpu feature off (the
cargo install keyhog --no-default-features --features ci path), the
GPU drivers aren’t linked at all, the probe functions report “no GPU
available” without ever calling into wgpu, and the self-test functions
return a “not available in this build” Err instead of panicking.
The CPU MoE path in ml_scorer.rs is the entire scoring story under
that profile.
Structs§
- GpuSelf
Test - Result from an explicit GPU adapter and dispatch self-test.
- Vyre
AcKernel Self Test - Status report from the AC-kernel GPU self-test. Returned by
vyre_ac_kernel_self_testso the diagnostic CLI can display the active backend and match count rather than just PASS/FAIL. - Vyre
GpuSelf Test - Result from an explicit vyre GPU scanner self-test.
Functions§
- batch_
ml_ inference - Score multiple (credential, context) pairs in a single batch.
- env_
no_ gpu - env_
require_ gpu - True when
KEYHOG_REQUIRE_GPU=1is set: the operator demands a usable GPU and a silent CPU fallback is forbidden. Read uncached so embedders / tests that toggle the var between scans see the change (it is process- global at runtime, so this is only a few extra syscalls on the cold path). - gpu_
available - Check if GPU acceleration is available.
Return
truewhen GPU scoring support is available in this build/runtime. - gpu_
probe - Probe GPU availability and adapter metadata without panicking.
- gpu_
self_ test - Force a GPU compute dispatch and validate the returned scores.
- is_
ci_ environment - True when we are running inside a CI system. Used by the GPU init paths to auto-skip the wgpu adapter probe (which always fails on hosted CI runners and costs ~250ms of pointless cold- start time + emits a confusing warning).
- require_
gpu_ preflight - Require-GPU preflight, independent of backend routing.
- vyre_
ac_ kernel_ self_ test - vyre_
gpu_ self_ test