Skip to content

Commit ca2960d

Browse files
Merge pull request #2184 from devitocodes/intel_compiler
compiler: Enable AVX512 compiler support when available.
2 parents 77d4e82 + c0d920a commit ca2960d

2 files changed

Lines changed: 16 additions & 10 deletions

File tree

‎devito/arch/archinfo.py‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
'Device', 'NvidiaDevice', 'AmdDevice', 'IntelDevice',
2121
# Intel
2222
'INTEL64', 'SNB', 'IVB', 'HSW', 'BDW', 'KNL', 'KNL7210',
23-
'SKX', 'KLX', 'CLX', 'CLK',
23+
'SKX', 'KLX', 'CLX', 'CLK', 'SPR',
2424
# ARM
2525
'AMD', 'ARM', 'M1', 'GRAVITON',
2626
# Other loosely supported CPU architectures
@@ -616,7 +616,7 @@ class IntelSkylake(Intel64):
616616
pass
617617

618618

619-
class IntelGoldenCode(Intel64):
619+
class IntelGoldenCove(Intel64):
620620
pass
621621

622622

@@ -744,6 +744,7 @@ def march(cls):
744744
KLX = IntelSkylake('klx')
745745
CLX = IntelSkylake('clx')
746746
CLK = IntelSkylake('clk')
747+
SPR = IntelGoldenCove('spr')
747748

748749
ARM = Arm('arm')
749750
GRAVITON = Arm('graviton')
@@ -771,6 +772,7 @@ def march(cls):
771772
'klx': KLX, # Kaby Lake
772773
'clx': CLX, # Coffee Lake
773774
'clk': CLK, # Cascade Lake
775+
'spr': SPR, # Sapphire Rapids
774776
'knl': KNL,
775777
'knl7210': KNL7210,
776778
'arm': ARM, # Generic ARM CPU

‎devito/arch/compiler.py‎

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
from codepy.toolchain import GCCToolchain, call_capture_output
1414

1515
from devito.arch import (AMDGPUX, Cpu64, M1, NVIDIAX, POWER8, POWER9, GRAVITON,
16-
INTELGPUX, IntelSkylake, get_nvidia_cc, check_cuda_runtime,
16+
INTELGPUX, get_nvidia_cc, check_cuda_runtime,
1717
get_m1_llvm_path)
1818
from devito.exceptions import CompilationError
1919
from devito.logger import debug, warning, error
@@ -394,11 +394,15 @@ def __init__(self, *args, **kwargs):
394394
else:
395395
self.cflags.append('-ffast-math')
396396

397-
if isinstance(platform, IntelSkylake):
398-
# The default is `=256` because avx512 slows down the CPU frequency;
399-
# however, we empirically found that stencils generally benefit
400-
# from `=512`
401-
self.cflags.append('-mprefer-vector-width=512')
397+
if platform.isa == 'avx512':
398+
if self.version >= Version("8.0.0"):
399+
# The default is `=256` because avx512 slows down the CPU frequency;
400+
# however, we empirically found that stencils generally benefit
401+
# from `=512`
402+
self.cflags.append('-mprefer-vector-width=512')
403+
else:
404+
# Unsupported on earlier versions
405+
pass
402406

403407
if platform in [POWER8, POWER9]:
404408
# -march isn't supported on power architectures, is -mtune needed?
@@ -708,8 +712,8 @@ def __init__(self, *args, **kwargs):
708712
else:
709713
self.cflags.append('-fp-model=fast')
710714

711-
if isinstance(platform, IntelSkylake):
712-
# Systematically use 512-bit vectors on skylake
715+
if platform.isa == 'avx512':
716+
# Systematically use 512-bit vectors if avx512 is available.
713717
self.cflags.append("-qopt-zmm-usage=high")
714718

715719
if language == 'openmp':

0 commit comments

Comments
 (0)