Skip to content
Snippets Groups Projects
Open Use `set()` less
  • View options
  • Use `set()` less

  • View options
  • Open Issue created by Oscar Gustafsson

    This leads to non-deterministic behavior.

    Often it would be possible to just replace these with lists.

    When they are used to find unique values, one can either use a dict with None values or sort the results in a well-defined order after going back to a list.

    Not sure if networkx may use a set to store graphs though, so it may not be fully possible to get deterministic behavior.

    Context:

    Run the architecture example a few times and the same code twice yields different results (possibly you will have to swap add4 for it to happen. In this case it can be dealt with by moving memory variables to go from one to the other, but it is a bit annoying.

    One should possibly also think about another port-splitting-algorithm that is deterministic. (Something like left-edge will actually work and will also work for more than one read/writeport, although it will probably be noticeable that it is sub-optimal more often then...)

    Edited by Oscar Gustafsson

    Child items
    0

  • No child items are currently assigned. Use child items to break down work into smaller parts.

    Linked items 0

  • Link items together to show that they're related or that one is blocking others.

    Development

    Activity

    • All activity
    • Comments only
    • History only
    • Newest first
    • Oldest first
    • Oscar Gustafsson changed the description ·
    • Mikael Henriksson
      Maintainer
      ❯ git grep --line-number "set()"
      b_asic/architecture.py:372:        schedule_times = set()
      b_asic/architecture.py:412:        memory_read_ports = set()
      b_asic/architecture.py:413:        memory_write_ports = set()
      b_asic/architecture.py:424:        pe_input_ports = set()
      b_asic/architecture.py:425:        pe_output_ports = set()
      b_asic/architecture.py:505:        edges = set()
      b_asic/resources.py:965:        process_collection_set_list = [set() for _ in range(max(coloring.values()) + 1)]
      b_asic/resources.py:1028:                cell_assignment[cell] = ProcessCollection(set(), self._schedule_time)
      b_asic/resources.py:1069:                    collection=set(), schedule_time=self._schedule_time
      b_asic/resources.py:1210:        short = set()
      b_asic/resources.py:1211:        long = set()
      b_asic/schedule.py:653:        non_schedulable_ops = set()
      b_asic/scheduler_gui/operation_item.py:80:        operation._check_all_latencies_set()
      b_asic/scheduler_gui/scheduler_item.py:142:        s = set()
      b_asic/scheduler_gui/scheduler_item.py:165:            s = set()
      b_asic/signal_flow_graph.py:65:    def next_id(self, type_name: TypeName, used_ids: MutableSet = set()) -> GraphID:
      b_asic/signal_flow_graph.py:129:    _used_ids: Set[GraphID] = set()
      b_asic/signal_flow_graph.py:153:        self._used_ids = set()
      b_asic/signal_flow_graph.py:920:        printed_ops = set()
      b_asic/signal_flow_graph.py:956:        seen = set()
      b_asic/signal_flow_graph.py:1428:        branch_nodes = set()
      test/test_architecture.py:21:    empty_collection = ProcessCollection(collection=set(), schedule_time=5)
      test/test_architecture.py:51:    empty_collection = ProcessCollection(collection=set(), schedule_time=5)
    • Oscar Gustafsson mentioned in merge request !371 (merged)
    • Oscar Gustafsson mentioned in merge request !372 (merged)
    • Mikael Henriksson
      Maintainer

      Autumn update:

      ❯ git grep --line-number "set()"
      b_asic/architecture.py:608:        schedule_times = set()
      b_asic/architecture.py:662:        memory_read_ports = set()
      b_asic/architecture.py:663:        memory_write_ports = set()
      b_asic/architecture.py:674:        pe_input_ports = set()
      b_asic/architecture.py:675:        pe_output_ports = set()
      b_asic/schedule.py:806:        non_schedulable_ops = set()
      b_asic/scheduler_gui/operation_item.py:82:        operation._check_all_latencies_set()
      b_asic/scheduler_gui/scheduler_item.py:150:        s = set()
      b_asic/signal_flow_graph.py:65:    def next_id(self, type_name: TypeName, used_ids: MutableSet = set()) -> GraphID:
      b_asic/signal_flow_graph.py:128:    _used_ids: Set[GraphID] = set()
      b_asic/signal_flow_graph.py:152:        self._used_ids = set()
      b_asic/signal_flow_graph.py:1037:        printed_ops = set()
      b_asic/signal_flow_graph.py:1074:        seen = set()
      b_asic/signal_flow_graph.py:1544:        branch_nodes = set()
      test/test_architecture.py:22:    empty_collection = ProcessCollection(collection=set(), schedule_time=5)
      test/test_architecture.py:50:    empty_collection = ProcessCollection(collection=set(), schedule_time=5)