summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAMD Toolchain Support <73240730+amd-toolchain-support@users.noreply.github.com>2021-03-17 20:36:25 +0530
committerGitHub <noreply@github.com>2021-03-17 15:06:25 +0000
commite6c8fa131109d52ea4c7f06b11344b0e93b49a77 (patch)
treeef49cbc69d68066b69f71ecea617a29a9edbda82 /lib
parent43dd7b84c032db10c0c21f292e89cd9cd7bf2d26 (diff)
downloadspack-e6c8fa131109d52ea4c7f06b11344b0e93b49a77.tar.gz
spack-e6c8fa131109d52ea4c7f06b11344b0e93b49a77.tar.bz2
spack-e6c8fa131109d52ea4c7f06b11344b0e93b49a77.tar.xz
spack-e6c8fa131109d52ea4c7f06b11344b0e93b49a77.zip
aocc: add support for v3.0 compilers (#22219)
A mitigation of a known issue that affects v3.0 is added, see https://developer.amd.com/wp-content/resources/AOCC-3.0-Install-Guide.pdf
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/compilers/aocc.py20
-rw-r--r--lib/spack/spack/test/compilers/basics.py4
-rw-r--r--lib/spack/spack/test/compilers/detection.py5
3 files changed, 29 insertions, 0 deletions
diff --git a/lib/spack/spack/compilers/aocc.py b/lib/spack/spack/compilers/aocc.py
index 725767b212..f16d9c285c 100644
--- a/lib/spack/spack/compilers/aocc.py
+++ b/lib/spack/spack/compilers/aocc.py
@@ -9,6 +9,7 @@ import sys
import llnl.util.lang
from spack.compiler import Compiler
+from spack.version import ver
class Aocc(Compiler):
@@ -118,3 +119,22 @@ class Aocc(Compiler):
@property
def stdcxx_libs(self):
return ('-lstdc++', )
+
+ @property
+ def cflags(self):
+ return self._handle_default_flag_addtions()
+
+ @property
+ def cxxflags(self):
+ return self._handle_default_flag_addtions()
+
+ @property
+ def fflags(self):
+ return self._handle_default_flag_addtions()
+
+ def _handle_default_flag_addtions(self):
+ # This is a known issue for AOCC 3.0 see:
+ # https://developer.amd.com/wp-content/resources/AOCC-3.0-Install-Guide.pdf
+ if self.real_version == ver('3.0.0'):
+ return ("-Wno-unused-command-line-argument "
+ "-mllvm -eliminate-similar-expr=false")
diff --git a/lib/spack/spack/test/compilers/basics.py b/lib/spack/spack/test/compilers/basics.py
index 005000fdcb..553d89ecac 100644
--- a/lib/spack/spack/test/compilers/basics.py
+++ b/lib/spack/spack/test/compilers/basics.py
@@ -466,6 +466,10 @@ def test_aocc_flags():
supported_flag_test("f77_pic_flag", "-fPIC", "aocc@2.2.0")
supported_flag_test("fc_pic_flag", "-fPIC", "aocc@2.2.0")
supported_flag_test("version_argument", "--version", "aocc@2.2.0")
+ flg = "-Wno-unused-command-line-argument -mllvm -eliminate-similar-expr=false"
+ supported_flag_test("cflags", flg, "aocc@3.0.0")
+ supported_flag_test("cxxflags", flg, "aocc@3.0.0")
+ supported_flag_test("fflags", flg, "aocc@3.0.0")
def test_fj_flags():
diff --git a/lib/spack/spack/test/compilers/detection.py b/lib/spack/spack/test/compilers/detection.py
index e68c54c6ff..1736f47ee5 100644
--- a/lib/spack/spack/test/compilers/detection.py
+++ b/lib/spack/spack/test/compilers/detection.py
@@ -321,6 +321,11 @@ def test_cray_frontend_compiler_detection(
@pytest.mark.parametrize('version_str,expected_version', [
# This applies to C,C++ and FORTRAN compiler
+ ('AMD clang version 12.0.0 (CLANG: AOCC_3.0.0-Build#78 2020_12_10)'
+ '(based on LLVM Mirror.Version.12.0.0)\n'
+ 'Target: x86_64-unknown-linux-gnu\n'
+ 'Thread model: posix\n', '3.0.0'
+ ),
('AMD clang version 11.0.0 (CLANG: AOCC_2.3.0-Build#85 2020_11_10)'
'(based on LLVM Mirror.Version.11.0.0)\n'
'Target: x86_64-unknown-linux-gnu\n'