Questions tagged [neon]
NEON is a vector-processing instruction set for ARM processors. Please use this tag together with [arm] if asking about the AArch32 version of NEON (to run on 32-bit ARM processors), or [arm64] for AArch64. See also the [simd] tag.
865
questions
4
votes
1
answer
70
views
Is there a way to treat the register file as an array in ARMv8 (scalar or Neon)?
Suppose I have a short array v of say 8 int64_t. I have an algorithm that needs to access different elements of that array, which are not compile-time constants, e.g. something like v[(i + j)/2] += ......
0
votes
0
answers
17
views
Assembling armv8-a neon with gnu assembler
I am trying to assemble aarch64 neon instructions with the gnu assembler. The example is from the neon programming quick reference
.text
.align 4
.global add_float_neon2
.type ...
1
vote
1
answer
94
views
Fastest way to search an array on m1 mac
I am trying to load an array of u16s from memory and find the first element that is less than some number, as fast as possible on an M1 mac. I have been looking through the NEON instructions, but I ...
0
votes
2
answers
55
views
Looking for performance improvement of NEON code to match clipping area on the screen
Here is my test code to find 1st clipping area on the screen.
Two subroutines and dummy loops in the code to compare the performance of them.
point_in_neon (NEON version) and point_in (Regular version)...
2
votes
3
answers
127
views
bitpack ascii string into 7-bit binary blob using ARM-v8 Neon SIMD
Following my x86 question, I would like to know how it is possible to vectorized efficiently the following code on Arm-v8:
static inline uint64_t Compress8x7bit(uint64_t x) {
x = ((x & ...
0
votes
1
answer
42
views
Detailed documentation on arm intrinsics support versions
I am trying to build an infrastructure (and database) so that people can detect the available SIMD intrinsics without connecting to the actual hardware.
It is extremely hard (if ever possible) to get ...
1
vote
0
answers
68
views
Rotate or shift a neon vector by a byte?
I want to do the below but avoid the double load
isSlash = vld1q_u8(ptr) == '\\'
isSlash2 = vld1q_u8(ptr+1) == '\\'
backToBackSlash = isSlash & isSlash2
My first instinct was to use a shift ...
0
votes
1
answer
117
views
Convert vector compare mask into bit mask in AArch64 SIMD or ARM NEON?
Lets take the example of "ABAA". I can use result = vceqq_u8(input, vdupq_n_u8('A')) to get FF 00 FF FF (or 0xFFFF00FF).
Sometimes I only need to know the first match, other times I want to ...
2
votes
1
answer
129
views
Cycle count neon for M2?
Is there a resource on how many cycles SIMD is on apple M1/M2? Like x86 https://uops.info/table.html or agner fog? I wish I could give a bigger bounty but that's all the rep I have
I never programmed ...
0
votes
1
answer
51
views
Sémantics of the VMLA ARM instruction
Am I right in saying that the VMLA.F32 instruction is fully equivalent to a F32 multiplication (complete with rounding step) followed by a F32 addition, including with respect to NaN payloads? (It ...
0
votes
1
answer
61
views
Using JNI types like jint with arm neon inline assembly - compile errors on ARM64 [duplicate]
I know very little about inline assembly, codes(see here for details) are as follows:
JNIEXPORT void JNICALL
Java_com_xingin_xarengine_RGBAToGrayRenderer_nCopy(JNIEnv *env, jclass clazz, jobject ...
0
votes
3
answers
57
views
neon spreading load with zero-fill
I've got an incoming bytestream of blocks of 16 uint8_t that I need to expand into 4x uint32x4_t neon registers for further processing. This is going to run on a core based on Cortex-A55. Here's an ...
1
vote
0
answers
58
views
Accuracy of the ARM NEON vrsqrteq intrinsic
I am using the ARM NEON vrsqrteq intrinsic to calculate the approximate reciprocal square root of a vector of floats. I would like to know the accuracy of that approximation.
However I can't find any ...
2
votes
0
answers
35
views
How to build GAS assembly with Android AOSP?
I'm trying to build the Ne10 Library into an AOSP app (Android 9). Whilst I have successfully built the C intrinsics functions I am struggling to get the corresponding assembly functions to work. If I ...
2
votes
1
answer
73
views
Why (or why not) pass Neon intrinsics datatypes as inputs/outputs functions parameters?
This is a small test I built. Here we have two scenarios:
Scenario 1: Two functions (scenario1a and scenario1b) which inputs and outputs are uint16_t* and load/store to/from Neon datatype (...
0
votes
1
answer
70
views
Which one is faster? Array Initialization or SIMD operations?
I need to use Neon Intrinsics (in aarch64) using slightly modified data from an array passed in a parameter of a function:
void scenario1(uint16x8_t* X) {
uint16x8_t arrayTest01[4] = {
{...
1
vote
1
answer
62
views
Search over an array of 14 integers, build a mask and return the match on ARMv8a using NEON
For my open source project cachegrand we are implementing AARCH64 support and although most of the port is completed we are sorting out a feature to perform an accelerated array search using NEON ...
0
votes
1
answer
75
views
ARM v7: SIMD lookup table for 32-bit floats
I have a vector of float32 numbers. For each element I have to find cos,sin
I want to use a lookup table instead of the default library.
Is there an ARM intrinsic code I can use for this purpose ?
0
votes
0
answers
143
views
OpenCV error: arm_neon.h unknown type name
I am trying to write a Python wrapper for a C++ project that uses OpenCV (my C++ knowledge is very limited).
I installed OpenCV 4.5.0 using this link:
https://qengineering.eu/install-opencv-4.5-on-...
2
votes
1
answer
127
views
How to swap the byte order for individual words in a vector in ARM/ACLE
I usually write portable C code and try to adhere to strictly standard-conforming subset of the features supported by compilers.
However, I'm writing codes that exploits the ARM v8 Cryptography ...
1
vote
1
answer
107
views
how to properly do multiply accumulate with NEON intrinsics
i need to do a simple multiply accumulate of two signed 8 bit arrays.
This routine runs every millisecond on an ARM7 embedded device. I am trying to speed it up a bit. I have already tried optimizing ...
1
vote
1
answer
101
views
Do these aarch64 intrinsics have alignment requirements?
Do the core::arch::aarch64 functions vld1q_u8 and vst1q_u8 have any alignment requirements? The documentation doesn't mention any, but the documentation is also very sparse, so I'm wondering if there ...
1
vote
0
answers
129
views
How to do vector(simd) round to nearest, ties / half to even in ARMv7 by NEON efficiently?
I am porting an ARMv8 targeting algorithm to ARMv7 platform. ARMv8 support vector convert from floating-point to signed or unsigned integer with directed rounding modes, VCVT with directed. Such round ...
0
votes
1
answer
135
views
Memory copying: ARM STM vs. ARM NEON
I need to copy large amounts of memory (on the order of 47k) (example, from a USB buffer to a more permanent buffer).
This is using an ARM Cortex A8.
(The ARM has the NEON code.)
The ARM NEON ...
0
votes
1
answer
123
views
What is the difference between sse2neon and arm_neon.h?
I am trying to build software to run on aws graviton3. To get the most out of the performance, aws advice to use sse2neon to port codes with SSE intrinsics to neon (porting-codes-with-sseavx-...
0
votes
0
answers
172
views
The fmul instruction of the neon instruction set does not work
I am trying to use the neon instruction set of armv8 to do matrix multiplication, and some of the codes refer to Neon Programmer Guide for Armv8-A Coding for Neon: Matrix multiplication. I use aarch64-...
1
vote
1
answer
215
views
GCC flag for emulating floating point operations in software on ARMv8 platform with neon FPU
Background
I am trying to compile and run this on a Raspberry Pi 4 Model B Rev 1.4 running Ubuntu 20.04 LTS aarch64.
The output of the lscpu command is:
Architecture: aarch64
CPU op-mode(...
0
votes
1
answer
106
views
efficiently creating a list of pointers to a character in a buffer using arm neon simd
I've been rewriting some performance sensitive parts of my code to aarch64 neon. For some things, like population count, i've managed to get a 12x speed. But for some algorithms i'm having trouble..
...
1
vote
1
answer
189
views
Why ARM NEON Intrinsics slower than C++ on simple vector multiplication task?
I try to multiply data in two float pointers and store the result into the third pointer, here is the C++ code:
void cpp_version (float *a, float *b, float *c, int counter, int dim) {
for (int i=0;...
0
votes
1
answer
202
views
Software optimization guide for AArch64 Neon and SVE
There is ARM software optimization guide (e.g., https://developer.arm.com/documentation/swog309707/latest for neoverse n1).
This guide doesn't seem to contain the latency and throughput for Neon or ...
1
vote
2
answers
181
views
Neon : Perform Vector multiplication with a scalar value
Hi i am new to neon programming.
Looking for vector multiplication with a scalar value.
For adding two vector i was able to perform using following code.
void add(float* dst, float* src1, float* src2, ...
1
vote
1
answer
109
views
What kind of assembly instruction is this ld1 {v4.16b - v7.16b}, [x10]?
The below assembly instruction is AArch64 NEON / ASIMD assembly code.
ld1 {v4.16b - v7.16b}, [x10]
and found some related page about ld1 instruction.
but there are no reference about minus(-) symbol ...
0
votes
1
answer
32
views
coretex a-53: 256bit vector
Following is the info of the CPU in a cortex A53 embedded target.
How can I know is this CPU supports 256bit vectoer (e.g float32x8)
Thank you,
Zvika
sidekiq@z3u:~$ cat /proc/cpuinfo
processor : ...
0
votes
0
answers
114
views
ARM/x86 : Sort vector efficiently [duplicate]
Do you know a way to use a sorting algorithm that uses vectors intrinsics efficiently ?
I have to use the capability of loading, storing 4 floats at one operation and also other vectors operations.
I ...
0
votes
2
answers
111
views
store neon vector register to memory
This seems like a stupid question, but I can't for the life work out how to do it.
I have a buffer like;
let result_buff: &[u8]
and I have some code like
let anded_value: uint8x16_t = unsafe { ...
0
votes
1
answer
90
views
NEON : Swap 4 scalars in float32x4
I used the following code to swap 4 scalars in float32x4_t vector.
{1,2,3,4} -> {4,3,2,1}
float32x4_t Vec = {1,2,3,4};
float32x4_t Rev = vrev64q_f32 (Vec); //{2,1,4,3}
High = vget_high_f32 (Rev)...
0
votes
1
answer
142
views
Going from ARM NEON to Intel intrinsics for sum of absolute differences for a row of 8x uint8_t
I am trying to convert some code using ARM NEON intrinsics to use Intel intrinsics instead.
I immediately got stuck and am trying to find the appropriate Intel intrinsics to replace the NEON ...
0
votes
1
answer
82
views
How to optimize function that adds padding to image with NEON Intrinsics?
im new to NEON and whilst i can do some processing i struggle with lack of knowledge at some basics concepts especially with optimizing 2d arrays.
uint8_t** add_padding(uint8_t** img,int width, int ...
0
votes
1
answer
84
views
Question about address operations in neon intrinstics
I'm rearranging an array in my project on ARMv7. Now I get the elements' address d[] in the order I expect. To make the code more efficient, I want to use neon intrinstics in C++. Now my problem is, I ...
0
votes
1
answer
51
views
GCC warning with typecasts of NEON array type (e.g. int32x4x2_t to int64x2x2_t)
Consider the following MRE:
#include <arm_neon.h>
void test(int64_t *r) {
int32x4x2_t vr;
// Do something actually interesting here instead
vr.val[0] = vr.val[1] = vdupq_n_s32(0);
...
0
votes
0
answers
597
views
Aarch64 GCC equivalent option for "-mfpu=neon"?
I have a C code which uses Neon Intrinsics which will run in a Raspberry Pi 4 (Cortex-A72).
When I compile the code with the built-in GCC:
In Raspberry Pi OS 32-bits (ARM - armv7l), if I run
gcc -o ...
1
vote
0
answers
256
views
How to compile C code with Neon Intrinsic on 64 bit raspberrypi4 running Linux (using either gcc or clang)?
Q: Which compiler options should be used to compile C code with NEON intrinsic
using #include <arm_neon.h> on raspberry-pi4 (cortex-a72, neon-fp-armv8) running a 64bit Linux OS (Ubuntu)?
On ...
1
vote
0
answers
56
views
How can I do vector operations to pointers (instead of int/float) in Neon Intrinsics?
I have the following code:
// int8_t* dout[4];
uint32x4_t ones = vdupq_n_u32(1);
uint32x4_t addr = vaddq_u32(vld1q_u32((uint32_t*)dout), ones);
vst1q_u32((uint32_t*)dout, addr);
where dout[4] is an ...
0
votes
0
answers
123
views
Does the Ne10 FFT implementation work on both Arm 32-bit `armv7l` and 64-bit `aarch64`?
I'm using Cortex-A53 processor for a C code project.
The project needs a Fourier transform, for which planned to use the Ne10 library.
The Cortex-A53 processor can work in two modes: as 32-bit armv7l ...
2
votes
0
answers
147
views
Optimizing FMA sequences on different arm64 micro-architectures
In order to optimize a heavily used inner loop (3x3xN tensor convolution in winograd domain), I had some good results by using the maximum amount of neon registers (32) and trying to read as little ...
0
votes
1
answer
52
views
Is it possible LLDB load scripts conditionally?
The problem description
I want to print int8x8_t type variable for different target architectures: ARM NEON(real device via remote debugging), and ARM NEON Simulation(on PC).
When without format print ...
3
votes
1
answer
476
views
Efficiently calculate hamming weight
I'm on an apple m1 processor.
What i'm trying to do is efficiently count the 1 bits in a large char array in rust. I looked up the arm neon instructions, and I think I can do it via a cnt instruction ...
0
votes
1
answer
90
views
How do I interpret the instruction `mov v2.2d[0],x14` in aarch64 assembly?
I have run into this line in an assembly program:
mov v2.2d[0],x14
and I'm having a very difficult time understanding what it does.
It appears to be a NEON instruction but I can't understand what it ...
0
votes
1
answer
396
views
ARM Assembly: Is there a way to shift the entirety of a NEON register?
I want to load two, 64-bit integers into a single, 128-bit NEON register then use some right-shift function to, essentially, concatenate the two. I know that (u|s)shr and (u|s)shl exist, but according ...
0
votes
1
answer
49
views
Can neon registers be indexed?
Consider a neon register such as:
uint16x8_t foo;
To access an individual lane, one is supposed to use vgetq_lane_u16(foo, 3). However, one might be tempted to write foo[3] instead given the ...