]> git.sesse.net Git - stockfish/log
stockfish
13 years agoMove printing of best move on think
Marco Costalba [Thu, 30 Dec 2010 14:45:43 +0000 (15:45 +0100)]
Move printing of best move on think

It seems a more appropiate place (IMHO) and helps to clarify
that idle_loop() should return a move, not a score.

Fix also handling of stalemate positions (we were not
sending any score) and we don't need to wait on "ponderhit",
this is done when returning in think().

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoUnify single and multi PV 'new best move' handling
Marco Costalba [Thu, 30 Dec 2010 11:53:02 +0000 (12:53 +0100)]
Unify single and multi PV 'new best move' handling

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoMove print_pv_info() under RootMove
Marco Costalba [Thu, 30 Dec 2010 10:55:25 +0000 (11:55 +0100)]
Move print_pv_info() under RootMove

And rename to pv_info_to_uci()

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoBetter document value_to_uci()
Marco Costalba [Thu, 30 Dec 2010 10:46:53 +0000 (11:46 +0100)]
Better document value_to_uci()

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoStandardize root_search() signature
Marco Costalba [Thu, 30 Dec 2010 09:38:02 +0000 (10:38 +0100)]
Standardize root_search() signature

Now pass alpha and beta by copy as in serach()

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoMove extract_pv_from_tt() and insert_pv_in_tt() under RootMove
Marco Costalba [Wed, 29 Dec 2010 10:00:32 +0000 (11:00 +0100)]
Move extract_pv_from_tt() and insert_pv_in_tt() under RootMove

Functional change only due to additional do/undo move
but absolutly harmless.

Also handle re-insertion in tt of PV lines also for multi PV case.

13 years agoUse rml[0].pv[] instead of dedicated pv[] array
Marco Costalba [Wed, 29 Dec 2010 07:47:14 +0000 (08:47 +0100)]
Use rml[0].pv[] instead of dedicated pv[] array

We have a small functionality change in case we have a
fail-high so that both rml[].pv and pv[] are updated, but if,
after researching, we have a fail-low then rml score is updated
again but pv[] remains the same and coming back from search we
used a PV line that has failed-low (after having failed-high).

With this patch we always use the 'correct' PV line, i.e. the
line with highest score at the end of the whole search.

Retire also redundant RootMove's 'move' member and directly
use pv[0] instead.

13 years agoLast small touches in RootMoveList
Marco Costalba [Tue, 28 Dec 2010 18:05:24 +0000 (19:05 +0100)]
Last small touches in RootMoveList

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoRetire LMR intermediate research
Marco Costalba [Mon, 20 Dec 2010 15:42:07 +0000 (16:42 +0100)]
Retire LMR intermediate research

It does not seem to improve anything.

After 8344 games Mod - Orig:
1362 - 1321 - 5661 ELO +2

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoUse insertion_sort() in RootMoveList
Marco Costalba [Tue, 28 Dec 2010 12:29:53 +0000 (13:29 +0100)]
Use insertion_sort() in RootMoveList

Simplify code and get a bit of extra speed, about +0.5%

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoRedefine MoveStack comparison as the natural one
Marco Costalba [Tue, 28 Dec 2010 10:45:57 +0000 (11:45 +0100)]
Redefine MoveStack comparison as the natural one

Define symbol '<' to mean 'minor of', as it should be. Its meaning
was reversed to be used with std::sort() that sorts in ascending order
while we want a descending order.

But now that we use our own sorting code we don't need this
trick anymore.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoFix broken last patch series
Marco Costalba [Tue, 28 Dec 2010 09:16:53 +0000 (10:16 +0100)]
Fix broken last patch series

When a reference breaks things !

Here we take a reference (that is a pointer) to an
entry in a vector that changes below us --> BOOM !

References are essential but should be considered with
care in C++ because could lead to nasty surprises.

Restored functionality.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoSpeedup moves root list sorting
Marco Costalba [Mon, 27 Dec 2010 12:29:52 +0000 (13:29 +0100)]
Speedup moves root list sorting

Instead of a default member by member copy use set_pv()
to copy the useful part of pv[] array and skip the remaining.

This greatly speeds up sorting of root move list !

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoUse a std::vector to store root moves
Marco Costalba [Mon, 27 Dec 2010 11:20:26 +0000 (12:20 +0100)]
Use a std::vector to store root moves

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoRename RootMoveList members removing 'move'
Marco Costalba [Mon, 27 Dec 2010 09:52:04 +0000 (10:52 +0100)]
Rename RootMoveList members removing 'move'

It is redundant being a move list ;-)

Also better document the two scores used by root list.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoRetire DirectionTable[]
Marco Costalba [Sun, 26 Dec 2010 23:13:10 +0000 (00:13 +0100)]
Retire DirectionTable[]

With this patch even word 'direction' is disappeared !

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoRetire direction.cpp
Marco Costalba [Sun, 26 Dec 2010 15:27:58 +0000 (16:27 +0100)]
Retire direction.cpp

Move the code to bitboard.cpp

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoRetire enum Direction
Marco Costalba [Sun, 26 Dec 2010 11:41:30 +0000 (12:41 +0100)]
Retire enum Direction

Use SquareDelta instead

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoRetire SignedDirectionTable[] and RayBB[]
Marco Costalba [Sun, 26 Dec 2010 10:58:48 +0000 (11:58 +0100)]
Retire SignedDirectionTable[] and RayBB[]

Function ray_bb() was used just in one endgame where can
be used squares_in_front_of() instead.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoRetire direction.h
Marco Costalba [Sun, 26 Dec 2010 09:54:45 +0000 (10:54 +0100)]
Retire direction.h

Move all to square.h

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoSimplify enum SquareDelta definition
Marco Costalba [Sun, 26 Dec 2010 09:21:48 +0000 (10:21 +0100)]
Simplify enum SquareDelta definition

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoUnify MovePicker c'tor call
Marco Costalba [Sat, 25 Dec 2010 17:03:43 +0000 (18:03 +0100)]
Unify MovePicker c'tor call

And use the standard one.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoUse generate_moves() in san.cpp
Marco Costalba [Sat, 25 Dec 2010 10:22:55 +0000 (11:22 +0100)]
Use generate_moves() in san.cpp

Instead of MovePicker and cleanup san.cpp

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoIgnore two braindamaged remarks under icc
Marco Costalba [Sat, 25 Dec 2010 07:59:47 +0000 (08:59 +0100)]
Ignore two braindamaged remarks under icc

Remark 1418: external function definition with no prior declaration

and

Remark 1419: external declaration in primary source file

Can be safely ignored because are pure idiocy.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoRenamed thread_should_stop() in cutoff_at_splitpoint()
Marco Costalba [Fri, 24 Dec 2010 23:11:53 +0000 (00:11 +0100)]
Renamed thread_should_stop() in cutoff_at_splitpoint()

It is more clear what happened.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoSimplify a condition in update of best move
Marco Costalba [Fri, 24 Dec 2010 16:07:00 +0000 (17:07 +0100)]
Simplify a condition in update of best move

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoTriviality in struct PieceLetters
Marco Costalba [Fri, 24 Dec 2010 14:25:11 +0000 (15:25 +0100)]
Triviality in struct PieceLetters

And little touches in search() too.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoBetter clarify how we use TT depth in qsearch
Marco Costalba [Sat, 18 Dec 2010 09:27:24 +0000 (10:27 +0100)]
Better clarify how we use TT depth in qsearch

Namely we use only two types of depth in TT:
DEPTH_QS_CHECKS or DEPTH_QS_NO_CHECKS.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoSecond cleanup wave on check_is_useless()
Marco Costalba [Wed, 15 Dec 2010 08:14:01 +0000 (09:14 +0100)]
Second cleanup wave on check_is_useless()

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoLet check_is_useless() follow SF coding style
Joona Kiiski [Tue, 14 Dec 2010 13:49:06 +0000 (15:49 +0200)]
Let check_is_useless() follow SF coding style

No functional change

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoFixed a bug in move_from_uci(): En passant captures were not handled
Tord Romstad [Tue, 14 Dec 2010 11:07:37 +0000 (12:07 +0100)]
Fixed a bug in move_from_uci(): En passant captures were not handled
correctly.

13 years agoSelective checks at qsearch
Joona Kiiski [Sun, 12 Dec 2010 09:54:50 +0000 (11:54 +0200)]
Selective checks at qsearch

After 5821 games
Mod- Orig:  1014 - 869 - 3938 ELO +8 (+- 3.6) LOS 97%

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoRetire uci_main_loop()
Marco Costalba [Mon, 13 Dec 2010 10:17:06 +0000 (11:17 +0100)]
Retire uci_main_loop()

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoSmall cleanup in uci.cpp
Marco Costalba [Mon, 13 Dec 2010 08:48:12 +0000 (09:48 +0100)]
Small cleanup in uci.cpp

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoRetire square_from_string()
Marco Costalba [Thu, 9 Dec 2010 11:10:02 +0000 (12:10 +0100)]
Retire square_from_string()

And rename move_from/to_string() in a more specific
move_from/to_uci() that is a simple coordinate notation.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoMove the last multi-threads globals to ThreadsManager
Marco Costalba [Sun, 12 Dec 2010 11:46:10 +0000 (12:46 +0100)]
Move the last multi-threads globals to ThreadsManager

Also rename ThreadsManager memeber data to be lower case.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoFurther reduce sleep lock contention
Marco Costalba [Sun, 12 Dec 2010 10:06:36 +0000 (11:06 +0100)]
Further reduce sleep lock contention

Use one sleep lock per thread insted of a single one shared.

Also renamed WaitLock in SleepLock.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoAllow threads to sleep when available
Marco Costalba [Sun, 7 Nov 2010 22:45:13 +0000 (23:45 +0100)]
Allow threads to sleep when available

By mean of an an UCI option it is possible let the available
threads to sleep, this should help with Hyper Threading although
is not the best solution when number of threads equals number
of available cores.

Option is disabled by default.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoIncrease MAX_THREADS to 16
Marco Costalba [Sat, 4 Dec 2010 08:18:18 +0000 (09:18 +0100)]
Increase MAX_THREADS to 16

No speed regression and no functional change.

After 7826 games Mod- Orig:
1188 - 1230 - 5408 ELO -1 (+- 3.1)

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoIncrease PV LMR to SF 1.8 levels
Marco Costalba [Sun, 5 Dec 2010 16:54:35 +0000 (17:54 +0100)]
Increase PV LMR to SF 1.8 levels

Non-PV LMR is left unchanged.

After 8819 games
Mod- Orig:  1442 - 1343 - 6034 ELO +3 (+- 2.9) LOS 86%

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoVarious cleanups in Position's ancillary functions
Marco Costalba [Mon, 6 Dec 2010 09:26:01 +0000 (10:26 +0100)]
Various cleanups in Position's ancillary functions

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoFix a crash due to a broken Book::open()
Marco Costalba [Sat, 4 Dec 2010 20:19:22 +0000 (21:19 +0100)]
Fix a crash due to a broken Book::open()

Bug introduced in 9dcc2aad98b9703

We can be asked to open a non-exsistent file,
in this case we should gracefully handle the
case and silently return instead of exiting.

Bug discovered and bisected down by Joona.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoNew try for unstoppable pawn evaluation
Joona Kiiski [Sat, 13 Nov 2010 16:42:12 +0000 (18:42 +0200)]
New try for unstoppable pawn evaluation

This time we try very hard to avoid false positives.
The obvious downside is that we also miss many true
winning positions.

After 10544 games on RC
Mod- Orig:  1744  - 1646 - 7154 ELO +3 (+- 2.7) LOS 83%

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoAllow razoring after a null move
Marco Costalba [Sat, 30 Oct 2010 14:28:33 +0000 (15:28 +0100)]
Allow razoring after a null move

After 8322 games on Russian Cluster
Mod- Orig:  1341 - 1281 - 5700 ELO +2 (+- 3) LOS 75%

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoPrune all negative see moves at low depths
Joona Kiiski [Tue, 30 Nov 2010 12:46:41 +0000 (14:46 +0200)]
Prune all negative see moves at low depths

After 2036 games Mod- Orig:
381 - 278 - 1377 ELO +17 (+- 6.2) LOS 99%

One of the biggest increases ever !

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoFix bestmove output in multi PV case
Marco Costalba [Sun, 28 Nov 2010 16:05:49 +0000 (17:05 +0100)]
Fix bestmove output in multi PV case

When MultiPV > 1, always take bestmove from the RootMoveList
(and don't bother with a ponder move). Without that the bestmove
is most probably incorrect.

Patch from Peter Petrov.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoFix 'generation' type to uint8_t
Marco Costalba [Mon, 22 Nov 2010 17:40:36 +0000 (18:40 +0100)]
Fix 'generation' type to uint8_t

When we store this value in TT we cut this to 9 bits,
so we need a smaller variable otherwise comparisons
like:

   replace->generation() == generation

Are always false if generation is bigger then the maximum
TT storable value.

This fixes a very nasty and difficult to spot bug (2 weeks for
regression hunting).

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoRevert sleeping threads
Marco Costalba [Fri, 19 Nov 2010 06:59:51 +0000 (07:59 +0100)]
Revert sleeping threads

Revert 141caf1d5b64 + c59efc53c9

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoRevert "Allow split point master to sleep (take 2)"
Marco Costalba [Tue, 23 Nov 2010 06:00:30 +0000 (07:00 +0100)]
Revert "Allow split point master to sleep (take 2)"

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoWe don't need a stringstream in buildKey()
Marco Costalba [Tue, 23 Nov 2010 08:09:15 +0000 (09:09 +0100)]
We don't need a stringstream in buildKey()

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoRetire Application class
Marco Costalba [Mon, 22 Nov 2010 13:55:56 +0000 (14:55 +0100)]
Retire Application class

It is a redundant boiler plate, just call initialization and
resource release directly from main()

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoRetire piece.cpp
Marco Costalba [Mon, 22 Nov 2010 10:50:58 +0000 (11:50 +0100)]
Retire piece.cpp

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoUCI options names should not be case sensitive
Marco Costalba [Sun, 21 Nov 2010 22:28:17 +0000 (23:28 +0100)]
UCI options names should not be case sensitive

Correctly handle uci option names in a case insensitive way.

Alos fix some indentation while there.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoRetire "New Game" UCI option
Marco Costalba [Sun, 21 Nov 2010 13:23:16 +0000 (14:23 +0100)]
Retire "New Game" UCI option

Was introduced by 403db5a6e9f
on 1/12/2009 to correctly handle "loose on time"
LSN filtering functionality, but is now unused.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoRemove hardcoded 16 from benchmark default positions size
Marco Costalba [Sun, 21 Nov 2010 12:06:53 +0000 (13:06 +0100)]
Remove hardcoded 16 from benchmark default positions size

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoMicro-optimize pl_move_is_legal()
Marco Costalba [Sun, 21 Nov 2010 11:43:16 +0000 (12:43 +0100)]
Micro-optimize pl_move_is_legal()

This L1/L2 optimization has an incredible +4.7% speedup
in perft test where this function is the most time consumer.

Verified a speed up also in normal bench, although smaller.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoStore "true" and "false" in bool options
Marco Costalba [Sat, 20 Nov 2010 13:23:28 +0000 (14:23 +0100)]
Store "true" and "false" in bool options

UCI protocol uses "true" and "false" for check and button types,
so store that values instead of "1" and "0", this simplifies a
bit the code.

Also a bit strictier option's type checking in debug mode.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoDebug counters don't need to be global
Marco Costalba [Sat, 20 Nov 2010 10:48:04 +0000 (11:48 +0100)]
Debug counters don't need to be global

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoSmall touches to engine_name()
Marco Costalba [Fri, 19 Nov 2010 16:03:44 +0000 (17:03 +0100)]
Small touches to engine_name()

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoUse occupied_squares() in book_key()
Marco Costalba [Tue, 16 Nov 2010 18:28:09 +0000 (19:28 +0100)]
Use occupied_squares() in book_key()

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoRearrange pawn moves generation
Marco Costalba [Tue, 16 Nov 2010 08:42:12 +0000 (09:42 +0100)]
Rearrange pawn moves generation

This patch greatly cleanups generation of pawn moves but
we change the order in which moves are generated so there is
a change in functionality, but not in perft.

The only real functionality change is that now when type == CHECK
we generate knight underpromotion captures only if give check and
not always as before.

Perft is 2% faster and fully verified.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoIntroduce generate_promotions()
Marco Costalba [Tue, 16 Nov 2010 07:51:07 +0000 (08:51 +0100)]
Introduce generate_promotions()

A bit ugly to guarantee no functional change.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoSimplify generate_pawn_captures()
Marco Costalba [Mon, 15 Nov 2010 15:27:05 +0000 (16:27 +0100)]
Simplify generate_pawn_captures()

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoCleanup Bioskey()
Marco Costalba [Mon, 15 Nov 2010 12:49:13 +0000 (13:49 +0100)]
Cleanup Bioskey()

And rename in dataAvailable()

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoLet bench to have full defaults arguments
Marco Costalba [Mon, 8 Nov 2010 19:49:40 +0000 (20:49 +0100)]
Let bench to have full defaults arguments

Now stockfish bench' defaults to

stockfish bench 128 1 12 default depth

that is the most used line (at least by me)

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoVarious cleanup in book.cpp
Marco Costalba [Mon, 8 Nov 2010 14:30:12 +0000 (15:30 +0100)]
Various cleanup in book.cpp

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoLet benchmark to default to depth 12
Marco Costalba [Mon, 8 Nov 2010 10:08:01 +0000 (11:08 +0100)]
Let benchmark to default to depth 12

And also simplify a lot the code.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoMove PieceValue[] and SlidingArray[] where they belong
Marco Costalba [Mon, 8 Nov 2010 08:44:28 +0000 (09:44 +0100)]
Move PieceValue[] and SlidingArray[] where they belong

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoAllow split point master to sleep (take 2)
Marco Costalba [Sun, 7 Nov 2010 22:45:13 +0000 (23:45 +0100)]
Allow split point master to sleep (take 2)

Let to sleep even split point master, it will be waken
up by its slaves when they return from the search.

This time let it be enabled by an UCI option, so
people is free to test it on their Hyper Thread box.

Option is disabled by default.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoUse namespace in position.cpp
Marco Costalba [Sun, 7 Nov 2010 12:41:21 +0000 (13:41 +0100)]
Use namespace in position.cpp

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoRetire uci.h and benchmark.h
Marco Costalba [Sun, 7 Nov 2010 12:22:13 +0000 (13:22 +0100)]
Retire uci.h and benchmark.h

Moved the single prototipes where are needed.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoObject OpeningBook doen't need to be global
Marco Costalba [Sun, 7 Nov 2010 12:12:48 +0000 (13:12 +0100)]
Object OpeningBook doen't need to be global

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoMake rkiss seed deterministic
Marco Costalba [Sun, 7 Nov 2010 11:33:17 +0000 (12:33 +0100)]
Make rkiss seed deterministic

Search at fixed depth with one thread must be
reproducible so remove randomess from time().

Also better license description.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoLet rkiss.h to follow SF coding style
Marco Costalba [Sun, 7 Nov 2010 11:11:01 +0000 (12:11 +0100)]
Let rkiss.h to follow SF coding style

Fix also Makefile after mersenne.cpp has been removed

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoUse Heinz's RKiss instead of marsenne
Marco Costalba [Sun, 7 Nov 2010 10:13:17 +0000 (11:13 +0100)]
Use Heinz's RKiss instead of marsenne

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoFix an off by one bug in print_uci_options()
Marco Costalba [Fri, 5 Nov 2010 12:59:48 +0000 (13:59 +0100)]
Fix an off by one bug in print_uci_options()

Last option was not printed.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoRetire bitbase.h
Marco Costalba [Fri, 5 Nov 2010 12:53:13 +0000 (13:53 +0100)]
Retire bitbase.h

Moved the only prototipe where is needed.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoRewrite options handling in an object oriented fashion
Marco Costalba [Thu, 4 Nov 2010 07:03:27 +0000 (08:03 +0100)]
Rewrite options handling in an object oriented fashion

Big rewrite and about 100 lines removed.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoRetire push_button() and button_was_pressed()
Marco Costalba [Wed, 3 Nov 2010 08:32:14 +0000 (09:32 +0100)]
Retire push_button() and button_was_pressed()

Directly access the underlying bool option.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoPrefer int to uint8_t when possible
Marco Costalba [Mon, 1 Nov 2010 12:16:32 +0000 (13:16 +0100)]
Prefer int to uint8_t when possible

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoAdd "mingw" compiler to Makefile
Marco Costalba [Mon, 1 Nov 2010 11:17:54 +0000 (12:17 +0100)]
Add "mingw" compiler to Makefile

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoFix MinGW warnings
Marco Costalba [Mon, 1 Nov 2010 10:44:46 +0000 (11:44 +0100)]
Fix MinGW warnings

I finally got SF to compile under MinGW (after adding pthread libraries)
and here are the fixed warnings.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoAllocate RootPosition on the stack
Marco Costalba [Sun, 31 Oct 2010 10:37:43 +0000 (11:37 +0100)]
Allocate RootPosition on the stack

And pass it as an argument.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoUpdate nodes after a do_move()
Marco Costalba [Sun, 31 Oct 2010 09:55:28 +0000 (10:55 +0100)]
Update nodes after a do_move()

And also store the node counter in Position and not in Thread.
This will allow to properly count nodes also in sub trees with
SMP active.

This requires a surprisingly high number of changes
in a lot of places to make it work properly.

No functional change but node count changed for obvious reasons.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoFix some icc's "statement is unreachable" warnings
Marco Costalba [Sat, 30 Oct 2010 17:44:34 +0000 (18:44 +0100)]
Fix some icc's "statement is unreachable" warnings

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoMove moveCount update near the SpNode case
Marco Costalba [Sat, 30 Oct 2010 17:18:48 +0000 (18:18 +0100)]
Move moveCount update near the SpNode case

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoIntroduce and use TranspositionTable::refresh()
Marco Costalba [Sat, 30 Oct 2010 14:22:10 +0000 (15:22 +0100)]
Introduce and use TranspositionTable::refresh()

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoUse margins[] array in evaluate
Marco Costalba [Sat, 30 Oct 2010 13:22:57 +0000 (14:22 +0100)]
Use margins[] array in evaluate

It will be used by future patches.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoMore readable search/qsearch dispatch
Marco Costalba [Sat, 30 Oct 2010 11:31:42 +0000 (12:31 +0100)]
More readable search/qsearch dispatch

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoFix last leak detected by Valgrind
Marco Costalba [Sun, 24 Oct 2010 08:39:33 +0000 (10:39 +0200)]
Fix last leak detected by Valgrind

This was subtle and google was my friend.

The leak was in _dl_allocate_tls called by pthread_create() and
is due to the fact that threads are created in joinable state so that
once terminated are not freed. To make the thread to release
its resources upon termination we should set them in detached state.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoFix a memcpy() warning under Valgrind
Marco Costalba [Sun, 24 Oct 2010 08:15:31 +0000 (10:15 +0200)]
Fix a memcpy() warning under Valgrind

Fix warning: "Source and destination overlap in memcpy"

This happens when we call multiple time do_move() with the
same state, for instance when we don't need to undo the move.

This is what valgrind docs say:

You don't want the two blocks to overlap because one of them could
get partially overwritten by the copying.

You might think that Memcheck is being overly pedantic reporting this
in the case where 'dst' is less than 'src'. For example, the obvious way
to implement memcpy() is by copying from the first byte to the last.
However, the optimisation guides of some architectures recommend copying
from the last byte down to the first. Also, some implementations of
memcpy() zero 'dst' before copying, because zeroing the destination's
cache line(s) can improve performance.

In addition, for many of these functions, the POSIX standards have wording
along the lines "If copying takes place between objects that overlap,
the behavior is undefined." Hence overlapping copies violate the standard.

The moral of the story is: if you want to write truly portable code, don't
make any assumptions about the language implementation.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoRevert previous patch
Marco Costalba [Sun, 24 Oct 2010 08:51:49 +0000 (09:51 +0100)]
Revert previous patch

It seems we have a speed regression under Linux, anyhow
commit and revert to leave some documentation in case we
want to try again in the future.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoAllow split point master to sleep
Marco Costalba [Thu, 21 Oct 2010 06:46:38 +0000 (07:46 +0100)]
Allow split point master to sleep

Let to sleep even split point master, it will be waken up
by its slaves when they return from the search.

With this patch we get maximum HT speedup

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoRe-add "Pass evalMargin through SearchStack as eval"
Marco Costalba [Sat, 23 Oct 2010 06:52:17 +0000 (07:52 +0100)]
Re-add "Pass evalMargin through SearchStack as eval"

It has more sense to treat the two evaluation metrics
in the same way.

As a side effect now we use the correct eval margin when
pruning in a SplitPoint node.

No functional change in single thread.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoFinally retire sp_search()
Marco Costalba [Sat, 23 Oct 2010 06:38:48 +0000 (07:38 +0100)]
Finally retire sp_search()

Fix the movcount updating bug and let search() to completely
subsititute sp_search().

No functional change even with fakes split.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoTemporary restore old sp_search()
Marco Costalba [Mon, 18 Oct 2010 02:29:58 +0000 (04:29 +0200)]
Temporary restore old sp_search()

There is a bug in the conversion that is triggered when testing
with faked split and that I missed somehow :-(

To allow proper testing on cluster restore old sp_search()
until I don't fiugre up what's happened.

Restored to be functional equivalent to old behaviour both in
single thread and in faked split.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoRevert "Pass evalMargin through SearchStack as eval"
Marco Costalba [Sat, 16 Oct 2010 10:54:44 +0000 (11:54 +0100)]
Revert "Pass evalMargin through SearchStack as eval"

Restore full no functional change also in Faked Split mode.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoDon't wake up /sleep threads in think() anymore
Marco Costalba [Sun, 17 Oct 2010 12:12:12 +0000 (13:12 +0100)]
Don't wake up /sleep threads in think() anymore

When entering and exiting from think() we don't need any special
wake up / sleeping code because we want available threads to keep
sleeping.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoEnable sleeping of available threads
Marco Costalba [Sun, 17 Oct 2010 10:23:59 +0000 (11:23 +0100)]
Enable sleeping of available threads

This simple patch has devastating consequences ;-)

Now an available thread goes to sleep and is waked up after
being allocated.

This patch allows Stockfish to dramatically increase performances
on HyperThreading systems.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoUse fast SRWLOCK locks under Windows
Marco Costalba [Sun, 17 Oct 2010 10:01:55 +0000 (11:01 +0100)]
Use fast SRWLOCK locks under Windows

They are fast and also have the same semantic of Linux ones.

This allow to simplify the code and especially to use
SleepConditionVariableSRW() to wait on a condition releaseing the lock,
this has the same semantic as pthread_cond_wait().

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>