diff --git a/lib/systems/architectures.nix b/lib/systems/architectures.nix new file mode 100644 index 00000000000..9d1c29fd9f0 --- /dev/null +++ b/lib/systems/architectures.nix @@ -0,0 +1,77 @@ +{ lib }: + +rec { + # platform.gcc.arch to its features (as in /proc/cpuinfo) + features = { + default = [ ]; + # x86_64 Intel + 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" ]; + haswell = [ "sse3" "ssse3" "sse4_1" "sse4_2" "aes" "avx" "avx2" "fma" ]; + broadwell = [ "sse3" "ssse3" "sse4_1" "sse4_2" "aes" "avx" "avx2" "fma" ]; + skylake = [ "sse3" "ssse3" "sse4_1" "sse4_2" "aes" "avx" "avx2" "fma" ]; + skylake-avx512 = [ "sse3" "ssse3" "sse4_1" "sse4_2" "aes" "avx" "avx2" "avx512" "fma" ]; + # x86_64 AMD + btver1 = [ "sse3" "ssse3" "sse4_1" "sse4_2" ]; + btver2 = [ "sse3" "ssse3" "sse4_1" "sse4_2" "aes" "avx" ]; + bdver1 = [ "sse3" "ssse3" "sse4_1" "sse4_2" "sse4a" "aes" "avx" "fma" "fma4" ]; + bdver2 = [ "sse3" "ssse3" "sse4_1" "sse4_2" "sse4a" "aes" "avx" "fma" "fma4" ]; + bdver3 = [ "sse3" "ssse3" "sse4_1" "sse4_2" "sse4a" "aes" "avx" "fma" "fma4" ]; + bdver4 = [ "sse3" "ssse3" "sse4_1" "sse4_2" "sse4a" "aes" "avx" "avx2" "fma" "fma4" ]; + znver1 = [ "sse3" "ssse3" "sse4_1" "sse4_2" "sse4a" "aes" "avx" "avx2" "fma" ]; + znver2 = [ "sse3" "ssse3" "sse4_1" "sse4_2" "sse4a" "aes" "avx" "avx2" "fma" ]; + # other + armv5te = [ ]; + armv6 = [ ]; + armv7-a = [ ]; + armv8-a = [ ]; + mips32 = [ ]; + loongson2f = [ ]; + }; + + # 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 = [ ]; + sandybridge = [ "westmere" ] ++ inferiors.westmere; + ivybridge = [ "sandybridge" ] ++ inferiors.sandybridge; + haswell = [ "ivybridge" ] ++ inferiors.ivybridge; + broadwell = [ "haswell" ] ++ inferiors.haswell; + skylake = [ "broadwell" ] ++ inferiors.broadwell; + skylake-avx512 = [ "skylake" ] ++ inferiors.skylake; + # x86_64 AMD + btver1 = [ ]; + btver2 = [ ]; # TODO: fill this (need testing) + bdver1 = [ ]; # TODO: fill this (need testing) + bdver2 = [ ]; # TODO: fill this (need testing) + bdver3 = [ ]; # TODO: fill this (need testing) + bdver4 = [ ]; # TODO: fill this (need testing) + znver1 = [ ]; # TODO: fill this (need testing) + znver2 = [ ]; # TODO: fill this (need testing) + # other + armv5te = [ ]; + armv6 = [ ]; + armv7-a = [ ]; + armv8-a = [ ]; + mips32 = [ ]; + loongson2f = [ ]; + }; + + predicates = let + featureSupport = feature: x: builtins.elem feature features.${x}; + in { + sse3Support = featureSupport "sse3"; + ssse3Support = featureSupport "ssse3"; + sse4_1Support = featureSupport "sse4_1"; + sse4_2Support = featureSupport "sse4_2"; + sse4_aSupport = featureSupport "sse4a"; + avxSupport = featureSupport "avx"; + avx2Support = featureSupport "avx2"; + avx512Support = featureSupport "avx512"; + aesSupport = featureSupport "aes"; + fmaSupport = featureSupport "fma"; + fma4Support = featureSupport "fma4"; + }; +} diff --git a/lib/systems/default.nix b/lib/systems/default.nix index 09884d40682..9939743157e 100644 --- a/lib/systems/default.nix +++ b/lib/systems/default.nix @@ -7,6 +7,7 @@ rec { inspect = import ./inspect.nix { inherit lib; }; platforms = import ./platforms.nix { inherit lib; }; examples = import ./examples.nix { inherit lib; }; + architectures = import ./architectures.nix { inherit lib; }; # Elaborate a `localSystem` or `crossSystem` so that it contains everything # necessary. @@ -126,6 +127,7 @@ rec { else throw "Don't know how to run ${final.config} executables."; } // mapAttrs (n: v: v final.parsed) inspect.predicates + // mapAttrs (n: v: v final.platform.gcc.arch or "default") architectures.predicates // args; in assert final.useAndroidPrebuilt -> final.isAndroid; assert lib.foldl diff --git a/nixos/modules/services/misc/nix-daemon.nix b/nixos/modules/services/misc/nix-daemon.nix index 0fbc9cecb4d..2680b1cc0d3 100644 --- a/nixos/modules/services/misc/nix-daemon.nix +++ b/nixos/modules/services/misc/nix-daemon.nix @@ -587,16 +587,10 @@ in nix.systemFeatures = mkDefault ( [ "nixos-test" "benchmark" "big-parallel" "kvm" ] ++ - optionals (pkgs.stdenv.isx86_64 && pkgs.hostPlatform.platform ? gcc.arch) ( - # a x86_64 builder can run code for `platform.gcc.arch` and minor architectures: - [ "gccarch-${pkgs.hostPlatform.platform.gcc.arch}" ] ++ { - sandybridge = [ "gccarch-westmere" ]; - ivybridge = [ "gccarch-westmere" "gccarch-sandybridge" ]; - haswell = [ "gccarch-westmere" "gccarch-sandybridge" "gccarch-ivybridge" ]; - broadwell = [ "gccarch-westmere" "gccarch-sandybridge" "gccarch-ivybridge" "gccarch-haswell" ]; - skylake = [ "gccarch-westmere" "gccarch-sandybridge" "gccarch-ivybridge" "gccarch-haswell" "gccarch-broadwell" ]; - skylake-avx512 = [ "gccarch-westmere" "gccarch-sandybridge" "gccarch-ivybridge" "gccarch-haswell" "gccarch-broadwell" "gccarch-skylake" ]; - }.${pkgs.hostPlatform.platform.gcc.arch} or [] + optionals (pkgs.hostPlatform.platform ? gcc.arch) ( + # a builder can run code for `platform.gcc.arch` and inferior architectures + [ "gccarch-${pkgs.hostPlatform.platform.gcc.arch}" ] ++ + map (x: "gccarch-${x}") lib.systems.architectures.inferiors.${pkgs.hostPlatform.platform.gcc.arch} ) ); diff --git a/pkgs/applications/science/math/nauty/default.nix b/pkgs/applications/science/math/nauty/default.nix index c1d408213b9..d75fc9731cd 100644 --- a/pkgs/applications/science/math/nauty/default.nix +++ b/pkgs/applications/science/math/nauty/default.nix @@ -10,15 +10,13 @@ stdenv.mkDerivation rec { sha256 = "1nym0p2djws8ylkpr0kgpxfa6fxdlh46cmvz0gn5vd02jzgs0aww"; }; outputs = [ "out" "dev" ]; - configureFlags = { + configureFlags = [ # Prevent nauty from sniffing some cpu features. While those are very # widely available, it can lead to nasty bugs when they are not available: # https://groups.google.com/forum/#!topic/sage-packaging/Pe4SRDNYlhA - default = [ "--disable-clz" "--disable-popcnt" ]; - westmere = [ "--disable-clz" ]; - sandybridge = [ "--disable-clz" ]; - ivybridge = [ "--disable-clz" ]; - }.${stdenv.hostPlatform.platform.gcc.arch or "default"} or []; + "--${if stdenv.hostPlatform.sse4_2Support then "enable" else "disable"}-popcnt" + "--${if stdenv.hostPlatform.sse4_aSupport then "enable" else "disable"}-clz" + ]; installPhase = '' mkdir -p "$out"/{bin,share/doc/nauty} "$dev"/{lib,include/nauty} diff --git a/pkgs/build-support/cc-wrapper/default.nix b/pkgs/build-support/cc-wrapper/default.nix index 6ee287e287b..bfb15f2f783 100644 --- a/pkgs/build-support/cc-wrapper/default.nix +++ b/pkgs/build-support/cc-wrapper/default.nix @@ -64,18 +64,26 @@ let # older compilers (for example bootstrap's GCC 5) fail with -march=too-modern-cpu isGccArchSupported = arch: if isGNU then - { skylake = versionAtLeast ccVersion "6.0"; + { # Intel + skylake = versionAtLeast ccVersion "6.0"; skylake-avx512 = versionAtLeast ccVersion "6.0"; cannonlake = versionAtLeast ccVersion "8.0"; icelake-client = versionAtLeast ccVersion "8.0"; icelake-server = versionAtLeast ccVersion "8.0"; knm = versionAtLeast ccVersion "8.0"; + # AMD + znver1 = versionAtLeast ccVersion "6.0"; + znver2 = versionAtLeast ccVersion "9.0"; }.${arch} or true else if isClang then - { cannonlake = versionAtLeast ccVersion "5.0"; + { # Intel + cannonlake = versionAtLeast ccVersion "5.0"; icelake-client = versionAtLeast ccVersion "7.0"; icelake-server = versionAtLeast ccVersion "7.0"; knm = versionAtLeast ccVersion "7.0"; + # AMD + znver1 = versionAtLeast ccVersion "4.0"; + znver2 = versionAtLeast ccVersion "9.0"; }.${arch} or true else false; diff --git a/pkgs/development/interpreters/j/default.nix b/pkgs/development/interpreters/j/default.nix index 8e6b434281e..e2bf921f882 100644 --- a/pkgs/development/interpreters/j/default.nix +++ b/pkgs/development/interpreters/j/default.nix @@ -1,5 +1,5 @@ { stdenv, fetchFromGitHub, readline, libedit, bc -, avxSupport ? false +, avxSupport ? stdenv.hostPlatform.avxSupport }: stdenv.mkDerivation rec { diff --git a/pkgs/development/libraries/dlib/default.nix b/pkgs/development/libraries/dlib/default.nix index 3f59368c278..43ac2530cc1 100644 --- a/pkgs/development/libraries/dlib/default.nix +++ b/pkgs/development/libraries/dlib/default.nix @@ -2,7 +2,7 @@ , guiSupport ? false, libX11 # see http://dlib.net/compile.html -, avxSupport ? true +, avxSupport ? stdenv.hostPlatform.avxSupport , cudaSupport ? true }: @@ -21,7 +21,7 @@ stdenv.mkDerivation rec { rm -rf dlib/external ''; - cmakeFlags = [ + cmakeFlags = [ "-DUSE_DLIB_USE_CUDA=${if cudaSupport then "1" else "0"}" "-DUSE_AVX_INSTRUCTIONS=${if avxSupport then "yes" else "no"}" ]; diff --git a/pkgs/development/libraries/fflas-ffpack/default.nix b/pkgs/development/libraries/fflas-ffpack/default.nix index bc84039a9aa..23b31fe439f 100644 --- a/pkgs/development/libraries/fflas-ffpack/default.nix +++ b/pkgs/development/libraries/fflas-ffpack/default.nix @@ -31,19 +31,21 @@ stdenv.mkDerivation rec { configureFlags = [ "--with-blas-libs=-lcblas" "--with-lapack-libs=-llapacke" - ] ++ stdenv.lib.optionals stdenv.isx86_64 { + ] ++ stdenv.lib.optionals stdenv.isx86_64 [ # disable SIMD instructions (which are enabled *when available* by default) # for now we need to be careful to disable *all* relevant versions of an instruction set explicitly (https://github.com/linbox-team/fflas-ffpack/issues/284) - default = [ "--disable-sse3" "--disable-ssse3" "--disable-sse41" "--disable-sse42" "--disable-avx" "--disable-avx2" "--disable-avx512f" "--disable-avx512dq" "--disable-avx512vl" "--disable-fma" "--disable-fma4" ]; - westmere = [ "--disable-avx" "--disable-avx2" "--disable-avx512f" "--disable-avx512dq" "--disable-avx512vl" "--disable-fma" "--disable-fma4" ]; - sandybridge = [ "--disable-avx2" "--disable-avx512f" "--disable-avx512dq" "--disable-avx512vl" "--disable-fma" "--disable-fma4" ]; - ivybridge = [ "--disable-avx2" "--disable-avx512f" "--disable-avx512dq" "--disable-avx512vl" "--disable-fma" "--disable-fma4" ]; - haswell = [ "--disable-fma4" ]; - broadwell = [ "--disable-fma4" ]; - skylake = [ "--disable-fma4" ]; - skylake-avx512 = [ "--disable-fma4" ]; - }.${stdenv.hostPlatform.platform.gcc.arch or "default"}; - + "--${if stdenv.hostPlatform.sse3Support then "enable" else "disable"}-sse3" + "--${if stdenv.hostPlatform.ssse3Support then "enable" else "disable"}-ssse3" + "--${if stdenv.hostPlatform.sse4_1Support then "enable" else "disable"}-sse41" + "--${if stdenv.hostPlatform.sse4_2Support then "enable" else "disable"}-sse42" + "--${if stdenv.hostPlatform.avxSupport then "enable" else "disable"}-avx" + "--${if stdenv.hostPlatform.avx2Support then "enable" else "disable"}-avx2" + "--${if stdenv.hostPlatform.avx512Support then "enable" else "disable"}-avx512f" + "--${if stdenv.hostPlatform.avx512Support then "enable" else "disable"}-avx512dq" + "--${if stdenv.hostPlatform.avx512Support then "enable" else "disable"}-avx512vl" + "--${if stdenv.hostPlatform.fmaSupport then "enable" else "disable"}-fma" + "--${if stdenv.hostPlatform.fma4Support then "enable" else "disable"}-fma4" + ]; doCheck = true; meta = with stdenv.lib; { diff --git a/pkgs/development/libraries/g2o/default.nix b/pkgs/development/libraries/g2o/default.nix index 7167112b6bd..675d994cf0e 100644 --- a/pkgs/development/libraries/g2o/default.nix +++ b/pkgs/development/libraries/g2o/default.nix @@ -27,16 +27,13 @@ mkDerivation rec { # Detection script is broken "-DQGLVIEWER_INCLUDE_DIR=${libqglviewer}/include/QGLViewer" "-DG2O_BUILD_EXAMPLES=OFF" - ] ++ lib.optionals stdenv.isx86_64 ([ "-DDO_SSE_AUTODETECT=OFF" ] ++ { - default = [ "-DDISABLE_SSE3=ON" "-DDISABLE_SSE4_1=ON" "-DDISABLE_SSE4_2=ON" "-DDISABLE_SSE4_A=ON" ]; - westmere = [ "-DDISABLE_SSE4_A=ON" ]; - sandybridge = [ "-DDISABLE_SSE4_A=ON" ]; - ivybridge = [ "-DDISABLE_SSE4_A=ON" ]; - haswell = [ "-DDISABLE_SSE4_A=ON" ]; - broadwell = [ "-DDISABLE_SSE4_A=ON" ]; - skylake = [ "-DDISABLE_SSE4_A=ON" ]; - skylake-avx512 = [ "-DDISABLE_SSE4_A=ON" ]; - }.${stdenv.hostPlatform.platform.gcc.arch or "default"}); + ] ++ lib.optionals stdenv.isx86_64 [ + "-DDO_SSE_AUTODETECT=OFF" + "-DDISABLE_SSE3=${ if stdenv.hostPlatform.sse3Support then "OFF" else "ON"}" + "-DDISABLE_SSE4_1=${if stdenv.hostPlatform.sse4_1Support then "OFF" else "ON"}" + "-DDISABLE_SSE4_2=${if stdenv.hostPlatform.sse4_2Support then "OFF" else "ON"}" + "-DDISABLE_SSE4_A=${if stdenv.hostPlatform.sse4_aSupport then "OFF" else "ON"}" + ]; meta = with lib; { description = "A General Framework for Graph Optimization"; diff --git a/pkgs/development/libraries/givaro/default.nix b/pkgs/development/libraries/givaro/default.nix index fdaf518c611..78b6b088270 100644 --- a/pkgs/development/libraries/givaro/default.nix +++ b/pkgs/development/libraries/givaro/default.nix @@ -17,17 +17,17 @@ stdenv.mkDerivation rec { configureFlags = [ "--disable-optimization" - ] ++ stdenv.lib.optionals stdenv.isx86_64 { + ] ++ stdenv.lib.optionals stdenv.isx86_64 [ # disable SIMD instructions (which are enabled *when available* by default) - default = [ "--disable-sse3" "--disable-ssse3" "--disable-sse41" "--disable-sse42" "--disable-avx" "--disable-avx2" "--disable-fma" "--disable-fma4" ]; - westmere = [ "--disable-avx" "--disable-avx2" "--disable-fma" "--disable-fma4" ]; - sandybridge = [ "--disable-avx2" "--disable-fma" "--disable-fma4" ]; - ivybridge = [ "--disable-avx2" "--disable-fma" "--disable-fma4" ]; - haswell = [ "--disable-fma4" ]; - broadwell = [ "--disable-fma4" ]; - skylake = [ "--disable-fma4" ]; - skylake-avx512 = [ "--disable-fma4" ]; - }.${stdenv.hostPlatform.platform.gcc.arch or "default"}; + "--${if stdenv.hostPlatform.sse3Support then "enable" else "disable"}-sse3" + "--${if stdenv.hostPlatform.ssse3Support then "enable" else "disable"}-ssse3" + "--${if stdenv.hostPlatform.sse4_1Support then "enable" else "disable"}-sse41" + "--${if stdenv.hostPlatform.sse4_2Support then "enable" else "disable"}-sse42" + "--${if stdenv.hostPlatform.avxSupport then "enable" else "disable"}-avx" + "--${if stdenv.hostPlatform.avx2Support then "enable" else "disable"}-avx2" + "--${if stdenv.hostPlatform.fmaSupport then "enable" else "disable"}-fma" + "--${if stdenv.hostPlatform.fma4Support then "enable" else "disable"}-fma4" + ]; # On darwin, tests are linked to dylib in the nix store, so we need to make # sure tests run after installPhase. diff --git a/pkgs/development/libraries/linbox/default.nix b/pkgs/development/libraries/linbox/default.nix index 2217996acdb..09bd7e12091 100644 --- a/pkgs/development/libraries/linbox/default.nix +++ b/pkgs/development/libraries/linbox/default.nix @@ -39,18 +39,17 @@ stdenv.mkDerivation rec { configureFlags = [ "--with-blas-libs=-lblas" "--disable-optimization" - ] ++ stdenv.lib.optionals stdenv.isx86_64 { + ] ++ stdenv.lib.optionals stdenv.isx86_64 [ # disable SIMD instructions (which are enabled *when available* by default) - default = [ "--disable-sse3" "--disable-ssse3" "--disable-sse41" "--disable-sse42" "--disable-avx" "--disable-avx2" "--disable-fma" "--disable-fma4" ]; - westmere = [ "--disable-avx" "--disable-avx2" "--disable-fma" "--disable-fma4" ]; - sandybridge = [ "--disable-avx2" "--disable-fma" "--disable-fma4" ]; - ivybridge = [ "--disable-avx2" "--disable-fma" "--disable-fma4" ]; - haswell = [ "--disable-fma4" ]; - broadwell = [ "--disable-fma4" ]; - skylake = [ "--disable-fma4" ]; - skylake-avx512 = [ "--disable-fma4" ]; - }.${stdenv.hostPlatform.platform.gcc.arch or "default"} - ++ stdenv.lib.optionals withSage [ + "--${if stdenv.hostPlatform.sse3Support then "enable" else "disable"}-sse3" + "--${if stdenv.hostPlatform.ssse3Support then "enable" else "disable"}-ssse3" + "--${if stdenv.hostPlatform.sse4_1Support then "enable" else "disable"}-sse41" + "--${if stdenv.hostPlatform.sse4_2Support then "enable" else "disable"}-sse42" + "--${if stdenv.hostPlatform.avxSupport then "enable" else "disable"}-avx" + "--${if stdenv.hostPlatform.avx2Support then "enable" else "disable"}-avx2" + "--${if stdenv.hostPlatform.fmaSupport then "enable" else "disable"}-fma" + "--${if stdenv.hostPlatform.fma4Support then "enable" else "disable"}-fma4" + ] ++ stdenv.lib.optionals withSage [ "--enable-sage" ]; diff --git a/pkgs/development/libraries/qt-5/modules/qtbase.nix b/pkgs/development/libraries/qt-5/modules/qtbase.nix index 4d7507220b5..3cbcaaacefb 100644 --- a/pkgs/development/libraries/qt-5/modules/qtbase.nix +++ b/pkgs/development/libraries/qt-5/modules/qtbase.nix @@ -255,18 +255,18 @@ stdenv.mkDerivation { "-no-warnings-are-errors" ] ++ ( - if (!stdenv.hostPlatform.isx86_64) - then [ "-no-sse2" ] - else lib.optionals (compareVersion "5.9.0" >= 0) { - default = [ "-sse2" "-no-sse3" "-no-ssse3" "-no-sse4.1" "-no-sse4.2" "-no-avx" "-no-avx2" ]; - westmere = [ "-sse2" "-sse3" "-ssse3" "-sse4.1" "-sse4.2" "-no-avx" "-no-avx2" ]; - sandybridge = [ "-sse2" "-sse3" "-ssse3" "-sse4.1" "-sse4.2" "-avx" "-no-avx2" ]; - ivybridge = [ "-sse2" "-sse3" "-ssse3" "-sse4.1" "-sse4.2" "-avx" "-no-avx2" ]; - haswell = [ "-sse2" "-sse3" "-ssse3" "-sse4.1" "-sse4.2" "-avx" "-avx2" ]; - broadwell = [ "-sse2" "-sse3" "-ssse3" "-sse4.1" "-sse4.2" "-avx" "-avx2" ]; - skylake = [ "-sse2" "-sse3" "-ssse3" "-sse4.1" "-sse4.2" "-avx" "-avx2" ]; - skylake-avx512 = [ "-sse2" "-sse3" "-ssse3" "-sse4.1" "-sse4.2" "-avx" "-avx2" ]; - }.${stdenv.hostPlatform.platform.gcc.arch or "default"} + if (!stdenv.hostPlatform.isx86_64) then [ + "-no-sse2" + ] else if (compareVersion "5.9.0" >= 0) then [ + "-sse2" + "${if stdenv.hostPlatform.sse3Support then "" else "-no"}-sse3" + "${if stdenv.hostPlatform.ssse3Support then "" else "-no"}-ssse3" + "${if stdenv.hostPlatform.sse4_1Support then "" else "-no"}-sse4.1" + "${if stdenv.hostPlatform.sse4_2Support then "" else "-no"}-sse4.2" + "${if stdenv.hostPlatform.avxSupport then "" else "-no"}-avx" + "${if stdenv.hostPlatform.avx2Support then "" else "-no"}-avx2" + ] else [ + ] ) ++ [ "-no-mips_dsp" diff --git a/pkgs/development/python-modules/dlib/default.nix b/pkgs/development/python-modules/dlib/default.nix index a57d8307551..027500ff2ab 100644 --- a/pkgs/development/python-modules/dlib/default.nix +++ b/pkgs/development/python-modules/dlib/default.nix @@ -1,4 +1,6 @@ -{ buildPythonPackage, dlib, python, pytest, more-itertools, avxSupport ? true, lib }: +{ buildPythonPackage, stdenv, lib, dlib, python, pytest, more-itertools +, avxSupport ? stdenv.hostPlatform.avxSupport +}: buildPythonPackage { inherit (dlib) name src nativeBuildInputs buildInputs meta; diff --git a/pkgs/development/python-modules/tensorflow/1/default.nix b/pkgs/development/python-modules/tensorflow/1/default.nix index 4dc5c57070d..5f65004b3d6 100644 --- a/pkgs/development/python-modules/tensorflow/1/default.nix +++ b/pkgs/development/python-modules/tensorflow/1/default.nix @@ -23,9 +23,9 @@ , xlaSupport ? cudaSupport # Default from ./configure script , cudaCapabilities ? [ "3.5" "5.2" ] -, sse42Support ? builtins.elem (stdenv.hostPlatform.platform.gcc.arch or "default") ["westmere" "sandybridge" "ivybridge" "haswell" "broadwell" "skylake" "skylake-avx512"] -, avx2Support ? builtins.elem (stdenv.hostPlatform.platform.gcc.arch or "default") [ "haswell" "broadwell" "skylake" "skylake-avx512"] -, fmaSupport ? builtins.elem (stdenv.hostPlatform.platform.gcc.arch or "default") [ "haswell" "broadwell" "skylake" "skylake-avx512"] +, sse42Support ? stdenv.hostPlatform.sse4_2Support +, avx2Support ? stdenv.hostPlatform.avx2Support +, fmaSupport ? stdenv.hostPlatform.fmaSupport # Darwin deps , Foundation, Security }: diff --git a/pkgs/development/python-modules/tensorflow/2/default.nix b/pkgs/development/python-modules/tensorflow/2/default.nix index 4dd378d1410..eedd6e6d0df 100644 --- a/pkgs/development/python-modules/tensorflow/2/default.nix +++ b/pkgs/development/python-modules/tensorflow/2/default.nix @@ -23,9 +23,9 @@ , xlaSupport ? cudaSupport # Default from ./configure script , cudaCapabilities ? [ "3.5" "5.2" ] -, sse42Support ? builtins.elem (stdenv.hostPlatform.platform.gcc.arch or "default") ["westmere" "sandybridge" "ivybridge" "haswell" "broadwell" "skylake" "skylake-avx512"] -, avx2Support ? builtins.elem (stdenv.hostPlatform.platform.gcc.arch or "default") [ "haswell" "broadwell" "skylake" "skylake-avx512"] -, fmaSupport ? builtins.elem (stdenv.hostPlatform.platform.gcc.arch or "default") [ "haswell" "broadwell" "skylake" "skylake-avx512"] +, sse42Support ? stdenv.hostPlatform.sse4_2Support +, avx2Support ? stdenv.hostPlatform.avx2Support +, fmaSupport ? stdenv.hostPlatform.fmaSupport # Darwin deps , Foundation, Security }: diff --git a/pkgs/servers/nosql/arangodb/default.nix b/pkgs/servers/nosql/arangodb/default.nix index 54d5e8484bc..4d5c24c7304 100644 --- a/pkgs/servers/nosql/arangodb/default.nix +++ b/pkgs/servers/nosql/arangodb/default.nix @@ -32,15 +32,9 @@ let # do not set GCC's -march=xxx based on builder's /proc/cpuinfo "-DUSE_OPTIMIZE_FOR_ARCHITECTURE=OFF" # also avoid using builder's /proc/cpuinfo - ] ++ - { westmere = [ "-DHAVE_SSE42=ON" "-DASM_OPTIMIZATIONS=ON" ]; - sandybridge = [ "-DHAVE_SSE42=ON" "-DASM_OPTIMIZATIONS=ON" ]; - ivybridge = [ "-DHAVE_SSE42=ON" "-DASM_OPTIMIZATIONS=ON" ]; - haswell = [ "-DHAVE_SSE42=ON" "-DASM_OPTIMIZATIONS=ON" ]; - broadwell = [ "-DHAVE_SSE42=ON" "-DASM_OPTIMIZATIONS=ON" ]; - skylake = [ "-DHAVE_SSE42=ON" "-DASM_OPTIMIZATIONS=ON" ]; - skylake-avx512 = [ "-DHAVE_SSE42=ON" "-DASM_OPTIMIZATIONS=ON" ]; - }.${stdenv.hostPlatform.platform.gcc.arch or ""} or [ "-DHAVE_SSE42=OFF" "-DASM_OPTIMIZATIONS=OFF" ]; + "-DHAVE_SSE42=${if stdenv.hostPlatform.sse4_2Support then "ON" else "OFF"}" + "-DASM_OPTIMIZATIONS=${if stdenv.hostPlatform.sse4_2Support then "ON" else "OFF"}" + ]; enableParallelBuilding = true; diff --git a/pkgs/tools/misc/cpuminer-multi/default.nix b/pkgs/tools/misc/cpuminer-multi/default.nix index 65482fabb11..dba42e4bfea 100644 --- a/pkgs/tools/misc/cpuminer-multi/default.nix +++ b/pkgs/tools/misc/cpuminer-multi/default.nix @@ -1,5 +1,5 @@ { stdenv, fetchgit, curl, jansson, autoconf, automake -, aesni ? true }: +, aesni ? stdenv.hostPlatform.aesSupport }: let rev = "8393e03089c0abde61bd5d72aba8f926c3d6eca4"; @@ -28,6 +28,6 @@ stdenv.mkDerivation { license = licenses.gpl2; maintainers = [ maintainers.ehmry ]; # does not build on i686 https://github.com/lucasjones/cpuminer-multi/issues/27 - platforms = [ "x86_64-linux" ]; + platforms = [ "x86_64-linux" ]; }; } diff --git a/pkgs/tools/networking/i2pd/default.nix b/pkgs/tools/networking/i2pd/default.nix index b686ea4d04f..5f9f3ceef07 100644 --- a/pkgs/tools/networking/i2pd/default.nix +++ b/pkgs/tools/networking/i2pd/default.nix @@ -1,8 +1,8 @@ { stdenv, fetchFromGitHub , boost, zlib, openssl , upnpSupport ? true, miniupnpc ? null -, aesniSupport ? false -, avxSupport ? false +, aesniSupport ? stdenv.hostPlatform.aesSupport +, avxSupport ? stdenv.hostPlatform.avxSupport }: assert upnpSupport -> miniupnpc != null;