lisp hardware optimization

Joel Reymont* recently joined lisp-hug and initiated a discussion about compiler performance and optimization. It's been interesting; I particularly liked Marc Battyani's followup.

Joel:

I'm pitting LW 5.0 on Mac Intel against ACL 8.0 in a final round of pre-purchase checks.

I have some heavy-duty floating-point computations. The C function looks like this:

double digamma(double x)
{
     double p;
     x=x+6;
     p=1/(x*x);
     p=(((0.004166666666667*p-0.003968253986254)*p+
	0.008333333333333)*p-0.083333333333333)*p;
     p=p+log(x)-0.5/x-1/(x-1)-1/(x-2)-1/(x-3)-1/(x-4)-1/(x-5)-1/(x-6);
     return p;
}

GCC generates about 200 assembler instructions for the code above.

...

Marc:

Disclaimer: It's probably cheating (but after all the target computer is not specified) and the compiler in written in LW so let's say it's relevant here. ;-)

I'm currently working on a the design of a VHPC system and I've written a C to VHDL compiler to transfor this kind of stuff in hardware to put in FPGAs. So I fed this function into this compiler and you can see the result here: www.fractalconcept.com/digamma.pdf
(BTW ouput is easily recognizable as cl-typesetting+cl-pdf ;-)

With this I get a fully pipelined design running at 300MHz so it will take 3.3ms for the computation.
Assuming I can fit 6 of these into my system and split the data, I can compute this in 550µs.

Who said Lisp is slow? :)

edit Marc sent me a note of clarification: "BTW you should put somewhere that 550µs is the time required for 1000000 computations so it's 550ps for one! ;-)"

* See also the last entries on this page.

Tags:

Comments

(Anonymous)

LW

FYI, Zach, I did end up purchasing LW the same day I started the thread. -joel

September 2014

S M T W T F S
 123456
78910111213
14151617181920
21222324252627
282930    
Powered by LiveJournal.com