Re: [eigen] Extracting the executed computations

[ Thread Index | Date Index | More Archives ]


what I usually is to generate the assembly (g++ -S -DNDEBUG -O2
file.cpp -o file.s) and examine it. To help finding the starting point
I add the following comment just before the expression I'm interested

A = 2*A+B;

Then you can (quite) easily follow the generated SIMD code, the loops,
the function calls..

A more meaningful output could be obtained by putting such
EIGEN_ASM_COMMENT() in Eigen's code itself. For instance, we could put
ASM comments like:

EIGEN_ASM_COMMENT("EIGEN_BEGIN: vectorized inner unrolling")

EIGEN_ASM_COMMENT("EIGEN_BEGIN: scalar linear evaluation")

EIGEN_ASM_COMMENT("EIGEN: temporary creation")


EIGEN_ASM_COMMENT("EIGEN_BEGIN: vectorized unrolled reduction")



On Wed, Feb 6, 2013 at 9:20 PM, Cowing-Zitron, Christopher
<ccowingzitron@xxxxxxxx> wrote:
> Hello,
> I'm interested in the internals of Eigen's expression optimizations, in
> order to both optimize my usage of Eigen and to improve my overall
> programming techniques. Given some matrix expression such as D=C+(A*B)^-1, I
> know Eigen doesn't actually execute anything until the equals sign. Rather,
> Eigen's expression templates generate an optimized set of calculations,
> combining steps to avoid temporaries and aliasing, for instance. Eigen also
> rearranges the computations to make them more amenable to compiler
> optimizations like loop unrolling and autovectorization. But while I
> understand the general ideas, and the significance of each individual step,
> the complexity of both Eigen's and the compiler's optimizations are such
> that I have a hard time seeing the whole picture. Is it possible to have an
> expression somehow print out or save the final computation sequence chosen
> by the compiler? If that's not possible with Eigen on its own, is there some
> third-party tool, i.e. a debugger or disassembler, that I can use in
> conjunction with Eigen which will record in human-readable format the
> executed computations? Thanks for your help,
> -- Chris

Mail converted by MHonArc 2.6.19+