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

systems/architecture: bump default architecture to x86-64-v2 #202526

Closed
24 changes: 18 additions & 6 deletions lib/systems/architectures.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@

rec {
# gcc.arch to its features (as in /proc/cpuinfo)
features = {
default = [ ];
features = rec {
default = x86-64-v2;
# x86_64 Intel
nehalem = [ "sse3" "ssse3" "sse4_1" "sse4_2" "aes" ];
westmere = [ "sse3" "ssse3" "sse4_1" "sse4_2" "aes" ];
sandybridge = [ "sse3" "ssse3" "sse4_1" "sse4_2" "aes" "avx" ];
ivybridge = [ "sse3" "ssse3" "sse4_1" "sse4_2" "aes" "avx" ];
Expand All @@ -28,6 +29,12 @@ rec {
znver1 = [ "sse3" "ssse3" "sse4_1" "sse4_2" "sse4a" "aes" "avx" "avx2" "fma" ];
znver2 = [ "sse3" "ssse3" "sse4_1" "sse4_2" "sse4a" "aes" "avx" "avx2" "fma" ];
znver3 = [ "sse3" "ssse3" "sse4_1" "sse4_2" "sse4a" "aes" "avx" "avx2" "fma" ];
# Microarchitecture levels
K900 marked this conversation as resolved.
Show resolved Hide resolved
# https://en.wikipedia.org/wiki/X86-64#Microarchitecture_levels
x86-64 = [ ];
x86-64-v2 = [ "sse3" "ssse3" "sse4_1" "sse4_2" ];
x86-64-v3 = [ "sse3" "ssse3" "sse4_1" "sse4_2" "avx" "avx2" "fma" ];
x86-64-v4 = [ "sse3" "ssse3" "sse4_1" "sse4_2" "avx" "avx2" "avx512" "fma" ];
# other
armv5te = [ ];
armv6 = [ ];
Expand All @@ -40,14 +47,19 @@ rec {
# a superior CPU has all the features of an inferior and is able to build and test code for it
inferiors = {
# x86_64 Intel
default = [ ];
westmere = [ ];
default = [ "x86-64-v2" ];
x86-64 = [ ];
x86-64-v2 = [ "x86-64" ] ++ inferiors.x86-64;
nehalem = [ "x86-64-v2" ] ++ inferiors.x86-64-v2;
westmere = [ "nehalem" ] ++ inferiors.nehalem;
sandybridge = [ "westmere" ] ++ inferiors.westmere;
ivybridge = [ "sandybridge" ] ++ inferiors.sandybridge;
haswell = [ "ivybridge" ] ++ inferiors.ivybridge;
x86-64-v3 = [ "ivybridge" ] ++ inferiors.ivybridge;
haswell = [ "x86-64-v3" ] ++ inferiors.x86-64-v3;
broadwell = [ "haswell" ] ++ inferiors.haswell;
skylake = [ "broadwell" ] ++ inferiors.broadwell;
skylake-avx512 = [ "skylake" ] ++ inferiors.skylake;
x86-64-v4 = [ "skylake" ] ++ inferiors.skylake;
skylake-avx512 = [ "x86-64-v4" ] ++ inferiors.x86-64-v4;

# x86_64 AMD
# TODO: fill this (need testing)
Expand Down
6 changes: 6 additions & 0 deletions lib/systems/platforms.nix
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@ rec {
autoModules = true;
target = "bzImage";
};
gcc = {
# this should match the microarchitecture level of lib.systems.architectures.features.default
# but nehalem is used instead of x86-64-v2 because as of writting the bootstrapping gcc in stage 0 does not understand it
arch = "nehalem";
tune = "generic";
};
};

pc_simplekernel = lib.recursiveUpdate pc {
Expand Down
11 changes: 10 additions & 1 deletion nixos/doc/manual/from_md/release-notes/rl-2305.section.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,16 @@
In addition to numerous new and upgraded packages, this release
has the following highlights:
</para>
<itemizedlist spacing="compact">
<itemizedlist>
<listitem>
<para>
On x86 platforms nixpkgs is now build by default with the
<literal>x86_64-v2</literal> microarchitecture level. This
means any x86 processor that does not support SSE4.2 and AES
instructions is no longer supported by the precompiled binary
cache.
</para>
</listitem>
<listitem>
<para>
Cinnamon has been updated to 5.6, see
Expand Down
3 changes: 3 additions & 0 deletions nixos/doc/manual/release-notes/rl-2305.section.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ In addition to numerous new and upgraded packages, this release has the followin

<!-- To avoid merge conflicts, consider adding your item at an arbitrary place in the list instead. -->

- On x86 platforms nixpkgs is now build by default with the `x86_64-v2` microarchitecture level.
SuperSandro2000 marked this conversation as resolved.
Show resolved Hide resolved
This means any x86 processor that does not support SSE4.2 and AES instructions is no longer supported by the precompiled binary cache.

- Cinnamon has been updated to 5.6, see [the pull request](https://github.com/NixOS/nixpkgs/pull/201328#issue-1449910204) for what is changed.

## New Services {#sec-release-23.05-new-services}
Expand Down
41 changes: 41 additions & 0 deletions nixos/release-small.nix
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,22 @@ let
nixpkgs = nixpkgsSrc;
}) [ "unstable" ];

nixpkgs-unoptimised' = builtins.removeAttrs (import ../pkgs/top-level/release.nix {
inherit supportedSystems;
nixpkgs = nixpkgsSrc;
# default value plus empty gcc.arch/gcc.tune
nixpkgsArgs = {
config = {
allowUnfree = false;
gcc = {
arch = null;
tune = null;
};
inHydra = true;
};
};
}) [ "unstable" ];

in rec {

nixos = {
Expand Down Expand Up @@ -85,6 +101,31 @@ in rec {
vim;
};

nixpkgs-unoptimised = {
inherit (nixpkgs-unoptimised')
apacheHttpd
cmake
cryptsetup
emacs
gettext
git
imagemagick
jdk
linux
mariadb
nginx
nodejs
openssh
php
postgresql
python
rsyslog
stdenv
subversion
tarball
vim;
};

tested = let
onSupported = x: map (system: "${x}.${system}") supportedSystems;
onSystems = systems: x: map (system: "${x}.${system}")
Expand Down
5 changes: 4 additions & 1 deletion pkgs/stdenv/generic/make-derivation.nix
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,10 @@ else let
enableParallelChecking = attrs.enableParallelChecking or true;
} // lib.optionalAttrs (hardeningDisable != [] || hardeningEnable != [] || stdenv.hostPlatform.isMusl) {
NIX_HARDENING_ENABLE = enabledHardeningOptions;
} // lib.optionalAttrs (stdenv.hostPlatform.isx86_64 && stdenv.hostPlatform ? gcc.arch) {
} // lib.optionalAttrs (stdenv.hostPlatform.isx86_64 && stdenv.hostPlatform ? gcc.arch
# ignore x86-64-v1/2, nehalem and westmere to allow a smoother transition when bumping the default gcc.arch.
# This silently assumes that any x86 machines supports them at least!
&& lib.all (x: stdenv.hostPlatform.gcc.arch != x) [ "x86-64" "x86-64-v2" "nehalem" "westmere" ]) {
requiredSystemFeatures = attrs.requiredSystemFeatures or [] ++ [ "gccarch-${stdenv.hostPlatform.gcc.arch}" ];
} // lib.optionalAttrs (stdenv.buildPlatform.isDarwin) {
inherit __darwinAllowLocalNetworking;
Expand Down