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 <Vijay-teekinavar.Kallesh@amd.com>
This commit is contained in:
AMD Toolchain Support 2025-02-07 03:44:44 +05:30 committed by GitHub
parent 8677bb4d43
commit 54f591cce5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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