Skip to content

Commit

Permalink
Merge pull request #2239 from vneiger/config_meteorlake
Browse files Browse the repository at this point in the history
Configure and flint-mparam for some recent Intel processors
  • Loading branch information
vneiger authored Feb 6, 2025
2 parents 2ddde79 + 89a19b6 commit e7aa8f5
Show file tree
Hide file tree
Showing 9 changed files with 140 additions and 23 deletions.
6 changes: 3 additions & 3 deletions acinclude.m4
Original file line number Diff line number Diff line change
Expand Up @@ -113,16 +113,16 @@ define(X86_PATTERN,
[[i?86*-*-* | k[5-8]*-*-* | pentium*-*-* | athlon-*-* | viac3*-*-* | geode*-*-* | atom-*-*]])

define(X86_64_PATTERN,
[[athlon64-*-* | k8-*-* | k10-*-* | bobcat-*-* | jaguar*-*-* | bulldozer*-*-* | piledriver*-*-* | steamroller*-*-* | excavator*-*-* | zen*-*-* | pentium4-*-* | atom-*-* | silvermont-*-* | goldmont-*-* | tremont-*-* | core2-*-* | corei*-*-* | x86_64-*-* | nano-*-* | nehalem*-*-* | westmere*-*-* | sandybridge*-*-* | ivybridge*-*-* | haswell*-*-* | broadwell*-*-* | skylake*-*-* | kabylake*-*-* | icelake*-*-* | tigerlake*-*-* | rocketlake*-*-* | alderlake*-*-* | raptorlake*-*-* | x86_64v[1234]-*-*]])
[[athlon64-*-* | k8-*-* | k10-*-* | bobcat-*-* | jaguar*-*-* | bulldozer*-*-* | piledriver*-*-* | steamroller*-*-* | excavator*-*-* | zen*-*-* | pentium4-*-* | atom-*-* | silvermont-*-* | goldmont-*-* | tremont-*-* | core2-*-* | corei*-*-* | x86_64-*-* | nano-*-* | nehalem*-*-* | westmere*-*-* | sandybridge*-*-* | ivybridge*-*-* | haswell*-*-* | broadwell*-*-* | skylake*-*-* | kabylake*-*-* | cometlake*-*-* | icelake*-*-* | tigerlake*-*-* | rocketlake*-*-* | alderlake*-*-* | raptorlake*-*-* | meteorlake*-*-* | x86_64v[1234]-*-*]])

define(X86_64_ADX_PATTERN,
[[zen[1234]-*-* | coreibwl-*-* | broadwell-*-* | skylake-*-* | skylake_server-*-* | cannonlake-*-* | kabylake-*-* | icelake-*-* | icelake_server-*-* | rocketlake-*-* | tigerlake-*-* | alderlake-*-* | raptorlake-*-* | knightslanding-*-* | sapphirerapids-*-* | cometlake-*-*]])
[[zen[1234]-*-* | coreibwl-*-* | broadwell-*-* | skylake-*-* | skylake_server-*-* | cannonlake-*-* | kabylake-*-* | cometlake-*-* | icelake-*-* | icelake_server-*-* | rocketlake-*-* | tigerlake-*-* | alderlake-*-* | raptorlake-*-* | meteorlake-*-* | knightslanding-*-* | sapphirerapids-*-*]])

define(ARM64_PATTERN,
[[armcortexa53-*-* | armcortexa53neon-*-* | armcortexa55-*-* | armcortexa55neon-*-* | armcortexa57-*-* | armcortexa57neon-*-* | armcortexa7[2-9]-*-* | armcortexa7[2-9]neon-*-* | armexynosm1-*-* | armthunderx-*-* | armxgene1-*-* | aarch64*-*-* | applem[1-9]*-*-* | armv8*-*-*]])

define(SLOW_VROUNDPD_PATTERN,
[[haswell* | broadwell* | skylake* | kabylake* | icelake* | tigerlake* | rocketlake* | alderlake* | raptorlake*]])
[[haswell* | broadwell* | skylake* | kabylake* | icelake* | tigerlake* | rocketlake* | alderlake* | raptorlake* | meteorlake*]])

define(FAST_VROUNDPD_PATTERN,
[[znver[2-4]* | sandybridge* | ivybridge*]])
Expand Down
1 change: 1 addition & 0 deletions config/config.guess
Original file line number Diff line number Diff line change
Expand Up @@ -955,6 +955,7 @@ main ()
else if (model == 0xa7) cpu_64bit = 1, cpu_avx=1, modelstr = "rocketlake"; /* Rocket Lake S */
else if (model == 0xba) cpu_64bit = 1, cpu_avx=1, modelstr = "raptorlake"; /* Raptor Lake */
else if (model == 0xb7) cpu_64bit = 1, cpu_avx=1, modelstr = "raptorlake"; /* Raptor Lake */
else if (model == 0xaa) cpu_64bit = 1, cpu_avx=1, modelstr = "meteorlake"; /* Meteor Lake H, U */
else cpu_64bit = 1, modelstr = "nehalem"; /* default */
if (strcmp (modelstr, "haswell") == 0 ||
Expand Down
2 changes: 1 addition & 1 deletion config/config.sub
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ itanium | itanium2)
test_cpu=ia64 ;;
pentium | pentiummmx | pentiumpro | pentium[234m] | k[567] | k6[23] | geode | athlon | viac3*)
test_cpu=i386 ;;
athlon64 | atom | silvermont | goldmont | tremont | core2 | corei* | opteron | k[89] | k10 | bobcat | jaguar* | bulldozer* | piledriver* | steamroller* | excavator* | zen[1234] | nano | nehalem | westmere | sandybridge | ivybridge | haswell | broadwell | skylake | skylake_server | cannonlake | kabylake | icelake | icelake_server | rocketlake | tigerlake | alderlake | raptorlake | knightslanding | sapphirerapids | cometlake | x86_64v[1234])
athlon64 | atom | silvermont | goldmont | tremont | core2 | corei* | opteron | k[89] | k10 | bobcat | jaguar* | bulldozer* | piledriver* | steamroller* | excavator* | zen[1234] | nano | nehalem | westmere | sandybridge | ivybridge | haswell | broadwell | skylake | skylake_server | cannonlake | kabylake | icelake | icelake_server | rocketlake | tigerlake | alderlake | raptorlake | meteorlake | knightslanding | sapphirerapids | cometlake | x86_64v[1234])
test_cpu=x86_64 ;;
power[2-9] | power1[0-9] | power2sc)
test_cpu=power ;;
Expand Down
38 changes: 21 additions & 17 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -698,15 +698,23 @@ Please report at <https://github.com/flintlib/flint/issues/>])
param_path="x86_64/skylake"
have_avx512="yes"
;;
cannonlake)
gcc_cflags_arch="-march=cannonlake"
kabylake)
gcc_cflags_arch="-march=skylake"
param_path="x86_64/skylake"
have_avx512="yes"
;;
kabylake)
cometlake)
gcc_cflags_arch="-march=skylake"
param_path="x86_64/skylake"
;;
knightslanding)
gcc_cflags_arch="-march=knl"
param_path="x86_64/skylake"
;;
cannonlake)
gcc_cflags_arch="-march=cannonlake"
param_path="x86_64/icelake" # fallback, to be refined
have_avx512="yes"
;;
icelake)
gcc_cflags_arch="-march=icelake-client"
param_path="x86_64/icelake"
Expand All @@ -719,35 +727,31 @@ Please report at <https://github.com/flintlib/flint/issues/>])
;;
rocketlake)
gcc_cflags_arch="-march=rocketlake"
param_path="x86_64/skylake"
param_path="x86_64/icelake" # fallback, to be refined
have_avx512="yes"
;;
tigerlake)
gcc_cflags_arch="-march=tigerlake"
param_path="x86_64/skylake"
param_path="x86_64/tigerlake"
have_avx512="yes"
;;
alderlake)
gcc_cflags_arch="-march=alderlake"
param_path="x86_64/skylake"
param_path="x86_64/icelake" # fallback, to be refined
;;
raptorlake)
gcc_cflags_arch="-march=alderlake"
param_path="x86_64/skylake"
gcc_cflags_arch="-march=raptorlake -march=alderlake"
param_path="x86_64/raptorlake"
;;
knightslanding)
gcc_cflags_arch="-march=knl"
param_path="x86_64/skylake"
meteorlake)
gcc_cflags_arch="-march=meteorlake -march=alderlake"
param_path="x86_64/meteorlake"
;;
sapphirerapids)
gcc_cflags_arch="-march=sapphirerapids"
param_path="x86_64/skylake"
param_path="x86_64/icelake" # fallback, to be refined
have_avx512="yes"
;;
cometlake)
gcc_cflags_arch="-march=skylake"
param_path="x86_64/skylake"
;;
*)
AC_MSG_ERROR([Error in deciding flags for $host.
Please report at <https://github.com/flintlib/flint/issues/>])
Expand Down
1 change: 0 additions & 1 deletion src/mpn_extras/x86_64/broadwell/flint-mparam.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
#define FFT_N_NUM 23
#define FFT_MULMOD_2EXPP1_CUTOFF 128

/* TODO: check this tuning */
#define FLINT_PREINVERT_LIMB_USE_NATIVE 0

#define FLINT_MULMOD_SHOUP_THRESHOLD 14
Expand Down
38 changes: 38 additions & 0 deletions src/mpn_extras/x86_64/meteorlake/flint-mparam.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/*
Copyright (C) 2025 Vincent Neiger
This file is part of FLINT.
FLINT is free software: you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License (LGPL) as published
by the Free Software Foundation; either version 3 of the License, or
(at your option) any later version. See <https://www.gnu.org/licenses/>.
*/

/* parameters found for Intel(R) Core(TM) Ultra 7 165H */

#ifndef FLINT_MPARAM_H
#define FLINT_MPARAM_H

/* TODO these were taken directly from skylake flint-mparam.h ----> */
#define FLINT_FFT_SMALL_MUL_THRESHOLD 1540
#define FLINT_FFT_SMALL_SQR_THRESHOLD 3080

#define FLINT_FFT_MUL_THRESHOLD 32000
#define FLINT_FFT_SQR_THRESHOLD 32000
/* <---- these were taken directly from skylake flint-mparam.h */

#define FFT_TAB \
{ { 4, 4 }, { 4, 3 }, { 3, 2 }, { 2, 2 }, { 2, 1 } }

#define MULMOD_TAB \
{ 4, 4, 4, 4, 4, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 1, 1 }

#define FFT_N_NUM 19
#define FFT_MULMOD_2EXPP1_CUTOFF 128

#define FLINT_PREINVERT_LIMB_USE_NATIVE 1

#define FLINT_MULMOD_SHOUP_THRESHOLD 0

#endif
38 changes: 38 additions & 0 deletions src/mpn_extras/x86_64/raptorlake/flint-mparam.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/*
Copyright (C) 2025 Vincent Neiger
This file is part of FLINT.
FLINT is free software: you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License (LGPL) as published
by the Free Software Foundation; either version 3 of the License, or
(at your option) any later version. See <https://www.gnu.org/licenses/>.
*/

/* parameters found for Intel(R) Core(TM) i5-1335U */

#ifndef FLINT_MPARAM_H
#define FLINT_MPARAM_H

/* TODO these were taken directly from skylake flint-mparam.h ----> */
#define FLINT_FFT_SMALL_MUL_THRESHOLD 1540
#define FLINT_FFT_SMALL_SQR_THRESHOLD 3080

#define FLINT_FFT_MUL_THRESHOLD 32000
#define FLINT_FFT_SQR_THRESHOLD 32000
/* <---- these were taken directly from skylake flint-mparam.h */

#define FFT_TAB \
{ { 4, 4 }, { 4, 3 }, { 3, 2 }, { 2, 2 }, { 1, 1 } }

#define MULMOD_TAB \
{ 4, 4, 4, 4, 4, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 1, 1 }

#define FFT_N_NUM 19
#define FFT_MULMOD_2EXPP1_CUTOFF 128

#define FLINT_PREINVERT_LIMB_USE_NATIVE 1

#define FLINT_MULMOD_SHOUP_THRESHOLD 0

#endif
1 change: 0 additions & 1 deletion src/mpn_extras/x86_64/skylake/flint-mparam.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
#define FFT_N_NUM 19
#define FFT_MULMOD_2EXPP1_CUTOFF 128

/* TODO: check this tuning */
#define FLINT_PREINVERT_LIMB_USE_NATIVE 0

/* verified on Xeon(R) Gold 6244 (cascade lake) */
Expand Down
38 changes: 38 additions & 0 deletions src/mpn_extras/x86_64/tigerlake/flint-mparam.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/*
Copyright (C) 2025 Vincent Neiger
This file is part of FLINT.
FLINT is free software: you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License (LGPL) as published
by the Free Software Foundation; either version 3 of the License, or
(at your option) any later version. See <https://www.gnu.org/licenses/>.
*/

/* parameters found for Intel(R) Core(TM) i7-1165G7 @ 2.80GHz */

#ifndef FLINT_MPARAM_H
#define FLINT_MPARAM_H

/* TODO these were taken directly from skylake flint-mparam.h ----> */
#define FLINT_FFT_SMALL_MUL_THRESHOLD 1540
#define FLINT_FFT_SMALL_SQR_THRESHOLD 3080

#define FLINT_FFT_MUL_THRESHOLD 32000
#define FLINT_FFT_SQR_THRESHOLD 32000
/* <---- these were taken directly from skylake flint-mparam.h */

#define FFT_TAB \
{ { 4, 4 }, { 4, 3 }, { 3, 2 }, { 2, 1 }, { 1, 1 } }

#define MULMOD_TAB \
{ 4, 4, 4, 4, 4, 3, 3, 3, 3, 2, 3, 3, 3, 2, 2, 1, 1 }

#define FFT_N_NUM 17
#define FFT_MULMOD_2EXPP1_CUTOFF 128

#define FLINT_PREINVERT_LIMB_USE_NATIVE 1

#define FLINT_MULMOD_SHOUP_THRESHOLD 0

#endif

0 comments on commit e7aa8f5

Please sign in to comment.