X Tutup
Skip to content

Don't build against lzcnt by default and enable USE_SSE42 only on Intel architecture#5871

Merged
sturnclaw merged 3 commits intopioneerspacesim:masterfrom
sturnclaw:build-improvements
Aug 12, 2024
Merged

Don't build against lzcnt by default and enable USE_SSE42 only on Intel architecture#5871
sturnclaw merged 3 commits intopioneerspacesim:masterfrom
sturnclaw:build-improvements

Conversation

@sturnclaw
Copy link
Member

This PR addresses some slightly over-zealous feature enablement from the previous release cycle that we are not yet materially using. The build system now only defaults the USE_SSE42 flag to 'on' if we're compiling for a non-ARM64 target, and we no longer enable utilization of the lzcnt instruction for SSE4.2 builds - it was introduced in the Haswell microarchitecture alongside AVX2 and as such has been moved to that build option.

I've also added feature-test flags for the build script to use in the future to detect whether we're compiling for an ARM64 target or an Intel target (and whether we're compiling for 32 or 64-bit x86 architecture).

- Move the lzcnt instruction flag to AVX2 builds (as it was introduced with Haswell)
- Only default USE_SSE42 on for x86/64 builds; better support ARM64 builds
- Add proper build flags for the target architecture
@sturnclaw
Copy link
Member Author

CC @pcercuei - are there any other changes that should be made to make the Flatpak build easier to maintain?

@pcercuei
Copy link
Contributor

Your TargetArchitecture.cmake looks overly complicated, all it needs is

if (${CMAKE_SYSTEM_PROCESSOR} MATCHES x86|x64)
       set(PIONEER_TARGET_INTEL ON)
endif()

You could check for ARM in there too, but you're not using it anywhere, so just introduce it when you need it.

Note that for Flatpaks I'll have to force-disable those two options anyway.

- We don't currently have any code that benefits from AVX2 except compiler autovectorization, so there's little point to building and hosting artifacts related to AVX2.
@sturnclaw
Copy link
Member Author

Thanks! I hadn't realized CMake was smart enough for regex matches, that makes this code much easier to express.

Regarding feature flags that need to be disabled - AVX2 is no longer enabled by default in any capacity, and SSE4.2 is default-enabled only on Intel targets for parity between user-compiled checkouts of Pioneer and the official builds we ship.

@sturnclaw sturnclaw merged commit 2c84062 into pioneerspacesim:master Aug 12, 2024
@sturnclaw sturnclaw deleted the build-improvements branch August 21, 2024 19:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

X Tutup