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

3673 commits

Author SHA1 Message Date
Marco Costalba
3c0fe1d9b2 Rework lock protecting
When changing 'search' and 'splitPointsSize' we have to
use thread locks, not split point ones, because can_join()
is called under the formers.

Verified succesfully with 24 hours toruture tests with 20
cores machine by Louis Zulli: it does not hangs.

Verifyed for no regressions with STC, 7 threads:
LLR: 2.94 (-2.94,2.94) [-3.00,1.00]
Total: 52804 W: 8159 L: 8087 D: 36558

No functional change.
2015-09-30 10:47:20 +02:00
Jonathan Calovski
77b4f4c2e7 Refine ranks and increase resulting bonus.
STC:
LLR: 2.94 (-2.94,2.94) [0.00,4.00]
Total: 272379 W: 51773 L: 50658 D: 169948

LTC:
LLR: 3.06 (-2.94,2.94) [0.00,4.00]
Total: 41504 W: 6555 L: 6273 D: 28676

bench: 7658406

Resolves #430
2015-09-19 09:14:35 -07:00
mstembera
68fbb1e052 Reduce writes in TT::probe().
Only refresh TT entry when it's really necessary.
This should give a small speed boost for some machines.
And it's a risk-free change.

No functional change.

Resolves #429
2015-09-17 17:33:40 -07:00
mstembera
01fab4d432 Remove unnecessary generation check in TT save
Checking for generation is unnecessary because if the key matches then the entry was probed and refreshed earlier.

STC 2MB
LLR: 2.96 (-2.94,2.94) [-3.00,1.00]
Total: 57391 W: 10671 L: 10613 D: 36107
http://tests.stockfishchess.org/tests/view/55ef59fa0ebc5976a2d6da5d

LTC 8MB
LLR: 2.95 (-2.94,2.94) [-3.00,1.00]
Total: 60732 W: 9260 L: 9199 D: 42273
http://tests.stockfishchess.org/tests/view/55ef8fe60ebc5976a2d6da6b

STC 16MB
LLR: 2.95 (-2.94,2.94) [-4.00,0.00]
Total: 23443 W: 4369 L: 4293 D: 14781
http://tests.stockfishchess.org/tests/view/55ef8fe60ebc5976a2d6da6b

No functional change

Resolves #427
2015-09-17 17:13:45 -07:00
Stefan Geschwentner
660c38f781 Scales the endgame score by the number of pawns.
Credits goes also to Stephane Nicolet for his great idea of scaling by pawns.

STC:
LLR: 2.95 (-2.94,2.94) [0.00,5.00]
Total: 9994 W: 1929 L: 1760 D: 6305

LTC:
LLR: 2.96 (-2.94,2.94) [0.00,5.00]
Total: 11240 W: 1789 L: 1626 D: 7825

bench 7298564

Resolves #423
2015-09-15 05:55:09 -07:00
Joona Kiiski
613dc66c12 Careful SMP locking - Fix very occasional hangs
Louis Zulli reported that Stockfish suffers from very occasional hangs with his 20 cores machine.

Careful SMP debugging revealed that this was caused by "a ghost split point slave", where thread
was marked as a split point slave, but wasn't actually working on it.

The only logical explanation for this was double booking, where due to SMP race, the same thread
is booked for two different split points simultaneously.

Due to very intermittent nature of the problem, we can't say exactly how this happens.

The current handling of Thread specific variables is risky though. Volatile variables are in some
cases changed without spinlock being hold. In this case standard doesn't give us any kind of
guarantees about how the updated values are propagated to other threads.

We resolve the situation by enforcing very strict locking rules:
- Values for key thread variables (splitPointsSize, activeSplitPoint, searching)
can only be changed when the thread specific spinlock is held.
- Structural changes for splitPoints[] are only allowed when the thread specific spinlock is held.
- Thread booking decisions (per split point) can only be done when the thread specific spinlock is held.

With these changes hangs didn't occur anymore during 2 days torture testing on Zulli's machine.

We probably have a slight performance penalty in SMP mode due to more locking.

STC (7 threads):
ELO: -1.00 +-2.2 (95%) LOS: 18.4%
Total: 30000 W: 4538 L: 4624 D: 20838

However stability is worth more than 1-2 ELO points in this case.

No functional change

Resolves #422
2015-09-10 19:15:43 +01:00
mstembera
3e2591d83c Minor clean up of some function parameters
No function change

Resolves #416
2015-09-07 20:17:39 +01:00
mstembera
46b5a5f0db Fix syzygy en passant issue
v = value without ep capture being considered
v1 = value of the ep capture

The correct logic is:
if without e.p. capture we are losing, and the value of e.p is either draw, or win or "loss, but 50 move rule saves us", then we should use the value of ep capture.

Credit and thanks to syzygy1 and lantonov !

No functional change (except with syzygy bases)

Resolves #415
Resolves #394
2015-09-06 22:19:33 +01:00
gguliash
84a641b8bb A small code simplification
No functional change

Resolves #411
2015-08-30 19:58:32 +01:00
Joona Kiiski
7f300a7698 History gravity
Instead of using hard coded Min and Max values for history,
always adjust the old value slightly downwards before adding a new value.

The adjustment acts like gravity that prevents the value escaping too
far from zero.

Bench: 8020484

Resolves #407
2015-08-29 15:09:00 +01:00
Marco Costalba
087b638f6c Reformat trace code
Apart from usual renaiming, take advantage of
C++11 function template default parmeter to
get rid of Eval trampoline functions.

Some triviality fixes while there.

No functional change.
2015-08-29 08:28:01 +02:00
lucasart
7ad85fca6d Prune castling moves
Align the behaviour with reductions. Initially castling moves had to be
treated differently, because the SEE did not handle them correctly. But now it
does.

STC:
LLR: 2.96 (-2.94,2.94) [-3.00,1.00]
Total: 83750 W: 15722 L: 15711 D: 52317

LTC:
LLR: 2.95 (-2.94,2.94) [-3.00,1.00]
Total: 97183 W: 15120 L: 15115 D: 66948

bench 7759837

Resolves #403
2015-08-28 20:33:12 +01:00
mstembera
bf6bc1b37b Better document entry age calculation used in TT replace.
No functional change.

Resolves #401
Resolves #400
2015-08-20 20:27:06 +01:00
lucasart
c052e03426 Retire dangerous flag
Replace by its value where it is used. Code is more clear that
way.

No functional change.

Resolves #402
2015-08-20 20:18:23 +01:00
Alain SAVARD
69a1a808c8 Retire PawnSafePush bonus
PawnSafePush, with the value S(5,5) proved not "necessary"
possibly due to recent changes to MobilityArea and other changes to Connected bonus.

STC:
LLR: 3.22 (-2.94,2.94) [-3.00,1.00]
Total: 98528 W: 18757 L: 18759 D: 61012

LTC:
LLR: 5.30 (-2.94,2.94) [-3.00,1.00]
Total: 204194 W: 31698 L: 31734 D: 140762

Bench: 7620871

Resolves #396
2015-08-17 19:32:43 +01:00
Marco Costalba
600234f2e2 Reformat PassedPawnsBonus
Align to SF coding standards.

No functional change.
2015-08-15 16:04:16 +02:00
mstembera
9dbb3ae8b2 TT entry value based on depth and relative age
Calculate TT replace value as depth minus eight times relative age.

STC 2MB
LLR: 2.96 (-2.94,2.94) [0.00,4.00]
Total: 45258 W: 8595 L: 8279 D: 28384

LTC 8MB
LLR: 2.95 (-2.94,2.94) [0.00,4.00]
Total: 56401 W: 8809 L: 8489 D: 39103

STC 16MB
LLR: 2.96 (-2.94,2.94) [-4.00,0.00]
Total: 34764 W: 6565 L: 6529 D: 21670

Bench: 9069474

Resolves #395
2015-08-15 12:24:48 +01:00
DiscanX
f4ace94f91 Tuned values for mid and end game passed pawns.
STC :
LLR: 2.96 (-2.94,2.94) [0.00,4.00]
Total: 22691 W: 4468 L: 4228 D: 13995

LTC :
LLR: 2.95 (-2.94,2.94) [0.00,4.00]
Total: 13620 W: 2216 L: 2023 D: 9381

Bench: 8384669

Resolves #391
2015-08-10 01:26:59 +08:00
mstembera
1aae35b8b7 Revert TT replacement strategy changes (#380)
It could cause problems with high depths and long time controls

Bench: 8626315

Resolves #390
2015-08-08 17:49:53 +01:00
Marco Costalba
e6310b3469 Rename Position::list
Use Position::square and Position::squares instead.

This allow us to remove king_square(), simplify
endgames and to have more naming uniformity.

Moreover, this is a prerequisite step in case
in the future we decide to retire piece lists
altoghter and use pop_lsb() to loop across
pieces and serialize the moves. In this way
we just need to change definition of Position::square
to something like:

template<PieceType Pt> inline
Square Position::square(Color c) const {
  return lsb(byColorBB[c]);
}

No functional change.
2015-08-04 09:51:06 +02:00
Marco Costalba
68d61b80c6 Simplify IID depth formula
Restore original formula messed up during
half-ply removal.

STC
LLR: 4.11 (-2.94,2.94) [-3.00,1.00]
Total: 21349 W: 4091 L: 3909 D: 13349

LTC
LLR: 5.42 (-2.94,2.94) [-3.00,1.00]
Total: 52819 W: 8321 L: 8122 D: 36376

bench: 8040572
2015-07-30 09:54:25 +02:00
VoyagerOne
a2410227cc PV refutation penalty
Extra penalty for PV move in previous ply when it gets refuted.

STC:
LLR: 4.49 (-2.94,2.94) [-1.50,4.50]
Total: 41094 W: 7889 L: 7620 D: 25585

LTC:
LLR: 2.95 (-2.94,2.94) [0.00,6.00]
Total: 12304 W: 1967 L: 1811 D: 8526

Bench: 8373608

Resolves #386
2015-07-30 00:51:49 +08:00
Alain SAVARD
4a6d59c6c7 MobilityArea (simplified)
Based off of Pull request #383:

Include squares occupied by some pawns in the MobilityArea
a) not blocked
b) on rank 4 and above
c) or captures

Passed STC
LLR: 2.95 (-2.94,2.94) [-1.50,4.50]
Total: 8157 W: 1644 L: 1516 D: 4997

And LTC
LLR: 2.97 (-2.94,2.94) [0.00,6.00]
Total: 26086 W: 4274 L: 4051 D: 17761

-----------

Then, a simplification test failed, trying to remove b and c)
LLR: -2.95 (-2.94,2.94) [-3.00,1.00]
Total: 6048 W: 1117 L: 1288 D: 3643

Another simplification test, was run to remove just (c)
Passed STC
LLR: 2.96 (-2.94,2.94) [-3.00,1.00]
Total: 28073 W: 5364 L: 5255 D: 17454

And LTC
LLR: 2.96 (-2.94,2.94) [-3.00,1.00]
Total: 34652 W: 5448 L: 5348 D: 23856

A parameter tweak test showed that changing b) for "on rank 3 and above"
does not work
LLR: -2.95 (-2.94,2.94) [0.00,4.00]
Total: 5233 W: 937 L: 1077 D: 3219

Finally, a small rewrite, and we have this version

Include squares occupied by some pawns in the MobilityArea which are
a) not blocked
b) on rank 4 and above

Bench: 8977899

Resolves #385
2015-07-30 00:47:51 +08:00
mstembera
51330414c4 Tuned version of TT replacement policy
If the used multiplier of 8 was any number larger than DEPTH_MAX
this would be a non functional patch.

STC 2MB
LLR: 2.96 (-2.94,2.94) [-1.50,4.50]
Total: 16353 W: 3216 L: 3066 D: 10071
http://tests.stockfishchess.org/tests/view/55a6d0630ebc590abbe1babd

LTC 8MB
LLR: 2.95 (-2.94,2.94) [0.00,4.00]
Total: 134618 W: 21276 L: 20716 D: 92626
http://tests.stockfishchess.org/tests/view/55a74d760ebc590abbe1bad6

STC 16MB
LLR: 2.96 (-2.94,2.94) [-4.00,0.00]
Total: 22549 W: 4257 L: 4178 D: 14114
http://tests.stockfishchess.org/tests/view/55a9a2f90ebc590abbe1bb16

Bench: 7372460

Resolves #380
2015-07-25 00:33:53 +08:00
Marco Costalba
42b77ea7ee Tidy up in movepick.cpp
Some formattng after recent changes.

No functional change.
2015-07-19 12:38:33 +02:00
Marco Costalba
4095ff0ee5 Fix formatting of previous patch
No functional change.
2015-07-16 08:17:40 +02:00
VoyagerOne
1d977aa79e LMR Simplification: Remove countermove condition
Removed countermove condition for decreasing reduction.

LTC:
LLR: 3.01 (-2.94,2.94) [-3.00,1.00]
Total: 32410 W: 5092 L: 4986 D: 22332

STC:
LLR: 2.95 (-2.94,2.94) [-3.00,1.00]
Total: 24450 W: 4632 L: 4517 D: 15301

Bench: 6943812

Resolves #378
2015-07-15 20:21:14 +01:00
mstembera
d8aeaab79c Consistent TT replace policy
This fixes an inconsistency bug where TT entries were valued differently
depending on which pointer they were accessed through.

STC 2MB
LLR: 2.95 (-2.94,2.94) [-3.00,1.00]
Total: 11301 W: 2176 L: 2038 D: 7087

LTC 8MB
LLR: 2.95 (-2.94,2.94) [-3.00,1.00]
Total: 17732 W: 2870 L: 2745 D: 12117

STC 16MB
LLR: 2.96 (-2.94,2.94) [-4.00,0.00]
Total: 17401 W: 3324 L: 3227 D: 10850

Bench: 8248164

Resolves #377
2015-07-15 20:17:16 +01:00
joergoster
3054db989d Use distance<file>() function in endgame.cpp
This one occurance of distance function was most likely overlooked.

No functional change.

Resolves #376
2015-07-12 20:48:50 +01:00
Marco Costalba
b2edac7075 Remove useless razoring condition
STC:
LLR: 2.96 (-2.94,2.94) [-3.00,1.00]
Total: 20626 W: 3977 L: 3855 D: 12794

LTC:
LLR: 3.10 (-2.94,2.94) [-3.00,1.00]
Total: 87334 W: 13675 L: 13648 D: 60011

Retire also the now unused pawn_on_7th() helper.

bench: 8248166
2015-07-09 08:13:30 +02:00
VoyagerOne
aa0dc16b75 CMH Fix: Exclude captures for TT move refutation penalty
This will make sure we store only quiet moves for TT Penalty.

STC:
LLR: 2.96 (-2.94,2.94) [-1.50,4.50]
Total: 34748 W: 6617 L: 6420 D: 21711

LTC:
LLR: 2.96 (-2.94,2.94) [-3.00,1.00]
Total: 19975 W: 3259 L: 3137 D: 13579

Bench: 8063826

Resolves #373
2015-07-04 14:22:41 +01:00
Marco Costalba
112607bf49 Correctly check for no-makefile compile
Under Windows with MSVC we use the IDE to compile,
in this case we infer some compiler flags usually
set by Makefile.

The condition to check this was wrong, namely when compiling
with mingw under Windows 64 bit we always set IS_64BIT and
USE_BSFQ even if compiled with ARCH=x86-32 (this is how I
found it).

Small code style touches while there.

No functional change.
2015-06-28 10:56:42 +02:00
VoyagerOne
7e9f776fca LMR Tweak: Decrease reduction if cmh>0 && history>0.
STC:
LLR: 2.96 (-2.94,2.94) [-1.50,4.50]
Total: 9627 W: 1879 L: 1748 D: 6000

LTC:
LLR: 2.97 (-2.94,2.94) [0.00,6.00]
Total: 21543 W: 3433 L: 3234 D: 14876

Bench: 8646407

Resolves #370 #371
2015-06-27 09:45:59 +01:00
Marco Costalba
3f1bc9e013 Fix compile on icc
Error is:

  a value of type "int" cannot be assigned to an entity of type "Value"

Also retire the now unused squares_of_color() function.

No functional change.
2015-06-25 05:29:56 +02:00
joergoster
e8cc5c9968 Small coding style fix for Outpost array
No functional change

Resolves #367
2015-06-17 15:02:57 +01:00
lucasart
00563be5cc Retire -Wno-long-long
long long is part of the C++11 standard.

No functional change.

Resolves #364
2015-06-13 16:59:50 +01:00
lucasart
ad87d707ff Simplify outpost evaluation
STC

LLR: 2.95 (-2.94,2.94) [-3.00,1.00]
Total: 114149 W: 21986 L: 22032 D: 70131

LTC

LLR: 2.96 (-2.94,2.94) [-3.00,1.00]
Total: 52232 W: 8468 L: 8396 D: 35368

Bench: 6716940

No functional change

Resolves #363
2015-06-07 09:49:01 +01:00
Vince Negri
7b8ffe0f5d Remove intermediate re-search in LMR
STC:
LLR: 2.96 (-2.94,2.94) [-3.00,1.00]
Total: 20149 W: 3830 L: 3707 D: 12612

LTC:
LLR: 2.95 (-2.94,2.94) [-3.00,1.00]
Total: 45384 W: 7089 L: 7006 D: 31289

Bench: 8110365

Resolves #361
2015-06-05 21:03:10 +01:00
Marco Costalba
c1d3bd2dba Rename stages
Hopefully more clear.

No functional change.
2015-06-04 15:51:45 +02:00
lucasart
5ebdf2f8c8 Tune pawn shelter/storm
STC
LLR: 2.95 (-2.94,2.94) [0.00,4.00]
Total: 31679 W: 6183 L: 5912 D: 19584

LTC
LLR: 2.95 (-2.94,2.94) [0.00,4.00]
Total: 43550 W: 6885 L: 6602 D: 30063

Bench: 9219343

Resolves #360
2015-06-02 12:09:19 -07:00
Stéphane Nicolet
4502a1934f Tweak backward pawns definition
Advanced pawns cannot be backward. Also lower the backward penalty in
endgame.

Passed STC:
LLR: 2.96 (-2.94,2.94) [-1.50,4.50]
Total: 18534 W: 3588 L: 3433 D: 11513

and LTC:
LLR: 2.96 (-2.94,2.94) [0.00,6.00]
Total: 21319 W: 3415 L: 3217 D: 14687

Bench: 7271152

Resolves #359
2015-06-02 12:07:02 -07:00
Marco Costalba
2795aedbc3 Checking for rook color when setting castling
In Chess960 we can have legal positions with
opponent rook in A or H file and with castling
available, for instance:

4k3/pppppppp/8/8/8/8/PPPPPPPP/rR2K3 w Q - 0 1

In those cases we pick up the wrong rook when
setting castling.

Fix it by checking the color of the rook.

Bug reported by Matthew Lai.

No functional change.
2015-05-29 05:38:40 +02:00
lucasart
8e95c39bfa Simplify backward pawn scoring
STC

LLR: 2.96 (-2.94,2.94) [-3.00,1.00]
Total: 52322 W: 10011 L: 9945 D: 32366

LTC

LLR: 2.96 (-2.94,2.94) [-3.00,1.00]
Total: 14143 W: 2334 L: 2203 D: 9606

Bench: 7976423

Resolves #354
2015-05-27 20:05:20 +01:00
Joona Kiiski
80a759d544 Resolve build failure for Mac
Remove '-Wl' switch from gcc arguments when compiling for Mac

No functional change

Resolves #353
2015-05-24 13:07:15 +01:00
lucasart
2e0ec4ad6f Fix merge error for Tuned PSQT
Fall-out from 411e704f

Bench: 7907776

Resolves #352
2015-05-21 19:56:01 +01:00
Stefan Geschwentner
e14046517e Remove Gain Stats
Additionally in futility pruning the margin is raised for compensation.

STC
LLR: 2.96 (-2.94,2.94) [-3.00,1.00]
Total: 48481 W: 9229 L: 9156 D: 30096

LTC
LLR: 2.95 (-2.94,2.94) [-3.00,1.00]
Total: 32058 W: 5134 L: 5031 D: 21893

Bench: 8098149

Resolves #350
2015-05-18 13:59:30 -07:00
lucasart
411e704fdf Tuned PSQT
STC:
LLR: 3.11 (-2.94,2.94) [-0.50,4.50]
Total: 58764 W: 11530 L: 11185 D: 36049

LTC:
LLR: 2.96 (-2.94,2.94) [0.00,4.50]
Total: 282710 W: 46339 L: 45209 D: 191162

Bench: 8512947

Resolves #349
2015-05-18 13:54:45 -07:00
Marco Costalba
ee0371f86e Cleanup work in misc.cpp
Also some code style tidy up of latest patches.

Also renamed checkSq -> checkSquares because it
is a bitboard and not a square.

No functional change.
2015-05-10 09:42:26 +02:00
mstembera
eaeb63f1d0 Smart TT save
Don't overwrite more valuable data with less valuable data

STC 2MB
LLR: 2.96 (-2.94,2.94) [-1.50,4.50]
Total: 21132 W: 4108 L: 3946 D: 13078
http://tests.stockfishchess.org/tests/view/5547d59f0ebc5940ca5d6883

LTC 8MB
LLR: 2.97 (-2.94,2.94) [0.00,6.00]
Total: 13381 W: 2149 L: 1987 D: 9245
http://tests.stockfishchess.org/tests/view/5549b5a80ebc5940ca5d68b9

STC 16MB regression w/ zero effective hash pressure
LLR: 2.96 (-2.94,2.94) [-5.00,0.00]
Total: 18944 W: 3607 L: 3564 D: 11773
http://tests.stockfishchess.org/tests/view/554b0fda0ebc5940ca5d68ea

Bench: 8787152

Resolves #347
2015-05-09 17:43:57 +01:00
lucasart
92dbee7875 Edge distance
Instead of crafting a clever formula to calculate the array offset, simply use a
3 dimensional array. Remove the comment while at it, because now the code is
self-documenting.

No functional change.

Resolves #344
2015-05-09 14:06:19 +01:00