Re: [eigen] Extending Eigen with AVX

[ Thread Index | Date Index | More lists.tuxfamily.org/eigen Archives ]


In my opinion, the first step to port to AVX is to write the wrapper
interface. Typically, for AVX this means defining types like Packet4d,
Packet2d, Packet4f and Packet8f, and write all the p* functions for
them. In a first step we could enable via a preprocessor token only
128 or 256 bits packets. The few places where alignement is hardcoded
should not be difficult to fix. Matrix-vector products will need some
adjustments because it assumes the maximum packet size is 4. The
matrix-matrix kernel might need some adjustment too, but I can help
with them.

This step will already permit to leverage 256 bits packets for users
that care only about dynamic (or large enough) matrices, and to do the
first bench with AVX, to adjust the product codes if needed, etc.

Then, in a second step the choice between 128 or 256 bits packets
should be done automatically by Eigen (still at compile time). This
step has to be done together with the new evaluator mechanism.

If you wanna start with the first step, then the best is to make a
fork on bitbucket.

gael


On Mon, Mar 4, 2013 at 5:58 AM, Rohit Garg <rpg.314@xxxxxxxxx> wrote:
> On Sun, Mar 3, 2013 at 7:26 AM, Christoph Hertzberg
> <chtz@xxxxxxxxxxxxxxxxxxxxxxxx> wrote:
>> On 03.03.2013 01:09, Rohit Garg wrote:
>>>
>>> I can work on the PacketMath functions for AVX if there are other
>>> developers more familiar with Eigen's internals who would be OK with
>>> helping me integrate this. Sadly, I do not know as much about Eigen's
>>
>>
>> I'm afraid it is not too trivial, mostly because AVX supports packages twice
>> as large as SSE and there are some parts of Eigen where the packet size is
>> hard-coded.
>> There has been the idea of meta-packages some time ago (i.e. put more values
>> in a package than fit in a register). On the one hand this would help
>> implementing expressions involving casts (e.g. from float to double) and it
>> would make AVX-integration "almost trivial".
>
> Would it be any easier if we used AVX just for dynamic sized matrices?
>>
>>
>>> internals as I should. Since AVX does not have integer operations, I
>>
>>
>> That's quite a drawback (if packet integer operations are required in an
>> algorithm) since switching between AVX and SSE is quite costly.
>
> That is not neccesarily a problem. If you compile with -mavx on gcc,
> even the SSE intrinsics use AVX instructions. They get the 3 operand
> syntax for free. Integer support would become available with AVX2.
>
>>
>>
>>
>> Christoph
>>
>>
>>
>>
>> --
>> ----------------------------------------------
>> Dipl.-Inf., Dipl.-Math. Christoph Hertzberg
>> Cartesium 0.049
>> Universität Bremen
>> Enrique-Schmidt-Straße 5
>> 28359 Bremen
>>
>> Tel: +49 (421) 218-64252
>> ----------------------------------------------
>>
>>
>
>
>
> --
> Rohit Garg
>
> http://rpg-314.blogspot.com/
>
> Graduate Student
> Applied and Engineering Physics
> Cornell University
>
>



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/