andresy/torch — pull request #61 by arnaudchauveur (2012-09-07 19:03:39+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 file THVector_AVX.h containing conv1d directive for AVX enabled 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 48 (these values have been set to maximize performance and relied on my test on Ubuntu laptop).

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

It could be interesting to put this in a separate branch to do more test and see if there is no performance regressions or other issues.

on OSX, even with AVX compatible processor, AVX is disabled (ENABLE_AVX setted to false). This has been done to prevent build issues. Make AVX compilation works on OSX is a bit tricky. It need the very last version of clang (3.2 still in development) in you path and a recent gcc (tested with 4.6) and a modified script replacing the as assembler binary (http://old.nabble.com/Re%3a-gcc,-as,-AVX,-binutils-and-MacOS-X-10.7-p32584737.html).

It should work out-of-the-box on Linux (tested with Ubuntu 11.10). Be aware that AVX instruction are not virtualized by any virtualization software yet. So the Linux need to be runned on bare metal hardware.