fix(ci): enforce basic CPU instruction set to prevent execution problems #1759
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
It seems Github Action runners started using new machines with new fancy CPUs which include AVX512 instructions. These are not widely available in non-server / older HW (it seems), which result in unusable binaries built in GH Actions.
We can pass explicit architecture / CPU instruction set to build for to C compiler through Nim using
--passC:"-march=..."
The list of supported architectures: https://gcc.gnu.org/onlinedocs/gcc/x86-Options.html
I am choosing basic instruction set
x86-64
for this PR. This may potentially influence speed of some crypto algorithms (which would otherwise leverage AVX instructions), so we should consider doing some benchmarking in the future to asses the impact and consider some newer architecture(s), but to have current builds working and as general as possible, x86-64 seems to be a reasonable choice.A variable
ARCHITECTURE
is added for cases where operators would prefer to rebuild with newer architecture ornative
option (which leverages all available instructions on the build machine) to benefit from AVX and other "fancy" instructions.Changes
-march
option toMakefile
to make binaries use limited set of CPU instructions