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 129 - Syntax errors in ARM NEON related code
Summary: Syntax errors in ARM NEON related code
Status: RESOLVED FIXED
Alias: None
Product: Eigen
Classification: Unclassified
Component: Core - vectorization (show other bugs)
Version: 3.0
Hardware: ARM - NEON All
: --- major
Assignee: Konstantinos Margaritis
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 3.0
  Show dependency treegraph
 
Reported: 2010-12-09 19:26 UTC by Michael Hofmann
Modified: 2011-02-22 16:10 UTC (History)
5 users (show)



Attachments
Suggested fixes to PacketMath.h and Complex.h (3.02 KB, application/octet-stream)
2010-12-09 19:26 UTC, Michael Hofmann
no flags Details

Description Michael Hofmann 2010-12-09 19:26:27 UTC
Created attachment 52 [details]
Suggested fixes to PacketMath.h and Complex.h

I am trying to enable ARM NEON vectorization support for development on an Android phone using the Android NDK and the current Eigen trunk (or 3.0-beta2). It seems to me that ARM NEON support is not really functional yet.

After enabling vectorization support by adding -mfpu=neon -mfloat-abi=softfp to the compiler options, I immediately ran into several compiler errors.
Some of them I was able to fix by patching my compiler (see http://forum.kde.org/viewtopic.php?f=74&t=91183) while others required modifications to the Eigen source code, see below.

This is the compiler output using the Eigen trunk sources:

In file included from Eigen/Core:251:
Eigen/src/Core/arch/NEON/PacketMath.h:179: error: template-id 'pload<float>' for '__builtin_neon_sf __vector__ Eigen::internal::pload(const float*)' does not match any template declaration
Eigen/src/Core/arch/NEON/PacketMath.h:180: error: template-id 'pload<int>' for '__builtin_neon_si __vector__ Eigen::internal::pload(const int*)' does not match any template declaration
Eigen/src/Core/arch/NEON/PacketMath.h: In function 'Packet Eigen::internal::ploaddup(const typename Eigen::internal::unpacket_traits<Packet>::type*) [with Packet = __builtin_neon_sf __vector__]':
Eigen/src/Core/arch/NEON/PacketMath.h:189: error: 'hi' was not declared in this scope
Eigen/src/Core/arch/NEON/PacketMath.h: At global scope:
Eigen/src/Core/arch/NEON/PacketMath.h:192: error: template-id 'ploaddup<__builtin_neon_si __vector__>' for '__builtin_neon_si __vector__ Eigen::internal::ploaddup(const float*)' does not match any template declaration
In file included from Eigen/Core:252:
Eigen/src/Core/arch/NEON/Complex.h:119: error: template-id 'pload<std::complex<float> >' for 'Eigen::internal::Packet2cf Eigen::internal::pload(const std::complex<float>*)' does not match any template declaration
Eigen/src/Core/arch/NEON/Complex.h:120: error: template-id 'ploadu<std::complex<float> >' for 'Eigen::internal::Packet2cf Eigen::internal::ploadu(const std::complex<float>*)' does not match any template declaration
Eigen/src/Core/arch/NEON/Complex.h: In function 'Eigen::internal::Packet2cf Eigen::internal::pcplxflip(const Eigen::internal::Packet2cf&)':
Eigen/src/Core/arch/NEON/Complex.h:148: error: 'a' was not declared in this scope

There are some obvious syntax errors in a few variable/parameter declarations and some errors related to template specialization.
I have attached a patch to this bug report which removes above compiler errors. With this I seem to have fixed the syntax, but I am not completely sure about semantics. There might still be errors in functions my software doesn't call.

(FYI, even with these fixes, my software still produces incorrect results when enabling ARM vectorization support. See also this discussion on the forum:
http://forum.kde.org/viewtopic.php?f=74&t=91893&p=181630)
Comment 1 Benoit Jacob 2010-12-10 16:35:31 UTC
Konstantinos: we're about to release Eigen 3 real soon, so we really need to decide: either this gets fixed soon, or we should temporarily disable NEON in 3.0, but I'd prefer to avoid that as NEON is a huge selling point ;-)
Comment 2 Konstantinos Margaritis 2010-12-10 19:58:05 UTC
Fixed in latest commit ( 54ce4ddcc7c9).
Comment 3 Konstantin Tokarev 2011-02-21 15:17:46 UTC
I'm getting exactly the same error message when building on Mac OS 10.5 with enabled AltiVec support using GCC 4.2
Comment 4 Gael Guennebaud 2011-02-21 17:44:36 UTC
hi, I've fixed pload and ploadu in changeset 8fb900cdc035. Could you confirm it is working, and if not could you please paste the error message. Thank you.
Comment 5 Konstantin Tokarev 2011-02-21 18:20:06 UTC
Hi Gael, it does not work (i.e., I get the same error message as from beta3)


[  0%] Building CXX object unsupported/test/CMakeFiles/polynomialutils_9.dir/polynomialutils.cpp.o
In file included from /Users/konstantintokarev/projects/hg/eigen/Eigen/Core:270,
                 from /Users/konstantintokarev/projects/hg/eigen/Eigen/QR:4,
                 from /Users/konstantintokarev/projects/hg/eigen/unsupported/test/../../test/main.h:163,
                 from /Users/konstantintokarev/projects/hg/eigen/unsupported/test/polynomialutils.cpp:25:
/Users/konstantintokarev/projects/hg/eigen/Eigen/src/Core/arch/AltiVec/Complex.h: In function ‘Packet Eigen::internal::pset1(const typename Eigen::internal::unpacket_traits<T>::type&) [with Packet = Eigen::internal::Packet2cf]’:
/Users/konstantintokarev/projects/hg/eigen/Eigen/src/Core/arch/AltiVec/Complex.h:73: error: no matching function for call to ‘pload(const float*)’
/Users/konstantintokarev/projects/hg/eigen/Eigen/src/Core/arch/AltiVec/Complex.h:76: error: no matching function for call to ‘ploadu(const float*)’
/Users/konstantintokarev/projects/hg/eigen/Eigen/src/Core/arch/AltiVec/Complex.h: At global scope:
/Users/konstantintokarev/projects/hg/eigen/Eigen/src/Core/arch/AltiVec/Complex.h:111: error: template-id ‘pload<std::complex<float> >’ for ‘Eigen::internal::Packet2cf Eigen::internal::pload(const std::complex<float>*)’ does not match any template declaration
/Users/konstantintokarev/projects/hg/eigen/Eigen/src/Core/arch/AltiVec/Complex.h:112: error: template-id ‘ploadu<std::complex<float> >’ for ‘Eigen::internal::Packet2cf Eigen::internal::ploadu(const std::complex<float>*)’ does not match any template declaration
/Users/konstantintokarev/projects/hg/eigen/Eigen/src/Core/arch/AltiVec/Complex.h: In function ‘typename Eigen::internal::unpacket_traits<T>::type Eigen::internal::predux(const Packet&) [with Packet = Eigen::internal::Packet2cf]’:
/Users/konstantintokarev/projects/hg/eigen/Eigen/src/Core/arch/AltiVec/Complex.h:139: error: ‘sum’ was not declared in this scope
/Users/konstantintokarev/projects/hg/eigen/Eigen/src/Core/arch/AltiVec/PacketMath.h: At global scope:
/Users/konstantintokarev/projects/hg/eigen/Eigen/src/Core/arch/AltiVec/PacketMath.h:80: warning: ‘Eigen::internal::p4i_MINUS16’ defined but not used
Comment 6 Gael Guennebaud 2011-02-21 20:37:49 UTC
ok there were occurrences than I thought. Should be fine now.
Comment 7 Konstantin Tokarev 2011-02-22 15:54:30 UTC
Thanks Geal, it compiles now

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