This bugzilla service is closed. All entries have been migrated to
Bug 1685 - Vectorize .reverse() and .reverseInPlace()
Summary: Vectorize .reverse() and .reverseInPlace()
Alias: None
Product: Eigen
Classification: Unclassified
Component: Core - vectorization (show other bugs)
Version: 3.4 (development)
Hardware: x86 - AVX All
: Low Optimization
Assignee: Nobody
Keywords: JuniorJob
Depends on:
Reported: 2019-02-22 10:38 UTC by Christoph Hertzberg
Modified: 2019-12-04 18:31 UTC (History)
4 users (show)


Description Christoph Hertzberg 2019-02-22 10:38:08 UTC
While exposing a bug in LLVM, Bug 1684 also demonstrated that many reverse operations could be nicely vectorized, especially with AVX or AVX512.
E.g., a rowwise vectorization of a Matrix4f with AVX would be possible using two vperm2f128 instructions with AVX or one vpermps instruction with AVX512F.

Similar optimizations are possible with SSE for matrices with 2 rows or (slightly more complicated) 4*n+2 rows.

Low priority/JuniorJob. 
If someone wants to try this, but does not want to dig into the internals of Eigen, provide solutions like:

  template<int rows, int cols>
  void rowwise_reverse(float* out, float const* in);

  template<int rows, int cols>
  void colwise_reverseInPlace(float* in_out);

(Or with a templated Scalar instead of float)

It is also ok to provide solutions just for some cases at first (but avoid writing too much boiler plate code).
Comment 1 Nobody 2019-12-04 18:31:21 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to'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:

Note You need to log in before you can comment on or make changes to this bug.