Summary: | Reconsider usage of EIGEN_FAST_MATH | ||
---|---|---|---|
Product: | Eigen | Reporter: | Christoph Hertzberg <chtz> |
Component: | Core - vectorization | Assignee: | Nobody <eigen.nobody> |
Status: | DECISIONNEEDED --- | ||
Severity: | Internal Design | CC: | chtz, gael.guennebaud, hans.j.johnson, jacob.benoit.1, markos, rmlarsen |
Priority: | Normal | ||
Version: | 3.4 (development) | ||
Hardware: | All | ||
OS: | All | ||
Whiteboard: | |||
Bug Depends on: | 1259 | ||
Bug Blocks: | 564, 1608, 1693 |
Description
Christoph Hertzberg
2019-02-25 10:47:38 UTC
I would also like to remove the `unsupported/Eigen/MoreVectorization` module and merge it into the stable part (assuming it works correctly). Another small thing which can have a significant impact would be to ignore setting ERRNO when computing roots, i.e., just call `sqrtss` or `sqrtsd` (if SSE is available) instead of `std::sqrt`. See here for a real-world case: https://stackoverflow.com/questions/56547557/ Actually, it is kind of inconsistent at the moment that `sqrt(ArrayXd(5))` may change ERRNO, but `sqrt(ArrayXd(4))` will not (if vectorization is enabled). If we are really strict with `EIGEN_FAST_MATH==0`, we can't vectorize square-roots (unless we first check that all inputs are valid) -- even though I doubt that many users actually care about ERRNO. I agree that the meaning of EIGEN_FAST_MATH is not very well defined. Practically speaking, Eigen follows "fast-math" semantics in many cases regardless of the value of EIGEN_FAST_MATH, so I would be happy to to get rid of it. As a data point, only a single out of millions of targets depending at Eigen at Google sets EIGEN_FAST_MATH to 0, and as far as I can tell, that is not longer necessary. Do we know of users who depend on it? I don't know of any users depending on it, but knowledge about our user-base is quite sparse. We started thinking about doing a survey a while ago (I'll try to push that). Is "a single out of millions of targets" meant literally, or is this just a guess? It was literally one out of several millions. I just got rid of it, so now it is zero. :-) I agree that EIGEN_FAST_MATH is not relevant anymore. If we want to leverage more control (ignore NaN, Inf, denormals, ERRNO, ULP, etc.), this should be done at the call site IMO. Regarding sqrt, we already call _mm_sqrt_ss. Regarding MoreVectorization, I completely forgot about this one, but looking at the code , its integration within Core/ seems to be straightforward (provided it is accurate enough and robust to NaN/Inf/out-of-range). Removing support for EIGEN_FAST_MATH would be a nice simplification! -- GitLab Migration Automatic Message -- This bug has been migrated to gitlab.com's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.com/libeigen/eigen/issues/1687. |