New user self-registration is currently disabled. Please email eigen-core-team @ lists.tuxfamily.org if you need an account.
Bug 1059 - maxcoeff() on integer arrays produces incorrect results on NEON
maxcoeff() on integer arrays produces incorrect results on NEON
Status: RESOLVED FIXED
Product: Eigen
Classification: Unclassified
Component: Core - vectorization
3.2
All All
: Normal Wrong Result
Assigned To: Nobody
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2015-08-26 06:13 UTC by Akira MAEZAWA
Modified: 2015-09-01 14:31 UTC (History)
4 users (show)



Attachments
Patch for Eigen/src/Core/arch/NEON/PacketMath.h (336 bytes, text/plain)
2015-08-26 06:13 UTC, Akira MAEZAWA
no flags Details

Description Akira MAEZAWA 2015-08-26 06:13:33 UTC
Created attachment 601 [details]
Patch for Eigen/src/Core/arch/NEON/PacketMath.h

Using maxcoeff() on integer arrays (or vectors, etc) produces incorrect result.

To reproduce the error, put the maximum element on either 3+4n th or 2+4n th (n>0 integer) index on 4byte-aligned Array.

The error is due to a bug in predux_max<Packet4i>(const Packet4i& a) found in Core/arch/NEON/PacketMath.h , where it is missing 
  max = vpmax_s32(max, max);

The patch is attached.
Comment 1 Christoph Hertzberg 2015-08-31 12:10:38 UTC
Makes sense to me. Can someone with access to a NEON CPU confirm this and apply it to 3.2 and the devel-branch?
If nobody does, and no objections arise, I'll apply this myself within the next days.
Comment 2 Gael Guennebaud 2015-09-01 14:31:43 UTC
Thank you for noticing this issue. It was already fixed in the default branch.
https://bitbucket.org/eigen/eigen/commits/21957a1ddbb6

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