Incremental NNUE & Outlook on the Non-Blocking CPU+GPU Knowledge Pump
Planned quantized NNUE evaluation with a net passport (hash of the weights and documented training), plus a planned asynchronous GPU advisor.
Why does BalouChess do this?
In today’s engine code, BalouChess evaluates leaves with its classical MaterialEvaluator (material and piece-square tables), while the quantized incremental NNUE pipeline and the clean-room training and netpass system are still being built toward the first embedded standard network.
Looking further ahead, BalouChess specifies a strictly non-blocking CPU+GPU 'Knowledge Pump' (research architecture): an optional external neural Advisor evaluates upper-tree positions asynchronously so its hints can refine move ordering in the next iteration — without ever stalling the CPU alpha-beta search.
Data Layout, Invariants & Common Pitfalls
Memory & State Layout
Evaluator trait with two implementations (engine, SPEC 005): active MaterialEvaluator (permanent oracle and fallback) and specified NnueEvaluator with preallocated EVAL_STACK_DEPTH = 128 incremental push/pop accumulators, fixed-point quantized kernels (scalar reference under #![forbid(unsafe_code)], plus SIMD kernels sse41/avx2/avx512/neon), SHA-256 weight verification, and mandatory Netpass provenance. Separately, the future Advisor design connects solely via HintSource::submit/probe.
Formal Invariants
- Bit-exact cross-SIMD quantization & zero heap allocation (engine, SPEC 005/R4, R5, R9, specified): every planned SIMD kernel must match the safe scalar reference bit-for-bit without overflow, incremental push/pop matches full refresh, and evaluate allocates zero memory.
- Core autonomy & HintSource firewall (engine, SPEC 003/R9–R12, Advisor Draft): the CPU search never waits on the Advisor, hints never prune moves or overwrite transposition-table bounds, and with NoHints the engine is bit-identical to a pure CPU build.
Typical Pitfalls & Edge Cases
- Silent floating-point drift across CPUs: floating-point neural inference breaks deterministic bench signatures across architectures; fixed-point integer quantization with verified saturation guarantees bit-identical scores everywhere.
- Coupling tree search to GPU latency: synchronous GPU calls cripple alpha-beta node throughput; turning latency into an asynchronous next-iteration throughput pump preserves full CPU speed even if the accelerator disconnects.