Syntax errors in ARM NEON related code

Submitted by Michael Hofmann

Assigned to Konstantinos Margaritis

Link to original bugzilla bug (#129)
Version: 3.0
Platform: ARM - NEON

Description

Created attachment 52

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)

Attachment 52, "Suggested fixes to PacketMath.h and Complex.h":

NEON.patch

Blocking

#25 (closed)