-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add detect software built for the Arm Neoverse series of processors and recommend options for AmpereOne support. * detects build files for missing AmpereOne support * update UT cases for neoverse/ampere1 build flag detection * support scanning makefiles with arm64/aarch64 as file extension in filename * extend other arch list to reduce noise during assembly code detection
- Loading branch information
1 parent
d7f069a
commit 510aa13
Showing
11 changed files
with
269 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,16 @@ | ||
""" | ||
SPDX-License-Identifier: Apache-2.0 | ||
Copyright (c) 2023, Ampere Computing LLC | ||
Copyright (c) 2024, Ampere Computing LLC | ||
""" | ||
|
||
ARCH_SPECIFIC_OPTS = ['mmx', 'sse', 'sse2', 'sse3', 'ssse3', 'sse4', 'sse4a', 'sse4.1', 'sse4.2', 'avx', 'avx2', 'avx512f', 'avx512pf', 'avx512er', 'avx512cd', 'avx512vl', 'avx512bw', 'avx512dq', 'avx512ifma', 'avx512vbmi', 'sha', 'aes', 'pclmul', 'clflushopt', 'clwb', 'fsgsbase', 'ptwrite', 'rdrnd', 'f16c', 'fma', 'pconfig', 'wbnoinvd', 'fma4', 'prfchw', 'rdpid', 'prefetchwt1', 'rdseed', 'sgx', 'xop', 'lwp', '3dnow', '3dnowa', 'popcnt', 'abm', 'adx', 'bmi', 'bmi2', 'lzcnt', 'fxsr', 'xsave', 'xsaveopt', 'xsavec', 'xsaves', 'rtm', 'hle', 'tbm', 'mwaitx', 'clzero', 'pku', 'avx512vbmi2', 'avx512bf16', 'avx512fp16', 'gfni', 'vaes', 'waitpkg', 'vpclmulqdq', 'avx512bitalg', 'movdiri', 'movdir64b', 'enqcmd', 'uintr', 'tsxldtrk', 'avx512vpopcntdq', 'avx512vp2intersect', 'avx5124fmaps', 'avx512vnni', 'avxvnni', 'avx5124vnniw', 'cldemote', 'serialize', 'amx-tile', 'amx-int8', 'amx-bf16', 'hreset', 'kl', 'widekl', 'avxifma', 'avxvnniint8', 'avxneconvert', 'cmpccxadd', 'amx-fp16', 'prefetchi', 'raoint', 'amx-complex'] | ||
X86_SPECIFIC_OPTS = ['mmx', 'sse', 'sse2', 'sse3', 'ssse3', 'sse4', 'sse4a', 'sse4.1', 'sse4.2', 'avx', 'avx2', 'avx512f', 'avx512pf', 'avx512er', 'avx512cd', 'avx512vl', 'avx512bw', 'avx512dq', 'avx512ifma', 'avx512vbmi', 'sha', 'aes', 'pclmul', 'clflushopt', 'clwb', 'fsgsbase', 'ptwrite', 'rdrnd', 'f16c', 'fma', 'pconfig', 'wbnoinvd', 'fma4', 'prfchw', 'rdpid', 'prefetchwt1', 'rdseed', 'sgx', 'xop', 'lwp', '3dnow', '3dnowa', 'popcnt', 'abm', 'adx', 'bmi', 'bmi2', 'lzcnt', 'fxsr', 'xsave', 'xsaveopt', 'xsavec', 'xsaves', 'rtm', 'hle', 'tbm', 'mwaitx', 'clzero', 'pku', 'avx512vbmi2', 'avx512bf16', 'avx512fp16', 'gfni', 'vaes', 'waitpkg', 'vpclmulqdq', 'avx512bitalg', 'movdiri', 'movdir64b', 'enqcmd', 'uintr', 'tsxldtrk', 'avx512vpopcntdq', 'avx512vp2intersect', 'avx5124fmaps', 'avx512vnni', 'avxvnni', 'avx5124vnniw', 'cldemote', 'serialize', 'amx-tile', 'amx-int8', 'amx-bf16', 'hreset', 'kl', 'widekl', 'avxifma', 'avxvnniint8', 'avxneconvert', 'cmpccxadd', 'amx-fp16', 'prefetchi', 'raoint', 'amx-complex'] | ||
"""Options that are not available on aarch64.""" | ||
|
||
NEOVERSE_SPECIFIC_OPTS = ['neoverse-'] | ||
"""Options for Arm Neoverse are not appropriate for AmpereOne family.""" | ||
|
||
AMPEREONE_SPECIFIC_OPTS = ['ampere1', 'ampere1a', 'ampere1b'] | ||
"""Options for AmpereOne family.""" | ||
|
||
ARCH_SPECIFIC_IN_BUILD_FILES = ['meson.build', 'CMakeLists.txt', 'Makefile.in', 'Makefile.am', 'Makefile.arm64', 'Makefile.aarch64'] | ||
"""Build files in aarch64 port dir can't be filter out as they might missing support for ampere1.""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
""" | ||
SPDX-License-Identifier: Apache-2.0 | ||
Copyright (c) 2024, Ampere Computing LLC | ||
""" | ||
|
||
import os | ||
import re | ||
from ..constants.arch_strings import AARCH64_ARCHS, NON_AARCH64_ARCHS | ||
from ..constants.arch_specific_libs import ARCH_SPECIFIC_LIBS | ||
from ..constants.arch_specific_options import X86_SPECIFIC_OPTS | ||
from ..constants.arch_specific_options import NEOVERSE_SPECIFIC_OPTS | ||
from ..constants.arch_specific_options import AMPEREONE_SPECIFIC_OPTS | ||
from ..parsers.continuation_parser import ContinuationParser | ||
from ..reports.issues.arch_specific_library_issue import ArchSpecificLibraryIssue | ||
from ..reports.issues.arch_specific_build_option_issue import ArchSpecificBuildOptionIssue | ||
from ..reports.issues.arch_specific_build_option_issue import NeoverseSpecificBuildOptionIssue | ||
from ..reports.issues.arch_specific_build_option_issue import AmpereoneSpecificBuildOptionIssue | ||
from ..reports.issues.define_other_arch_issue import DefineOtherArchIssue | ||
from .scanner import Scanner | ||
|
||
|
||
class MesonScanner(Scanner): | ||
"""Scanner that scans Meson builds""" | ||
|
||
MESON_NAMES = ['meson.build'] | ||
|
||
X86_SPECIFIC_OPTS_RE_PROG = re.compile(r'-m(%s)' % | ||
'|'.join([(r'%s\b' % x) for x in X86_SPECIFIC_OPTS])) | ||
ARCH_SPECIFIC_LIBS_RE_PROG = re.compile(r'(?:find_library)\(\'(%s)' % | ||
'|'.join([(r'%s\b' % x) for x in ARCH_SPECIFIC_LIBS])) | ||
NEOVERSE_SPECIFIC_OPTS_RE_PROG = re.compile(r'-m(cpu|tune)=(%s)' % | ||
'|'.join([(r'%s\b' % x) for x in NEOVERSE_SPECIFIC_OPTS])) | ||
AMPEREONE_SPECIFIC_OPTS_RE_PROG = re.compile(r'-m(cpu|tune)=(%s)' % | ||
'|'.join([(r'%s\b' % x) for x in AMPEREONE_SPECIFIC_OPTS])) | ||
|
||
def accepts_file(self, filename): | ||
basename = os.path.basename(filename) | ||
return basename in MesonScanner.MESON_NAMES | ||
|
||
def scan_file_object(self, filename, file, report): | ||
continuation_parser = ContinuationParser() | ||
seen_neoverse_build_flag = False | ||
seen_ampere1_build_flag = False | ||
|
||
for lineno, line in enumerate(file, 1): | ||
line = continuation_parser.parse_line(line) | ||
|
||
if not line: | ||
continue | ||
|
||
match = MesonScanner.ARCH_SPECIFIC_LIBS_RE_PROG.search(line) | ||
if match: | ||
lib_name = match.group(1) | ||
report.add_issue(ArchSpecificLibraryIssue( | ||
filename, lineno + 1, lib_name)) | ||
match = MesonScanner.X86_SPECIFIC_OPTS_RE_PROG.search(line) | ||
if match: | ||
opt_name = match.group(1) | ||
report.add_issue(ArchSpecificBuildOptionIssue( | ||
filename, lineno + 1, opt_name)) | ||
match = MesonScanner.NEOVERSE_SPECIFIC_OPTS_RE_PROG.search(line) | ||
if match: | ||
seen_neoverse_build_flag = True | ||
opt_name = match.group(1) | ||
opt_value = match.group(2) | ||
report.add_issue(NeoverseSpecificBuildOptionIssue( | ||
filename, lineno + 1, opt_name, opt_value)) | ||
match = MesonScanner.AMPEREONE_SPECIFIC_OPTS_RE_PROG.search(line) | ||
if match: | ||
seen_ampere1_build_flag = True | ||
if seen_neoverse_build_flag and not seen_ampere1_build_flag: | ||
report.add_issue(AmpereoneSpecificBuildOptionIssue(filename, lineno + 1)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.