New user self-registration is disabled due to spam. Please email eigen-core-team @ lists.tuxfamily.org if you need an account.
Before reporting a bug, please make sure that your Eigen version is up-to-date!
Bug 1685 - Vectorize .reverse() and .reverseInPlace()
Summary: Vectorize .reverse() and .reverseInPlace()
Status: CONFIRMED
Alias: None
Product: Eigen
Classification: Unclassified
Component: Core - vectorization (show other bugs)
Version: 3.4 (development)
Hardware: x86 - AVX All
: Low Optimization
Assignee: Nobody
URL:
Whiteboard:
Keywords: JuniorJob
Depends on:
Blocks:
 
Reported: 2019-02-22 10:38 UTC by Christoph Hertzberg
Modified: 2019-02-22 10:38 UTC (History)
4 users (show)



Attachments

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).

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