recursive and iterative search

Discussion of chess software programming and technical issues.

Moderator: Ras

Rein Halbersma
Posts: 771
Joined: Tue May 22, 2007 11:13 am

recursive and iterative search

Post by Rein Halbersma »

The developers of the Clang C/C++ compiler are talking about ways to let the compiler automatically transform recursive functions into iterative versions with explicit stack manipulation http://thread.gmane.org/gmane.comp.comp ... evel/81848

Their idea is that the iterative form will open up a lot of compiler optimizations that cannot be applied in recursive form. Sounds like an interesting development to experiment with once this starts appearing in their nightly builds at http://llvm.org/apt/
Aleks Peshkov
Posts: 988
Joined: Sun Nov 19, 2006 9:16 pm
Location: Russia
Full name: Aleks Peshkov

Re: recursive and iterative search

Post by Aleks Peshkov »

About 10 years ago GCC with explicit extra memory limits for function inlining converted my recursive simple alpha-beta chess program into a single piece of code without any function calls at all.
Rein Halbersma
Posts: 771
Joined: Tue May 22, 2007 11:13 am

Re: recursive and iterative search

Post by Rein Halbersma »

Aleks Peshkov wrote:About 10 years ago GCC with explicit extra memory limits for function inlining converted my recursive simple alpha-beta chess program into a single piece of code without any function calls at all.
No doubt automatic recursive-to-iterative transformations have been possible for a long time. But I would like to see if the Clang type of reductions would allow optimization of say IID and LMR, e.g. to eliminate the common move generation of successive searches.
User avatar
hgm
Posts: 28480
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: recursive and iterative search

Post by hgm »

Of course a proper implementation of these concepts would not involve such a duplicate effort in the first place. There was a reasn it was called iterative deepening rather than recursive deepening...