Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doesn't build on linux aarch64 #236

Closed
Bleuzen opened this issue Dec 16, 2021 · 12 comments
Closed

Doesn't build on linux aarch64 #236

Bleuzen opened this issue Dec 16, 2021 · 12 comments
Assignees
Labels
bug Something isn't working

Comments

@Bleuzen
Copy link

Bleuzen commented Dec 16, 2021

Hi, I currently try to build this plugin as a flatpak and on flathub:
flathub/flathub#2681

Flathub usually builds for x86_64 and aarch64. The problem is that the aarch64 build fails.

According to this comment:
flathub/flathub#2681 (comment)

vvtanh is missing and from what I gather it's because they assume aarch64 == Apple.

You can find the currently latest build log here:
https://flathub.org/builds/api/v2/logs/2903750/raw

@Bleuzen Bleuzen added the bug Something isn't working label Dec 16, 2021
@jatinchowdhury18
Copy link
Owner

Hi @Bluezen, thanks for reporting this, and for the detailed report! The good news is that it looks like that error was present in some obsolete code leftover from an old implementation of that class. I just pushed a fix to the develop branch that removes the obsolete code. Definitely let me know if that works for you!

@hfiguiere
Copy link

I have two different patches. One being in chowdsp_utils. They are untested at the moment (ie things build).

hfiguiere added a commit to hfiguiere/AnalogTapeModel that referenced this issue Dec 17, 2021
hfiguiere added a commit to hfiguiere/chowdsp_utils that referenced this issue Dec 17, 2021
@jatinchowdhury18
Copy link
Owner

@hfiguiere For the PR in this repo, I believe I've already fixed that problem on the develop branch. Would it be possible to test from there?

For the PR in chowdsp_utils, would it be possible to share the error messages related to that change? My understanding was that aarch64 should support SIMD instructions for double-precision floats. Otherwise, I might need to provide some different #if / #else fallbacks there.

Thanks!

@Bleuzen
Copy link
Author

Bleuzen commented Dec 17, 2021

@jatinchowdhury18

I believe I've already fixed that problem on the develop branch. Would it be possible to test from there?

Did that, build failed, log:
https://flathub.org/builds/api/v2/logs/2908486/raw

@hfiguiere
Copy link

This is the same error that Chowdhury-DSP/chowdsp_utils#98 addresses.
The patch itself is still valid (one-liner), if that the right solution.

@jatinchowdhury18
Copy link
Owner

Gotcha, thanks for including the build log again. It seems like the first issue is fixed, so that's definitely a good sign! For the remaining issue, I don't think the one-line fix is correct, since that will "turn off" most of the double-precision SIMD methods on all ARM platforms, which would definitely have a big performance hit.

I was able to investigate a bit further, and I think I've found the problem: xsimd::isnan returns a SIMD register of booleans, which I try to cast as a batch of doubles in my wrapper:

/** SIMD implementation of std::isnan */
template <typename T>
inline typename juce::dsp::SIMDRegister<T>::vMaskType isnanSIMD (juce::dsp::SIMDRegister<T> x)
{
    using Vec = juce::dsp::SIMDRegister<T>;
    return Vec::notEqual ((Vec) xsimd::isnan ((x_type<T>) x.value), (Vec) 0);
}

What really confuses me is that the compiler seems to allow this cast with SSE SIMD instructions, and when compiling for ARM with Clang... Anyway, I'll dig into it and hopefully can have it fixed soon!

@hfiguiere
Copy link

What really confuses me is that the compiler seems to allow this cast with SSE SIMD instructions, and when compiling for ARM with Clang... Anyway, I'll dig into it and hopefully can have it fixed soon!

Does it throw warnings? Sometime warnings are actual errors. (I saw the x86_64 had a lot)

And yes I was building with gcc 10.2 or 11.2 which are the default here, be it plain Debian aarch64 or Freedesktop-SDK (the runtime for Flatpak)

@jatinchowdhury18
Copy link
Owner

Yeah, I haven't seen any warnings about that specific section of code either. Maybe I need to adjust my warning flags to be more strict... Anyway, I have an attempted fix now on the isnan-fix branch, if you want to give it a try.

@Bleuzen
Copy link
Author

Bleuzen commented Dec 17, 2021

@jatinchowdhury18
Copy link
Owner

Ah, the plot thickens... it seems like xsimd::isnan returns a batch of unsigned ints on ARM NEON, but when using SSE SIMD instructions it returns a batch of doubles. This explains why I previously wasn't getting errors or warnings when compiling for x86_64. I've pushed a new fix to the isnan-fix branch if you want to try that out.

@Bleuzen
Copy link
Author

Bleuzen commented Dec 18, 2021

@jatinchowdhury18
With the new fix, build works now on both x86_64 and aarch64. Thank you :)

@Bleuzen Bleuzen closed this as completed Dec 18, 2021
@jatinchowdhury18
Copy link
Owner

Great! I'll take care of getting all the fixes merged down to develop and then master. Thanks for being patient and helping to get everything fixed!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants