nsimd: add v2.1 (#21623)

Updated variants and conflicts accordingly
This commit is contained in:
Erik Schnetter 2021-02-11 10:41:46 -05:00 committed by GitHub
parent 3268cf4b96
commit 7f003a77dd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -12,6 +12,9 @@ class Nsimd(CMakePackage):
maintainers = ['eschnett'] maintainers = ['eschnett']
version('2.1', sha256='3274f1061d1fac170130b8c75378a6b94580629b3dc1d53db244b51500ee4695')
# Version 2.0 is disabled since it does not support cmake
# version('2.0', sha256='b239e98316f93257161b25c8232634884edcee358982a74742981cc9b68da642')
version('1.0', sha256='523dae83f1d93eab30114321f1c9a67e2006a52595da4c51f121ca139abe0857') version('1.0', sha256='523dae83f1d93eab30114321f1c9a67e2006a52595da4c51f121ca139abe0857')
variant('simd', variant('simd',
@ -21,17 +24,40 @@ class Nsimd(CMakePackage):
'none', 'none',
'CPU', 'CPU',
'SSE2', 'SSE42', 'AVX', 'AVX2', 'AVX512_KNL', 'AVX512_SKYLAKE', 'SSE2', 'SSE42', 'AVX', 'AVX2', 'AVX512_KNL', 'AVX512_SKYLAKE',
'NEON128', 'AARCH64', 'SVE', 'NEON128', 'AARCH64',
'SVE', 'SVE128', 'SVE256', 'SVE512', 'SVE1024', 'SVE2048',
'CUDA', 'ROCM',
), ),
multi=False) multi=False)
variant('optionals', values=any_combination_of('FMA', 'FP16'), variant('optionals', values=any_combination_of('FMA', 'FP16'),
description='Optional SIMD features',) description='Optional SIMD features',)
conflicts('simd=none', msg="SIMD instruction set not defined") conflicts('simd=none', msg="SIMD instruction set not defined")
conflicts('simd=SVE128', when=('@:1'),
msg="SIMD extension not available in version @:1")
conflicts('simd=SVE256', when=('@:1'),
msg="SIMD extension not available in version @:1")
conflicts('simd=SVE512', when=('@:1'),
msg="SIMD extension not available in version @:1")
conflicts('simd=SVE1024', when=('@:1'),
msg="SIMD extension not available in version @:1")
conflicts('simd=SVE2048', when=('@:1'),
msg="SIMD extension not available in version @:1")
conflicts('simd=CUDA', when=('@:1'),
msg="SIMD extension not available in version @:1")
conflicts('simd=ROCM', when=('@:1'),
msg="SIMD extension not available in version @:1")
conflicts('optionals=FMA', when=('@2:'),
msg="SIMD optionals not available in version @2:")
conflicts('optionals=FP16', when=('@2:'),
msg="SIMD optionals not available in version @2:")
conflicts('optionals=FMA,FP16', when=('@2:'),
msg="SIMD optionals not available in version @2:")
# Requires a C++14 compiler for building. # Requires a C++14 compiler for building.
# The C++ interface requires a C++11 compiler to use. # The C++ interface requires a C++11 compiler to use.
depends_on('cmake@2.8.7:', type='build') depends_on('cmake@2.8.7:', type='build')
depends_on('cmake@3.0.2:', type='build', when='@2:')
depends_on('python@3:', type='build') depends_on('python@3:', type='build')
# Add a 'generate_code' phase in the beginning # Add a 'generate_code' phase in the beginning
@ -39,11 +65,11 @@ class Nsimd(CMakePackage):
def generate_code(self, spec, prefix): def generate_code(self, spec, prefix):
"""Auto-generates code in the build directory""" """Auto-generates code in the build directory"""
if self.spec.satisfies("@:1"):
options = [ options = [
'egg/hatch.py', 'egg/hatch.py',
'--all', '--all',
'--force', '--force',
'--disable-clang-format',
] ]
python = spec['python'].command python = spec['python'].command
python(*options) python(*options)
@ -51,8 +77,12 @@ def generate_code(self, spec, prefix):
def cmake_args(self): def cmake_args(self):
# Required SIMD argument # Required SIMD argument
simd = self.spec.variants['simd'].value simd = self.spec.variants['simd'].value
if self.spec.satisfies("@:1"):
cmake_args = ["-DSIMD={0}".format(simd)] cmake_args = ["-DSIMD={0}".format(simd)]
else:
cmake_args = ["-Dsimd={0}".format(simd)]
if self.spec.satisfies("@:1"):
# Optional SIMD instructions to be turned on explicitly # Optional SIMD instructions to be turned on explicitly
optionals_value = self.spec.variants['optionals'].value optionals_value = self.spec.variants['optionals'].value
if optionals_value != 'none': if optionals_value != 'none':