]> git.sesse.net Git - stockfish/log
stockfish
8 years agoSimplify outpost evaluation
lucasart [Sun, 7 Jun 2015 08:49:01 +0000 (09:49 +0100)]
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

8 years agoRemove intermediate re-search in LMR
Vince Negri [Sun, 31 May 2015 09:52:41 +0000 (10:52 +0100)]
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

8 years agoRename stages
Marco Costalba [Thu, 4 Jun 2015 10:25:49 +0000 (12:25 +0200)]
Rename stages

Hopefully more clear.

No functional change.

8 years agoTune pawn shelter/storm
lucasart [Tue, 2 Jun 2015 19:08:35 +0000 (12:08 -0700)]
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

8 years agoTweak backward pawns definition
Stéphane Nicolet [Tue, 2 Jun 2015 19:06:46 +0000 (12:06 -0700)]
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

8 years agoChecking for rook color when setting castling
Marco Costalba [Fri, 29 May 2015 03:38:40 +0000 (05:38 +0200)]
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.

8 years agoSimplify backward pawn scoring
lucasart [Fri, 22 May 2015 10:39:36 +0000 (18:39 +0800)]
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

8 years agoResolve build failure for Mac
Joona Kiiski [Thu, 21 May 2015 19:04:19 +0000 (20:04 +0100)]
Resolve build failure for Mac

Remove '-Wl' switch from gcc arguments when compiling for Mac

No functional change

Resolves #353

8 years agoFix merge error for Tuned PSQT
lucasart [Thu, 21 May 2015 11:52:25 +0000 (19:52 +0800)]
Fix merge error for Tuned PSQT

Fall-out from 411e704f

Bench: 7907776

Resolves #352

8 years agoRemove Gain Stats
Stefan Geschwentner [Mon, 18 May 2015 20:58:13 +0000 (13:58 -0700)]
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

8 years agoTuned PSQT
lucasart [Sat, 16 May 2015 01:12:36 +0000 (09:12 +0800)]
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

8 years agoCleanup work in misc.cpp
Marco Costalba [Sat, 9 May 2015 09:09:06 +0000 (11:09 +0200)]
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.

8 years agoSmart TT save
mstembera [Sat, 9 May 2015 16:43:57 +0000 (17:43 +0100)]
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

8 years agoEdge distance
lucasart [Sun, 3 May 2015 22:57:22 +0000 (06:57 +0800)]
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

8 years agoRestore deterministic search state
lucasart [Wed, 6 May 2015 11:24:00 +0000 (19:24 +0800)]
Restore deterministic search state

Introduce helper function Search::reset() which clears all kind of search
memory, in order to restore a deterministic search state.

Generalize TT.clear() into Search::reset() for the following use cases:
- bench: needed to guarantee deterministic bench (ie. if you call bench from
interactive command line twice in a row you get the same value).
- Clear Hash: restore clean search state, which is the purpose of this button.
- ucinewgame: ditto.

No functional change.

Resolves #346

8 years agoNever clear stats
lucasart [Tue, 5 May 2015 11:10:19 +0000 (19:10 +0800)]
Never clear stats

Based on an idea and patch by VoyagerOne.

Small simplification, but was tedted for an ELO gain anyway.

STC:
LLR: 2.95 (-2.94,2.94) [-1.00,4.00]
Total: 5375 W: 1119 L: 977 D: 3279

LTC:
LLR: 2.95 (-2.94,2.94) [0.00,5.00]
Total: 17893 W: 2984 L: 2792 D: 12117

bench 8322847

8 years agoHalve PSQT row data
Marco Costalba [Sun, 3 May 2015 06:06:10 +0000 (08:06 +0200)]
Halve PSQT row data

Use symmetry along vertical middle axis of the board
to reduce the number of parameters.

For instance psqt value of SQ_A5 == SQ_A4 and value of
SQ_F8 == SQ_F1.

This is always true, at least until now nobody came in
with an asymmetric psqt table that worked.

Original patch by Lucas.

No functional change.

8 years agoSplit PSQT init from Position init
Marco Costalba [Sat, 2 May 2015 00:36:39 +0000 (02:36 +0200)]
Split PSQT init from Position init

Easier for tuning psq tables:

TUNE(myParameters, PSQT::init);

Also move PSQT code in a new *.cpp file, and retire the
old and hacky psqtab.h that required to be included only
once to work correctly, this is not idiomatic for a header
file.

Give wide visibility to psq tables (previously visible only
in position.cpp), this will easy the use of psq tables outside
Position, for instance in move ordering.

Finally trivial code style fixes of the latest patches.

Original patch of Lucas Braesch.

No functional change.

8 years agoImprove ordering of good captures using rank term
Stefano80 [Sun, 3 May 2015 17:18:38 +0000 (10:18 -0700)]
Improve ordering of good captures using rank term

Rank based term improved approximation of pos.see() for scoring good
captures.

STC
LLR: 2.95 (-2.94,2.94) [-1.50,4.50]
Total: 4632 W: 945 L: 827 D: 2860

LTC
LLR: 2.95 (-2.94,2.94) [0.00,6.00]
Total: 25770 W: 4184 L: 3964 D: 17622

Bench: 7593704

Resolves #342

8 years agoReplace MVV/LVA by MVV for good captures
Stefano80 [Tue, 28 Apr 2015 21:06:18 +0000 (22:06 +0100)]
Replace MVV/LVA by MVV for good captures

Passed STC

LLR: 3.71 (-2.94,2.94) [-3.00,1.00]
Total: 64363 W: 12299 L: 12214 D: 39850

and LTC

LLR: 2.95 (-2.94,2.94) [-3.00,1.00]
Total: 69976 W: 11056 L: 11011 D: 47909

Bench: 8012532

Resolves #340

8 years agoChange extra ply LMR condition to: cmh <= 0 && hist < 0
VoyagerOne [Sun, 26 Apr 2015 19:12:25 +0000 (20:12 +0100)]
Change extra ply LMR condition to: cmh <= 0 && hist < 0

Extra ply LMR condition is now cmh <= 0 && h < 0
Instead of cmh + h < 0

STC:
LLR: 2.96 (-2.94,2.94) [-1.50,4.50]
Total: 55210 W: 10812 L: 10557 D: 33841

LTC:
LLR: 2.95 (-2.94,2.94) [0.00,4.00]
Total: 13212 W: 2239 L: 2045 D: 8928

Bench: 8420865

Resolves #339

9 years agoExclude queen from Rook Contact Check computation
Alain SAVARD [Sat, 18 Apr 2015 21:12:56 +0000 (22:12 +0100)]
Exclude queen from Rook Contact Check computation

In ei.attackedBy, Queen does not x-ray through Rook, but the Rook does
X-ray through the Queen.

So most of the rook contact checks supported by queen are, in fact,
Queen Contact Checks and they are already scored separately.

Bench: 7762189

Resolves #338

9 years agoRetire FORCE_INLINE
lucasart [Wed, 15 Apr 2015 20:21:45 +0000 (21:21 +0100)]
Retire FORCE_INLINE

No speed regression on my machine (i7-3770k, gcc 4.9.1, linux 3.16):

        stat        test     master   diff
        mean   2,482,415  2,474,987  7,906
        stdev      4,603      5,644  2,497

        speedup        0.32%
        P(speedup>0)  100.0%

Fishtest 9+0.03:

ELO: 0.26 +-1.8 (95%) LOS: 61.2%
Total: 60000 W: 12437 L: 12392 D: 35171

No functional change.

Resolves #334

9 years agoRemoved extra condition (history < 0) in LMR to help sync up with move ordering.
VoyagerOne [Fri, 10 Apr 2015 21:50:19 +0000 (17:50 -0400)]
Removed extra condition (history < 0) in LMR to help sync up with move ordering.

LMR condition is now cmh+history<0
Instead of history<0 OR cmh+history<0

STC:
LLR: 2.96 (-2.94,2.94) [-3.00, 1.00]
Total: 26446 W: 5092 L: 4980 D: 16374

LTC:
LLR: 2.96 (-2.94,2.94) [-3.00, 1.00]
Total: 14129 W: 2340 L: 2209 D: 9580

Bench: 7815183

Resolves #331

9 years agoAssorted cleanup of last patches
Marco Costalba [Sat, 11 Apr 2015 21:21:52 +0000 (23:21 +0200)]
Assorted cleanup of last patches

No functional change.

9 years agoAllow Position::init() to be called more than once
Marco Costalba [Fri, 10 Apr 2015 06:57:35 +0000 (08:57 +0200)]
Allow Position::init() to be called more than once

Currently Zobrist::castling[] are not properly zeroed
and rely on the compiler to do this at startup, but this
makes Position::init() to set different values every time
it is called!

This is a bit odd, and although not impacting normal usage,
can yield to subtle misbehaviour, very difficult to track
down, in case we happen to call it more than once for some
reason. I found this while developing tuning support and
it took me a while to track it down.

So properly init Zobrist::castling[]

No functional change.

Resolves #329

9 years agoUpdate stats at pv nodes
Stefan Geschwentner [Fri, 10 Apr 2015 19:32:39 +0000 (20:32 +0100)]
Update stats at pv nodes

If a quiet best move is found at a pv node then always update stats.

STC:
LLR: 2.96 (-2.94,2.94) [-1.50,4.50]
Total: 41485 W: 8047 L: 7830 D: 25608

LTC:
LLR: 2.96 (-2.94,2.94) [0.00,6.00]
Total: 14351 W: 2420 L: 2250 D: 9681

Bench: 6985247

Resolves #330

9 years agoNew formula for quiet move scoring: 3 * cmh + 1 * hist
mstembera [Fri, 10 Apr 2015 19:09:45 +0000 (20:09 +0100)]
New formula for quiet move scoring: 3 * cmh + 1 * hist

STC

LLR: 2.97 (-2.94,2.94) [-1.50,4.50]
Total: 45363 W: 8759 L: 8532 D: 28072

LTC

LLR: 3.51 (-2.94,2.94) [0.00,4.00]
Total: 125092 W: 20032 L: 19468 D: 85592

Bench: 7058819

Resolves #328

9 years agoupdate stats also in check
Stefan Geschwentner [Sun, 5 Apr 2015 18:36:11 +0000 (20:36 +0200)]
update stats also in check

Update stats also if in check (drop condition).

STC:
LLR: 3.22 (-2.94,2.94) [-3.00,1.00]
Total: 87472 W: 16929 L: 16913 D: 53630

LTC:
LLR: 2.96 (-2.94,2.94) [-3.00,1.00]
Total: 39971 W: 6436 L: 6345 D: 27190

Bench: 7086031

Resolves #327

9 years agoPrune evasions when we can castle
lucasart [Sat, 4 Apr 2015 00:00:15 +0000 (08:00 +0800)]
Prune evasions when we can castle

A minor simplification.

STC:

LLR: 2.95 (-2.94,2.94) [-3.50,0.50]
Total: 67877 W: 12882 L: 12904 D: 42091

STC:

LLR: 2.96 (-2.94,2.94) [-3.00,1.00]
Total: 20677 W: 4023 L: 3901 D: 12753

LTC:

LLR: 2.96 (-2.94,2.94) [-3.00,1.00]
Total: 12221 W: 2022 L: 1888 D: 8311

Bench: 7911336

Resolves #326

9 years agoUse minimumSplitDepth = 5
Stéphane Nicolet [Sat, 4 Apr 2015 16:07:45 +0000 (18:07 +0200)]
Use minimumSplitDepth = 5

Using minimumSplitDepth = 5 seems to be the best compromise in the
current SMP implementation

STC, 11 threads:

ELO: 14.87 +-4.1 (95%) LOS: 100.0%
Total: 8509 W: 1497 L: 1133 D: 5879

STC, 4 threads:

ELO: 0.30 +-2.8 (95%) LOS: 58.2%
Total: 20000 W: 3365 L: 3348 D: 13287

STC, 2 threads:

ELO: -1.02 +-2.0 (95%) LOS: 16.4%
Total: 40000 W: 7087 L: 7204 D: 25709

Resolves #324

9 years agoFix MSVC warning from previous patch
Marco Costalba [Fri, 3 Apr 2015 17:29:29 +0000 (19:29 +0200)]
Fix MSVC warning from previous patch

No functional change.

9 years agoFix elapsed()
Marco Costalba [Fri, 3 Apr 2015 02:53:53 +0000 (04:53 +0200)]
Fix elapsed()

Messed up during merge.

No functional change.

9 years agoAdd support for playing in 'nodes as time' mode
Marco Costalba [Sun, 22 Mar 2015 20:15:44 +0000 (21:15 +0100)]
Add support for playing in 'nodes as time' mode

When running more games in parallel, or simply when running a game
with a background process, due to how OS scheduling works, there is no
guarantee that the CPU resources allocated evenly between the two
players. This introduces noise in the result that leads to unreliable
result and in the worst cases can even invalidate the result. For
instance in SF test framework we avoid running from clouds virtual
machines because are a known source of very unstable CPU speed.

To overcome this issue, without requiring changes to the GUI, the idea
is to use searched nodes instead of time, and to convert time to
available nodes upfront, at the beginning of the game.

When nodestime UCI option is set at a given nodes per milliseconds
(npmsec), at the beginning of the game (and only once), the engine
reads the available time to think, sent by the GUI with 'go wtime x'
UCI command. Then it translates time in available nodes (nodes =
npmsec * x), then feeds available nodes instead of time to the time
management logic and starts the search. During the search the engine
checks the searched nodes against the available ones in such a way
that all the time management logic still fully applies, and the game
mimics a real one played on real time. When the search finishes,
before returning best move, the total available nodes are updated,
subtracting the real searched nodes. After the first move, the time
information sent by the GUI is ignored, and the engine fully relies on
the updated total available nodes to feed time management.

To avoid time losses, the speed of the engine (npms) must be set to a
value lower than real speed so that if the real TC is for instance 30
secs, and npms is half of the real speed, the game will last on
average 15 secs, so much less than the TC limit, providing for a
safety 'time buffer'.

There are 2 main limitations with this mode.

1. Engine speed should be the same for both players, and this limits
the approach to mainly parameter tuning patches.

2. Because npms is fixed while, in real engines, the speed increases
toward endgame, this introduces an artifact that is equivalent to an
altered time management. Namely it is like the time management gives
less available time than what should be in standard case.

May be the second limitation could be mitigated in a future with a
smarter 'dynamic npms' approach.

Tests shows that the standard deviation of the results with 'nodestime'
is lower than in standard TC, as is expected because now all the introduced
noise due the random speed variability of the engines during the game is
fully removed.

Original NIT idea by Michael Hoffman that shows how to play in NIT mode
without requiring changes to the GUI. This implementation goes a bit
further, the key difference is that we read TC from GUI only once upfront
instead of re-reading after every move as in Michael's implementation.

No functional change.

9 years agoRename of TimeMgr and friends
Marco Costalba [Thu, 2 Apr 2015 07:07:17 +0000 (09:07 +0200)]
Rename of TimeMgr and friends

More natural naming IMO.

No functional change.

9 years agoIntroduce elapsed_time()
Marco Costalba [Thu, 2 Apr 2015 06:52:22 +0000 (08:52 +0200)]
Introduce elapsed_time()

And reformat a bit time manager code.

Note that now we set starting search time in think() and
no more in ThreadPool::start_thinking(), the added delay
is less than 1 msec, so below timer resolution (5msec) and
should not affect time lossses ratio.

No functional change.

9 years agoSimplification to use only one counter move.
mstembera [Thu, 2 Apr 2015 17:16:15 +0000 (01:16 +0800)]
Simplification to use only one counter move.

STC http://tests.stockfishchess.org/tests/view/5518dca30ebc5902160ec5d0
LLR: 2.95 (-2.94,2.94) [-3.50,0.50]
Total: 18868 W: 3638 L: 3530 D: 11700

LTC http://tests.stockfishchess.org/tests/view/5518f7ed0ebc5902160ec5d4
LLR: 2.96 (-2.94,2.94) [-3.00,1.00]
Total: 69767 W: 11019 L: 10973 D: 47775

Extracted from http://tests.stockfishchess.org/tests/view/5511028a0ebc5902160ec40b

Original patch by hxim.  All credit goes to him.

Bench: 7664249

Resolves #320

9 years agoAssorted code style of latest commits
Marco Costalba [Sun, 29 Mar 2015 07:24:17 +0000 (09:24 +0200)]
Assorted code style of latest commits

No functional chnage.

9 years agoFix indentations for hanging pawns code
Joona Kiiski [Sun, 29 Mar 2015 07:54:25 +0000 (08:54 +0100)]
Fix indentations for hanging pawns code

No functional change

9 years agoRemove some difficult to understand C++11 constructs
lucasart [Fri, 27 Mar 2015 01:44:57 +0000 (09:44 +0800)]
Remove some difficult to understand C++11 constructs

Code like this is more a case of showing off one's C++ knowledge, rather than
using it adequately, IMHO.

**First loop (std::generate)**

Iterators are inadequate here, because they lose the key information which is
idx. As a result, we need to carry a redundant idx variable, and increment it
along the way. Very clumsy.
Usage of std::generate and a lambda function only obfuscate the code, which is
merely a simple and stupid loop over the elements of a vector.

**Second loop (std::accumulate)**

This code is thoroughlly incomprehensible. Restore the original, which was much
simpler to understand.

**Third loop (range based loop)**

Again, a range based loop is inadequate, because we lose idx! To resolve this
artificially created problem, the data model was made redundant (idx is a data
member of db[] elements!?), which is ugly and unjustified. A simple and stupid
for loop with idx does the job much better.

No functional change.

Resolves #313

9 years agoPSV3_1
Alain SAVARD [Sat, 28 Mar 2015 23:30:46 +0000 (07:30 +0800)]
PSV3_1

Small speed-up in pawn.cpp
Results for 10 tests for each version:

Base      Test      Diff
Mean    1435636   1445238   -9602
StDev   22576     23189     1848

p-value: 1
speedup: 0.007

No functional change

Resolves #295

9 years agoGive a reduced bonus for threats by hanging pawns
Ajith [Sat, 28 Mar 2015 23:27:43 +0000 (07:27 +0800)]
Give a reduced bonus for threats by hanging pawns

Passed STC:
LLR: 2.96 (-2.94,2.94) [-1.50,4.50]
Total: 105539 W: 20389 L: 20001 D: 65149

and LTC:
LLR: 2.95 (-2.94,2.94) [0.00,6.00]
Total: 9629 W: 1577 L: 1432 D: 6620

Bench: 7658627

Resolves #317

9 years agoRetire follow-up move heuristic
mbootsector [Sat, 28 Mar 2015 22:09:48 +0000 (22:09 +0000)]
Retire follow-up move heuristic

STC: http://tests.stockfishchess.org/tests/view/5501d0f30ebc5902160ec0fd
LLR: 2.95 (-2.94,2.94) [-3.00,1.00]
Total: 34891 W: 6904 L: 6808 D: 21179

LTC: http://tests.stockfishchess.org/tests/view/550328540ebc5902160ec133
LLR: 3.10 (-2.94,2.94) [-3.00,1.00]
Total: 182653 W: 29866 L: 29993 D: 122794

Bench: 8396161

Resolves #310

9 years agoUse CounterMoveHistory when calculating LMR for cut nodes
VoyagerOne [Sat, 28 Mar 2015 21:15:49 +0000 (21:15 +0000)]
Use CounterMoveHistory when calculating LMR for cut nodes

If the sum of CounterMoveHistory heuristic and History heuristic is below zero,
then reduce an extra ply in cut nodes

LTC:
LLR: 2.96 (-2.94,2.94) [0.00,6.00]
Total: 6479 W: 1099 L: 967 D: 4413

Bench: 7773299

Resolves #315

9 years agoClean up previous patch
Marco Costalba [Wed, 25 Mar 2015 05:47:40 +0000 (06:47 +0100)]
Clean up previous patch

No functional change.

9 years agoTuned values for the pawn piece square table
joergoster [Tue, 24 Mar 2015 23:38:32 +0000 (07:38 +0800)]
Tuned values for the pawn piece square table

Quick measure at very fast tc:
ELO: 4.77 +-2.2 (95%) LOS: 100.0%
Total: 40124 W: 8711 L: 8160 D: 23253

LTC:
LLR: 2.95 (-2.94,2.94) [0.00,4.00]
Total: 52284 W: 8880 L: 8559 D: 34845

Bench: 8865736

Resolves #311

9 years agoIntroduce a new counter move history penalty
VoyagerOne [Tue, 24 Mar 2015 23:00:31 +0000 (23:00 +0000)]
Introduce a new counter move history penalty

Extra penalty for TT move in previous ply when it gets refuted

STC:

LLR: 2.94 (-2.94,2.94) [-1.50,4.50]
Total: 31303 W: 6216 L: 6025 D: 19062

LTC:

LLR: 2.97 (-2.94,2.94) [0.00,6.00]
Total: 6950 W: 1189 L: 1054 D: 4707

Bench: 8191926

Resolves #309

9 years agoFully yielding locks, no spinning
Joona Kiiski [Sat, 14 Mar 2015 21:20:11 +0000 (21:20 +0000)]
Fully yielding locks, no spinning

7 threads:

ELO: 2.00 +-2.7 (95%) LOS: 92.4%
Total: 20000 W: 3276 L: 3161 D: 13563

There is no functional change in single thread mode

Resolves #304

9 years agoAllow Bitbases::init() to be called more than once
Marco Costalba [Sun, 22 Mar 2015 11:41:11 +0000 (12:41 +0100)]
Allow Bitbases::init() to be called more than once

Currently if we call it more than once, we crash.

This is not a real problem, because this function is
indeed called just once. Nevertheless with this small fix,
that gets rid of a hidden 'static' variable, we cleanly
resolve the issue.

While there, fix also ThreadPool::exit to return in a
consistent state. Now all the init() functions but
UCI::init() are reentrant and can be called multiple
times.

No functional change.

9 years agoDouble magics generation speed
Marco Costalba [Sun, 22 Mar 2015 10:27:32 +0000 (11:27 +0100)]
Double magics generation speed

Profiling shows that resetting attacks table after
a failed candidate magic attempt is the biggest
time consumer, so rewrite the logic avoiding the
memset()

Magics init for rook+bishop goes from 200msecs to
under 100msec.

No functional change.

9 years agoGet rid of nativeThread
Marco Costalba [Sat, 21 Mar 2015 10:50:14 +0000 (11:50 +0100)]
Get rid of nativeThread

No functional change.

9 years agoUse only one ConditionVariable to sync UI
Marco Costalba [Fri, 20 Mar 2015 16:58:43 +0000 (17:58 +0100)]
Use only one ConditionVariable to sync UI

To sync UI with main thread it is enough a single
condition variable because here we have a single
producer / single consumer design pattern.

Two condition variables are strictly needed just for
many producers / many consumers case.

Note that this is possible because now we don't send to
sleep idle threads anymore while searching, so that now
only UI can wake up the main thread and we can use the
same ConditionVariable for both threads.

The natural consequence is to retire wait_for_think_finished()
and move all the logic under MainThread class, yielding the
rename of teh function to join()

No functional change.

9 years agoFix comment
lucasart [Wed, 18 Mar 2015 14:10:13 +0000 (22:10 +0800)]
Fix comment

We always probe, but we do not prune at PV nodes.

No functional change.

Resolves #300

9 years agoRetire ConditionVariable
Marco Costalba [Wed, 18 Mar 2015 07:25:15 +0000 (08:25 +0100)]
Retire ConditionVariable

Now that we use spinlocks everywhere and don't put
threads to sleep while idle, we can use the slower
(but no more in hot path) std::condition_variable_any
instead of our homwgrown ConditionVariable struct.

Verified fo rno regression at STC with 7 threads:
ELO: -0.66 +-2.7 (95%) LOS: 31.8%
Total: 20000 W: 3210 L: 3248 D: 13542

No functional change

9 years agoTuned mobility with another SPSA run
joergoster [Fri, 20 Mar 2015 00:08:21 +0000 (08:08 +0800)]
Tuned mobility with another SPSA run

Further improved mobility values after another SPSA session, 50k
iterations.

Elo measure at very fast 9+0.05":
ELO: 3.40 +-2.2 (95%) LOS: 99.9%
Total: 40000 W: 8434 L: 8042 D: 23524

and LTC SPRT[0, 4]:
LLR: 2.95 (-2.94,2.94) [0.00,4.00]
Total: 11052 W: 1874 L: 1687 D: 7491

Bench: 8226843

Resolves #301

9 years agoFix the comment for Position::is_draw()
joergoster [Tue, 17 Mar 2015 16:42:29 +0000 (17:42 +0100)]
Fix the comment for Position::is_draw()

We no longer check for insufficient material.

No functional change

Resolves #299

9 years agoconnected should be bool, not Bitboard
lucasart [Tue, 17 Mar 2015 14:01:07 +0000 (22:01 +0800)]
connected should be bool, not Bitboard

There's no reason to define it as a Bitboard, so for consistency, use bool.

This is even a speedup on my machine: i7-3770k, using gcc 4.9.1 (linux):

    stat        test     master    diff
    mean   2,341,338  2,327,998  13,134
    stdev     15,765     14,717   5,405

    speedup       0.56%
    P(speedup>0) 100.0%

No functional change.

Resolves #298

9 years agoReformat FastMove
Marco Costalba [Wed, 18 Mar 2015 07:12:59 +0000 (08:12 +0100)]
Reformat FastMove

Align to SF coding style.

Verified no regression:

LLR: 2.95 (-2.94,2.94) [-3.00,1.00]
Total: 55938 W: 10893 L: 10835 D: 34210

No functional change.

9 years agoSimplify nosleep logic
Marco Costalba [Wed, 18 Mar 2015 07:01:50 +0000 (08:01 +0100)]
Simplify nosleep logic

Avoid redundant 'while' conditions. It is enough to
check them in the outer loop.

Quick tested for no regression 10K games at 4 threads
ELO: -1.32 +-3.9 (95%) LOS: 25.6%
Total: 10000 W: 1653 L: 1691 D: 6656

No functional change.

9 years agoFix a bogus use of mutex
Marco Costalba [Tue, 17 Mar 2015 06:31:45 +0000 (07:31 +0100)]
Fix a bogus use of mutex

Spinlock must be used instead.

Tested for no regression at 15+0.05 th 4:

LLR: 2.96 (-2.94,2.94) [-3.00,1.00]
Total: 25928 W: 4303 L: 4190 D: 17435

No functional change.

Resolves #297

9 years agoRe-arrange history update code
Marco Costalba [Sun, 15 Mar 2015 09:05:57 +0000 (10:05 +0100)]
Re-arrange history update code

Unify the quites moves loop for both cases,
the compiler optimizes away the

 if (is_ok((ss-1)->currentMove))

inside loop, so that the result is same
speed as original.

No functional change.

9 years agoUse acquire() and release() for spinlocks
Marco Costalba [Sun, 15 Mar 2015 06:39:10 +0000 (07:39 +0100)]
Use acquire() and release() for spinlocks

It is more idiomatick than lock() and unlock()

No functional change.

9 years agoFix dependency generation for MacOSX
Vince Negri [Sat, 14 Mar 2015 14:14:37 +0000 (14:14 +0000)]
Fix dependency generation for MacOSX

No functional change

Resolves #290

9 years agoFix dependency generation for C++11
Joona Kiiski [Sat, 14 Mar 2015 21:12:13 +0000 (21:12 +0000)]
Fix dependency generation for C++11

No functional change

Resolves #291

9 years agoDo not sleep, but yield
Joona Kiiski [Sun, 15 Mar 2015 19:45:30 +0000 (19:45 +0000)]
Do not sleep, but yield

During the search, do not block on condition variable, but instead use std::this_thread::yield().

Clear gain with 16 threads. Again results vary highly depending on hardware, but on average it's a clear gain.

ELO: 12.17 +-4.3 (95%) LOS: 100.0%
Total: 7998 W: 1407 L: 1127 D: 5464

There is no functional change in single thread mode

Resolves #294

9 years agoNew values for Mobility and Outposts.
joergoster [Sat, 14 Mar 2015 21:35:52 +0000 (21:35 +0000)]
New values for Mobility and Outposts.

Both are the result of a SPSA tuning session with a custom book, 50k iterations each.

After an additional tuning session of the mobility values, tuning the delta values, with following result.

40k games at 9+0.05:
ELO: 4.13 +-2.2 (95%) LOS: 100.0%
Total: 40000 W: 8581 L: 8106 D: 23313

and LTC
LLR: 2.95 (-2.94,2.94) [0.00,4.00]
Total: 36518 W: 6049 L: 5782 D: 24687

Bench: 8567402

Resolves #284

9 years agoLink with -static in mingw
Marco Costalba [Sat, 14 Mar 2015 07:49:50 +0000 (08:49 +0100)]
Link with -static in mingw

Fixes reported startup error about missing libwinpthread-1.dll
when the dll is not in the path.

The current -static-xxxx flags, introduced with:

https://github.com/official-stockfish/Stockfish/commit/373503f4a9a990054b5

Only take in account standard libraries, but not thread
library.

No functional change.

Resolves #289

9 years agoIntroduce yielding spin locks
Joona Kiiski [Thu, 12 Mar 2015 20:36:32 +0000 (20:36 +0000)]
Introduce yielding spin locks

Idea and original implementation by Stephane Nicolet

7 threads 15+0.05
ELO: 3.54 +-2.9 (95%) LOS: 99.2%
Total: 17971 W: 2976 L: 2793 D: 12202

There is no functional change in single thread mode

9 years agoRemove check for gcc version from Makefile.
Joona Kiiski [Thu, 12 Mar 2015 22:05:18 +0000 (22:05 +0000)]
Remove check for gcc version from Makefile.

This check is obsolete.
very old gcc versions can't compile c++11 code.

No functional change

Resolves #285

9 years agoNew easy move implementation
mstembera [Thu, 12 Mar 2015 19:49:30 +0000 (19:49 +0000)]
New easy move implementation

Spend much less time in positions where one move is much better than all other alternatives.
We carry forward pv stability information from the previous search to identify such positions.
It's based on my old InstaMove idea but with two significant improvements.

1) Much better instability detection inside the search itself.
2) When it's time to make a FastMove we no longer make it instantly but still spend at least 10% of normal time verifying it.

Credit to Gull for the inspiration.
BIG thanks to Gary because this would not work without accurate PV!

20K
ELO: 8.22 +-3.0 (95%) LOS: 100.0%
Total: 20000 W: 4203 L: 3730 D: 12067

STC
LLR: 2.96 (-2.94,2.94) [-1.50,4.50]
Total: 23266 W: 4662 L: 4492 D: 14112

LTC
LLR: 2.95 (-2.94,2.94) [0.00,6.00]
Total: 12470 W: 2091 L: 1931 D: 8448

Resolves #283

9 years agoIntroduce Counter Move History tables
Stefan Geschwentner [Thu, 12 Mar 2015 07:29:57 +0000 (07:29 +0000)]
Introduce Counter Move History tables

Introduce a counter move history table which additionally is indexed by the last move's piece and target square.
For quiet move ordering use now the sum of standard and counter move history table.

STC:
LLR: 2.96 (-2.94,2.94) [-1.50,4.50]
Total: 4747 W: 1005 L: 885 D: 2857

LTC:
LLR: 2.95 (-2.94,2.94) [0.00,6.00]
Total: 5726 W: 1001 L: 872 D: 3853

Because of reported low NPS on multi core test
STC (7 threads):
ELO: 7.26 +-3.3 (95%) LOS: 100.0%
Total: 14937 W: 2710 L: 2398 D: 9829

Bench: 7725341

Resolves #282

9 years agoUse thread specific mutexes instead of a global one.
Joona Kiiski [Wed, 11 Mar 2015 21:50:41 +0000 (21:50 +0000)]
Use thread specific mutexes instead of a global one.

This is necessary to improve the scalability with high number of cores.

There is no functional change in a single thread mode.

Resolves #281

9 years agoRetire spinlocks
Marco Costalba [Tue, 10 Mar 2015 20:50:45 +0000 (21:50 +0100)]
Retire spinlocks

Use Mutex instead.

This is in preparaation for merging with master branch,
where we stilll don't have spinlocks.

Eventually spinlocks will be readded in some future
patch, once c++11 has been merged.

No functional change.

9 years agoCleanup thread_win.h
Marco Costalba [Tue, 10 Mar 2015 16:13:52 +0000 (17:13 +0100)]
Cleanup thread_win.h

No functional change.

9 years agoDisable spinlocks
Marco Costalba [Tue, 10 Mar 2015 11:47:49 +0000 (12:47 +0100)]
Disable spinlocks

To allow testing on fishtest.

No functional change.

9 years agoAdd thread_win32.h header
Marco Costalba [Tue, 10 Mar 2015 11:42:40 +0000 (12:42 +0100)]
Add thread_win32.h header

Workaround slow std::thread implementation in mingw
and gcc for Windows with our own old low level thread
functions.

No functional change.

9 years agoSync with master
Marco Costalba [Sat, 7 Mar 2015 09:52:55 +0000 (10:52 +0100)]
Sync with master

bench: 8285241

9 years agoSync with master
Marco Costalba [Sat, 7 Mar 2015 09:41:07 +0000 (10:41 +0100)]
Sync with master

No functional change.

9 years agoTransform minKingPawnDistance into a local variable
hxim [Sat, 7 Mar 2015 09:03:19 +0000 (09:03 +0000)]
Transform minKingPawnDistance into a local variable

minKingPawnDistance is used only as local variable in one place so we don't need it to be part of "Pawns::Entry" structure.

No functional change.

Resolves #277

9 years agoUpdate Makefile for Mac OS X compilation
Stéphane Nicolet [Mon, 2 Mar 2015 21:01:19 +0000 (22:01 +0100)]
Update Makefile for Mac OS X compilation

This change in the Makefile restores the possibility to compile
Stockfish on Mac OS X 10.9 and 10.10 after the C++11 has been merged.

To use the default (fastest) settings, compile with:

make build ARCH=x86-64-modern

To test the clang settings, compile with

make build ARCH=x86-64-modern COMP=clang

Beware that the clang settings may provide a slightly slower (6%)
executable.

Backported from master.

No functional change

Resolves #275

9 years agoRe-enable spinlocks
Marco Costalba [Sat, 7 Mar 2015 07:36:23 +0000 (08:36 +0100)]
Re-enable spinlocks

For branch C++11, that doe snot run on fishtest,
there is no need of this kludge, let only master
have it.

No functional change.

9 years agoRevert C++11 merge
Joona Kiiski [Sat, 7 Mar 2015 07:38:22 +0000 (07:38 +0000)]
Revert C++11 merge

Restore the state of repo back to commit 'Simplify pawn code a bit' (1e6d21dbb6)

No functional change

9 years agoUpdate Makefile for Mac OS X compilation
Stéphane Nicolet [Mon, 2 Mar 2015 21:01:19 +0000 (22:01 +0100)]
Update Makefile for Mac OS X compilation

This change in the Makefile restores the possibility to compile
Stockfish on Mac OS X 10.9 and 10.10 after the C++11 has been merged.

To use the default (fastest) settings, compile with:

make build ARCH=x86-64-modern

To test the clang settings, compile with

make build ARCH=x86-64-modern COMP=clang

Beware that the clang settings may provide a slightly slower (6%)
executable.

No functional change

Resolves #275

9 years agoDisable spinlocks
Marco Costalba [Mon, 2 Mar 2015 07:11:39 +0000 (08:11 +0100)]
Disable spinlocks

Now that c++11 branch has been merged in master,
disable unconditionally the spinlocks and use mutex
instead. This will allow to run fishtest even on HT
machines withouth changes.

In the future we will reintorduce spinlocks, once
we will have took care of fishtest.

No functional change.

9 years agoAllow to disable spinlocks
Marco Costalba [Sun, 1 Mar 2015 16:12:09 +0000 (17:12 +0100)]
Allow to disable spinlocks

And use mutex instead. You may never want to do this.
It is a workaround to run c++11 on fishtest where many
machiens have HTenabled and this can be a problem when
number of cores set is higher than number of physical cores.

To disable spinlocks, just compile with -DNO_SPINLOCK flag

No functional change.

9 years agoRename available_to()
Marco Costalba [Sun, 1 Mar 2015 11:13:14 +0000 (12:13 +0100)]
Rename available_to()

Change this API to be more natural and simple.

Inspired by a patch by Joona.

No functional change.

9 years agoSync with master
Marco Costalba [Sat, 28 Feb 2015 19:21:38 +0000 (20:21 +0100)]
Sync with master

bench: 8285241

9 years agoSimplify pawn code a bit
Stéphane Nicolet [Sat, 28 Feb 2015 17:00:52 +0000 (01:00 +0800)]
Simplify pawn code a bit

Simplify a bit the number of bitwise operators used to calculate the
pawn evaluation in pawns.cpp

No functional change.

Resolves #269

9 years agoRaise penalty for knight attacked by pawn
Stéphane Nicolet [Sat, 28 Feb 2015 16:58:32 +0000 (00:58 +0800)]
Raise penalty for knight attacked by pawn

Raise a bit the penalty for knight attacked by pawn.

STC:
LLR: 2.97 (-2.94,2.94) [-1.50,4.50]
Total: 27744 W: 5563 L: 5380 D: 16801

LTC:
LLR: 2.96 (-2.94,2.94) [0.00,4.00]
Total: 87571 W: 14747 L: 14314 D: 58510

Bench: 8285241

Resolves #270

9 years agoRetire apply_weight()
Marco Costalba [Fri, 27 Feb 2015 08:52:56 +0000 (09:52 +0100)]
Retire apply_weight()

Use the more natural operator*() instead.

No functional change.

9 years agoSync with master
Marco Costalba [Thu, 26 Feb 2015 19:49:41 +0000 (20:49 +0100)]
Sync with master

bench: 8069601

9 years agoNormalize twice supported pawns
Marco Costalba [Thu, 26 Feb 2015 17:56:16 +0000 (01:56 +0800)]
Normalize twice supported pawns

Align codying style to current conventions and move
formula for twice supported pawns to Pawns::init()
where it should be.

No functional change.

9 years agoApex Pawns
Alain SAVARD [Thu, 26 Feb 2015 17:50:35 +0000 (01:50 +0800)]
Apex Pawns

Pawns which are supported already have a bonus. Apex are pawns which are
supported twice.
This patch gives an additional 50% bonus for them.

STC
LLR: 2.96 (-2.94,2.94) [-1.50,4.50]
Total: 6549 W: 1333 L: 1209 D: 4007

LTC
LLR: 2.95 (-2.94,2.94) [0.00,6.00]
Total: 18002 W: 3037 L: 2850 D: 12115

Bench: 8069601

Resolves #267

9 years agoDon't assume the type of Time::point
Marco Costalba [Tue, 24 Feb 2015 11:24:53 +0000 (12:24 +0100)]
Don't assume the type of Time::point

But instead use the proper definition. Also
rewrite chrono functions while there.

No functional change.

9 years agoSmall tweaks in pawns.cpp
Marco Costalba [Tue, 24 Feb 2015 10:33:40 +0000 (11:33 +0100)]
Small tweaks in pawns.cpp

No functional change.

9 years agoImprove spinlock implementation
Marco Costalba [Mon, 23 Feb 2015 18:22:37 +0000 (19:22 +0100)]
Improve spinlock implementation

Calling lock.test_and_set() in a tight loop creates expensive
memory synchronizations among processors and penalize other
running threads. So syncronize only only once at the beginning
with fetch_sub() and then loop on a simple load() that puts much
less pressure on the system.

Reported about 2-3% speed up on various systems.

Patch by Ronald de Man.

No functional change.

9 years agoUse spinlock instead of mutex for Threads and SplitPoint
Marco Costalba [Sun, 22 Feb 2015 13:59:55 +0000 (14:59 +0100)]
Use spinlock instead of mutex for Threads and SplitPoint

It is reported to be defenitly faster with increasing
number of threads, we go from a +3.5% with 4 threads
to a +15% with 16 threads.

The only drawback is that now when testing with more
threads than physical available cores, the speed slows
down to a crawl. This is expected and was similar at what
we had setting the old sleepingThreads to false.

No functional change.

9 years agoIntroduce Spinlock class
Marco Costalba [Sun, 22 Feb 2015 13:40:46 +0000 (14:40 +0100)]
Introduce Spinlock class

Initialization is more complex than what I'd like due
to MSVC compatibility that for some reason does not like:

std::atomic_flag lock = ATOMIC_FLAG_INIT;

No functional change.

9 years agoSync with master
Marco Costalba [Mon, 23 Feb 2015 12:35:04 +0000 (13:35 +0100)]
Sync with master

bench: 8253813

9 years agoFix build under OS X
Marco Costalba [Sun, 22 Feb 2015 15:30:53 +0000 (16:30 +0100)]
Fix build under OS X

Reported by Vince Negri

No functional change.