diff --git a/osaca/api/kerncraft_interface.py b/osaca/api/kerncraft_interface.py index aceb23c..2d448e1 100755 --- a/osaca/api/kerncraft_interface.py +++ b/osaca/api/kerncraft_interface.py @@ -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() diff --git a/osaca/osaca.py b/osaca/osaca.py index afe95e9..012e165 100755 --- a/osaca/osaca.py +++ b/osaca/osaca.py @@ -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): diff --git a/osaca/parser/__init__.py b/osaca/parser/__init__.py index cce0143..1e9d6c6 100644 --- a/osaca/parser/__init__.py +++ b/osaca/parser/__init__.py @@ -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)) diff --git a/osaca/parser/parser_AArch64v81.py b/osaca/parser/parser_AArch64.py similarity index 99% rename from osaca/parser/parser_AArch64v81.py rename to osaca/parser/parser_AArch64.py index 51d2fae..bccaa2a 100755 --- a/osaca/parser/parser_AArch64v81.py +++ b/osaca/parser/parser_AArch64.py @@ -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' diff --git a/osaca/semantics/arch_semantics.py b/osaca/semantics/arch_semantics.py index e0f69a4..6de5a0a 100755 --- a/osaca/semantics/arch_semantics.py +++ b/osaca/semantics/arch_semantics.py @@ -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)) ) diff --git a/osaca/semantics/isa_semantics.py b/osaca/semantics/isa_semantics.py index d96bb87..43a1e49 100755 --- a/osaca/semantics/isa_semantics.py +++ b/osaca/semantics/isa_semantics.py @@ -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.""" diff --git a/osaca/semantics/marker_utils.py b/osaca/semantics/marker_utils.py index b4beb25..2a64885 100755 --- a/osaca/semantics/marker_utils.py +++ b/osaca/semantics/marker_utils.py @@ -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],