Joona Kiiski [Sat, 6 Feb 2010 16:18:12 +0000 (18:18 +0200)]
Use posKey instead of pos.get_key() after NonPVIID
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Joona Kiiski [Sat, 6 Feb 2010 13:55:44 +0000 (15:55 +0200)]
Use opening book when pondering
Otherwise we will not use move given by opening book
when we receive 'ponderhit'-command.
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Marco Costalba [Fri, 5 Feb 2010 17:17:52 +0000 (18:17 +0100)]
Delay sorting of negative scored non-captures
We can do this only when needed, if we get a cut-off
before we skip sorting entirely. This reduces sorting
time of about 20%.
No functional change.
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Joona Kiiski [Fri, 5 Feb 2010 16:05:48 +0000 (18:05 +0200)]
Copy 4 SearchStack items in split()
In search routines we use information from previous ply
and init killers two plies ahead.
So for me it seems correct to copy 4 searchstack items
in split:
ply - 1, ply, ply + 1, ply + 2
Because
a) we do not split at root (ply == 0)
b) ply < PLY_MAX and SearchStack size is PLY_MAX_PLUS_2
there should be no risk of underflows or overflows
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Marco Costalba [Fri, 5 Feb 2010 16:37:33 +0000 (17:37 +0100)]
Remove sorting optimization for many zeroes
With negative history we don't have anymore a
lot of zeroes to score, so just split moves in
positives and non-positives sets.
Speed up is almost zero, we cannot test speed directly
because node count changed due to reorder, but I have
verified sorting is correct. With a profiler I have
seen we gain a little in sort_moves() and lose a little
in insertion_sort(), so the net effect is almost zero,
but code is simpler.
No real change, just move reordering.
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Joona Kiiski [Fri, 5 Feb 2010 13:20:38 +0000 (15:20 +0200)]
Give FailLow flag more descriptive name
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Joona Kiiski [Fri, 5 Feb 2010 13:12:48 +0000 (15:12 +0200)]
Remove Problem variable
It was only used to control StopOnPonderHit variable.
Now use FailLow variable instead.
Patch has a minor effect on time management when ponder is on.
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Joona Kiiski [Fri, 5 Feb 2010 12:24:28 +0000 (14:24 +0200)]
Remove unused failHighPly1 flag
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Joona Kiiski [Fri, 5 Feb 2010 12:21:22 +0000 (14:21 +0200)]
Remove unused FailHigh flag
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Joona Kiiski [Fri, 5 Feb 2010 12:17:38 +0000 (14:17 +0200)]
Simplify time management
noProblemFound condition is never true.
This was verified by running 800 games 1+0 match in 1 CPU computer.
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Marco Costalba [Fri, 5 Feb 2010 07:19:39 +0000 (08:19 +0100)]
Be sure negative see evasions are at the bottom
Because H.move_ordering_score() can return negative values
some negative see moves could be searched before non-negative
see moves with negative history.
This patch restores proper ordering.
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Marco Costalba [Wed, 3 Feb 2010 18:36:53 +0000 (19:36 +0100)]
Score non-captures only by history
Now that history can go negative and is almost alwyas
non zero we have no more reasons to use also psqt term.
After 994 games at 1+0
Mod vs Orig +204 =597 -193 +4 ELO
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Joona Kiiski [Thu, 4 Feb 2010 16:09:07 +0000 (18:09 +0200)]
Reduction lookup table
No functional change
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Marco Costalba [Tue, 2 Feb 2010 08:10:15 +0000 (09:10 +0100)]
Convert gains to use a piece-to mapping
Instead of piece-from-to, in this way it is similar
to what we already do for history.
Almost no change, but seems a bit simpler in this way.
After 995 games at 1+0
Mod vs Orig +207 =596 -192 +5 ELO
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Marco Costalba [Tue, 2 Feb 2010 18:01:24 +0000 (19:01 +0100)]
Fix a compile error from previous patch
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Joona Kiiski [Tue, 2 Feb 2010 17:25:20 +0000 (19:25 +0200)]
Fix indentations
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Joona Kiiski [Tue, 2 Feb 2010 17:21:49 +0000 (19:21 +0200)]
Retire outdated aspiration search code
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Marco Costalba [Tue, 2 Feb 2010 07:51:54 +0000 (08:51 +0100)]
Renamed stand pat as 'static null move pruning'
It seems more standard conformant. Also added a bit of
description directly from Tord.
No functional change.
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Marco Costalba [Mon, 1 Feb 2010 19:06:56 +0000 (20:06 +0100)]
Save futilityMargin for both colors
It will be needed by future patches.
No functional change.
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Marco Costalba [Mon, 1 Feb 2010 18:32:02 +0000 (19:32 +0100)]
Fix duplicated scaling function
We erroneusly added two times the same scaling function
to endgame's map.
Fix detected by valgrind becasue resulted in a memleak
of the first added scaling function.
Bug introduced by
30e8f0c9ad6a473 of 13/02/2009
No functional change.
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Marco Costalba [Mon, 1 Feb 2010 15:53:10 +0000 (16:53 +0100)]
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>
Marco Costalba [Mon, 1 Feb 2010 13:06:59 +0000 (14:06 +0100)]
Check bounds in set_option_value()
Normally it's up to the GUI to check for option's limits,
but we could receive the new value directly from the user
by teminal window. So let's check the bounds anyway.
No functional change.
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Marco Costalba [Sun, 31 Jan 2010 10:08:04 +0000 (11:08 +0100)]
Some code style triviality in root search
No functional change.
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Marco Costalba [Sat, 30 Jan 2010 18:18:27 +0000 (19:18 +0100)]
Add hardware POPCNT support for gcc
With new target 'make gcc-popcnt' it is now
possible to compile with enabled hardware POPCNT
support also with gcc. Until now was possible only
for Intel and MSVC compilers.
When this instruction is supported by CPU, for instance
on Intel i7 or i5 family, produced binary is a bit faster.
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Marco Costalba [Sat, 30 Jan 2010 09:35:04 +0000 (10:35 +0100)]
Revert "Remove pointless gcc flag when generating dependencies"
This reverts commit
c43c5fe9e0c9a99947b940133df2cb2bbb57c3f9.
Produces following build error after 'make clean', 'make icc' under Mandriva
with icc version 11.0
Makefile:306: .depend: No such file or directory
In file included from tt.cpp:28:
/usr/lib/gcc/i586-manbo-linux-gnu/4.3.2/include/xmmintrin.h:35:3: error: #error "SSE instruction set not enabled"
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Marco Costalba [Thu, 28 Jan 2010 23:16:00 +0000 (00:16 +0100)]
Retire captures pruning
Futility captures alone does not seem an improvment.
Perhaps is a combination of stand pat + futility that is winning,
so revert for now and continue testing starting from a standard
base until we find the correct receipe.
After 999 games at 1+0
Mod vs Orig +231 0506 -201 +10 ELO
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Marco Costalba [Fri, 29 Jan 2010 15:47:04 +0000 (16:47 +0100)]
Avoid search tree explosion in qsearch
Under some rare cases we can have a search tree explosion
due to a perpetual check or to a very long non-capture TT
sequence.
This avoids the tree explosion not following TT moves that
are not captures or promotions when we are below the
'generate checks' depth.
Idea suggested by Richard Vida.
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Joona Kiiski [Fri, 29 Jan 2010 08:13:21 +0000 (10:13 +0200)]
Correct qsearch() TT save
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Marco Costalba [Wed, 27 Jan 2010 11:05:27 +0000 (12:05 +0100)]
Stricter conditions in main search stand pat
Not a biggie but is a reduced pruned patch that doesn't
seems to hurt, so it is welcomed ;-)
After 999 games at 1+0
Mod vs Orig +207 =601 -191 +6 ELO
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Marco Costalba [Thu, 28 Jan 2010 11:47:48 +0000 (12:47 +0100)]
Use float instead of double in reduction parameters
This is faster on 32 bit CPU and precision is enough.
No functional change.
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Marco Costalba [Thu, 28 Jan 2010 11:39:15 +0000 (12:39 +0100)]
Micro optimize reduction_parameters()
At ply == OnePly (common case) we avoid some useless
floating point computation.
No functional change.
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Marco Costalba [Thu, 28 Jan 2010 11:14:27 +0000 (12:14 +0100)]
Avoid to calculate reduction for each move
This is slow because some floating point operation is
involved.
No functional change.
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Joona Kiiski [Wed, 27 Jan 2010 22:02:51 +0000 (00:02 +0200)]
Remove useless variable 'PostFutilityValueMargin'
No functional change
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Joona Kiiski [Wed, 27 Jan 2010 21:54:01 +0000 (23:54 +0200)]
Precalculate FutilityMargins
This way we don't need to copy+paste formula everywhere
No functional change
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Joona Kiiski [Wed, 27 Jan 2010 21:24:01 +0000 (23:24 +0200)]
Use calculate_reduction() function to simplify code
No functional change
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Joona Kiiski [Wed, 27 Jan 2010 20:59:18 +0000 (22:59 +0200)]
Bugfix: reduction was not set to zero in full depth search
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Joona Kiiski [Wed, 27 Jan 2010 20:56:11 +0000 (22:56 +0200)]
Implement calculate_reduction function
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Joona Kiiski [Wed, 27 Jan 2010 08:37:12 +0000 (10:37 +0200)]
Standardize set_option function
Previously input like "setoption name Use Search Log value true "
(note space at the end of the line) didn't work.
Now parse value same way as option name. This way we implicitly
left- and right-trim value.
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Joona Kiiski [Tue, 26 Jan 2010 18:22:51 +0000 (20:22 +0200)]
Do not initialize RootPosition at startup
Initializing high-level object at startup is very dangerous,
because low-level snippets are not yet initialized.
For example Position's constructor calls find_checkers() which
calls attackers_to() which depends on various global bitboard arrays
which are not yet initialized. I think we are lucky not to crash.
RootPosition.from_fen(StartPosition); is called immediately after
all initializations are made at uci_main_loop() which is the
correct behaviour
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Marco Costalba [Wed, 27 Jan 2010 18:46:57 +0000 (19:46 +0100)]
Aspiration window rewrite
Joona new aspiration window. Main idea is to always
research aspiration fail highs/low at the same
ply and use much smaller aspiration window than previously.
Testing result is very positive.
1CPU:
953-1149
4CPU:
545 - 656
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Marco Costalba [Wed, 27 Jan 2010 18:23:16 +0000 (19:23 +0100)]
Be sure we exit while loop with lock held
This fixes an hang introduced by recent locking
rewrite patch.
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Joona Kiiski [Wed, 27 Jan 2010 17:49:54 +0000 (19:49 +0200)]
Fix capture pruning
We forgot to update bestValue previously
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Marco Costalba [Wed, 27 Jan 2010 16:29:34 +0000 (17:29 +0100)]
Simplify locking in sp_search and sp_search_pv
Avoid to take the lock two times in a tight sequence, the first
in get_next_move() and the second to update sp->moves.
Do all with one lock and so retire the now useless locked version
of get_next_move().
Also fix some theorical race due to comparison sp->bestValue < sp->beta
is done out of lock protection. Finally fix another (harmless but time
waster) race that coudl occur because thread_should_stop() is also
called outside of lock protection.
No functional change.
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Marco Costalba [Wed, 27 Jan 2010 16:57:04 +0000 (17:57 +0100)]
Temporary revert "captures pruning" due to an assert
In debug run with 2 threads it happens to be following
assert after some minutes:
assert(value > -VALUE_INFINITE && value < VALUE_INFINITE);
in search(), line 1615.
I am not able to understand why, anyhow reverted for the moment.
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Marco Costalba [Wed, 27 Jan 2010 10:49:03 +0000 (11:49 +0100)]
Added some FIXME to track needed tests
This avoid us to forget some very needed tests now that
futility has changed in a whole big chunk we need to fine
tuning every splitted change.
No functional change.
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Marco Costalba [Wed, 27 Jan 2010 10:19:56 +0000 (11:19 +0100)]
Integrate gains table in History
This will be useful to use gains table in move
ordering along with history table.
No functional change and big code remove.
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Marco Costalba [Wed, 27 Jan 2010 09:55:19 +0000 (10:55 +0100)]
Introduce update_gains() and refactor some code
No functional change
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Joona Kiiski [Fri, 22 Jan 2010 20:54:28 +0000 (22:54 +0200)]
Fix some silly bugs
SelectiveDepth was ignored
Test results for the whole futility pruning series:
4CPU:
Orig - Mod: 959 - 1027 (+12 elo)
1CPU:
Orig - Mod: 763 - 830 (+15 elo)
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Joona Kiiski [Thu, 21 Jan 2010 20:45:38 +0000 (22:45 +0200)]
MaxGain based futility pruning for captures
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Joona Kiiski [Thu, 21 Jan 2010 20:13:02 +0000 (22:13 +0200)]
MaxGain based pruning
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Joona Kiiski [Thu, 21 Jan 2010 17:03:06 +0000 (19:03 +0200)]
Implement post futility pruning
and prevent futility pruning from pruning
castling moves
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Joona Kiiski [Thu, 21 Jan 2010 15:58:00 +0000 (17:58 +0200)]
Collect MaxGain statistics
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Joona Kiiski [Thu, 21 Jan 2010 14:50:23 +0000 (16:50 +0200)]
Implement MaxGain table
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Joona Kiiski [Tue, 26 Jan 2010 17:06:38 +0000 (19:06 +0200)]
Remove pointless gcc flag when generating dependencies
When generating dependencies there is absolutely no point
to pass -msse flag to gcc, so remove it.
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Joona Kiiski [Tue, 26 Jan 2010 17:05:06 +0000 (19:05 +0200)]
Remove InfiniteSearch hack
With current search control system, I can see absolutely no
reason to classify fixed time search as infinite search.
So remove old dated hack
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Joona Kiiski [Tue, 26 Jan 2010 16:55:27 +0000 (18:55 +0200)]
Remove last use of uip.eof()
Value of uip.eof() should not be trusted.
input like "go infinite searchmoves " (note space in the end of line)
causes problems.
Check the return value of (uip >> token) instead
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Marco Costalba [Tue, 26 Jan 2010 11:05:38 +0000 (12:05 +0100)]
Reduce lock contention in sp_search_pv()
In less then 1% of cases value > sp->bestValue, so avoid
an useless lock in the common case. This is the same change
already applied to sp_search().
Also SplitPoint futilityValue is not volatile because
never changes after has been assigned in split()
No functional change.
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Marco Costalba [Mon, 25 Jan 2010 21:18:12 +0000 (22:18 +0100)]
Fix a possible crash in thread_is_available()
When we have more then 2 threads then we do an array
access with index 'Threads[slave].activeSplitPoints - 1'
This should be >= 0 because we tested the variable just
few statements before, but because is a shared variable
it could be that the 'slave' thread set the value to zero
just after we test it, so that when we use the decremented
variable for array access we crash.
Bug spotted by Bruno Causse.
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Marco Costalba [Mon, 25 Jan 2010 18:48:10 +0000 (19:48 +0100)]
Small split() cleanup
Unify start loop for master and slave threads. Also guarantee
that all the 'stop' flags are set to false before first slave
is started, should be no harm because only master thread can
reset 'stop' flag of slaves to true, so should be no race but
better safe then sorry.
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Marco Costalba [Wed, 20 Jan 2010 10:40:33 +0000 (11:40 +0100)]
Prune evasions with negative SEE in qsearch
Only pure blocking evasions are candidate
for pruning.
After 998 games at 1+0
Mod vs Orig +215 =596 -187 +10 ELO
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Marco Costalba [Mon, 25 Jan 2010 15:22:50 +0000 (16:22 +0100)]
Avoid copy a Position to get a move's san notation
In move_to_san() we create by copy a new position just
to detect if move gives check. This could be very costly in
line_to_san() that calls move_to_san() for every move, so
create the position only once and pass a reference to move_to_san()
No functional change.
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Marco Costalba [Mon, 25 Jan 2010 14:01:20 +0000 (15:01 +0100)]
Fix a race in idle_loop() exiting
When pondering threads are put to sleep, but when thinking
the threads are parked in idle_loop in a tight polling loop
checking for workIsWaiting falg.
So before we set the slave's flag workIsWaiting we have to
guarantee that all the slave data is already setup because
slave can start in any moment from there.
Rearrange the last loop to fix this race.
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Marco Costalba [Mon, 25 Jan 2010 13:06:35 +0000 (14:06 +0100)]
In split() release the lock before slow search stack copy
Once we have allocated our slave threads and we have removed
master from available threads we can safely remove the lock
so that the lenghty search stack copy operation will not
impact lock contention.
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Marco Costalba [Mon, 25 Jan 2010 11:44:30 +0000 (12:44 +0100)]
Do not copy master position in split()
A pointer is enough because after a split point has been
setup master and slaves thread end up calling sp_search() or
sp_search_pv() and here a full copy of split point position is
done again, note that even master does another copy (of itself)
and this is done before any do_move() call so that master Position
is never updated between split() and sp_search().
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Marco Costalba [Mon, 25 Jan 2010 11:07:59 +0000 (12:07 +0100)]
Use fast_copy() instead of full copy in sp_search
And detach splitPoint Position from the master one.
So we duplicate StateInfo only once in split() instead
of one for each thread in sp_search
No functional change.
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Marco Costalba [Mon, 25 Jan 2010 11:04:00 +0000 (12:04 +0100)]
Better document how Position c'tor works
Renamed a bit the functions to be more clear what
we actually are doing when we craete a Position object
and explained how StateInfo works.
No functional change.
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Marco Costalba [Mon, 25 Jan 2010 10:18:35 +0000 (11:18 +0100)]
Fix a couple of MSVC casting warnings
Also removed some trailing whitespaces and aligned
indentation to current standard.
No functional change.
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Marco Costalba [Mon, 25 Jan 2010 10:07:30 +0000 (11:07 +0100)]
Copy only the search stack tail in split()
Only the previous, the current and the next ply SearchStack
are copied.
This reduces split overhead especially at low depth (high ply)
and with many threads.
Possibly no functional change (it is not easy to prove in SMP)
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Tord Romstad [Sun, 24 Jan 2010 15:09:54 +0000 (16:09 +0100)]
Merge branch 'master' of ssh://free2.projectlocker.com/sf
Tord Romstad [Sun, 24 Jan 2010 15:09:32 +0000 (16:09 +0100)]
Fixes a Chess960 bug when playing with more than one search thread.
The init_eval() function corrupted the static array castleRightsMask[]
in the Position class, resulting in instant crashes in most Chess960
games. Fixed by repairing the damage directly after the function is
called. Also modified the Position::to_fen() function to display
castle rights correctly for Chess960 positions, and added sanity checks
for uncastled rook files in Position::is_ok().
Marco Costalba [Sun, 24 Jan 2010 11:24:01 +0000 (12:24 +0100)]
Check for thread creation successful completion
It is a good programming practice to verify a system
call has indeed succeed.
No functional change.
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Marco Costalba [Sun, 24 Jan 2010 12:46:27 +0000 (13:46 +0100)]
Fix some races in SMP code
When a search fails high then sp->alpha is increased and
slave threads are requested to stop.
So we have to check for a stop request before to start a search
otherwise we could end up with sp->alpha >= sp->beta
leading to an assert in debug run in search_pv().
This patch fixes the assert and get rid of some of possible races.
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Tord Romstad [Fri, 22 Jan 2010 12:42:33 +0000 (13:42 +0100)]
Make sure we make a move at the end of the search when reaching
maximum depth during a "go movetime ..." search. This prevents
Stockfish from hanging forever after finding a mate in two or
three while running a test suite at a level of a few seconds
per move.
No functional change when playing games at normal time controls.
Marco Costalba [Tue, 19 Jan 2010 14:24:26 +0000 (15:24 +0100)]
If near beta generate checks at -OnePly
In qsearch() try to get a cutoff with the help of an
extra check if we are already very near.
Small increase in actual games but a good result in tactical
test sets where this patch makes SF more tactical.
Mod vs Orig +197 =620 -181 +6 ELO
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Marco Costalba [Wed, 20 Jan 2010 17:43:29 +0000 (18:43 +0100)]
Retire LMRPVMoves and LMRNonPVMoves
Are no used anymore.
No functional change.
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Marco Costalba [Tue, 19 Jan 2010 22:30:23 +0000 (23:30 +0100)]
Fix enum Value issue with gcc 4.4
Louis Zulli reports a miscompile with g++-4.4 from MacPorts.
Namely enum Value is compiled as unsigned instead of signed integer
and this yields an issue in score_string() where float(v) is incorrectly
casted when Value v is negative.
This patch ensure that compiler choses a signed variable to store a Value.
No functional change.
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Marco Costalba [Tue, 19 Jan 2010 10:48:22 +0000 (11:48 +0100)]
Small lnArray[] cleanup
No functional change.
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Marco Costalba [Mon, 18 Jan 2010 18:50:45 +0000 (19:50 +0100)]
Silence some silly MSVC warnings
Value is never used un-initialized, but MSVC is not
smart enough to detect itself :-(
No functional change.
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Marco Costalba [Sun, 17 Jan 2010 13:55:53 +0000 (14:55 +0100)]
Order check moves used in qsearch
Use the same scoring system used for evasions. Small if any
increase, but should be in at least for completeness.
After 999 games at 1+0
Mod vs Orig +208 =601 -190 +6 ELO
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Marco Costalba [Mon, 18 Jan 2010 14:47:43 +0000 (15:47 +0100)]
Avoid an useless evaluate() call
Now that we have position static score we don't
need to call evaluate() a second time.
No functional change.
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Marco Costalba [Mon, 18 Jan 2010 09:01:49 +0000 (10:01 +0100)]
Allow SearchStack to link an EvalInfo object
This will allow to have wider access to attack
information, for instance from MovePicker.
Note that 'eval' field become obsolete, it is kept
just becasue when we get a position score from TT
we update 'eval' even without an EvalInfo object.
No functional change.
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Joona Kiiski [Sun, 17 Jan 2010 17:14:23 +0000 (19:14 +0200)]
Make reduction search code SMP-friendly
In sp_search_pv() we do a LMR search using sp->alpha, at the end
we detect a fail high with condition (value > sp->alpha), but if
another thread has increased sp->alpha during our LMR search we
could miss to detect a fail high event becasue value will be equal
to old alpha and so smaller then new one.
This patch fixes this SMP-bug and changes also the non SMP versions
of the search to keep code style in sync.
Bug spotted by Bruno Causse.
No functional change (for single CPU case)
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Joona Kiiski [Sun, 17 Jan 2010 13:05:28 +0000 (15:05 +0200)]
Small cleanup of unused code in sp_search
futilityValue is now calculated immediately after
staticValue, so remove small bunch of unused code
No functional change
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Marco Costalba [Sun, 17 Jan 2010 12:54:52 +0000 (13:54 +0100)]
Fix silly MSVC warning
MSVC raises an "use of partially uninitialized variable" for futilityValue
and staticValue but this is not rue becasue when !isCheck variables
are never used, anyhow silence the warning.
No functional change.
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Marco Costalba [Sun, 17 Jan 2010 12:22:09 +0000 (13:22 +0100)]
Initialize futilityMargin in EvalInfo c'tor
This is less prone to bugs because now it's up to the
compiler don't forget this important initialization.
No functional change.
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Joona Kiiski [Sun, 17 Jan 2010 11:55:10 +0000 (13:55 +0200)]
Retire quick_evaluate()
No change in functionality signature
The only functional change is that when we reach PLY_MAX,
we now return VALUE_DRAW instead of evaluating position.
But we reach PLY_MAX only when position is dead drawn and
transposition table is filled with draw scores, so this
shouldn't matter at all.
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Joona Kiiski [Thu, 14 Jan 2010 20:58:38 +0000 (22:58 +0200)]
Razor at depth one, but do razoring only when not in check
This way razoring is always based on exact evaluation and
follows simple formula.
Joona's test results are positive:
32-bit 1CPU:
Mod - Orig: 1073 - 993
64-bit 4CPU:
Mod - Orig: 759 - 721
Functionality Signature:
11448962
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Marco Costalba [Tue, 12 Jan 2010 17:21:15 +0000 (18:21 +0100)]
Allow negative history values
Don't clamp to zero if a move continues to fail.
After 946 games at 1+0
Mod vs Orig +208 =562 -176 +12 ELO
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Marco Costalba [Sun, 10 Jan 2010 16:19:49 +0000 (17:19 +0100)]
Store node evaluation in SearchStack
This info will be used by future patches.
No functional change.
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Marco Costalba [Sun, 10 Jan 2010 00:12:15 +0000 (01:12 +0100)]
Decrease NullMoveMargin and adjust razoring
Also retire razoring margins vector and use
a simpler formula instead.
Now that we use a more accurate static evaluation
try to avoid useless null searches when we are well
below beta. And for teh same reason increase a bit
the razoring.
After 972 games at 1+0
Mod vs Orig +224 =558 -190 +12 ELO
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Marco Costalba [Mon, 11 Jan 2010 10:15:23 +0000 (11:15 +0100)]
Do not wait when AbortSearch is set
It means we have already received "stop" or "quit" commands.
This fixes an hang in tactical test in Fritz GUI. Bug
introduced by previous bug fix :-(
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Marco Costalba [Sun, 10 Jan 2010 11:38:59 +0000 (12:38 +0100)]
Fix sending of best move during an infinite search
According to UCI standard once engine receives 'go infinite'
command it should search until the "stop" command and do not exit
the search without being told so, even if PLY_MAX has been reached.
Patch is quite invasive because it cleanups some hacks used
by fixed depth and fixed nodes modes, mainly during benchmarks.
Bug found by Pascal Georges.
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Marco Costalba [Sat, 9 Jan 2010 15:45:31 +0000 (16:45 +0100)]
Fix threads count setting
Was broken after "Optimal tune for 8 cores" patch.
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Marco Costalba [Fri, 8 Jan 2010 11:51:11 +0000 (12:51 +0100)]
Optimal tune for 8 cores
After deep tests Louis Zulli found on his OCTAL machine that
best setup for an 8 core CPU is as following
"Threads" = 8
"Minimum Split Depth" = 6 or 7 (mSD)
"Maximum Number of Threads per Split Point" = not important (MNTpSP)
Here are testing results:
mSD7 (8 threads) vs mSD4 (8 threads): 291 - 120 - 589
mSD6 vs mSD7: 168 - 188 - 644
mSD6-MNTpSP5 vs mSD6-MNTpSP6: 172 - 172 - 656
SF-7threads vs SF-8threads: 179 - 204 - 617
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Marco Costalba [Fri, 8 Jan 2010 10:45:46 +0000 (11:45 +0100)]
Sync qsearch with search
So to have the same layout and be as much similar as
possible. The only functional change is that now we
try ttMove as first also in PV nodes and at the end
we save the ttMove, as it happens in search. This
should have almost zero impact on ELO but it seems
the correct thing to do.
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Marco Costalba [Tue, 5 Jan 2010 08:57:48 +0000 (09:57 +0100)]
Use full evaluation in null search
This is an important design change because we know
compute evaluation in each node.
This is a 2.0 type change!
After 977 games at 1+0
Mod vs Orig +236 =538 -202 51.74% +12 ELO
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Joona Kiiski [Mon, 4 Jan 2010 16:41:24 +0000 (18:41 +0200)]
Slow down reductions
After testing on Joona QUAD the whole LMR series:
Orig - Mod: 335 - 405 (+33 elo)
Functionality Signature:
12581900
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Joona Kiiski [Mon, 4 Jan 2010 06:46:33 +0000 (08:46 +0200)]
Use logarithmic LMR also at root
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Joona Kiiski [Sun, 3 Jan 2010 19:58:50 +0000 (21:58 +0200)]
Logarithmic LMR
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Marco Costalba [Thu, 7 Jan 2010 10:59:32 +0000 (11:59 +0100)]
Fix 'position ..... moves ' parsing bug
If after 'moves' there is a space then we crash.
The problem is that operator>>() trims whitespaces so that
after 'moves' has been extract we are still not at eof()
but remaining string contains only spaces. So that the next
extarction operation uip >> token ends up with unchanged token
value that remains 'moves', this garbage value is then feeded
to RootPosition.do_move() through move_from_string() that does
not detect the invalid move value leading to a crash.
This bug is triggered by Shredder 12 interface under Mac that
puts a space after 'moves' without any actual move list.
Bug fixed by Justin Blanchard
After reviewing UCI parsing code I spotted other possible weak
points due to the fact that we don't test if the last extract
operation has been succesful. So I have extended Justing patch
to fix the remaining possible holes in uci.cpp
No functional change.
Signed-off-by: Marco Costalba <mcostalba@gmail.com>