1
0
Fork 0
mirror of https://github.com/sockspls/badfish synced 2025-04-30 00:33:09 +00:00
Commit graph

4087 commits

Author SHA1 Message Date
VoyagerOne
722e1e0da6 Remove redundant if-statements
No functional change

Closes #1173
2017-07-27 02:14:18 -07:00
mstembera
973ede008a Tuned PSQT using a custom tuner.
bench: 5878420

Closes #1177
2017-07-23 17:35:44 -07:00
VoyagerOne
a6ae2d3a31 Simplify aspiration window
Don't modify alpha window on fail-high

Bench: 5875983

Closes #1172
2017-07-23 17:25:23 -07:00
Joost VandeVondele
272e4d1ac7 Faster travis checks
in the last month a couple of timeouts have been seen in travis valgrind testing, leading to undesired false positives. The precise cause of this is unclear: a normal valgrind instrumented run is about 6min, the timeout is 10min. Either there are rare hangs (not reproduced locally), or maybe the actual runtime fluctuates on the travis infrastructure (which uses VMs on AWS as far as I know). This patch leads to roughly a 2x speedup of the instrumented testing by reducing the depth from 10 to 9. If timeouts persist, it needs further analysis.

No functional change.

Closes #1171
2017-07-23 17:23:14 -07:00
Marco Costalba
e551afbab7 Move game_phase() to material.cpp
For some reason, although game phase is used
only in material, it is computed in Position.

Move computation to material, where it belongs,
and remove the useless call chain.

No functional change.
2017-07-15 07:28:38 +02:00
Joona Kiiski
d31f068312 Revert "Remove questionable gcc flags from profile-build"
This reverts commit 0371a8f8c4.
2017-07-13 16:36:27 -07:00
joergoster
377d77dbe9 Provide selective search depth info for each pv move
No functional change

Closes #1166
2017-07-13 16:30:03 -07:00
Joost VandeVondele
36a93d90f7 Move stop signal to Threads
Instead of having Signals in the search namespace,
make the stop variables part of the Threads structure.
This moves more of the shared (atomic) variables towards
the thread-related structures, making their role more clear.

No functional change

Closes #1149
2017-07-13 16:08:37 -07:00
Joona Kiiski
0371a8f8c4 Remove questionable gcc flags from profile-build
Optimization options for official stockfish should be
consistent, easy, future proof and simple.

We don't want to optimize for any specific version of gcc

No functional change

Closes #1165
2017-07-08 14:20:46 -07:00
GuardianRM
c8e5384c3a Queen vs. Minors imbalance
Addition of correction values in case of Imbalance of queens,
depending on the number of light pieces on the side without a queen.

Passed patch:

STC:
LLR: 2.95 (-2.94,2.94) [0.00,5.00]
Total: 29036 W: 5379 L: 5130 D: 18527

LTC:
LLR: 2.96 (-2.94,2.94) [0.00,5.00]
Total: 13680 W: 1836 L: 1674 D: 10170

Bench: 6258930

Closes #1155
2017-07-08 14:14:14 -07:00
Marco Costalba
802fca6fdd Don't uselessy share rootDepth
It is not needed becuase the only case is a real special
one (bench on depth with many threads) and can be easily
rewritten to avoid sharing rootDepth.

Verified with ThreadSanitizer.

No functional change.

Closes #1159
2017-07-02 22:06:47 -07:00
Marco Costalba
01b6cdb76b Fix some warnings with clang static analyzer
Only one remains (also in tbprobe.cpp), but is bougus.

As a side note, tbprobe.cpp is almost clean, only the last 3
functions probe_wdl(), root_probe() and root_probe_wdl()
are still the original ones and are quite hacky.

Somewhere in the future we will reformat also the last 3
ones. The reason why has not been done before it is because
these functions are really wrong by design and should be
rewritten entirely, not only reformatted.

No functional change.

Closes #1160
2017-07-02 22:02:11 -07:00
Marco Costalba
c0cb713a00 Indentation fix in index()
No functional change.

Closes #1158
2017-07-02 22:00:29 -07:00
Alain SAVARD
6d24ef8585 Tidy up
No functional change

Closes #1148
2017-07-02 21:53:45 -07:00
mstembera
69eb391cd7 Magic::index()
Make magic_index() a member of Magic since it uses all it's members
and keep us from having to pass the function pointer around to
init_magics().

No functional change

Closes #1146
2017-06-28 17:11:17 -07:00
Joost VandeVondele
7e897a64f2 Remove race suppression.
Pull #1134 fixed another race, so that can be removed from the thread sanitizer suppressions.

No functional change.

Closes #1150
2017-06-28 17:06:52 -07:00
Marco Costalba
05513a6641 Only main thread checks time
The main change of the patch is that now time check
is done only by main thread. In the past, before lazy
SMP, we needed all the threds to check for available
time because main thread could have been blocked on
a split point, now this is no more the case and main
thread can do the job alone, greatly simplifying the logic.

Verified for regression testing on STC with 7 threads:
LLR: 2.96 (-2.94,2.94) [-3.00,1.00]
Total: 11895 W: 1741 L: 1608 D: 8546

No functional change.

Closes #1152
2017-06-28 17:03:35 -07:00
Marco Costalba
fa1e3427bd Simplify pos_is_ok()
Now we don't need anymore the tricky pointer to
show the failed test. Added some few tests too.

Also small rename in see_ge() while there.

No functional change

Closes #1151
2017-06-28 16:54:59 -07:00
VoyagerOne
77342126d8 Increase reduction if tt-move is a capture
The idea is that chances are the tt-move is best and will be difficult to raise alpha when playing a quiet move.

STC:
LLR: 2.95 (-2.94,2.94) [0.00,5.00]
Total: 7582 W: 1415 L: 1259 D: 4908

LTC:
LLR: 2.97 (-2.94,2.94) [0.00,5.00]
Total: 59553 W: 7885 L: 7573 D: 44095

Bench: 5725676

Closes #1147
2017-06-21 14:06:05 -07:00
snicolet
612d93234b Improve readability of evaluation functions
This patch puts the evaluation helper functions inside EvalInfo struct, which simplifies a bit their signature and (most importantly, IMHO) makes their C++ code much cleaner and simpler to read (by removing the "ei." qualifiers all around in evaluate.cpp).

Also rename the EvalInfo struct into Evaluation class to get a natural invocation v = Evaluation(p).value() to evaluation position p.

The downside is an increase of 20 lines in evaluate.cpp (for the prototypes of the helper functions). The upsides are better readability and a speed-up of 0.6% (by generating all the helpers for the NO_TRACE case together, which helps the instruction cache).

No functional change

Closes #1135
2017-06-21 14:01:59 -07:00
VoyagerOne
0149a4c3d6 Update Top CPU - Bench: 6599721
Closes #1145
2017-06-21 13:47:10 -07:00
Joona Kiiski
336901fdb0 Revert "Prefetch earlier in qsearch()"
This reverts commit b73016bb41.

No functional change

Closes #1144
2017-06-21 13:45:03 -07:00
Joost VandeVondele
3cb0200459 Fix four data races.
the nodes, tbHits, rootDepth and lastInfoTime variables are read by multiple threads, but not declared atomic, leading to data races as found by -fsanitize=thread. This patch fixes this issue. It is based on top of the CI-threading branch (PR #1129), and should fix the corresponding CI error messages.

The patch passed an STC check for no regression:

http://tests.stockfishchess.org/tests/view/5925d5590ebc59035df34b9f
LLR: 2.96 (-2.94,2.94) [-3.00,1.00]
Total: 169597 W: 29938 L: 30066 D: 109593

Whereas rootDepth and lastInfoTime are not performance critical, nodes and tbHits are. Indeed, an earlier version using relaxed atomic updates on the latter two variables failed STC testing (http://tests.stockfishchess.org/tests/view/592001700ebc59035df34924), which can be shown to be due to x86-32 (http://tests.stockfishchess.org/tests/view/592330ac0ebc59035df34a89). Indeed, the latter have no instruction to atomically update a 64bit variable. The proposed solution thus uses a variable in Position that is accessed only by one thread, which is copied every few thousand nodes to the shared variable in Thread.

No functional change.

Closes #1130
Closes #1129
2017-06-21 13:37:58 -07:00
Alain SAVARD
2c237da546 Misc coding style fixes
a few comment and blank fixes.

No functional change

Closes #1141
2017-06-16 19:55:30 -07:00
snicolet
b73016bb41 Prefetch earlier in qsearch()
Closes #1139
2017-06-16 19:52:38 -07:00
Marco Costalba
27ba611a3d Better naming in endgame code
And small clean-up of magic bitboards code.

No functional change.

Closes #1138
2017-06-16 19:33:44 -07:00
Brian Sheppard
f907d5b7d9 Move depth calculation in probCut
The change passed an STC regression:

LLR: 2.95 (-2.94,2.94) [-3.00,1.00]
Total: 59350 W: 10793 L: 10738 D: 37819

I verified that there was no change in performance on my machine, but of course YMMV:

Results for 40 tests for each version:

                Base      Test      Diff
        Mean    2014338   2016121   -1783
        StDev   62655     63441     3860

p-value: 0.678
speedup: 0.001

No functional change.

Closes #1137
2017-06-16 19:30:19 -07:00
Joost VandeVondele
ebc563059c Call TT.new_search() earlier.
TT.new_search() was being called by mainThread in Thread::search(). However, mainThread is the last to start searching, and helper threads could reach a measured rootDepth 10 (on 64 cores) before mainThread increments the TT generation. Fixed by moving the call to MaintThread::search() before helper threads start searching.

No functional change.

Closes #1134
2017-06-16 19:20:01 -07:00
mstembera
659990b43f Reordering magic data
Gather all magic relevant data into a struct.

This changes memory layout putting everything necessary for processing a single square
in the same memory location thus speeding up access.

Original patch by @snicolet

No functional change.

Closes #1127
Closes #1128
2017-06-06 10:22:12 -07:00
atumanian
6d89d0b64a Don't score as an immediate draw 2-fold repetitions of the root position
In the current version a search stops when the current position is the same as
any position earlier in the search stack,
including the root position but excluding positions before the root.
The new version makes an exception for repeating the root position.

This gives correct scores for moves in the MultiPV > 1 mode.

Fixes #948 (see it for the detailed description of the bug).

LTC: http://tests.stockfishchess.org/tests/view/587910bc0ebc5915193f754b
ELO: 0.38 +-1.7 (95%) LOS: 66.8%
Total: 40000 W: 5166 L: 5122 D: 29712

STC: http://tests.stockfishchess.org/tests/view/5922e6230ebc59035df34a50
LLR: 2.94 (-2.94,2.94) [-3.00,1.00]
Total: 94622 W: 17059 L: 17064 D: 60499

 LTC: http://tests.stockfishchess.org/tests/view/59273a000ebc59035df34c03
LLR: 2.96 (-2.94,2.94) [-3.00,1.00]
Total: 61259 W: 7965 L: 7897 D: 45397

Bench: 6599721

Closes #1126
2017-06-06 10:15:13 -07:00
Joost VandeVondele
1781439fc2 use auto& for histories
No functional change.

Closes #1113
2017-06-06 09:56:13 -07:00
Marco Costalba
ecd3218b6b History code rewrite (#1122)
Rearrange and rename all history heuristic code. Naming
is now based on chessprogramming.wikispaces.com conventions
and the relations among the various heuristics are now more
clear and consistent.

No functional change.
2017-05-26 08:42:50 +02:00
Nathan Rugg
24df0f72c0 Changed spelling back to "Bishops" in eval output
No functional change.

Closes #1124
2017-05-23 20:27:30 -07:00
VoyagerOne
1d31065e1d Evasion Pruning Tweak
Use moveCount to decide when to prune for evasion pruning

STC:
LLR: 2.95 (-2.94,2.94) [0.00,5.00]
Total: 24476 W: 4518 L: 4289 D: 15669

LTC:
LLR: 2.96 (-2.94,2.94) [0.00,5.00]
Total: 18362 W: 2476 L: 2298 D: 13588

Bench: 6469989

Closes #1120
2017-05-21 18:27:57 -07:00
snicolet
c216dcbe7b Do check analysis later in the game
The previous patch has added a fraction of the king danger score to the
endgame score of the tapered eval, so it seems natural to perform the
king danger computation later in the endgame.

With this patch we extend the limit of such check analysis down to the
material of Rook+Knight, when we have at least two pieces attacking the
opponent king zone.

Passed STC:
LLR: 2.95 (-2.94,2.94) [0.00,5.00]
Total: 7446 W: 1409 L: 1253 D: 4784
http://tests.stockfishchess.org/tests/view/591c097c0ebc59035df3477c

and LTC:
LLR: 2.96 (-2.94,2.94) [0.00,5.00]
Total: 14234 W: 1946 L: 1781 D: 10507
http://tests.stockfishchess.org/tests/view/591c24f10ebc59035df3478c

Bench: 5975183

Closes #1121
2017-05-17 18:24:43 -07:00
snicolet
cf893bcded Use a fraction of king danger in endgame score
When SF has an attack on the opponent king in one flank, the huge
midgame -> endgame gradient of the tapered eval prevents us to properly
evaluate neutral exchanges on the other flank as the current king
danger score is a pure midgame term. This may affect SF's ability to
switch to defense in some positions. We add a small contribution
of the king danger to the endgame score to limit this
effect.

Again suggested in the following forum thread:
https://groups.google.com/forum/?fromgroups=#!topic/fishcooking/xrUCQ7b0ObE

Passed STC:
LLR: 2.96 (-2.94,2.94) [0.00,5.00]
Total: 12719 W: 2371 L: 2192 D: 8156
http://tests.stockfishchess.org/tests/view/5919761a0ebc59035df3468f

And LTC:
LLR: 2.95 (-2.94,2.94) [0.00,5.00]
Total: 31293 W: 4194 L: 3974 D: 23125
http://tests.stockfishchess.org/tests/view/591980450ebc59035df34695

Bench: 5961548

Closes #1118
2017-05-17 18:19:47 -07:00
Joost VandeVondele
732aa34e3d Fix memory access in Search::clear()
Fixes a bug in Search::clear, where the filling of CounterMoveStats&, overwrote (currently presumably unused) memory because sizeof(cm) returns the size in bytes, whereas elements was needed.

No functional change

Closes #1119
2017-05-17 18:15:01 -07:00
snicolet
862934d7ae Limit king ring to eight squares
In current master the size of the king ring varies abruptly from eight
squares when the king is in g8, to 12 squares when it is in g7. Because
the king ring is used for estimating attack strength, this may lead to
an overestimation of king danger in some positions. This patch limits
the king ring to eight squares in all cases.

 Inspired by the following forum thread:
https://groups.google.com/forum/?fromgroups=#!topic/fishcooking/xrUCQ7b0ObE

Passed STC:
LLR: 2.97 (-2.94,2.94) [0.00,5.00]
Total: 9244 W: 1777 L: 1611 D: 5856

and LTC:
LLR: 2.96 (-2.94,2.94) [0.00,5.00]
Total: 87121 W: 11765 L: 11358 D: 63998

Bench: 6121121

Closes #1115
2017-05-15 19:28:37 -07:00
Joost VandeVondele
7edd1f7ccd Execute an implied ucinewgame at startup
execute an implied ucinewgame upon entering the UCI::loop,
to make sure that searches starting with and without an (optional) ucinewgame
command yield the same search.

This is needed now that seach::clear() initializes tables to non-zero default values.

No functional change

Closes #1101
Closes #1104
2017-05-15 18:54:13 -07:00
Marco Costalba
0c1f119069 Default argument for see_ge()
No functional change.

Closes #1111
2017-05-10 18:20:45 +02:00
Joost VandeVondele
99d914985f Remove int to int conversion, unused include.
No functional change.

Closes #1112
2017-05-09 18:36:32 -07:00
FauziAkram
6b4959e3e0 Linear Protector bonus by distance
Replacing the old Protector table with a simple linear formula which takes into account a different slope for each different piece type.

The idea of this simplification of Protector is originated by Alain (Rocky)

STC: LLR: 2.95 (-2.94,2.94) [-3.00,1.00]
Total: 70382 W: 12859 L: 12823 D: 44700

LTC: LLR: 2.95 (-2.94,2.94) [-3.00,1.00]
Total: 61554 W: 8098 L: 8031 D: 45425

Bench: 6107863

Closes #1099
2017-05-07 21:11:51 -07:00
IIvec
ae97941628 King safety and rook mobility parameters tweak
STC:
LLR: 2.95 (-2.94,2.94) [0.00,4.00]
Total: 19280 W: 3595 L: 3373 D: 12312

LTC:
LLR: 2.95 (-2.94,2.94) [0.00,4.00]
Total: 221405 W: 28940 L: 28220 D: 164245

Bench: 6506664

Closes #1105
2017-05-07 20:57:29 -07:00
Stefan Geschwentner
69ec09bd4b Bonus for pawn scrifice which create passed pawn
STC:
LLR: 2.95 (-2.94,2.94) [0.00,5.00]
Total: 16752 W: 3141 L: 2944 D: 10667

LTC:
LLR: 3.34 (-2.94,2.94) [0.00,5.00]
Total: 33928 W: 4544 L: 4300 D: 25084

Bench: 5639223

Closes #1092
2017-05-07 20:51:52 -07:00
Marco Costalba
25296547d0 Move Pieces[] out of global visibility
It is an helper array used only in position.cpp

Also small code tidy up while there.

No functional change.

Closes #1106
2017-05-07 20:20:02 -07:00
mstembera
321a27fbe3 Avoid *begin always being included in the sorted list regardless of its value.
This was a minor criticism by @zamar in the original pull request
https://github.com/official-stockfish/Stockfish/pull/1065
necessitating a comment explanation.

No functional change.

Closes #1091
2017-05-07 20:15:56 -07:00
joergoster
8b15961349 Fix multiPV issue #502
In general, this patch handles the cases where we don't have a valid score for each PV line in a multiPV search. This can happen if the search has been stopped in an unfortunate moment while still in the aspiration loop. The patch consists of two parts.

Part 1: The new PVIdx was already part of the k-best pv's in the last iteration, and we therefore have a valid pv and score to output from the last iteration. This is taken care of with:

      bool updated = (i <= PVIdx && rootMoves[i].score != -VALUE_INFINITE);

Case 2: The new PVIdx was NOT part of the k-best pv's in the last iteration, and we have no valid pv and score to output. Not from the current nor from the previous iteration. To avoid this, we are now also considering the previous score when sorting, so that the PV lines with no actual but with a valid previous score are pushed up again, and the previous score can be displayed.

  bool operator<(const RootMove& m) const {
    return m.score != score ? m.score < score : m.previousScore < previousScore; } // Descending sort

I also added an assertion in UCI::value() to possibly catch similar issues earlier.

No functional change.

Closes #502
Closes #1074
2017-05-03 19:46:40 -07:00
Joost VandeVondele
e9f26cccdd gcc 7 port
Testing the release candidate revealed only one minor issue, namely a new warning -Wimplicit-fallthrough (part of -Wextra) triggers in the movepicker. This can be silenced by adding a comment, and once we move to c++17 by adding a standard annotation [[fallthrough]];.

No functional change.

Closes #1090
2017-04-30 08:43:43 -07:00
VoyagerOne
a18c2c2c3f Don't do InCheck Pruning at the root of QS
STC:
LLR: 2.96 (-2.94,2.94) [0.00,5.00]
Total: 34603 W: 6441 L: 6167 D: 21995

LTC:
LLR: 2.97 (-2.94,2.94) [0.00,5.00]
Total: 24474 W: 3274 L: 3076 D: 18124

Bench: 5934421

Closes #1089
2017-04-28 20:40:45 -07:00
Rocky640
b948b037a5 Remove cap in kingDanger initialization
Passed STC
http://tests.stockfishchess.org/tests/view/58fd53be0ebc59035df33eb5
LLR: 2.95 (-2.94,2.94) [-3.00,1.00]
Total: 52048 W: 9397 L: 9329 D: 33322

Passed LTC
http://tests.stockfishchess.org/tests/view/58ff9e0a0ebc59035df33f5c
LLR: 2.95 (-2.94,2.94) [-3.00,1.00]
Total: 35382 W: 4650 L: 4549 D: 26183

Bench: 5872717

Closes #1087
2017-04-28 20:38:03 -07:00