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

137 commits

Author SHA1 Message Date
ppigazzini
d4af15f682 Update AUTHORS and copyright notice
No functional change

Resolves #555
2016-01-02 09:43:51 +00:00
Marco Costalba
9742fb10fd Update Copyright year
No functional change.

Resolves #554
2016-01-01 10:17:36 +00: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
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
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
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
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
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
Marco Costalba
60c121f3b1 Sync with master
bench: 7374604
2015-01-31 13:05:51 +01:00
Jean-Francois Romang
a3b4e9e23c Ressurrect hashfull patch
This is an old patch from Jean-Francois Romang to send
UCI hashfull info to the GUI:
https://github.com/mcostalba/Stockfish/pull/60/files

It was wrongly judged as a slowdown, but it takes much
less than 1 ms to run, indeed on my core i5 2.6Ghz it
takes about 2 microsecs to run!

Regression test is good:

STC
LLR: 2.96 (-2.94,2.94) [-3.00,1.00]
Total: 7352 W: 1548 L: 1401 D: 4403

LTC
LLR: 2.96 (-2.94,2.94) [-3.00,1.00]
Total: 61432 W: 10307 L: 10251 D: 40874

I have set the name of the author to the original
one.

No functional change.
2015-01-30 18:07:20 +01:00
Marco Costalba
96e36a7897 Explicitly defaulted and deleted members
Better than a bit obscure implicit ones.

No functional change.
2015-01-21 13:18:19 +01:00
Marco Costalba
05cb58f4fc Fix some missing rename from previous patch
No functional change.
2015-01-17 22:15:15 +01:00
Marco Costalba
595fc342cf Fix a possible overflow in TT resize
On platforms where size_t is 32 bit, we
can have an overflow in this expression:

(mbSize * 1024 * 1024)

Fix it setting max hash size of 2GB on platforms
where size_t is 32 bit.

A small rename while there: now struct Cluster
is definied inside class TranspositionTable so
we should drop the redundant TT prefix.

No functional change.
2015-01-17 21:42:47 +01:00
Marco Costalba
4eb2d8ce09 Assorted headers cleanup
Mostly comments fixing and other small things.

No functional change.
2015-01-11 22:56:35 +01:00
Marco Costalba
42b48b08e8 Update copyright year
No functional change.
2015-01-10 11:46:28 +01:00
Marco Costalba
91cc82aa25 Let material probing to access per-thread table
It is up to material (and pawn) table look up
code to know where the per-thread tables are,
so change API to reflect this.

Also some comment fixing while there

No functional change.
2015-01-02 21:31:02 +01:00
Marco Costalba
413b243809 Coding style in TT code
In particular seems more natural to return
bool and TTEntry on the same line, actually
we should pass and return them as a pair,
but due to limitations of C++ and not wanting
to use std::pair this can be an acceptable
compromise.

No functional change.

Resolves #157
2014-12-14 23:49:00 +00:00
mstembera
14cf27e6f6 Avoid searching TT twice for the same key/position during probe() and store().
Just keep the pointer and remove code from tt.cpp

STC
LLR: 2.96 (-2.94,2.94) [-1.50,4.50]
Total: 13620 W: 2810 L: 2665 D: 8145

LTC
LLR: 2.97 (-2.94,2.94) [0.00,6.00]
Total: 13021 W: 2238 L: 2073 D: 8710STC http://tests.stockfishchess.org/tests/view/548436860ebc59331739b90c

STC 4MB
ELO: 2.41 +-2.2 (95%) LOS: 98.6%
Total: 40000 W: 8175 L: 7897 D: 23928

LTC 16MB
ELO: 1.78 +-2.0 (95%) LOS: 96.1%
Total: 39683 W: 6763 L: 6560 D: 26360

Resolves #151

Bench: 8116521
2014-12-13 07:22:37 +00:00
Marco Costalba
1a939cd8c8 Fix a warning on Intel C++
warning #2259: non-pointer conversion from "int" to
"uint8_t={unsigned char}" may lose significant bits

No functional change.
2014-11-17 12:56:48 +01:00
Marco Costalba
57fdfdedcf Assorted code-style triviality
No functional change.
2014-11-09 20:17:29 +01:00
mstembera
2fd075d1ea Optimize TranspositionTable::store() and TranspositionTable::probe() for speed.
No functional change.

Resolves #85
2014-11-03 18:40:49 +00:00
Marco Costalba
c97b702f4d Fix some warnings with Intel C++ compiler
No functional change.
2014-10-12 20:34:54 +01:00
lucasart
24ba204931 Raise max Hash to 1TB
And use size_t where appropriate, as suggested on FishCooking.

No functional change.
2014-07-01 18:37:18 +08:00
Ron Britvich
ccd823a4ff Pack 3 TT entries in 32 bytes cluster
Idea from Ron Britvich

Code reworked by Marco Costalba and Joona Kiiski

Bench: 8095369

Resolves #3
Resolves #10
2014-06-28 14:06:32 -04:00
Marco Costalba
678425f274 Fix a warning with MSVC 2010
Warning C4804: '<' : unsafe use of type 'bool' in operation

No functional change.
2014-03-30 14:25:57 +02:00
Jean-Francois Romang
4833887842 Further simplification of TT replace strategy
No functional change
2014-03-29 10:05:02 +01:00
Marco Costalba
865b71309c Simplify TT replace strategy
Tested for no-regression with SPRT[-3, 1] at STC
LLR: 2.96 (-2.94,2.94) [-3.00,1.00]
Total: 32046 W: 6020 L: 5918 D: 20108

No functional change.
2014-03-24 08:32:08 +01:00
mstembera
ffdf63ff7c Refresh TT entries generation automatically on probe
And other assorted simplifications, tested with SPRT[-3, 1]

Passed both short TC
LLR: 2.96 (-2.94,2.94) [-3.00,1.00]
Total: 18814 W: 3600 L: 3475 D: 11739

And long TC
LLR: 2.96 (-2.94,2.94) [-3.00,1.00]
Total: 20731 W: 3217 L: 3096 D: 14418

No functional change.
2014-03-23 09:46:15 +01:00
Marco Costalba
41641e3b1e Assorted tweaks from DON
Mainly renames and some little code style improvment,
inspired by looking at DON sources:

https://github.com/erashid/DON

No functional change.
2014-02-09 17:31:45 +01:00
Marco Costalba
40c863d41a Increase max hash size to 16GB
TCEC season 3, which is due to start in a few weeks, just
had its server upgraded to 64GB RAM and will therefore allow
16GB hash to be used per engine.

This is almost the upper limit without changing the
type of size and hashMask. After this we need to
move to uint64_t instead of uint32_t.

No functional change.
2014-01-18 18:22:32 +01:00
Marco Costalba
c9dcda6ac4 Update copyright year
No functional change.
2014-01-02 01:49:18 +01:00
Richard Lloyd
13a73f67c0 Big assorted spelling fixes
No functional change.
2013-12-02 20:29:35 +01:00
Lucas Braesch
eed508b444 Futility pruning simplification
1/ eval margin and gains removed:
16bit are now free on TT entries, due to the removal of eval margin. may be useful
in the future :) gains removed: use instead by Value(128). search() and qsearch()
are now consistent in this regard.

2/ futility_margin()
linear formula instead of complex (log(depth), movecount) formula.

3/ unify pre & post futility pruning
pre futility pruning used depth < 7 plies, while post futility pruning used
depth < 4 plies. Now it's always depth < 7.

Tested with fixed number of games both at short TC:
ELO: 0.82 +-2.1 (95%) LOS: 77.3%
Total: 40000 W: 7939 L: 7845 D: 24216

And long TC
ELO: 0.59 +-2.0 (95%) LOS: 71.9%
Total: 40000 W: 6876 L: 6808 D: 26316

bench 7243575
2013-11-09 10:17:27 +01:00
Marco Costalba
343544f3f7 Revert "Retire eval margin and gains"
This reverts commit ecd07e51d0.

Patch was incorrect and partial. It will be reapplied in
the correct form.

bench: 9189063
2013-11-07 22:32:13 +01:00
Lucas Braesch
ecd07e51d0 Retire eval margin and gains
1/ eval margin and gains removed:
 - gains removed by Value(128): search() and qsearch() now behave consistently!

2/ futility_margin()
 - testing showed that there is no added value in this weird (log(depth), movecount)
   formula, and a much simpler linear formula is just as good. In fact, it is most
   likely better, as it is not yet optimally tuned.
 - the new simplified formula also means we get rid of FutilityMargins[], its
   initialization code, and more importantly ss->futilityMoveCount, and the hacky
   code that updates it throughout the search().
 - the current formula gives negative futility margins, and there is a hidden interaction
   between the move coutn pruning formula and the futility margin one: what happens is
   that MCP is supposed to be triggered before we use the non-sensical negative futility
   margins.

3/ unify pre & post futility pruning
 - pre futility pruning (what SF calls value based pruning) used depth < 7 plies,
   while post futility pruning (what SF calls static null move pruning) used depth < 4 plies.
 - also the condition depth < 7 in pre futility pruning was not obvious, and it seemd
   to be depth < 16 (futility_margin() returns an infinite value when depth >= 7).

Tested with fixed number of games both at short TC:
ELO: 0.82 +-2.1 (95%) LOS: 77.3%
Total: 40000 W: 7939 L: 7845 D: 24216

And long TC
ELO: 0.59 +-2.0 (95%) LOS: 71.9%
Total: 40000 W: 6876 L: 6808 D: 26316

bench: 10206576
2013-11-07 19:46:51 +01:00
Lucas Braesch
7f142d6817 Use prefix operators wherever possible
No functional change.
2013-10-05 18:10:43 +02:00
Kojirion
a71209868b Use pre-increment also for native types
Now that we use pre-increment on enums, it
make sense, for code style uniformity, to
swith to pre-increment also for native types,
although there is no speed difference.

No functional change.
2013-09-15 09:17:21 +02:00
homoSapiensSapiens
fc316cbca9 Some renaming in TT store()
No functional change.
2013-08-14 09:38:35 +02:00
Marco Costalba
4ede49cd85 Fully qualify memset and memcpy
And other trivial touches.

Ispired by Lucas's DiscoCheck

No functional change.
2013-07-13 18:01:13 +02:00
Marco Costalba
203fdc9ac1 Use calloc() in TranspositionTable::set_size()
Function calloc() already initializes memory to
zero, so avoid calling clear() afterwards.

Also some renaming while there (inspired by DiscoCheck).

No functional change.
2013-06-29 11:23:07 +02:00
Marco Costalba
d44ac0a485 Another take at TT alignment
This time revert to original version but using
uintptr_t instead of size_t

Suggested by Lucas.

No functional change.
2013-05-02 09:38:23 +02:00
Marco Costalba
481eda4ca0 Re-add "Cache line aligned TT"
But this time do not play with pointers, in
particular do not assume that size_t is an
unsigned type of the same width as pointers.

This code should be fully portable.

No functional change.
2013-05-01 23:42:16 +02:00
Marco Costalba
293c44bc09 Revert "Cache line aligned TT"
This reverts commit 083fe58124

It seems to break Android build

No functional change.
2013-04-30 19:42:21 +02:00
Marco Costalba
083fe58124 Cache line aligned TT
Let TT clusters (16*4=64 bytes) to hold on a singe cache line.
This avoids the need for the double prefetch.

Original patches by Lucas and Jean-Francois that has also tested
on his AMD FX:

BIG HASHTABLE

./stockfish bench 1024 1 18 > /dev/null

Before:
1437642 nps
1426519 nps
1438493 nps

After:
1474482 nps
1476375 nps
1475877 nps

SMALL HASHTABLE

./stockfish bench 128 1 18 > /dev/null

Before:
1435207 nps
1435586 nps
1433741 nps

After:
1479143 nps
1471042 nps
1472286 nps

No functional change.
2013-04-26 19:38:11 +02:00
Marco Costalba
c5ec94d0f1 Update copyright year
No functional change.
2013-02-19 07:54:14 +01:00
Marco Costalba
0be7b8c542 Further simplify first_entry()
We can encode the ClusterSize directly in the
hashMask, this allows to skip the left shift.

There is no real change, but bench number is now
different because instead of using the lowest order
bits of the key to index the start of the cluster,
now we don't use the last two lsb bits that are
always set to zero (cluster size is 4). So for
instance, if 10 bits are used to index the cluster,
instead of bits [9..0] now we use bits [11..2].
This changes the positions that end up in the same
cluster affecting TT hits and so bench is different.

Also some renaming while there.

bench: 5383795
2013-02-09 16:37:20 +01:00
Marco Costalba
c698362680 Microptimize first_entry() for 32bits
Do a 32bit bitwise 'and' instead of a 64bit
subtract and bitwise 'and'.

This is possible because even in the biggest
hash table case (8GB) the number of entries
is 2^29 so storable in an unsigned int.

No functional change.
2013-02-09 10:55:38 +01:00
Marco Costalba
fe3352665b Retire TTCluster and simplify TT
Also some renaming while there.

No functional change.
2013-02-09 10:55:20 +01:00
jundery
88c3670edf Rename posKey stored in the transposition table
[Edit: Slightly extended by me]

No functional change.
2013-02-06 08:03:37 +01:00
Marco Costalba
3cf6471738 Revert evaluation cache
And return on using TT as backing store for position
evaluations.

Tests (even on single thread) show eval cache was a regression.
In multi thread result should be even worst because eval cache
is a per-thread struct, while TT is shared.

After 4957 games at 15"+0.05 (single thread)
eval cache vs master 969 - 1093 - 2895  -9 ELO

So previous reported result of +18 ELO was probably due to an
issue in the testing framework (a bug in cutechess-cli) that
has been fixed in the meanwhile.

bench: 5386711
2012-12-27 13:57:17 +01:00