Re: [eigen] Trouble using ARM NEON vector instructions on Android |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]
- To: eigen <eigen@xxxxxxxxxxxxxxxxxxx>
- Subject: Re: [eigen] Trouble using ARM NEON vector instructions on Android
- From: Gael Guennebaud <gael.guennebaud@xxxxxxxxx>
- Date: Sat, 13 Jul 2013 08:59:24 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=SgOpJQ8cxLQp7qssAIv4Uc+seLx/IkUNHdWaxOeelhg=; b=uX3kTzH8QKAKFH4YWqlnwXHLjxgABgGbF2/aBElLCoq4GBKGV4dTU/dlY1xYvn6KAs b0jM3bODrUV+FGuKJWcHgN7SeoH1EjPMUDFD2I2GfgZh02BxJ7iNJC6D1DuVLhUVK9MS gWsiTDrJYDcQKzUY2uKomhTm0Vc7lbBtLr7jOBrHpEJ2b2EKoSotMQgXKt3UXZNHriNg /bkPi0ixFRZXCCLuDcCyFCOvrBpIBzRCm5PzbSyagVypD+MlJx6H4ZpThaZB5TV/ZX/F BSTypBavX7tuBIleH/rBnH3aM2jySxyJdDUz6F/LkpB6jfXxj+rRMSogmyhMv4Hw1S+d VaKQ==
Alright. If that completely works, let us know.
gael
On Sat, Jul 13, 2013 at 4:59 AM, Patrick Mihelich
<patrick.mihelich@xxxxxxxxx> wrote:
> Thanks Gael, that makes sense. With the macro change, Vector4f addition does
> generate a vector instruction. I'll have to investigate further to see if I
> can actually do this safely on my target system.
>
> Cheers,
> Patrick
>
>
> On Thu, Jul 11, 2013 at 10:28 PM, Gael Guennebaud
> <gael.guennebaud@xxxxxxxxx> wrote:
>>
>> Yes, this is because on ARM the stack was not aligned, and so we could
>> not guarantee the alignment of Vector4f-likes objects, and so the
>> vectorization on ARM is only enabled for dynamic size objects (e.g.,
>> VectorXd). Perhaps, this is not the case on recent systems. You can
>> try by changing line 53 in Eigen/src/Core/util/Macros.h to:
>>
>> #if defined(__GNUC__) && !(defined(__i386__) || defined(__x86_64__) ||
>> defined(__powerpc__) || defined(__ppc__) || defined(__ia64__) ||
>> defined(__ARM_NEON__))
>>
>> gael
>>
>> On Fri, Jul 12, 2013 at 2:34 AM, Patrick Mihelich
>> <patrick.mihelich@xxxxxxxxx> wrote:
>> > Hi all,
>> >
>> > I am cross-compiling lots of Eigen code to ARM on Android, and for some
>> > reason I am not getting vector instructions.
>> >
>> > Versions:
>> >
>> > GCC: 4.6 standalone toolchain in Android NDK r8e, with flags including
>> > "-march=armv7-a -mfloat-abi=softfp -mfpu=neon"
>> > Eigen: I've tried 3.1.2, 3.2.0-beta1, and unstable dev.
>> >
>> > I've attached a trivial code snippet, which adds 4-element float vectors
>> > in
>> > 3 ways:
>> >
>> > vaddq_f32 intrinsic. Compiles to vadd.f32 instruction.
>> > Eigen's internal padd() on Packet4f's. Also compiles to vadd.32f.
>> > Adding Eigen::Vector4f's. Compiles to four fadds instructions!
>> >
>> > I've also attached the assembly output. Full command for generating it
>> > yourself (with NDK r8e installed) is at the top of the source file.
>> >
>> > I checked that EIGEN_VECTORIZE_NEON is defined, and
>> > Eigen::SimdInstructionSetsInUse() returns "ARM NEON".
>> >
>> > Any ideas? I know other people on this list are using Eigen on ARM. It
>> > looks
>> > like operator+ for Vector4f is not dispatching to the Packet4f
>> > specializations properly, but I'm not current enough on that
>> > infrastructure
>> > to understand why.
>> >
>> > Cheers,
>> > Patrick
>>
>>
>