|Re: [eigen] Extending Eigen with AVX|
[ Thread Index |
| More lists.tuxfamily.org/eigen Archives
- To: eigen <eigen@xxxxxxxxxxxxxxxxxxx>
- Subject: Re: [eigen] Extending Eigen with AVX
- From: Gael Guennebaud <gael.guennebaud@xxxxxxxxx>
- Date: Mon, 4 Mar 2013 09:52:36 +0100
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:mime-version:in-reply-to:references:from:date:message-id :subject:to:content-type:content-transfer-encoding; bh=WIcP4mzzpa/nGq8R2QkQFXxXfmdNVDE88vn5WvVom98=; b=o0G+bXRJKlUmHuUHNGvvaEqUfcdQJR94nMem83l+JTamDwTARAtSMgdRDsWS5quAzz Xs37uJIklDiwCFKIjqLMNQnqZNKc4iCfyzhIYOrCZuDh2ZQ0vaxXdJ6bGfhmXTuKB+Q3 MCxo0cb+iIj4yW5vODsLoaiPw/VVjPZeBx4z5R3glxCVXfWiqVC6xCQyccxTf1LFe7Mz skJbTEg3HYqVfsTlwn9KPMZGnPhCGh5hSkSfka39aeEXH+70EGHRpzsVmef08ItGrB7G ro6r6a3KI/rRho2iDHln9rZVpbMi7GqUnUSTENuSQn5jomHhZBUkreGtDECodUm1O2LU gVjg==
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
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.
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
>> 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.
>> 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
> Graduate Student
> Applied and Engineering Physics
> Cornell University