.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "examples/latency_offset_scheduling.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code. .. rst-class:: sphx-glr-example-title .. _sphx_glr_examples_latency_offset_scheduling.py: ================================================== Automatic scheduling for different latency-offsets ================================================== This example showcases how one can generate a schedule where the operations have different latency offsets for the different inputs/outputs. .. GENERATED FROM PYTHON SOURCE LINES 9-22 .. code-block:: Python from b_asic.list_schedulers import HybridScheduler from b_asic.schedule import Schedule from b_asic.scheduler import ALAPScheduler, ASAPScheduler from b_asic.sfg_generators import ldlt_matrix_inverse sfg = ldlt_matrix_inverse(N=3, name="matrix-inv", pe="mads") sfg.set_latency_offsets_of_type_name("mads", {"in0": 3, "in1": 0, "in2": 0, "out0": 4}) sfg.set_execution_time_of_type_name("mads", 1) sfg.set_latency_of_type_name("rec", 10) sfg.set_execution_time_of_type_name("rec", 1) .. GENERATED FROM PYTHON SOURCE LINES 23-24 The SFG is .. GENERATED FROM PYTHON SOURCE LINES 24-26 .. code-block:: Python sfg .. raw:: html
%3 in0 A[0,0] (in0) rec0 D_inv[0] (rec0) in0:e->rec0 in1 A[1,0] (in1) rec0.0 rec0->rec0.0 in1.0 in1:e->in1.0 in2 A[1,1] (in2) mads0 mads0 in1.0->mads0 1 mads14 mads14 in1.0->mads14 1 mads0.0 mads0->mads0.0 rec1 D_inv[1] (rec1) mads14->rec1 in2:e->mads14 0 in3 A[2,0] (in3) in3.0 in3:e->in3.0 in4 A[2,1] (in4) mads1 mads1 in3.0->mads1 1 mads13 mads13 in3.0->mads13 1 mads12 mads12 in3.0->mads12 1 mads1.0 mads1->mads1.0 mads13.0 mads13->mads13.0 mads10 mads10 mads12->mads10 0 in4:e->mads13 0 in5 A[2,2] (in5) in5:e->mads12 0 out0 res[0,0] (out0) out1 res[1,0] (out1) mads4 mads4 mads4->out0:w out2 res[1,1] (out2) mads5.0 mads5.0->mads4 2 mads5.0->out1:w mads5 mads5 mads5->mads5.0 out3 res[2,0] (out3) mads7.0 mads7.0->mads5 2 mads7.0->out2:w mads7 mads7 mads7->mads7.0 out4 res[2,1] (out4) mads3.0 mads3.0->out3:w mads2 mads2 mads3.0->mads2 2 mads3 mads3 mads3->mads3.0 out5 res[2,2] (out5) mads9.0 mads9.0->mads7 2 mads9.0->mads3 2 mads9.0->out4:w mads6 mads6 mads9.0->mads6 2 mads9 mads9 mads9->mads9.0 rec2.0 rec2.0->mads9 2 rec2.0->out5:w mads11 mads11 rec2.0->mads11 2 rec2 D_inv[2] (rec2) rec2->rec2.0 rec0.0->mads0 2 rec0.0->mads1 2 rec0.0->mads2 0 mads2->mads4 0 mads1.0->mads12 2 mads1.0->mads2 1 mads1.0->mads6 1 mads1.0->mads11 1 mads0.0->mads14 2 mads0.0->mads13 2 mads0.0->mads4 1 mads0.0->mads5 1 mads0.0->mads3 1 mads6->mads5 0 rec1.0 rec1.0->mads7 0 mads8 mads8 rec1.0->mads8 2 rec1->rec1.0 mads8.0 mads8.0->mads7 1 mads8.0->mads9 1 mads8.0->mads10 2 mads8->mads8.0 dontcare0 dontcare0 dontcare0->mads9 0 mads10->rec2 mads11->mads3 0 dontcare1 dontcare1 dontcare1->mads11 0 mads13.0->mads8 1 mads13.0->mads10 1 dontcare2 dontcare2 dontcare2->mads8 0 dontcare3 dontcare3 dontcare3->mads6 0 dontcare4 dontcare4 dontcare4->mads1 0 dontcare5 dontcare5 dontcare5->mads0 0


.. GENERATED FROM PYTHON SOURCE LINES 27-28 Create an ASAP schedule for reference. .. GENERATED FROM PYTHON SOURCE LINES 28-31 .. code-block:: Python schedule1 = Schedule(sfg, scheduler=ASAPScheduler()) schedule1 .. raw:: html
2026-06-03T14:26:22.279175 image/svg+xml Matplotlib v3.10.9, https://matplotlib.org/


.. GENERATED FROM PYTHON SOURCE LINES 32-33 Create an ALAP schedule for reference. .. GENERATED FROM PYTHON SOURCE LINES 33-36 .. code-block:: Python schedule2 = Schedule(sfg, scheduler=ALAPScheduler()) schedule2 .. raw:: html
2026-06-03T14:26:22.548760 image/svg+xml Matplotlib v3.10.9, https://matplotlib.org/


.. GENERATED FROM PYTHON SOURCE LINES 37-38 Create a resource restricted schedule. .. GENERATED FROM PYTHON SOURCE LINES 38-41 .. code-block:: Python schedule3 = Schedule(sfg, scheduler=HybridScheduler()) schedule3 .. raw:: html
2026-06-03T14:26:22.822817 image/svg+xml Matplotlib v3.10.9, https://matplotlib.org/


.. GENERATED FROM PYTHON SOURCE LINES 42-43 Create another schedule with shorter scheduling time by enabling cyclic. .. GENERATED FROM PYTHON SOURCE LINES 43-51 .. code-block:: Python schedule4 = Schedule( sfg, scheduler=HybridScheduler(), schedule_time=49, cyclic=True, ) schedule4 .. raw:: html
2026-06-03T14:26:23.110797 image/svg+xml Matplotlib v3.10.9, https://matplotlib.org/


.. GENERATED FROM PYTHON SOURCE LINES 52-53 Push the schedule time to the rate limit for one MADS operator. .. GENERATED FROM PYTHON SOURCE LINES 53-60 .. code-block:: Python schedule5 = Schedule( sfg, scheduler=HybridScheduler(), schedule_time=15, cyclic=True, ) schedule5 .. raw:: html
2026-06-03T14:26:23.524012 image/svg+xml Matplotlib v3.10.9, https://matplotlib.org/


.. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 1.545 seconds) .. _sphx_glr_download_examples_latency_offset_scheduling.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: latency_offset_scheduling.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: latency_offset_scheduling.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: latency_offset_scheduling.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_