[Liboil] exp, log

James Bergstra james.bergstra at umontreal.ca
Wed Mar 15 14:14:05 PST 2006


The problem which motivates this email is that if you write a loop like

for (int i = 0; i < 256; ++i) y[i] = exp(x[i]);

and compile it with gcc, you get code that runs much slower than if you make a
call to amd's libacml_mv

vrda_exp(256, x, y);

My question for the list is whether you think liboil might tackle the problem of
vectorized functions like exp, log, cos, sin, sincos, cabs, etc... or whether
these should be left for a compiler?   I believe that the answer should be
"both"... first liboil, and the compiler :)


The other aspect of implementing vectorized functions like these is demonstrated
by the fact that amd's library has routines like
__vrd1_exp()
__vrd2_exp()
__vrd4_exp()
that compute 1, 2, and 4 exp(x) values per call.  I don't know of any open
implementation of such functions.

Any thoughts?

-- 
james bergstra
http://www-etud.iro.umontreal.ca/~bergstrj



More information about the Liboil mailing list