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

130 commits

Author SHA1 Message Date
Joona Kiiski
856a5f3aaa Revert C++11 merge
Restore the state of repo back to commit 'Simplify pawn code a bit' (1e6d21dbb6)

No functional change
2015-03-07 07:38:22 +00: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
Marco Costalba
a2f46446cf Revert store of distinct upper and lower bounds
Test by Joona prooves the new feature don't value 70 added lines of code.

Grand totals after 10040 games (crashes: 0) for tt_both

master_9edc7 - 6a93488_6a934: 1756 - 1688 - 6596 ELO +2 (+- 2.7)

Confirmed by test of Gary:

After 8680 games:
ELO: 0.80 +- 99%: 9.62 95%: 7.31
LOS: 65.38%
Wins: 1288 Losses: 1268 Draws: 6130

Thanks a lot to both for testing it !!!

bench 5149248
2012-12-15 11:18:52 +01:00
Marco Costalba
feeafb0a50 Store distinct upper and lower bound scores
This is more complex than what I'd like but I
was unable to split in small chunks.

Here we add 2 slots to TTEntry (valueUpper and depthUpper)
so that sizeof(TTEntry) returns to the original 16 bytes
and we can pack exactly 4 entries in a 64 bytes cache line.

Now we save an upper bound score alongside a lower (exact)
score. The idea is to increase TT cut-offs rates becuase
there is now an higher probability for a node to use TT info.

This patch is highly experimental and probably needs further
steps as is hinted by an unrealistic bench number:

bench: 2022385
2012-12-09 13:15:50 +01:00
Marco Costalba
98cd8239cc Don't save eval score in TT
This patch completes the removal of eval info
in TT table.

No functional change.
2012-12-01 15:19:50 +01:00
Marco Costalba
6b5322ce00 Rename first_1 / last_1 in lsb / msb
It seems more accurate: lsb is clear while 'first
bit' depends from where you look at the bitboard.

And fix compile in case of 64 bits platforms that
do not use BSFQ intrinsics.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2012-07-08 09:36:40 +01:00
Marco Costalba
67d91dfd50 Use last_1() to compute new TT size
Transposition table consists of a power of 2
number of TTCluster entries.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2012-07-07 19:46:13 +01:00
Marco Costalba
b76c04c097 Rename ValueType to Bound
It is a more conventional and common naming.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2012-01-27 19:49:38 +01:00
Marco Costalba
8307da0de7 Update copyright year to 2012
And refresh Readme.txt while there.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2011-12-30 13:52:16 +01:00