HomeWildfire Games

Allo native builds on Mac OS M1 / Apple Silicon

Description

Allo native builds on Mac OS M1 / Apple Silicon

  • Update GMP to a version that supports arm64 darwin
  • Patch spidermonkey 78 to build and run on arm64 darwin
  • Choose the correct architecture dynamically in build scripts
  • Include python workaround that fixes python related errors on spidermonkey build

Based on a patch by: kumikumi
Based on a patch by: Langbart

Fixes #6474

Differential Revision: https://code.wildfiregames.com/D4607

Event Timeline

vladislavbelov added inline comments.
/ps/trunk/source/graphics/Color.cpp
86–88

It doesn't look like a proper place to add the arch check.

wraitii added inline comments.May 15 2022, 6:48 PM
/ps/trunk/source/graphics/Color.cpp
86–88

Well, the problem is that SSE is an x86 only thing, so the whole precompiled logic ought be improved.

Stan added a subscriber: Stan.May 15 2022, 6:51 PM
Stan added inline comments.
/ps/trunk/source/graphics/Color.cpp
86–88

Were you just fixing the tests ? In that case you might have just added a TestLogger in the relevant function.
This message shows up on a Raspbery Pi as well.

wraitii added inline comments.May 15 2022, 6:54 PM
/ps/trunk/source/graphics/Color.cpp
86–88

Were you just fixing the tests ? In that case you might have just added a TestLogger in the relevant function.
This message shows up on a Raspbery Pi as well.

I don't remember, but the message is broken -> there's no SSE available, so it's not a 'slow fallback routine'. Likewise on raspberry PI I guess, though whether that victories anything is out of my knowledge.

vladislavbelov added inline comments.May 15 2022, 6:55 PM
/ps/trunk/source/graphics/Color.cpp
86–88

Nevertheless it doesn't make the code correct, with less error it could be added to COMPILER_HAS_SSE.

wraitii added inline comments.May 15 2022, 6:59 PM
/ps/trunk/source/graphics/Color.cpp
86–88

It could not because that branch uses x86 specific intrisics IIRC, and the whole define is meaningless.

That being said, yes, this is not the best way to do this. I'm not up for refactoring the whole processor logic just yet.

vladislavbelov added inline comments.May 15 2022, 7:07 PM
/ps/trunk/source/graphics/Color.cpp
86–88

How does it contradicts? Only x86 (and related) supports SSE, so the sentence No SSE available. Slow fallback routines will be used. is true for all other archs.

That's why the current approach is worse.

Stan added a comment.May 15 2022, 8:59 PM

Question how do I build a X86 build on my M1 now ? I can pass arch to the libs, but not to updateworkspaces.sh, nor premake for the game

In rP26881#57875, @Stan wrote:

Question how do I build a X86 build on my M1 now ? I can pass arch to the libs, but not to updateworkspaces.sh, nor premake for the game

You can pass ARCH to update-workspaces.sh. That sets the workspaces for x86.

/ps/trunk/source/graphics/Color.cpp
86–88

I think it implies that the fallback routine is slow, when the 'fallback routine' can be vector optimised by the compiler (in the M1 case, is).

/ps/trunk/source/graphics/Color.cpp
86–88

I believe compilers are pretty dumb still in that area, and most of our plane code won't be optimized in that way.

wraitii added inline comments.May 15 2022, 11:28 PM
/ps/trunk/source/graphics/Color.cpp
86–88

Talking specifically about mac + clang here, I checked the assembly and it gets vectorized. But yes that might not be a general thing.

Stan added inline comments.May 15 2022, 11:29 PM
/ps/trunk/source/graphics/Color.cpp
86–88

Last I checked clang was the only compiler that almost matched our sse code. And it needed ofast and a bunch of flags