Black formatting

This commit is contained in:
stefandesouza
2023-12-03 17:22:11 +01:00
parent 93ae586745
commit cef7f8098d
12 changed files with 130 additions and 94 deletions

View File

@@ -124,6 +124,7 @@ class TestCLI(unittest.TestCase):
# remove copy again
os.remove(name_copy)
"""
def test_examples(self):
kernels = [
"add",
@@ -156,6 +157,7 @@ class TestCLI(unittest.TestCase):
output = StringIO()
osaca.run(args, output_file=output)
self.assertTrue("WARNING" not in output.getvalue())
"""
def test_architectures(self):
parser = osaca.create_parser()
@@ -169,6 +171,7 @@ class TestCLI(unittest.TestCase):
output = StringIO()
osaca.run(args, output_file=output)
"""
def test_architectures_sanity(self):
# Run sanity check for all architectures
archs = osaca.SUPPORTED_ARCHS
@@ -177,6 +180,7 @@ class TestCLI(unittest.TestCase):
out = StringIO()
sanity = sanity_check(arch, verbose=2, output_file=out)
self.assertTrue(sanity, msg=out)
"""
def test_without_arch(self):
# Run test kernels without --arch flag

View File

@@ -16,6 +16,7 @@ from osaca.parser.register import RegisterOperand
from osaca.parser.immediate import ImmediateOperand
from osaca.parser.identifier import IdentifierOperand
class TestParserAArch64(unittest.TestCase):
@classmethod
def setUpClass(self):
@@ -237,7 +238,7 @@ class TestParserAArch64(unittest.TestCase):
operands_id=[
{"prfop": {"type": ["PLD"], "target": ["L1"], "policy": ["KEEP"]}},
MemoryOperand(
offset_ID=ImmediateOperand(value_id=2048),
offset_ID=ImmediateOperand(value_id=2048),
base_id=RegisterOperand(prefix_id="x", name="26"),
index_id=None,
scale_id=1,
@@ -347,10 +348,18 @@ class TestParserAArch64(unittest.TestCase):
imd_hex_1 = ImmediateOperand(value_id="0x4f")
imd_decimal_2 = ImmediateOperand(value_id="8")
imd_hex_2 = ImmediateOperand(value_id="0x8")
imd_float_11 = ImmediateOperand(type_id="float",value_id={"mantissa": "0.79", "e_sign": "+", "exponent": "2"})
imd_float_12 = ImmediateOperand(type_id="float",value_id={"mantissa": "790.0", "e_sign": "-", "exponent": "1"})
imd_double_11 = ImmediateOperand(type_id="double",value_id={"mantissa": "0.79", "e_sign": "+", "exponent": "2"})
imd_double_12 = ImmediateOperand(type_id="double",value_id={"mantissa": "790.0", "e_sign": "-", "exponent": "1"})
imd_float_11 = ImmediateOperand(
type_id="float", value_id={"mantissa": "0.79", "e_sign": "+", "exponent": "2"}
)
imd_float_12 = ImmediateOperand(
type_id="float", value_id={"mantissa": "790.0", "e_sign": "-", "exponent": "1"}
)
imd_double_11 = ImmediateOperand(
type_id="double", value_id={"mantissa": "0.79", "e_sign": "+", "exponent": "2"}
)
imd_double_12 = ImmediateOperand(
type_id="double", value_id={"mantissa": "790.0", "e_sign": "-", "exponent": "1"}
)
identifier = IdentifierOperand(name="..B1.4")
value1 = self.parser.normalize_imd(imd_decimal_1)

View File

@@ -13,6 +13,7 @@ from osaca.parser.register import RegisterOperand
from osaca.parser.immediate import ImmediateOperand
from osaca.parser.identifier import IdentifierOperand
class TestParserX86ATT(unittest.TestCase):
@classmethod
def setUpClass(self):

View File

@@ -24,6 +24,7 @@ from osaca.parser.memory import MemoryOperand
from osaca.parser.identifier import IdentifierOperand
from osaca.parser.operand import Operand
class TestSemanticTools(unittest.TestCase):
MODULE_DATA_DIR = os.path.join(
os.path.dirname(os.path.split(os.path.abspath(__file__))[0]), "osaca/data/"
@@ -94,7 +95,6 @@ class TestSemanticTools(unittest.TestCase):
)
cls.machine_model_zen = MachineModel(arch="zen1")
for i in range(len(cls.kernel_x86)):
cls.semantics_csx.assign_src_dst(cls.kernel_x86[i])
cls.semantics_csx.assign_tp_lt(cls.kernel_x86[i])
@@ -117,7 +117,6 @@ class TestSemanticTools(unittest.TestCase):
cls.semantics_a64fx.assign_src_dst(cls.kernel_aarch64_deps[i])
cls.semantics_a64fx.assign_tp_lt(cls.kernel_aarch64_deps[i])
###########
# Tests
###########
@@ -276,7 +275,6 @@ class TestSemanticTools(unittest.TestCase):
test_mm_x86.dump(stream=dev_null)
test_mm_arm.dump(stream=dev_null)
def test_src_dst_assignment_x86(self):
for instruction_form in self.kernel_x86:
with self.subTest(instruction_form=instruction_form):
@@ -340,7 +338,7 @@ class TestSemanticTools(unittest.TestCase):
k2i1_pp = [round(x, 2) for x in tmp_kernel_2[0].port_pressure]
self.assertEqual(k1i1_pp, [0.33, 0.0, 0.33, 0.0, 0.0, 0.0, 0.0, 0.0, 0.33, 0.0, 0.0])
self.assertEqual(k2i1_pp, [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0])
# arm
kernel_fixed = deepcopy(self.kernel_AArch64)
self.semantics_tx2.add_semantics(kernel_fixed)
@@ -378,9 +376,8 @@ class TestSemanticTools(unittest.TestCase):
dg.get_dependent_instruction_forms()
# test dot creation
dg.export_graph(filepath="/dev/null")
def test_memdependency_x86(self):
def test_memdependency_x86(self):
dg = KernelDG(
self.kernel_x86_memdep,
self.parser_x86,
@@ -468,7 +465,6 @@ class TestSemanticTools(unittest.TestCase):
dg.get_loopcarried_dependencies()
def test_loop_carried_dependency_aarch64(self):
dg = KernelDG(
self.kernel_aarch64_memdep,
self.parser_AArch64,
@@ -521,7 +517,6 @@ class TestSemanticTools(unittest.TestCase):
[(4, 1.0), (5, 1.0), (10, 1.0), (11, 1.0), (12, 1.0)],
)
def test_loop_carried_dependency_x86(self):
lcd_id = "8"
lcd_id2 = "5"