mirror of
https://github.com/RRZE-HPC/OSACA.git
synced 2025-12-15 16:40:05 +01:00
try different ISA as fallback when parsing without --arch flag, use SKX as x86 default and enhanced ISA detection heuristic
This commit is contained in:
@@ -5,6 +5,7 @@ import io
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
import traceback
|
||||
|
||||
from osaca.db_interface import import_benchmark_output, sanity_check
|
||||
from osaca.frontend import Frontend
|
||||
@@ -29,7 +30,7 @@ SUPPORTED_ARCHS = [
|
||||
]
|
||||
DEFAULT_ARCHS = {
|
||||
'aarch64': 'A64FX',
|
||||
'x86': 'ICL',
|
||||
'x86': 'SKX',
|
||||
}
|
||||
|
||||
|
||||
@@ -257,7 +258,19 @@ def inspect(args, output_file=sys.stdout):
|
||||
|
||||
# Parse file
|
||||
parser = get_asm_parser(arch)
|
||||
parsed_code = parser.parse_file(code)
|
||||
try:
|
||||
parsed_code = parser.parse_file(code)
|
||||
except:
|
||||
# probably the wrong parser based on heuristic
|
||||
if args.arch is None:
|
||||
# change ISA and try again
|
||||
arch = DEFAULT_ARCHS['x86'] if BaseParser.detect_ISA(code) == 'aarch64' else DEFAULT_ARCHS['aarch64']
|
||||
isa = MachineModel.get_isa_for_arch(arch)
|
||||
parser = get_asm_parser(arch)
|
||||
parsed_code = parser.parse_file(code)
|
||||
else:
|
||||
traceback.print_exc(file=sys.stderr)
|
||||
sys.exit(1)
|
||||
|
||||
# Reduce to marked kernel and add semantics
|
||||
kernel = reduce_to_section(parsed_code, isa)
|
||||
|
||||
@@ -24,7 +24,7 @@ class BaseParser(object):
|
||||
"""Detect the ISA of the assembly based on the used registers and return the ISA code."""
|
||||
# Check for the amount of registers in the code to determine the ISA
|
||||
# 1) Check for xmm, ymm, zmm, rax, rbx, rcx, and rdx registers in x86
|
||||
heuristics_x86ATT = [r'%[xyz]mm[0-9]', r'%r[abcd]x[0-9]']
|
||||
heuristics_x86ATT = [r'%[xyz]mm[0-9]', r'%[er][abcd]x[0-9]']
|
||||
# 2) check for v and z vector registers and x/w general-purpose registers
|
||||
heuristics_aarch64 = [r'[vz][0-9][0-9]?\.[0-9][0-9]?[bhsd]', r'[wx][0-9]']
|
||||
matches = {'x86': 0, 'aarch64': 0}
|
||||
|
||||
Reference in New Issue
Block a user