GithubHelp home page GithubHelp logo

nnue's Introduction

nnue

This code provides an implementation of a Efficiently Updatable Neural Network (NNUE) for chess, compatible with the original implementation in Stockfish, which was based on contributions from Hisayori Noda aka Nodchip. Now also supporting the SFNNv4 network architecture, via the SFv4 branch.

Copyright, license

Copyright 2021-2023 by Jon Dart. All Rights Reserved.

MIT Licensed.

Implemented Features

  • can read Stockfish network files using insertion operator on the Network class
  • templated to support different network sizes, weight types, etc.
  • full and incremental update supported
  • SIMD support for x86_64 and ARM NEON architectures
  • unit test code

Missing Features

  • read only, no support for writing network files
  • does not validate hash codes from existing network files

Compilation

Requires C++-17. The Makefile (Gnu Make) builds a test executable. -DSIMD must be specificed to select SIMD optimizations. If SIMD is set then also one or more flags must be set to select the desired instruction set(s).

Add -DNEON to use the ARMv8 NEON instruction set.

For x86_64 processors, the following flags can be set. They can be combined and are utilized in the following order of precedence.

  1. AVX512_VNNI (in addition to AVX512)
  2. AVX512
  3. VNNI (in addition to AVX2)
  4. AVX2
  5. SSE41 (in addition to SSSE3)
  6. SSSE3 (assumes SSE2 also present)
  7. SSE2

If -DSIMD is enabled, at least one of: AVX2, SSSE3 or SSE2 must also be selected.

Interface

The Evaluator class is templated and assumes use of a class or typedef that provides a basic interface to a chess position.

The interface subdirectory contains an implementation named ChessInterface that provides the necessary methods and is used by the test code. Users are likely to want to replace this with a class that wraps whatever native position representation they have.

Test code

The nnue_test program in the test subdirectory tests the first layer of the network and the code for the interior linear transformation layers. It should execute and produce "0 errors" on output.

This program can also be used with the -f switch to read an existing network file, although its contents are not validated.

nnue's People

Contributors

jdart1 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.