mirror of
https://github.com/RRZE-HPC/OSACA.git
synced 2026-01-06 11:10:06 +01:00
Linters update
This commit is contained in:
@@ -148,8 +148,13 @@ def _get_asmbench_output(input_data, isa):
|
|||||||
mnemonic = i_form.split("-")[0]
|
mnemonic = i_form.split("-")[0]
|
||||||
operands = i_form.split("-")[1].split("_")
|
operands = i_form.split("-")[1].split("_")
|
||||||
operands = [_create_db_operand(op, isa) for op in operands]
|
operands = [_create_db_operand(op, isa) for op in operands]
|
||||||
entry = instructionForm(instruction_id=mnemonic,operands_id=operands,throughput=_validate_measurement(float(input_data[i + 2].split()[1]), "tp"),
|
entry = instructionForm(
|
||||||
latency=_validate_measurement(float(input_data[i + 1].split()[1]), "lt"),port_pressure=None)
|
instruction_id=mnemonic,
|
||||||
|
operands_id=operands,
|
||||||
|
throughput=_validate_measurement(float(input_data[i + 2].split()[1]), "tp"),
|
||||||
|
latency=_validate_measurement(float(input_data[i + 1].split()[1]), "lt"),
|
||||||
|
port_pressure=None,
|
||||||
|
)
|
||||||
if not entry.throughput or not entry.latency:
|
if not entry.throughput or not entry.latency:
|
||||||
warnings.warn(
|
warnings.warn(
|
||||||
"Your measurement for {} looks suspicious".format(i_form)
|
"Your measurement for {} looks suspicious".format(i_form)
|
||||||
@@ -174,7 +179,13 @@ def _get_ibench_output(input_data, isa):
|
|||||||
mnemonic = instruction.split("-")[0]
|
mnemonic = instruction.split("-")[0]
|
||||||
operands = instruction.split("-")[1].split("_")
|
operands = instruction.split("-")[1].split("_")
|
||||||
operands = [_create_db_operand(op, isa) for op in operands]
|
operands = [_create_db_operand(op, isa) for op in operands]
|
||||||
entry = instructionForm(instruction_id=mnemonic,operands_id=operands,throughput=None,latency=None,port_pressure=None)
|
entry = instructionForm(
|
||||||
|
instruction_id=mnemonic,
|
||||||
|
operands_id=operands,
|
||||||
|
throughput=None,
|
||||||
|
latency=None,
|
||||||
|
port_pressure=None,
|
||||||
|
)
|
||||||
if "TP" in instruction:
|
if "TP" in instruction:
|
||||||
entry.throughput = _validate_measurement(float(line.split()[1]), "tp")
|
entry.throughput = _validate_measurement(float(line.split()[1]), "tp")
|
||||||
if not entry.throughput:
|
if not entry.throughput:
|
||||||
|
|||||||
@@ -427,7 +427,9 @@ class ParserAArch64(BaseParser):
|
|||||||
if memory_address["index"]["shift_op"].lower() in valid_shift_ops:
|
if memory_address["index"]["shift_op"].lower() in valid_shift_ops:
|
||||||
scale = 2 ** int(memory_address["index"]["shift"][0]["value"])
|
scale = 2 ** int(memory_address["index"]["shift"][0]["value"])
|
||||||
if index is not None:
|
if index is not None:
|
||||||
index = RegisterOperand(name=index["name"], prefix_id=index["prefix"] if "prefix" in index else None)
|
index = RegisterOperand(
|
||||||
|
name=index["name"], prefix_id=index["prefix"] if "prefix" in index else None
|
||||||
|
)
|
||||||
new_dict = MemoryOperand(
|
new_dict = MemoryOperand(
|
||||||
offset_ID=offset,
|
offset_ID=offset,
|
||||||
base_id=RegisterOperand(name=base["name"], prefix_id=base["prefix"]),
|
base_id=RegisterOperand(name=base["name"], prefix_id=base["prefix"]),
|
||||||
@@ -631,7 +633,7 @@ class ParserAArch64(BaseParser):
|
|||||||
|
|
||||||
def is_reg_dependend_of(self, reg_a, reg_b):
|
def is_reg_dependend_of(self, reg_a, reg_b):
|
||||||
"""Check if ``reg_a`` is dependent on ``reg_b``"""
|
"""Check if ``reg_a`` is dependent on ``reg_b``"""
|
||||||
#if not isinstance(reg_b, Operand):
|
# if not isinstance(reg_b, Operand):
|
||||||
# print(reg_b)
|
# print(reg_b)
|
||||||
if not isinstance(reg_a, Operand):
|
if not isinstance(reg_a, Operand):
|
||||||
reg_a = RegisterOperand(name=reg_a["name"])
|
reg_a = RegisterOperand(name=reg_a["name"])
|
||||||
|
|||||||
@@ -6,14 +6,12 @@ import pickle
|
|||||||
import re
|
import re
|
||||||
import string
|
import string
|
||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
from copy import deepcopy
|
|
||||||
from itertools import product
|
from itertools import product
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
import ruamel.yaml
|
import ruamel.yaml
|
||||||
from osaca import __version__, utils
|
from osaca import __version__, utils
|
||||||
from osaca.parser import ParserX86ATT
|
from osaca.parser import ParserX86ATT
|
||||||
from ruamel.yaml.compat import StringIO
|
|
||||||
from osaca.parser.instruction_form import instructionForm
|
from osaca.parser.instruction_form import instructionForm
|
||||||
from osaca.parser.operand import Operand
|
from osaca.parser.operand import Operand
|
||||||
from osaca.parser.memory import MemoryOperand
|
from osaca.parser.memory import MemoryOperand
|
||||||
@@ -203,7 +201,10 @@ class MachineModel(object):
|
|||||||
if isinstance(o["base"], dict):
|
if isinstance(o["base"], dict):
|
||||||
o["base"] = RegisterOperand(name=o["base"]["name"])
|
o["base"] = RegisterOperand(name=o["base"]["name"])
|
||||||
if isinstance(o["index"], dict):
|
if isinstance(o["index"], dict):
|
||||||
o["index"] = RegisterOperand(name=o["index"]["name"],prefix_id=o["index"]["prefix"] if "prefix" in o["index"] else None)
|
o["index"] = RegisterOperand(
|
||||||
|
name=o["index"]["name"],
|
||||||
|
prefix_id=o["index"]["prefix"] if "prefix" in o["index"] else None,
|
||||||
|
)
|
||||||
new_operands.append(
|
new_operands.append(
|
||||||
MemoryOperand(
|
MemoryOperand(
|
||||||
base_id=o["base"],
|
base_id=o["base"],
|
||||||
@@ -494,6 +495,7 @@ class MachineModel(object):
|
|||||||
if isinstance(stream, StringIO):
|
if isinstance(stream, StringIO):
|
||||||
return stream.getvalue()
|
return stream.getvalue()
|
||||||
'''
|
'''
|
||||||
|
|
||||||
def operand_to_dict(self, mem):
|
def operand_to_dict(self, mem):
|
||||||
return {
|
return {
|
||||||
"base": mem.base,
|
"base": mem.base,
|
||||||
|
|||||||
@@ -200,7 +200,8 @@ class ISASemantics(object):
|
|||||||
base_name = (o.base.prefix if o.base.prefix is not None else "") + o.base.name
|
base_name = (o.base.prefix if o.base.prefix is not None else "") + o.base.name
|
||||||
return {
|
return {
|
||||||
base_name: {
|
base_name: {
|
||||||
"name": (o.base.prefix if o.base.prefix is not None else "") + o.base.name,
|
"name": (o.base.prefix if o.base.prefix is not None else "")
|
||||||
|
+ o.base.name,
|
||||||
"value": o.post_indexed["value"],
|
"value": o.post_indexed["value"],
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -299,7 +299,11 @@ class KernelDG(nx.DiGraph):
|
|||||||
# write to register -> abort
|
# write to register -> abort
|
||||||
if self.is_written(dst, instr_form):
|
if self.is_written(dst, instr_form):
|
||||||
break
|
break
|
||||||
if not isinstance(dst, Operand) and ("flag" in dst or dst["class"] == "flag" if "class" in dst else False) and flag_dependencies:
|
if (
|
||||||
|
not isinstance(dst, Operand)
|
||||||
|
and ("flag" in dst or dst["class"] == "flag" if "class" in dst else False)
|
||||||
|
and flag_dependencies
|
||||||
|
):
|
||||||
# read of flag
|
# read of flag
|
||||||
if self.is_read(dst, instr_form):
|
if self.is_read(dst, instr_form):
|
||||||
yield instr_form, []
|
yield instr_form, []
|
||||||
@@ -377,7 +381,9 @@ class KernelDG(nx.DiGraph):
|
|||||||
):
|
):
|
||||||
if isinstance(src, RegisterOperand):
|
if isinstance(src, RegisterOperand):
|
||||||
is_read = self.parser.is_reg_dependend_of(register, src) or is_read
|
is_read = self.parser.is_reg_dependend_of(register, src) or is_read
|
||||||
if not isinstance(src, Operand) and ("flag" in src or src["class"] == "flag" if "class" in src else False):
|
if not isinstance(src, Operand) and (
|
||||||
|
"flag" in src or src["class"] == "flag" if "class" in src else False
|
||||||
|
):
|
||||||
is_read = self.parser.is_flag_dependend_of(register, src) or is_read
|
is_read = self.parser.is_flag_dependend_of(register, src) or is_read
|
||||||
if isinstance(src, MemoryOperand):
|
if isinstance(src, MemoryOperand):
|
||||||
if src.base is not None:
|
if src.base is not None:
|
||||||
@@ -480,7 +486,9 @@ class KernelDG(nx.DiGraph):
|
|||||||
):
|
):
|
||||||
if isinstance(dst, RegisterOperand):
|
if isinstance(dst, RegisterOperand):
|
||||||
is_written = self.parser.is_reg_dependend_of(register, dst) or is_written
|
is_written = self.parser.is_reg_dependend_of(register, dst) or is_written
|
||||||
if not isinstance(dst, Operand) and ("flag" in dst or dst["class"] == "flag" if "class" in dst else False):
|
if not isinstance(dst, Operand) and (
|
||||||
|
"flag" in dst or dst["class"] == "flag" if "class" in dst else False
|
||||||
|
):
|
||||||
is_written = self.parser.is_flag_dependend_of(register, dst) or is_written
|
is_written = self.parser.is_flag_dependend_of(register, dst) or is_written
|
||||||
if isinstance(dst, MemoryOperand):
|
if isinstance(dst, MemoryOperand):
|
||||||
if dst.pre_indexed or dst.post_indexed:
|
if dst.pre_indexed or dst.post_indexed:
|
||||||
|
|||||||
@@ -230,7 +230,6 @@ class TestCLI(unittest.TestCase):
|
|||||||
osaca.run(args, output_file=output)
|
osaca.run(args, output_file=output)
|
||||||
self.assertTrue(output.getvalue().count("WARNING: LCD analysis timed out") == 0)
|
self.assertTrue(output.getvalue().count("WARNING: LCD analysis timed out") == 0)
|
||||||
|
|
||||||
|
|
||||||
def test_lines_arg(self):
|
def test_lines_arg(self):
|
||||||
# Run tests with --lines option
|
# Run tests with --lines option
|
||||||
parser = osaca.create_parser()
|
parser = osaca.create_parser()
|
||||||
|
|||||||
Reference in New Issue
Block a user