Memory Constrained Scheduling
The SFG is
Set latencies and execution times.

Generate a PE constrained HybridSchedule

direct, mem_vars = schedule2.get_memory_variables().split_on_length()
print("Max read ports:", mem_vars.read_ports_bound())
print("Max write ports:", mem_vars.write_ports_bound())
Max read ports: 3
Max write ports: 3
operations = schedule2.get_operations()
bfs = operations.get_by_type_name(R2Butterfly.type_name())
bfs.show(title="R2Butterfly executions")
const_muls = operations.get_by_type_name(ConstantMultiplication.type_name())
const_muls.show(title="ConstMul executions")
inputs = operations.get_by_type_name(Input.type_name())
inputs.show(title="Input executions")
outputs = operations.get_by_type_name(Output.type_name())
outputs.show(title="Output executions")
bf_pe = ProcessingElement(bfs, entity_name="bf")
mul_pe = ProcessingElement(const_muls, entity_name="mul")
pe_in = ProcessingElement(inputs, entity_name='input')
pe_out = ProcessingElement(outputs, entity_name='output')
mem_vars = schedule2.get_memory_variables()
mem_vars.show(title="All memory variables")
direct, mem_vars = mem_vars.split_on_length()
mem_vars.show(title="Non-zero time memory variables")
mem_vars_set = mem_vars.split_on_ports(
read_ports=1, write_ports=1, total_ports=2, strategy="greedy_graph_color"
)
memories = []
for i, mem in enumerate(mem_vars_set):
memory = Memory(mem, memory_type="RAM", entity_name=f"memory{i}")
memories.append(memory)
mem.show(title=f"{memory.entity_name}")
memory.assign("greedy_graph_color")
memory.show_content(title=f"Assigned {memory.entity_name}")
direct.show(title="Direct interconnects")
Generate another HybridSchedule but this time constrain the amount of reads and writes to reduce the amount of memories

direct, mem_vars = schedule3.get_memory_variables().split_on_length()
print("Max read ports:", mem_vars.read_ports_bound())
print("Max write ports:", mem_vars.write_ports_bound())
Max read ports: 2
Max write ports: 2
operations = schedule3.get_operations()
bfs = operations.get_by_type_name(R2Butterfly.type_name())
bfs.show(title="R2Butterfly executions")
const_muls = operations.get_by_type_name(ConstantMultiplication.type_name())
const_muls.show(title="ConstMul executions")
inputs = operations.get_by_type_name(Input.type_name())
inputs.show(title="Input executions")
outputs = operations.get_by_type_name(Output.type_name())
outputs.show(title="Output executions")
bf_pe = ProcessingElement(bfs, entity_name="bf")
mul_pe = ProcessingElement(const_muls, entity_name="mul")
pe_in = ProcessingElement(inputs, entity_name='input')
pe_out = ProcessingElement(outputs, entity_name='output')
mem_vars.show(title="Non-zero time memory variables")
mem_vars_set = mem_vars.split_on_ports(
strategy="greedy_graph_color", read_ports=1, write_ports=1, total_ports=2
)
memories = []
for i, mem in enumerate(mem_vars_set):
memory = Memory(mem, memory_type="RAM", entity_name=f"memory{i}")
memories.append(memory)
mem.show(title=f"{memory.entity_name}")
memory.assign("greedy_graph_color")
memory.show_content(title=f"Assigned {memory.entity_name}")
direct.show(title="Direct interconnects")
Total running time of the script: (0 minutes 15.660 seconds)
Gallery generated by Sphinx-Gallery