FastNoise2 icon indicating copy to clipboard operation
FastNoise2 copied to clipboard

Fix NEON bugs

Open atarabi opened this issue 2 years ago • 5 comments

I couldn't compile NEON sources on M1 Mac, so I fixed some bugs, typos and implemented missing operators.

atarabi avatar Jun 12 '22 04:06 atarabi

Thanks for looking at this, it's been on my to-do list for ages. Tbh I thought it would be more work than that!

I had a quick test on my raspberry pi and had a few type mismatch compile errors, probably a GCC Vs Clang difference. I will look into it further soon.

The only thing that looks odd to me is the negative sign bit shifting, the right shift needs to sign extend.

Auburn avatar Jun 13 '22 09:06 Auburn

vshlq_n_s32, vshrq_n_s32 take a compile time constant value as its parameter, so I used vshlq_s32. https://developer.arm.com/documentation/dui0491/i/Using-NEON-Support/Shifts-by-a-constant

And vsh”r”q_s32 doesn’t exist because left-shift of a negative value means right-shift. https://developer.arm.com/documentation/dui0491/i/Using-NEON-Support/Shifts-by-signed-variable

atarabi avatar Jun 13 '22 20:06 atarabi

I pulled the changes into a branch, fixed up a few more errors and setup cmake to detect ARM correctly. There are still a bunch more compile errors though which I don't have time to look into now.

https://github.com/Auburn/FastNoise2/tree/fix-neon-bugs

Auburn avatar Jun 13 '22 21:06 Auburn

Hello @Auburn and @atarabi, it would be really nice to have Apple M1 supported by FastNoise2 out of the box. I've successfully built atarabi project version on my MacBook Air with M1, but found that Simplex and Perlin noise generators are working incorrectly with NEON vectorization, while working fine in Scalar. Would it be possible to fix this bug and merge M1 support into the master?

NEON: Screenshot 2023-01-27 at 21 30 57

Scalar: Screenshot 2023-01-27 at 21 31 08

egorodet avatar Jan 27 '23 18:01 egorodet

Hi! Is this merged somehow into master? In master there are many other commits about NEON and ARM, so I was wondering if it's better to use master or this branch for Mac with M processor

andraghetti avatar Jun 18 '23 19:06 andraghetti