jdart1 / arasan-chess

Arasan chess engine
Other
122 stars 30 forks source link

CCC Custom Build Script Warnings #58

Open AndyGrant opened 4 months ago

AndyGrant commented 4 months ago

Hey Jon. I figured I would share this with you, as I notice it every time I build Arasan for Chess.com.

scoring.cpp: In member function 'void Scoring::calcPawnData(const Board&, ColorType, Scoring::PawnHashEntry::PawnData&)':
scoring.cpp:1355:10: warning: 'void* memset(void*, int, size_t)' clearing an object of non-trivial type 'struct Scoring::PawnHashEntry::PawnData'; use assignment or value-initialization instead [-Wclass-memaccess]
 1355 |    memset(&entr, '\0', sizeof(PawnHashEntry::PawnData));
      |    ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from scoring.cpp:3:
scoring.h:110:15: note: 'struct Scoring::PawnHashEntry::PawnData' declared here
  110 |        struct PawnData {
      |               ^~~~~~~~

This would also be the time to tell you that my build scripts for Arasan can be found here: https://github.com/ChessCom/ccc-configs/blob/master/dockers/arasan.Dockerfile . I recently was able to open-source all of the build scripts at CCC. I've done my best with all engines over the last year+ to make sure I'm building as optimally as I can. If there is anything better to do, or changes to make, please feel free to let me know, either in that repo, via my email (andrew.github@grantnet.us), or Discord (agethereal)

Note: The CCC machine is a 2xEPYC 7H12, a zen2 CPU, so its BMI2 support is present, but not good for PEXT/PDEP. I'm happy to run any dockerfile you can provide, if you want a specific version of a compiler for example.

jdart1 commented 4 months ago

I have not been worrying about this warning, because the code works, even though it may be improper to initialize a complex structure this way. In any case, my intent is to remove the HCE except for endgame code.

jdart1 commented 4 months ago

Build script looks ok but it is recommended to use Clang as the compiler (the Clang optimizer does a much better job on the NNUE vector code). Can specify by adding CC=clang to the make command line (need then also to ensure clang is available).

AndyGrant commented 4 months ago

I believe that entr = {} is considered the C++ ism for clearing it. But as you said, this is not important at all :)

I performed a "go movetime 30000" after setting uci/ucinewgame/position with the g++ compile. I got 429129 nodes per second. With clang++, I got 582866 nps. Quite a gain. I've updated Arasan for the currently running events.

I had a similar experience with gcc vs clang for Ethereal. In time, as I improved the NNUE code, I saw very minor gains with clang, but big gains with gcc. The same exists for Torch, actually.

Please feel free to close this issue, if you don't have any more suggestions for build script changes. https://github.com/ChessCom/ccc-configs/commit/5ac14f66b2b7b7c36ac950fb0990d9a2ad43b2d3