From 54f591cce5cfc0760a4ab1274ad71430d3798b92 Mon Sep 17 00:00:00 2001 From: AMD Toolchain Support <73240730+amd-toolchain-support@users.noreply.github.com> Date: Fri, 7 Feb 2025 03:44:44 +0530 Subject: [PATCH] amdfftw: fix broken build, adjust flags for performance tuning (#48754) With CFLAGS, the code path in the amdfftw build system will bypass the logic around AMD_ARCH. --------- Co-authored-by: vijay kallesh --- .../repos/builtin/packages/amdfftw/package.py | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/var/spack/repos/builtin/packages/amdfftw/package.py b/var/spack/repos/builtin/packages/amdfftw/package.py index 9e4cd107c8f..39b6b479889 100644 --- a/var/spack/repos/builtin/packages/amdfftw/package.py +++ b/var/spack/repos/builtin/packages/amdfftw/package.py @@ -4,7 +4,6 @@ import os -from spack.build_environment import optimization_flags from spack.package import * from spack.pkg.builtin.fftw import FftwBase @@ -95,14 +94,14 @@ class Amdfftw(FftwBase): ) variant( "amd-dynamic-dispatcher", - default=True, + default=False, when="@4.1: %aocc@4.1.0:", description="Single portable optimized library" " to execute on different x86 CPU architectures", ) variant( "amd-dynamic-dispatcher", - default=True, + default=False, when="@3.2: %gcc", description="Single portable optimized library" " to execute on different x86 CPU architectures", @@ -203,11 +202,10 @@ def configure(self, spec, prefix): if not self.compiler.f77 or not self.compiler.fc: options.append("--disable-fortran") - # Cross compilation is supported in amd-fftw by making use of target - # variable to set AMD_ARCH configure option. - # Spack user can not directly use AMD_ARCH for this purpose but should - # use target variable to set appropriate -march option in AMD_ARCH. - options.append(f"AMD_ARCH={optimization_flags(self.compiler, spec.target)}") + if "avx512" in spec.target: + options.append("CFLAGS=-mprefer-vector-width=512") + else: + options.append("CFLAGS=-mprefer-vector-width=256") # Specific SIMD support. # float and double precisions are supported