prepared for aarch64 8.2 support

This commit is contained in:
JanLJL
2020-07-23 15:54:54 +02:00
parent 5520362e65
commit 6c72281d65
7 changed files with 17 additions and 14 deletions

View File

@@ -5,7 +5,7 @@ import sys
from io import StringIO
from osaca.frontend import Frontend
from osaca.parser import ParserAArch64v81, ParserX86ATT
from osaca.parser import ParserAArch64, ParserX86ATT
from osaca.semantics import (INSTR_FLAGS, KernelDG, MachineModel,
ArchSemantics, reduce_to_section)
@@ -29,7 +29,7 @@ class KerncraftAPI(object):
self.semantics = ArchSemantics(self.machine_model)
isa = self.machine_model.get_ISA().lower()
if isa == 'aarch64':
self.parser = ParserAArch64v81()
self.parser = ParserAArch64()
elif isa == 'x86':
self.parser = ParserX86ATT()

View File

@@ -8,7 +8,7 @@ import sys
from osaca.db_interface import import_benchmark_output, sanity_check
from osaca.frontend import Frontend
from osaca.parser import BaseParser, ParserAArch64v81, ParserX86ATT
from osaca.parser import BaseParser, ParserAArch64, ParserX86ATT
from osaca.semantics import (INSTR_FLAGS, ArchSemantics, KernelDG,
MachineModel, reduce_to_section)
@@ -306,7 +306,7 @@ def get_asm_parser(arch) -> BaseParser:
if isa == 'x86':
return ParserX86ATT()
elif isa == 'aarch64':
return ParserAArch64v81()
return ParserAArch64()
def get_unmatched_instruction_ratio(kernel):

View File

@@ -6,14 +6,14 @@ Only the parser below will be exported, so please add new parsers to __all__.
from .attr_dict import AttrDict
from .base_parser import BaseParser
from .parser_x86att import ParserX86ATT
from .parser_AArch64v81 import ParserAArch64v81
from .parser_AArch64 import ParserAArch64
__all__ = ['AttrDict', 'BaseParser', 'ParserX86ATT', 'ParserAArch64v81', 'get_parser']
__all__ = ['AttrDict', 'BaseParser', 'ParserX86ATT', 'ParserAArch64', 'get_parser']
def get_parser(isa):
if isa.lower() == 'x86':
return ParserX86ATT()
elif isa.lower() == 'aarch64':
return ParserAArch64v81()
return ParserAArch64()
else:
raise ValueError("Unknown ISA {!r}.".format(isa))

View File

@@ -6,7 +6,7 @@ import pyparsing as pp
from osaca.parser import AttrDict, BaseParser
class ParserAArch64v81(BaseParser):
class ParserAArch64(BaseParser):
def __init__(self):
super().__init__()
self.isa = 'aarch64'

View File

@@ -72,7 +72,8 @@ class ArchSemantics(ISASemantics):
min_port_idx = port_sums.index(min(port_sums))
instr_ports[min_port_idx] += min(instr_ports)
differences[min_port_idx] += min(instr_ports)
# we don't need to decrease difference for other port, just delete it
# we don't need to decrease difference for other port, just
# delete it
del differences[instr_ports.index(min(instr_ports))]
self._itemsetter(*indices)(
instruction_form['port_pressure'], *instr_ports
@@ -90,7 +91,8 @@ class ArchSemantics(ISASemantics):
instr_ports = self._to_list(
itemgetter(*indices)(instruction_form['port_pressure'])
)
# never remove more than the fixed utilization per uop and port, i.e., cycles/len(ports)
# never remove more than the fixed utilization per uop and port, i.e.,
# cycles/len(ports)
if round(min(differences), 2) <= 0:
# don't worry if port_pressure isn't exactly 0 and just
# remove from further balancing
@@ -98,6 +100,7 @@ class ArchSemantics(ISASemantics):
instr_ports = self._to_list(
itemgetter(*indices)(instruction_form['port_pressure'])
)
del differences[differences.index(min(differences))]
port_sums = self._to_list(
itemgetter(*indices)(self.get_throughput_sum(kernel))
)

View File

@@ -2,7 +2,7 @@
from itertools import chain
from osaca import utils
from osaca.parser import AttrDict, ParserAArch64v81, ParserX86ATT
from osaca.parser import AttrDict, ParserAArch64, ParserX86ATT
from .hw_model import MachineModel
@@ -31,7 +31,7 @@ class ISASemantics(object):
if self._isa == 'x86':
self._parser = ParserX86ATT()
elif self._isa == 'aarch64':
self._parser = ParserAArch64v81()
self._parser = ParserAArch64()
def process(self, instruction_forms):
"""Process a list of instruction forms."""

View File

@@ -1,7 +1,7 @@
#!/usr/bin/env python3
from collections import OrderedDict
from osaca.parser import ParserAArch64v81, ParserX86ATT, get_parser
from osaca.parser import ParserAArch64, ParserX86ATT, get_parser
COMMENT_MARKER = {'start': 'OSACA-BEGIN', 'end': 'OSACA-END'}
@@ -38,7 +38,7 @@ def find_marked_kernel_AArch64(lines):
nop_bytes = ['213', '3', '32', '31']
return find_marked_section(
lines,
ParserAArch64v81(),
ParserAArch64(),
['mov'],
'x1',
[111, 222],