-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Possible data race #2933
Comments
To reproduce outside of CI, try: make clean && make -j2 ARCH=x86-64 sanitize=thread optimize=no debug=yes build
cat << EOF > tsan.supp
race:TTEntry::move
race:TTEntry::depth
race:TTEntry::bound
race:TTEntry::save
race:TTEntry::value
race:TTEntry::eval
race:TTEntry::is_pv
race:TranspositionTable::probe
race:TranspositionTable::hashfull
EOF
export TSAN_OPTIONS="suppressions=./tsan.supp"
cat << EOF > inp
setoption name Use NNUE value true
bench 16 2 13 default depth
EOF
./stockfish < inp |
This shows that the memory which occurs race condition was allocated in the line 64 of uci.cpp. Line 68 in 84f3e86
The address of the first element seems to be shared between threads in the line 217 of thread.cpp. Line 217 in 84f3e86
I think that this may cause data race. |
I think the underlying reason is that previously the state for position rootpos was readonly, now it seems it is not. See near line 208 of thread.cpp:
I won't be able to look into that soon, so if somebody comes up with a solution. |
the stateInfo at the rootPos is no longer read-only, as the NNUE accumulator is part of it. Threads can thus not share this object and need their own copy. tested for no regression https://tests.stockfishchess.org/tests/view/5f3022239081672066536bce LLR: 2.96 (-2.94,2.94) {-1.50,0.50} Total: 52800 W: 6843 L: 6802 D: 39155 Ptnml(0-2): 336, 4646, 16399, 4679, 340 fixes official-stockfish#2933 No functional change
the stateInfo at the rootPos is no longer read-only, as the NNUE accumulator is part of it. Threads can thus not share this object and need their own copy. tested for no regression https://tests.stockfishchess.org/tests/view/5f3022239081672066536bce LLR: 2.96 (-2.94,2.94) {-1.50,0.50} Total: 52800 W: 6843 L: 6802 D: 39155 Ptnml(0-2): 336, 4646, 16399, 4679, 340 closes official-stockfish/Stockfish#2957 fixes official-stockfish/Stockfish#2933 No functional change
the stateInfo at the rootPos is no longer read-only, as the NNUE accumulator is part of it. Threads can thus not share this object and need their own copy. tested for no regression https://tests.stockfishchess.org/tests/view/5f3022239081672066536bce LLR: 2.96 (-2.94,2.94) {-1.50,0.50} Total: 52800 W: 6843 L: 6802 D: 39155 Ptnml(0-2): 336, 4646, 16399, 4679, 340 closes official-stockfish/Stockfish#2957 fixes official-stockfish/Stockfish#2933 No functional change
the stateInfo at the rootPos is no longer read-only, as the NNUE accumulator is part of it. Threads can thus not share this object and need their own copy. tested for no regression https://tests.stockfishchess.org/tests/view/5f3022239081672066536bce LLR: 2.96 (-2.94,2.94) {-1.50,0.50} Total: 52800 W: 6843 L: 6802 D: 39155 Ptnml(0-2): 336, 4646, 16399, 4679, 340 closes official-stockfish#2957 fixes official-stockfish#2933 No functional change
While integrating NNUE bench in CI, the thread sanitizer reports a data race, which I presumably have not seen on my by-hand tests:
#2931
https://travis-ci.org/github/official-stockfish/Stockfish/jobs/715961393
like
@nodchip @dorzechowski @mstembera any idea if there are data structures shared between the threads that should not be. It appears to refer to pos.state()->accumulator
The text was updated successfully, but these errors were encountered: