platform.gcc.arch: support for AMD CPUs
This commit is contained in:
parent
bf9d9cef58
commit
463db72e63
11 changed files with 62 additions and 18 deletions
|
@ -63,18 +63,24 @@ 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";
|
||||
}.${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";
|
||||
}.${arch} or true
|
||||
else
|
||||
false;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{ stdenv, fetchFromGitHub, readline, libedit, bc
|
||||
, avxSupport ? false
|
||||
, avxSupport ? builtins.elem (stdenv.hostPlatform.platform.gcc.arch or "default") [ "sandybridge" "ivybridge" "haswell" "broadwell" "skylake" "skylake-avx512" "btver2" "bdver1" "bdver2" "bdver3" "bdver4" "znver1"]
|
||||
}:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
, guiSupport ? false, libX11
|
||||
|
||||
# see http://dlib.net/compile.html
|
||||
, avxSupport ? true
|
||||
, avxSupport ? builtins.elem (stdenv.hostPlatform.platform.gcc.arch or "default") [ "sandybridge" "ivybridge" "haswell" "broadwell" "skylake" "skylake-avx512" "btver2" "bdver1" "bdver2" "bdver3" "bdver4" "znver1"]
|
||||
, 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"}" ];
|
||||
|
||||
|
|
|
@ -35,13 +35,22 @@ stdenv.mkDerivation rec {
|
|||
# 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" ];
|
||||
# Intel
|
||||
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" ];
|
||||
haswell = [ "--disable-fma4" ];
|
||||
broadwell = [ "--disable-fma4" ];
|
||||
skylake = [ "--disable-fma4" ];
|
||||
skylake-avx512 = [ "--disable-fma4" ];
|
||||
# AMD
|
||||
btver1 = [ "--disable-avx" "--disable-avx2" "--disable-avx512f" "--disable-avx512dq" "--disable-avx512vl" "--disable-fma" "--disable-fma4" ];
|
||||
btver2 = [ "--disable-avx2" "--disable-fma" "--disable-fma4" ];
|
||||
bdver1 = [ "--disable-avx2" "--disable-avx512f" "--disable-avx512dq" "--disable-avx512vl" ];
|
||||
bdver2 = [ "--disable-avx2" "--disable-avx512f" "--disable-avx512dq" "--disable-avx512vl" ];
|
||||
bdver3 = [ "--disable-avx2" "--disable-avx512f" "--disable-avx512dq" "--disable-avx512vl" ];
|
||||
bdver4 = [ ];
|
||||
znver1 = [ "--disable-fma4" ];
|
||||
}.${stdenv.hostPlatform.platform.gcc.arch or "default"};
|
||||
|
||||
doCheck = true;
|
||||
|
|
|
@ -20,6 +20,7 @@ stdenv.mkDerivation rec {
|
|||
] ++ 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" ];
|
||||
# Intel
|
||||
westmere = [ "--disable-avx" "--disable-avx2" "--disable-fma" "--disable-fma4" ];
|
||||
sandybridge = [ "--disable-avx2" "--disable-fma" "--disable-fma4" ];
|
||||
ivybridge = [ "--disable-avx2" "--disable-fma" "--disable-fma4" ];
|
||||
|
@ -27,6 +28,14 @@ stdenv.mkDerivation rec {
|
|||
broadwell = [ "--disable-fma4" ];
|
||||
skylake = [ "--disable-fma4" ];
|
||||
skylake-avx512 = [ "--disable-fma4" ];
|
||||
# AMD
|
||||
btver1 = [ "--disable-avx" "--disable-avx2" "--disable-fma" "--disable-fma4" ];
|
||||
btver2 = [ "--disable-avx2" "--disable-fma" "--disable-fma4" ];
|
||||
bdver1 = [ "--disable-avx2" ];
|
||||
bdver2 = [ "--disable-avx2" ];
|
||||
bdver3 = [ "--disable-avx2" ];
|
||||
bdver4 = [ ];
|
||||
znver1 = [ "--disable-fma4" ];
|
||||
}.${stdenv.hostPlatform.platform.gcc.arch or "default"};
|
||||
|
||||
# On darwin, tests are linked to dylib in the nix store, so we need to make
|
||||
|
|
|
@ -42,6 +42,7 @@ stdenv.mkDerivation rec {
|
|||
] ++ 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" ];
|
||||
# Intel
|
||||
westmere = [ "--disable-avx" "--disable-avx2" "--disable-fma" "--disable-fma4" ];
|
||||
sandybridge = [ "--disable-avx2" "--disable-fma" "--disable-fma4" ];
|
||||
ivybridge = [ "--disable-avx2" "--disable-fma" "--disable-fma4" ];
|
||||
|
@ -49,6 +50,14 @@ stdenv.mkDerivation rec {
|
|||
broadwell = [ "--disable-fma4" ];
|
||||
skylake = [ "--disable-fma4" ];
|
||||
skylake-avx512 = [ "--disable-fma4" ];
|
||||
# AMD
|
||||
btver1 = [ "--disable-avx" "--disable-avx2" "--disable-fma" "--disable-fma4" ];
|
||||
btver2 = [ "--disable-avx2" "--disable-fma" "--disable-fma4" ];
|
||||
bdver1 = [ "--disable-avx2" ];
|
||||
bdver2 = [ "--disable-avx2" ];
|
||||
bdver3 = [ "--disable-avx2" ];
|
||||
bdver4 = [ ];
|
||||
znver1 = [ "--disable-fma4" ];
|
||||
}.${stdenv.hostPlatform.platform.gcc.arch or "default"}
|
||||
++ stdenv.lib.optionals withSage [
|
||||
"--enable-sage"
|
||||
|
|
|
@ -259,6 +259,7 @@ stdenv.mkDerivation {
|
|||
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" ];
|
||||
# Intel
|
||||
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" ];
|
||||
|
@ -266,6 +267,14 @@ stdenv.mkDerivation {
|
|||
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" ];
|
||||
# AMD
|
||||
btver1 = [ "-sse2" "-sse3" "-ssse3" "-sse4.1" "-sse4.2" "-no-avx" "-no-avx2" ];
|
||||
btver2 = [ "-sse2" "-sse3" "-ssse3" "-sse4.1" "-sse4.2" "-avx" "-no-avx2" ];
|
||||
bdver1 = [ "-sse2" "-sse3" "-ssse3" "-sse4.1" "-sse4.2" "-avx" "-no-avx2" ];
|
||||
bdver2 = [ "-sse2" "-sse3" "-ssse3" "-sse4.1" "-sse4.2" "-avx" "-no-avx2" ];
|
||||
bdver3 = [ "-sse2" "-sse3" "-ssse3" "-sse4.1" "-sse4.2" "-avx" "-no-avx2" ];
|
||||
bdver4 = [ "-sse2" "-sse3" "-ssse3" "-sse4.1" "-sse4.2" "-avx" "-avx2" ];
|
||||
znver1 = [ "-sse2" "-sse3" "-ssse3" "-sse4.1" "-sse4.2" "-avx" "-avx2" ];
|
||||
}.${stdenv.hostPlatform.platform.gcc.arch or "default"}
|
||||
)
|
||||
++ [
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
{ buildPythonPackage, dlib, python, pytest, more-itertools, avxSupport ? true, lib }:
|
||||
{ buildPythonPackage, lib, dlib, python, pytest, more-itertools,
|
||||
avxSupport ? builtins.elem (stdenv.hostPlatform.platform.gcc.arch or "default") [ "sandybridge" "ivybridge" "haswell" "broadwell" "skylake" "skylake-avx512" "btver2" "bdver1" "bdver2" "bdver3" "bdver4" "znver1"]
|
||||
}:
|
||||
|
||||
buildPythonPackage {
|
||||
inherit (dlib) name src nativeBuildInputs buildInputs meta;
|
||||
|
|
|
@ -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 ? builtins.elem (stdenv.hostPlatform.platform.gcc.arch or "default") ["westmere" "sandybridge" "ivybridge" "haswell" "broadwell" "skylake" "skylake-avx512" "btver2" "bdver1" "bdver2" "bdver3" "bdver4" "znver1"]
|
||||
, avx2Support ? builtins.elem (stdenv.hostPlatform.platform.gcc.arch or "default") [ "haswell" "broadwell" "skylake" "skylake-avx512" "bdver4" "znver1"]
|
||||
, fmaSupport ? builtins.elem (stdenv.hostPlatform.platform.gcc.arch or "default") [ "haswell" "broadwell" "skylake" "skylake-avx512" "bdver2" "bdver3" "bdver4" "znver1"]
|
||||
# Darwin deps
|
||||
, Foundation, Security
|
||||
}:
|
||||
|
|
|
@ -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 ? builtins.elem (stdenv.hostPlatform.platform.gcc.arch or "default") ["westmere" "sandybridge" "ivybridge" "haswell" "broadwell" "skylake" "skylake-avx512" "btver2" "bdver1" "bdver2" "bdver3" "bdver4" "znver1"]
|
||||
, avx2Support ? builtins.elem (stdenv.hostPlatform.platform.gcc.arch or "default") [ "haswell" "broadwell" "skylake" "skylake-avx512" "bdver4" "znver1"]
|
||||
, fmaSupport ? builtins.elem (stdenv.hostPlatform.platform.gcc.arch or "default") [ "haswell" "broadwell" "skylake" "skylake-avx512" "bdver2" "bdver3" "bdver4" "znver1"]
|
||||
# Darwin deps
|
||||
, Foundation, Security
|
||||
}:
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
{ stdenv, fetchFromGitHub
|
||||
, boost, zlib, openssl
|
||||
, upnpSupport ? true, miniupnpc ? null
|
||||
, aesniSupport ? false
|
||||
, avxSupport ? false
|
||||
, aesniSupport ? builtins.elem (stdenv.hostPlatform.platform.gcc.arch or "default") [ "sandybridge" "ivybridge" "haswell" "broadwell" "skylake" "skylake-avx512" "btver2" "bdver1" "bdver2" "bdver3" "bdver4" "znver1"]
|
||||
, avxSupport ? builtins.elem (stdenv.hostPlatform.platform.gcc.arch or "default") [ "sandybridge" "ivybridge" "haswell" "broadwell" "skylake" "skylake-avx512" "btver2" "bdver1" "bdver2" "bdver3" "bdver4" "znver1"]
|
||||
}:
|
||||
|
||||
assert upnpSupport -> miniupnpc != null;
|
||||
|
|
Loading…
Reference in a new issue