Re: [eigen] Mapping array of scalars into quaternions |

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

*To*: eigen@xxxxxxxxxxxxxxxxxxx*Subject*: Re: [eigen] Mapping array of scalars into quaternions*From*: Benoit Jacob <jacob.benoit.1@xxxxxxxxx>*Date*: Fri, 13 Nov 2009 08:48:03 -0500*Dkim-signature*: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=+xkZcKTzRGZ1FTvnXRiLT7J9/y9RFeKNWIQgqX/fct4=; b=E1UDVHMwQrbh6xR6hjQWGMcejMX9HzUGs/MRTssmRnMN+JbgbuzXN+kkJcFTAsHvpB Faqz9o4H99wqnyGYi0VAk1qWR6JFz1DIz5ZaMUN3fq6PqadfLgRc/DBWjnAuLHnWpDsP hJhXmmlyCLv7pLSUHHVq8/hU5f0In9WbFTzjw=*Domainkey-signature*: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=G9NWRPpokDR32D3rakFZBsiniYXqzdM+Su3XnxcQBQeXIoOPhMvfuhf3KmPqP/aUrt FQRJBfDI0xI/oAFy57nZXcP3c3UCpsUyNSm/e5aJ4sTOsJy/TQtnaxV6veqm0Itd0K4h WZZqnH0klm6GM5U/ZLs+UCUwVHvmlXRq+VU6Q=

2009/11/13 Mathieu Gautier <mathieu.gautier@xxxxxx>: >> Everytime you add a EIGEN_STRONG_INLINE on a function that has a >> nontrivial body of its own (rather than just forwarding the call to >> another function), I need to see some justification (as far as I can >> see, that would have to be justified by performance measurements). I'm >> by no means an expert, i'm really honestly asking. My fear is about >> uselessly increasing code size (and killing instruction caches). > > OK, I perform some benchmark on simple operations with gcc4.4, icc and vc++ > > 1/ q = q1*q2; > 2/ q = q1*q2*q3.inverse()*q4; > 3/ v = q._transformVector(v1); > > (v : vector, q : quaternion) > > using EIGEN_STRONG_INLINE didn't improve the performance with vc++. The asm > generated is never completly inlined both with inline and > EIGEN_STRONG_INLINE. It's also have no influence with gcc, since the asm > generated is always fully inlined. > > with icc (disabling any SSE extension) I have the following results for 10 > trials of 100,000,000 operations on a Intel xeon X5550: > > mean for 100,000,000 operations > > inline | EIGEN_STRONG_INLINE > 1/ 2.22s | 1.70s > 2/ 8.21s | 6.24s > 3/ 2.63s | 2.02s > > the ratio is roughly the same (0.76). Thanks for doing these experiments. This really pleads in favor of EIGEN_STRONG_INLINE, and the fact that gcc and msvc are inlining anyways means that it's quite safe. Just one thing: the current definition is: // EIGEN_FORCE_INLINE means "inline as much as possible" #if (defined _MSC_VER) #define EIGEN_STRONG_INLINE __forceinline #else #define EIGEN_STRONG_INLINE inline #endif so it only is different from "inline" when _MSC_VER is defined (which normally means that the compiler is MSVC). Does that mean that ICC defines _MSC_VER? Or that you are using a modified EIGEN_STRONG_INLINE for ICC? Anyway, I'm now OK for EIGEN_STRONG_INLINE. > > I also have a few superficial comments: >> >> First, "inline" keywords need only be put on function definitions, no >> need to put them on function definitions [1]. I realize that >> Quaternion.h already had this problem before your patch. I just am >> noticing it now, because EIGEN_STRONG_INLINE takes more space on my >> screen. > > :) When using icc, EIGEN_STRONG_INLINE is only effective if put in class > body. It must be specific to the "__force_inline" keywords. "inline" keyword > may be remove from the class body and only put in front of method > definition. Hm, this is very interesting to know. Thanks for this finding. >> Second, in the unit test (thanks for writing it), you could just >> reserve static arrays with EIGEN_ALIGN16, see what we do in >> MatrixStorage.h. > > ok > >> Third, when you significantly extend/rewrite a file, add yourself a >> copyright line. I already added you one on Quaternion.h, also do it on >> quaternion.cpp. > > I'll change these to points and I'm waiting a reply about inlining to send a > new patch. Ok, just send and i'll push. Benoit

**Follow-Ups**:**Re: [eigen] Mapping array of scalars into quaternions***From:*Mathieu Gautier

**Re: [eigen] Mapping array of scalars into quaternions***From:*Mathieu Gautier

**References**:**Re: [eigen] Mapping array of scalars into quaternions***From:*Mathieu Gautier

**Re: [eigen] Mapping array of scalars into quaternions***From:*Benoit Jacob

**Re: [eigen] Mapping array of scalars into quaternions***From:*Mathieu Gautier

**Re: [eigen] Mapping array of scalars into quaternions***From:*Benoit Jacob

**Re: [eigen] Mapping array of scalars into quaternions***From:*Mathieu Gautier

**Messages sorted by:**[ date | thread ]- Prev by Date:
**[eigen] Subtle way to produce bugs when using Block** - Next by Date:
**Re: [eigen] Mapping array of scalars into quaternions** - Previous by thread:
**Re: [eigen] Mapping array of scalars into quaternions** - Next by thread:
**Re: [eigen] Mapping array of scalars into quaternions**

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