andresy/torch — pull request #28 by arnaudchauveur (2012-06-20 22:06:29+00:00)
Title: conv1d directive in THVector.h and AVX optimizations

I added a conv1d directive in the THVector.h
I also added the add_unrolled directive in THVector.h

There is also a new specific file THVector_AVX.h containing conv1d directive for AVX processor.

The conv1d directive is called in THTensorConv by the validXCorr2Dptr and validConv2Dptr functions when the kernel's width size is greater than 3 and the width of the input greater than 96.

The conv1d directive is optimized for recent processor with AVX instructions (Intel Sandy Bridge and the last Ivy Bridge).
On older processor without AVX the directive add_unrolled are called.

Here a GDoc with benchmark on convolution on lena https://docs.google.com/spreadsheet/ccc?key=0Ak2hmEyF9DKtdEluc1puak9WTHlGY3NCRjRxa0Y1Qmc

Speedup is bigger on big kernel (63% with 5*5 kernel with AVX vs 141% for 11*11 kernel).

It could be interesting to put this in a separate branch to do more test, especially on MacOS (may be it need to use a recent version of GCC to recognize AVX instruction) and on slow computer.