fairy-stockfish / Fairy-Stockfish

chess variant engine supporting Xiangqi, Shogi, Janggi, Makruk, S-Chess, Crazyhouse, Bughouse, and many more
https://fairy-stockfish.github.io/
GNU General Public License v3.0
619 stars 196 forks source link

LARGEBOARDS compiled with msvc running error #21

Closed htomtom closed 5 years ago

htomtom commented 5 years ago

When compiled with msvc using LARGEBOARDS, it seems running unlimitted time. When run into the Bitbases::init() or Threads.set(Options["Threads"]) in main(), the error occurs, throws "access conflict at 0x000000000085C070", stop at the line: repeat |= (db[idx] == UNKNOWN && db[idx].classify(db) != UNKNOWN); when comment line Bitbases::init() , the error throws within set_state( ) module,throws "access conflict at 0x000000009F71798C" stop at the line si->key ^= Zobrist::psq[pc][s];

ianfab commented 5 years ago

Thanks for reporting it. I unfortunately do not have a setup for testing the compilation with MSVC at the moment, but there are a few issues I found in the code that are related to the issues you are seeing:

I hope I will find the time to address this soon. If you are interested, you can also try it yourself. The implementation of the bitboard operations can be analogous to how I generalized it from 64bit to 128bit for GCC: https://github.com/ianfab/Fairy-Stockfish/blob/0811ca24daad29b003c00b00a2bfc520229f4ac9/src/bitboard.h#L379-L383 https://github.com/ianfab/Fairy-Stockfish/blob/0811ca24daad29b003c00b00a2bfc520229f4ac9/src/bitboard.h#L391-L411

htomtom commented 5 years ago

Thanks a lot for your detailed reply. I will try the above methods you mentioned and test them. If I have time, I'll simulate the popcount, lsb and msb operations for msvc, although I do not have much experience with bitboard operation.

ianfab commented 5 years ago

I started to work on it, you can check out the msvc branch. However, I do not even know whether it compiles with MSVC (and I skipped the implementation for 32bit hardware for now). Would be nice if you find the time to test and possibly fix it.

ianfab commented 5 years ago

@htomtom The msvc branch (edit: also merged to master already) works fine with MSVC on appveyor now. Could you please check whether it also works for you locally?

htomtom commented 5 years ago

I start a rough test, and it works well. Nice!