CFish

Home * Engines * Stockfish * CFish

[ Joachim Beuckelaer - Fish Market [1] 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].

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

2017 …

2020 …

Re: Where to find CFish 11 Latest exe file by Ronald de Man, CCC, July 05, 2020

Re: Cfish is back! by Ronald de Man, CCC, July 07, 2020

References

  1. Fish Market by Joachim Beuckelaer, 16th century, Bonnefantenmuseum, Maastricht, Wikimedia Commons, Cod from Wikipedia
  2. Re: CFish by Louis Zulli, CCC, September 01, 2016
  3. Cfish/avx2-bitboard.h at master · syzygy1/Cfish · GitHub
  4. _mm256_lzcnt_epi64
  5. _mm256_ternarylogic_epi64
  6. Cfish/nnue.c at master · syzygy1/Cfish · GitHub

Up one Level