From f189d6328c6791250c9e098b38d6fce5a1598674 Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Sat, 26 Mar 2022 11:19:11 +0000 Subject: [PATCH] Revert "add python generator version of tree reduction" This reverts commit 2fe0ce6285864927127d8226171c566886b87e89. damage has occurred to installations by failing to run unit tests which easily show that adding __init__.py causes imports to fail --- .../decoder/isa/tree_reduce/__init__.py | 0 .../decoder/isa/tree_reduce/generator.py | 51 ------------------- 2 files changed, 51 deletions(-) delete mode 100644 src/openpower/decoder/isa/tree_reduce/__init__.py delete mode 100644 src/openpower/decoder/isa/tree_reduce/generator.py diff --git a/src/openpower/decoder/isa/tree_reduce/__init__.py b/src/openpower/decoder/isa/tree_reduce/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/src/openpower/decoder/isa/tree_reduce/generator.py b/src/openpower/decoder/isa/tree_reduce/generator.py deleted file mode 100644 index be271b79..00000000 --- a/src/openpower/decoder/isa/tree_reduce/generator.py +++ /dev/null @@ -1,51 +0,0 @@ -# SPDX-License-Identifier: LGPL-3-or-later -# Copyright 2022 Jacob Lifshay programmerjake@gmail.com - -""" Tree-based Reduction as a Python Generator. - -https://bugs.libre-soc.org/show_bug.cgi?id=697 -""" - -from openpower.util.text_tree_graph import Op, print_tree - - -class Move(Op): - def __init__(self, out, in_): - super().__init__((out,), (in_,)) - - -class FAdd(Op): - def __init__(self, out, in0, in1): - super().__init__((out,), (in0, in1)) - - -def tree_reduce(bitmask, vl, remap=None, bin_op=FAdd): - assert isinstance(vl, int) and vl >= 0 - assert isinstance(bitmask, int) - arg_dist = 1 - while arg_dist < vl: - for i0 in range(0, vl, arg_dist * 2): - i1 = i0 + arg_dist - if remap is not None: - # FIXME(lkcl): does remap remap bitmask indexes like it does - # register indexes? This code assumes so. - i0 = remap[i0] - i1 = remap[i1] - if (bitmask >> i1) & 1: - if (bitmask >> i0) & 1: - yield bin_op(i0, i0, i1) - else: - yield Move(i0, i1) - bitmask |= 1 << i0 - arg_dist *= 2 - - -if __name__ == "__main__": - for vl in range(0, 6): - for bitmask in range(2 ** vl): - print(f"vl={vl} bitmask={bin(bitmask)[2:].zfill(vl)}:") - program = list(tree_reduce(bitmask, vl)) - for op in program: - print(f" {op!s}") - # TODO: re-enable: - # print_tree(program) -- 2.30.2