CFish
Home * Engines * Stockfish * CFish
CFish,
a port of Stockfish written in plain C by Ronald de Man, first published on GitHub in July 2016. Possibly inspired by the asmFish project to speed up Stockfish using a programming language closer to the machine, the purpose of CFish is to explore possible optimization issues of C versus C++ compilers [2].
Contents
AVX2 Attacks
Since May 2020, CFish contains experimental AVX2/AVX-512 computational sliding piece attack code by Okuhara
as memory saving alternative to Magic bitboards [3]. It applies a kind of branchless classical approach.
For instance, the four positive rays and negative rays of a queen
are processed as vector of 4 bitboards in one 256-bit ymm register each. Positive and negative rays were intersected with the vector of broadcast occupancies,
to get the relevant blockers if any, LS1B for positive, and MS1B for negative rays.
While the positive rays were processed by BLSMSK aka ((x-1) ^ x)
to clear the ray squares above the LS1B blockers,
the negative rays use a parallel prefix fill with three vector right shifts and ors, to clear all ray bits below the MS1B blockers.
The eight ray attack sets were vertically and two times horizontally ored together for the final result.
The conditional compiled AVX-512 version takes advantage of the _mm256_lzcnt_epi64 [4] and _mm256_ternarylogic_epi64 [5] intrinsics.
Rook and bishop naturally suffer from less vector utilization, and combine some other well known techniques, i.e. the bishop attack getter processes only positive rays by swapping bytes.
NNUE
Since August 2020, CFish also provides the NNUE evaluation ported from its C++ base Stockfish NNUE [6], further utilizing SIMD instructions.
See also
Forum Posts
2016
- CFish by Dann Corbit, CCC, August 31, 2016
- Cfish solves the dreaded URI hard problem by Dann Corbit, CCC, September 05, 2016
- cfish for the mac by Michael B, CCC, September 11, 2016 » Macintosh
- New CFish Windows binary (from today's code) by Dann Corbit, CCC, October 13, 2016
- Cfish for the Mac by Michael B, CCC, October 17, 2016
- Cfish 8 for the MacOS by Michael B, CCC, November 05, 2016
2017 ...
- Cfish update -> macOS exe's for download by Michael B, CCC, November 13, 2017
- Cfish-54302a... Search of startpos to depth 50 by Louis Zulli, CCC, January 17, 2018 » Initial Position
- Cfish 9 is OUT! by Louis Zulli, CCC, January 31, 2018
- Cfish, shiny and new... by Dann Corbit, CCC, June 05, 2019
- Some NUMA data for Stockfish-dev and Cfish-dev by Louis Zulli, CCC, June 17, 2019 » NUMA, Stockfish
- Bin book adapter? by Ovyron, CCC, July 18, 2019 » PolyGlot
2020 ...
- Where to find CFish 11 Latest exe file by Eric Hughes Santiago, CCC, July 05, 2020
- Re: Where to find CFish 11 Latest exe file by Ronald de Man, CCC, July 05, 2020
- Cfish is back! by Louis Zulli, CCC, July 07, 2020
- Re: Cfish is back! by Ronald de Man, CCC, July 07, 2020
- Hacking around CFish NNUE by Maksim Korzh, CCC, October 15, 2020 » NNUE
External Links
- GitHub - syzygy1/Cfish: C port of Stockfish
- GitHub - okuhara/Cfish: C port of Stockfish
- Fish Go Deep - The Jazz (2002), YouTube Video
References
- ↑ Fish Market by Joachim Beuckelaer, 16th century, Bonnefantenmuseum, Maastricht, Wikimedia Commons, Cod from Wikipedia
- ↑ Re: CFish by Louis Zulli, CCC, September 01, 2016
- ↑ Cfish/avx2-bitboard.h at master · syzygy1/Cfish · GitHub
- ↑ _mm256_lzcnt_epi64
- ↑ _mm256_ternarylogic_epi64
- ↑ Cfish/nnue.c at master · syzygy1/Cfish · GitHub