1
0
Fork 0
Commit Graph

23 Commits (49c50399fe39b7b80ebe1cba1b986e8759633e51)

Author SHA1 Message Date
Marco Costalba 4b55d3d883 Increase TT size limit to 8 GB
We had an overflow due to use an integer for hash size,
now we use a size_t as we should, so we can increase to
an higher limit.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2010-02-01 16:53:10 +01:00
Marco Costalba 06a5b602dc Fix an off-by-one bug in extract_pv()
In case we reach ply == PLY_MAX we exit the function
writing

pv[PLY_MAX] = MOVE_NONE;

And because SearchStack is defined as:

struct SearchStack {
  Move pv[PLY_MAX];
  Move currentMove;
  .....

We end up with the unwanted assignment

SearchStack.currentMove = MOVE_NONE;

Fortunatly this is harmless because currentMove is not used where
extarct_pv() is called. But neverthless this is a bug that
needs to be fixed.

Thanks to Uri Blass for spotting out this.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-10-09 10:04:55 +01:00
Marco Costalba 60bc30275d Small code reformat in TranspositionTable::extract_pv()
In particular don't use an array of StateInfo, this
avoids a possible overflow and is in any case redundant.

Also pass as argument the pv[] array size to avoid a second
possible overflow on this one.

Fix suggested by Joona.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-10-06 07:14:12 +01:00
Marco Costalba 166c09a7a0 Reuse 5 slots instead of 4
But this time with the guarantee of an always aligned
access so that prefetching is not adversely impacted.

On Joona PC
1+0, 64Mb hash:

Orig - Mod: 174 - 237 - 359

Instead after 1000 games at 1+0 with 128MB hash size
we are at + 1 ELO (just 4 games of difference).

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-08-14 08:13:13 +01:00
Marco Costalba 60b5da4cc8 Use aligned prefetch address
Prefetch always form a chache line boundary. It seems
that if prefetch address is not cache line aligned then
performance is adversely impacted.

Hopefully we will resuse that 32 bits of padding for something
useful in the future.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-08-10 13:49:00 +01:00
Marco Costalba 76ae0e36be Enable prefetch also for gcc
This fix a compile error under Linux with gcc when
there aren't the intel dev libraries.

Also simplify the previous patch moving TT definition
from search.cpp to tt.cpp so to avoid using passing a
pointer to TT to the current position.

Finally simplify do_move(), now we miss a prefetch in the
rare case of setting an en-passant square but code is
much cleaner and performance penalty is almost zero.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-08-10 01:42:35 +01:00
Marco Costalba cd4604b05c Add TT prefetching support
TT.retrieve() is the most time consuming function
because almost always involves a very slow RAM access.

TT table is so big that is never cached. This patch
prefetches TT data just after a move is done, so that
subsequent TT.retrieve will be very  fast.

Profiling with VTune shows that TT:retrieve() times are
almost cutted in half !

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-08-09 14:18:15 +01:00
Marco Costalba 6f1475b6fc Use 32 bit key in TT
Shrink key to 32 bits instead of 64. To still avoid
collisions use the high 32 bits of position key as the
TT key and the low 32 bits to retrieve the correct
cluster index in the table.

With this patch size og TTentry shrinks to 96 bits instead
of 128 and the cluster of 4 TTEntry sums to 48 bytes instead
of 64.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-08-09 04:42:07 +01:00
Tord Romstad 2fff532f4e Moved the code for extracting the PV from the TT to tt.cpp, where
it belongs.
2009-08-06 14:02:53 +02:00
Marco Costalba 630fda2e2c Reduce SMP contention on TT
Move TT object away from heavy write accessed NodesSincePoll
and also, inside TT isolate the heavy accessed writes variable.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-06-13 11:13:09 +01:00
Marco Costalba 5c81602d14 Update copyright year
We are well in 2009 already.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-05-07 14:54:40 +02:00
Marco Costalba aabd526f7c Change TT interface to ask directly for a position key
Instead of a position because the key is all that we
need.

Interface is more clear and also very very little bit faster.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-05-03 08:11:36 +01:00
Marco Costalba 2f2e48fad2 Code style cleanup in transposition table code
Assorted fixes but no functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-04-27 13:21:49 +01:00
Marco Costalba 659c54582d Revert setting a flag when TT value equals static evaluation
Strangely enough it seems that optimization doesn't work.

After 760 games at 1+0: +155 -184 =421 -13 ELO

Probably the overhead, although small, for setting the flag
is not compensated by the saved evaluation call.

This could be due to the fact that after a TT value is stored,
if and when we hit the position again the stored TT value is
actually used as a cut-off so that we don't need to go on
with another search and evaluation is avoided in any case.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-03-31 20:41:06 +01:00
Marco Costalba 6a8e46d53e Remember when TT value equals static evaluation value
When the stored TT value equals the static value set a
proper flag so to not call evaluation() if we hit the
same position again but use the stored TT value instead.

This is another trick to avoid calling costly evaluation()
in qsearch.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-03-30 08:54:09 +01:00
Marco Costalba c6c4713ab2 Document TTEntry and move layouts
No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-03-30 08:29:02 +01:00
Marco Costalba 9e44a6dba9 A move needs 17 bits not 19
Fix a bug in the way a move is stored and read in a TT entry.
We use a mask of 19 bits insteaad of 17 so that the last
two bits in the TT entry end up to be random data.

This bug will bite us when we will use these two until now
unused bits.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-03-29 17:23:41 +01:00
Marco Costalba 5a0581498c Cache evaluation score in qsearch
Instead of just drop evaluation score after stand pat
logic save it in TT so to be reused if the same position
occurs again.

Note that we NEVER use the cached value apart to avoid an
evaluation call, in particulary we never return to caller
after a succesful tt hit.

To accomodate this a new value type VALUE_TYPE_EVAL has been
introduced so that ok_to_use_TT() always returns false.

With this patch we cut about 15% of total evaluation calls.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-03-24 18:28:42 +01:00
Marco Costalba 5dc2312121 Update copyright info
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-10-20 21:47:20 +02:00
Marco Costalba 7dd0c39714 Warnings termination fest
A bunch of Intel C++ warnings removed, other silent out.

Still few remaining but need deeper look.

Also usual whitespace crap removal noise.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-09-24 00:32:53 +02:00
Marco Costalba a230dc1404 Split transposition table lookup in a separate function
This slims down the code and is a prerequisite for
future patches.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-09-06 15:53:43 +02:00
Marco Costalba c2c0ba875f TranspositionTable: add first_entry() helper
An inline function to retrieve the first TT entry
given a position.

Plus usual whitespace noise.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-09-06 12:30:07 +02:00
Marco Costalba bb751d6c89 Initial import of Glaurung 2.1 2008-09-01 07:59:13 +02:00