Motivation
- Ensure the repository uses the exact requested Stockfish NNUE filenames and downloads/validates them robustly.
- Make the NNUE download/install independent of CWD and fail hard when required tools or validations are missing.
- Add Revolution-compatible Makefile gating so embedding can be disabled and build prerequisites honor that setting.
Description
- Update default BIG NNUE macro in
src/evaluate.htonn-c288c895ea92.nnuewhile keeping the small net macro unchanged. - Replace
scripts/net.shwith a CWD-independent, fail-fast downloader that auto-detectsevaluate.h, requireswgetorcurl, requiressha256sum/shasumfor validation, enforces minimum size thresholds, and creates a symlink intosrc/so the build embedding step can find the files. The script validates filename by sha256 prefix and removes invalid downloads. - Add Revolution-compatible NNUE gating block to
src/Makefile(NNUE_EMBEDDING_OFF ?= no) and setNNUE_TARGET := netor empty when embedding is disabled, and replacenetprerequisites with$(NNUE_TARGET)foranalyze,build,profile-build, andconfig-sanity, keeping thenettarget as the wrapper that calls../scripts/net.sh. - Adjust engine/network construction in
src/engine.cppto callNetworkswithEvalFilearguments (matching theNetworksconstructor signature) instead of trying to constructNetworkobjects inline. - Convert compile-time FullThreats LUT initialization into a runtime initializer: declare
init_threat_offsets()insrc/nnue/features/full_threats.h, implement a lazyinit_threat_offsets()insrc/nnue/features/full_threats.cpp, and move previously-constexpr LUTs into runtime-initialized arrays to avoid constexpr/ABI issues. - Add
ValueList::ssize()and include<cstddef>insrc/misc.hfor signed sizes used by NNUE accumulator code.
Files changed: src/evaluate.h, scripts/net.sh, src/Makefile, src/engine.cpp, src/misc.h, src/nnue/features/full_threats.h, src/nnue/features/full_threats.cpp.
Testing
make -C src net— succeeded; bothnn-c288c895ea92.nnueandnn-37f18f62d772.nnuewere validated and placed undersrc/nnue/(the script also created src/ symlinks). (PASS)make -C src build— succeeded; build completed and producedsrc/Wordfish-4.0-230126-sse41popcnt. (PASS)- UCI smoke test
./src/Wordfish-4.0-230126-sse41popcnt <<'EOF' ... EOF— succeeded; engine printed id/options and logged that it is usingnn-c288c895ea92.nnueandnn-37f18f62d772.nnue, then returned a best move. (PASS) make -C src -n build— dry-run shows the build calls../scripts/net.shand the config output; (PASS)make -C src -n build NNUE_EMBEDDING_OFF=yes— dry-run shows-DNNUE_EMBEDDING_OFFpresent inCXXFLAGSand$(NNUE_TARGET)is empty so net is omitted; (PASS)
All automated steps above completed successfully in the test environment.
