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
This commit is contained in:
AMD Toolchain Support
2021-03-17 20:36:25 +05:30
committed by GitHub
parent 43dd7b84c0
commit e6c8fa1311
4 changed files with 31 additions and 0 deletions

View File

@@ -9,6 +9,7 @@
import llnl.util.lang
from spack.compiler import Compiler
from spack.version import ver
class Aocc(Compiler):
@@ -118,3 +119,22 @@ def f77_version(cls, f77):
@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")

View File

@@ -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():

View File

@@ -321,6 +321,11 @@ def _module(cmd, *args):
@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'