SIMD Instructions for NEON in C/C++

Hello,

I am new to using NEON on the BBB but in this case, it is the BBGW. I am trying to interweave a non-conforming armel lib. to Debian, which should probably not be carried at all by Debian, for my BBGW to instruct the NEON on it to perform some principle math.

Seth

P.S. The compiler needed to handle this native compilation is arm-linux-none-gnueabi and this is exact, i.e. not arm-linux-none-gnueabihf.

If you find a way to compile the compiler, please do tell me. I would like to start w/ this venture as soon as I get around to it. I tried adding the ftp server in /etc/apt/sources.list but to no avail. I tried to update/upgrade my debian distro afterwards and this did not provide me the right to handle the install from Debian by way of apt.

Hi @silver2row , which version of Debian are you currently running? Depending on version, there are a couple different ways to install the “softfp” compiler…

If your stuck using that NEON library, there’s nothing stopping you from using Debian’s armel vs armhf either…

PS, what issues are you actually having when running the NEON application? that also shouldn’t be an issue to run as-is…

Regards,

1 Like

@RobertCNelson ,

Unless something has changed in time, the errors should not be showing. Please remember I am new to the syntax of the NEON unit on the BBB or other beagleboard.org family of boards w/ the am335x.

Hello…I am receiving an odd error about this much of an idea:

4.19.94-ti-r68 and BeagleBoard.org Debian Buster IoT Image 2020-04-06

The below error(s) are from plain, ole gcc b/c I cannot install gnueabi by any method I have found so far.

firstNeon.c: In function ‘fir_neon’:
firstNeon.c:16:9: warning: implicit declaration of function ‘vldl_s16’; did you mean ‘vld4_s16’? [-Wimplicit-function-declaration]
    si = vldl_s16(s+i+j);
         ^~~~~~~~
         vld4_s16
firstNeon.c:16:7: error: incompatible types when assigning to type ‘int16x4_t’ from type ‘int’
    si = vldl_s16(s+i+j);
       ^
firstNeon.c:17:7: error: incompatible types when assigning to type ‘int16x4_t’ from type ‘int’
    ci = vldl_s16(c+j);
       ^

I cannot test any other compilation of any other compile tool b/c of me not having it installed.

Seth

P.S. I followed the instruction(s) from a Doulos video online and kind of stopped the video to test software.

Here is the source that I picked up from Doulos in a video.


// NEON Hand Code Example from Cabanis from Duolos
// Video Example at https://www.doulos.com/knowhow/video-gallery/#anchor92

#include <arm_neon.h>

void fir_neon(const int16_t *s, const int16_t *c,
        int32_t *y, const uint32_t num_samples) {

        uint32_t i, j;
        int16x4_t si, ci;
        int32x4_t o;

        for (i = 0; i < num_samples; i++) {
                o = vdupq_n_s32(0);
                for (j = 0; j < 64; j+=4) {
                        si = vldl_s16(s+i+j);
                        ci = vldl_s16(c+j);
                        o  = vmlal_s16(o, si, ci);
                }
                y[i] = vgetq_lane_s32(o,0) + vgetq_lane_s32(o,1)
                        + vgetq_lane_s32(o,2) + vgetq_lane_s32(o,3);
        }
}

I was thinking about it. There is most likely more source to this small bit of source, i.e. I think. Who knows?

Hi @silver2row i’m no expert in NEON intrinsics

But looking at this video…

It’s from Nov 2, 2011, a lot has changed in Debian since that time… We’ve gone from “arm” → “armel” (ARM EABI) → “armhf” (ARM EABI HF)… i bet those instructions relied on old ‘arm’…

If you want to use NEON, find a linaro tutorial, they did much of the “armhf” neon porting about 5-6 years ago for linaro/ubuntu…

Regards,

1 Like

Hello @RobertCNelson ,

No issue, I have also been readin’ the ole text on the screen again located here:

https://developer.arm.com/documentation/dht0002/a/Introducing-NEON/What-is-SIMD-/ARM-SIMD-instructions

I appreciate you making me understand about things changing. Lots to look up again!

Seth

Hello Mr. Robert,

Seth here. @RobertCNelson , so.

  1. When compiling for the NEON arch, would the gnu (which seems to be Gas as an abbreviation) or RVCT be a better choice?

  2. For instance, if I was to compile w/ gnu:
    a. arm-none-linux-gnueabi-as -mfpu=neon asm.s

  3. For compiling w/ RVCT, one would:
    a. armasm --cpu=Cortex-A8 asm.s

Either way, I do not think my BBB or other family boards has this correct install to handle such actions.

Seth

P.S. Is there a way, like w/ what you were describing earlier, to get at least the gnu compiler on the BBB or other family board?

Hi @silver2row is this from the same 2011 video?

Otherwise what book/etc are you using now?

I’d recommend you start with:

https://developer.arm.com/documentation/den0018/a

Regards,

RVCT is a windows or linux “x86” running binary… It is not an option to run directly on the BBB.

Regards,

Hello @RobertCNelson ,

Okay about the RVCT. I was unclear on its capabilities. Here is where I am reading right now: Documentation – Arm Developer .

It is on page /Assembler.

Seth

You’ll also have to pay for it…

Regards,

1 Like

Yikes,

Thank you for the info.

Seth

P.S. Now, about this gnu toolchain compiler, is there a way to install it on Buster w/ Kernel 4.19.x w/out reflashing a new image?

Hello Sir,

It is fine if you do not divulge this info. freely. I understand completely. No issue. I will keep looking in to it.

Seth

Buster 10.x cross build tools are only available for x86, arm64 and powerpc…

Regards,

Yes Sir,

I noticed. I could not figure out how to install it. Is there another image from the bbb.io persons that you know of currently that handles such an install?

Seth

P.S. I will go around and look at Bullseye and Sid too.

Those cross compiler’s i listed must be installed on an x86, arm64, or powerpc64 host… So install Debian on another system, install the cross compilers in debian, then copy the binary to the BBB…

Regards,

Hello Sir,

Thank you for making me understand. I will go and try to CC the builds to the armhf machine from a x86, i.e. BBB.

Seth