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

3704 commits

Author SHA1 Message Date
Marco Costalba
6f997a83d6 Small code stye fixes
Among them restore the original rootPos name for
the starting position.

No functional change.
2015-10-17 09:29:07 +02:00
joergoster
a75e45b37e Simplify altering the search depth of the helper threads
As a side-effect, the old iterative deepening loop
logic is being restored.

bench: 8116244 (after rebasing on new master)
2015-10-17 08:11:15 +02:00
mstembera
7b9e83f604 Back to @mbootsector original easy move fix which is the correct one. 2015-10-17 08:09:40 +02:00
Gary Linscott
17f96bc641 Revert "Delay waiting for threads to finish"
This reverts commit 35e649d70d6426a311325de221af797f864d171b.

We need to be sure all threads are finished before sending 'bestmove'.
2015-10-17 08:09:38 +02:00
Marco Costalba
47b5242930 Set the search start time much earlier
The start time is the time point we start our clock and in
an ideal case it should be set to the same clock running in
the tournament manager when it sends to the engine the 'go'
UCI command.

Currently it is set at the beginning of MainThread::think()
but this means we have not accounted for the time to wake
up the thread and the time it takes start_thinking to join()
the main thread, possibly waiting for the slave threads to finish.

In standard conditions we are talking of very few msecs, but
with high number of cores and high time pressure, it is
difficult to get a reliable estimate.

So move it much earlier, just before processing the 'go' command.

bench: 8397672
2015-10-17 08:09:36 +02:00
mstembera
e854b30c84 Bug fix for MSVC Error
error C2440: cannot convert from 'double' to 'Depth'

No functional change.
2015-10-17 08:09:34 +02:00
Marco Costalba
a129fa8ee3 Delay waiting for threads to finish
Wait after best move is sentm so that
waiting time is not accounted.

No functional change.
2015-10-17 08:09:33 +02:00
Ivan Ivec
06801f8dca Use a log formula for depths
The SPRT LTC test on 3 threads was like this:

LLR: 2.95 (-2.94,2.94) [0.00,5.00]
Total: 25653 W: 3730 L: 3521 D: 18402

The ELO STC test on 3 threads was like this:

ELO: 6.79 +-3.4 (95%) LOS: 100.0%
Total: 13716 W: 2435 L: 2167 D: 9114

The ELO STC test on 23 threads was like this:

ELO: 0.77 +-5.3 (95%) LOS: 61.1%
Total: 4970 W: 765 L: 754 D: 3451

bench: 8397672
2015-10-17 08:09:31 +02:00
Marco Costalba
f6512a4092 Move EasyMove logic to its original place
And other small fixes.

No functional change.
2015-10-17 08:09:29 +02:00
Marco Costalba
8a2c8c58ca Better fix of crash bug
Crash is due to slave thread accessing main thread
data while exiting.

Fix it in the proper way makeing slave threads
independent from main state.

No functional change.
2015-10-17 08:07:17 +02:00
Marco Costalba
494aeb199d Fix a crash on exit
In Thread::idle_loop() we now access main thread data,
namely Threads.main()->thinking

So upon exit we have to ensure main thread is the last
one to be deleted. It can be easily reproduced setting
more then one thread and then quitting.

This bug happens also in original lazy_smp but for some
reason remains hidden.

Although a crash, this should not compromise TCEC version
because it occurs only upon exiting the engine.

No functional change.
2015-10-17 08:07:15 +02:00
Marco Costalba
dee1bd8ebc Further tweak locks
No functional change.
2015-10-17 08:07:13 +02:00
Marco Costalba
309cc4fcd8 Further reformat lazy smp
No functional change.
2015-10-17 08:07:11 +02:00
Marco Costalba
9c587288da Simplify locking
Retire slavesMask. We don't need it. It si enough
'searching' and 'thinking' flags.

Further simplification is still possible, perhaps
we could use a single flag.

No functional change.
2015-10-17 08:07:09 +02:00
Marco Costalba
32d2c4e12b Move Thread::idle_loop() where it belongs
No functional change.
2015-10-17 08:07:07 +02:00
Marco Costalba
caba255a1c Retire id_loop
Inline its contents instead.

No functional change.
2015-10-17 08:07:05 +02:00
Marco Costalba
b01ad9ba18 Reformat lazy smp code
Just a first quick pass. Probably Skill and MultiPV
need some work too.

No functional change.
2015-10-17 08:07:03 +02:00
Marco Costalba
713604a3d4 Fix easy move
bench: 8397672
2015-10-17 08:07:01 +02:00
mbootsector
2d668a3cfc Lazy smp
Start all threads searching on root position and
use only the shared TT table as synching scheme.

It seems this scheme scales better than YBWC for
high number of threads.

Tested at very LTC (120+0.1) with 23 threads
ELO: 35.52 +-9.6 (95%) LOS: 100.0%
Total: 1109 W: 183 L: 70 D: 856

Tested at LTC with 23 threads
ELO: 34.41 +-9.9 (95%) LOS: 100.0%
Total: 1094 W: 184 L: 76 D: 834

Tested at LTC with 7 threads
ELO: 8.76 +-5.0 (95%) LOS: 100.0%
Total: 5000 W: 735 L: 609 D: 3656

Tested at STC with 7 threads
ELO: 16.76 +-5.4 (95%) LOS: 100.0%
Total: 5000 W: 899 L: 658 D: 3443

Bench: 8397672
2015-10-17 08:06:59 +02:00
Stéphane Nicolet
7ea5659c5f Asymmetry bonus for the attacking side
Use asymmetry in the position (king separation, pawn structure) to
compute an "initiative bonus" for the attacking side.

Passed STC:
LLR: 2.95 (-2.94,2.94) [0.00,5.00]
Total: 14563 W: 2826 L: 2636 D: 9101

And LTC:
LLR: 2.96 (-2.94,2.94) [0.00,5.00]
Total: 14363 W: 2317 L: 2141 D: 9905

Bench: 8116244

Resolves #462
2015-10-15 21:27:52 -07:00
VoyagerOne
8fd34d7763 Combination of two ideas:
Apply bonus for the prior CMH that caused a fail low.

Balance Stats: CMH and History bonuses are updated differently.
This eliminates the "fudge" factor weight when scoring moves. Also
eliminated discontinuity in the gravity history stat formula. (i.e. stat
scores will no longer inverse when depth exceeds 22)

STC:
LLR: 2.96 (-2.94,2.94) [0.00,5.00]
Total: 21802 W: 4107 L: 3887 D: 13808

LTC:
LLR: 2.96 (-2.94,2.94) [0.00,5.00]
Total: 46036 W: 7046 L: 6756 D: 32234

Bench: 7677367
2015-10-12 14:00:54 -07:00
Jonathan Calovski
55b46ffa90 Retire rook contact checks
STC:
LLR: 2.95 (-2.94,2.94) [-3.00,1.00]
Total: 34114 W: 6363 L: 6265 D: 21486

LTC:
LLR: 2.95 (-2.94,2.94) [-3.00,1.00]
Total: 61776 W: 9349 L: 9289 D: 43138

LTC (after rebasing):
LLR: 2.96 (-2.94,2.94) [-3.00,1.00]
Total: 15261 W: 2343 L: 2214 D: 10704

Bench: 7523382

Resolves #442
2015-10-07 19:43:20 +01:00
Marco Costalba
08d6465d90 Travis CI: add gcc 4.8 for osx
This setup was still missing.

Suggested by Stéphane Nicolet.

No functional change.
2015-10-07 20:33:37 +02:00
Marco Costalba
5f4d9309c8 Travis CI: add clang and osx
Extend builds to clang and osx platforms.

And check bench numbers.

No functional change.
2015-10-06 12:35:42 +02:00
Stefano80
436c303731 Tuning of assorted values
Passed STC

LLR: 2.96 (-2.94,2.94) [0.00,4.00]
Total: 45401 W: 8590 L: 8274 D: 28537

Passed LTC

LLR: 2.96 (-2.94,2.94) [0.00,4.00]
Total: 36089 W: 5589 L: 5331 D: 25169

Bench: 8397672

Resolves #445
2015-10-05 19:49:52 -07:00
Alain SAVARD
540b49a152 Remove queen threat evaluation
Threats by queen seem to be worthless.

STC:
LLR: 2.96 (-2.94,2.94) [-3.00,1.00]
Total: 13627 W: 2607 L: 2473 D: 8547

LTC:
LLR: 2.96 (-2.94,2.94) [-3.00,1.00]
Total: 19146 W: 2950 L: 2827 D: 13369

Bench: 8222484

Resolves #439
2015-10-06 03:35:17 +01:00
Marco Costalba
2e45447957 Add Trevis CI support
Add Travis CI support to GitHub repo.

After every push to master, Travis will build
the sources directly from GitHub repo according
to .travis.yml and verify everything is ok.

No functional change.
2015-10-05 12:39:34 +02:00
Marco Costalba
dc3508d157 Fix a comment in TTEntry::save
Comment was slightly incorrect.

No functional change.
2015-10-05 09:16:16 +02:00
Marco Costalba
ca38358574 Run PVS-STUDIO analyzer
Fix issues after a run of PVS-STUDIO analyzer.
Mainly false positives but warnings are anyhow
useful to point out not very readable code.

Noteworthy is the memset() one, where PVS prefers ss-2
instead of stack. This is because memeset() could
be optimized away by the compiler when using 'stack',
due to stack being a local variable no more used after
memset. This should normally not happen, but when
it happens it leads to very sublte and difficult
to find bug, so better to be safe than sorry.

No functional change.
2015-10-05 09:13:33 +02:00
Stefan Geschwentner
83e19fbed5 File based passed pawn bonus
Add file based bonus for passed pawns. Values tuned by SPSA.

STC:
LLR: 3.33 (-2.94,2.94) [0.00,5.00]
Total: 36889 W: 6805 L: 6507 D: 23577

LTC:
LLR: 2.97 (-2.94,2.94) [0.00,5.00]
Total: 32301 W: 5101 L: 4858 D: 22342

Bench: 8073614

Resolves #436
2015-10-03 03:50:06 -07:00
Jonathan Calovski
9f5b31c21d Bonus for checking moves
STC:
LLR: 2.97 (-2.94,2.94) [0.00,5.00]
Total: 14531 W: 2765 L: 2576 D: 9190

LTC:
LLR: 3.20 (-2.94,2.94) [0.00,5.00]
Total: 52518 W: 8107 L: 7782 D: 36629

Bench: 7556477

Resolves #435
2015-10-03 03:39:21 -07:00
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