Re: [eigen] Eigen containers cannot be vectorized |

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

*To*: eigen <eigen@xxxxxxxxxxxxxxxxxxx>*Subject*: Re: [eigen] Eigen containers cannot be vectorized*From*: Benoit Jacob <jacob.benoit.1@xxxxxxxxx>*Date*: Thu, 8 Dec 2016 09:32:33 -0500*Dkim-signature*: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=uy+kxUZ48VE0vhOaYvlKBrGYZiduD9lpeM1Z4clxf80=; b=PFl7S1L61HeRZ23/+gdXdX0w2CDUPL5O6TUkbNx4yNWhNQS1c4tUiPx+q33/04OUCL WgkN8oQfHU44/IoAA8HJn0EUpuhoIpOLYyBJXctxlU0R7+f+EFV30KVAnfg3ltM1ahEY aMKB4/a1/vERQ0fgXVBIjaHUbqlo8cLr7ktGvW89rwWb4QYQdFVfenBMJYE6Cx2HZo2s 50GIqtWpToEICt1WjooW0Flk1nLFhu/MuDy1TGZTVWI+JbsunOOVMzPuq2Dlsbv+LxMw AM+aws6CgbpzSPyapWCv6oiMQaD72HPW1UT5Eigj87PNVf9JLrSMqQS5ZlCy63GscDF9 A3HA==

2016-12-08 9:27 GMT-05:00 Francois Fayard <fayard@xxxxxxxxxxxxx>:

On 2016-12-08 15:03, Francois Fayard wrote:I was also surprised to see that in debug mode, bounds checking is done with: assert(i >=0 && i < n). This can be optimized into assert(static_cast<std::size_t>(i) < static_cast<std::size_t>(n)).

I would be surprised if any reasonably good compiler fails to see that optimization. I did not check though, and I guess it should not matter, since one should have disabled assertions if one really needs the last bit of performance (of course, only after making sure that everything works)No compiler cannot do that as the optimization from the first _expression_ to the second one is only valid when n is nonnegative.

The point of these range checks is to be safe and readable. They will be very high-overhead anyway. When the overhead matters, the way is to avoid doing range-checks, not micro-optimizing them. Eigen does that by having internal coefficient accessors that bypass range checks, so that most accesses performed internally by Eigen are free of any such overhead (except in unit tests, where range checks are enabled also for these internal accessors).

François Fayard

Founder & Consultant - Inside Loop

**References**:**[eigen] Eigen containers cannot be vectorized***From:*Francois Fayard

**Re: [eigen] Eigen containers cannot be vectorized***From:*Joseph Mirabel

**Re: [eigen] Eigen containers cannot be vectorized***From:*Francois Fayard

**Re: [eigen] Eigen containers cannot be vectorized***From:*Christoph Hertzberg

**Re: [eigen] Eigen containers cannot be vectorized***From:*Francois Fayard

**Messages sorted by:**[ date | thread ]- Prev by Date:
**Re: [eigen] Eigen containers cannot be vectorized** - Next by Date:
**Re: [eigen] Eigen containers cannot be vectorized** - Previous by thread:
**Re: [eigen] Eigen containers cannot be vectorized** - Next by thread:
**Re: [eigen] Eigen containers cannot be vectorized**

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