From ab8fe1e200a96e16d50fc8cfe9f214966d92cb98 Mon Sep 17 00:00:00 2001
From: Yaman Umuroglu <maltanar@gmail.com>
Date: Thu, 22 Sep 2022 09:58:44 +0200
Subject: [PATCH] [Refactor] remove remaining outFIFODepth refs

---
 .../transformation/fpgadataflow/derive_characteristic.py   | 5 +----
 src/finn/transformation/fpgadataflow/insert_fifo.py        | 7 ++++---
 2 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/src/finn/transformation/fpgadataflow/derive_characteristic.py b/src/finn/transformation/fpgadataflow/derive_characteristic.py
index c171fce3c..849ecea1e 100644
--- a/src/finn/transformation/fpgadataflow/derive_characteristic.py
+++ b/src/finn/transformation/fpgadataflow/derive_characteristic.py
@@ -149,7 +149,7 @@ class DeriveFIFOSizes(NodeLocalTransformation):
                 assert (
                     len(prod_chrc) == 2 * period
                 ), "Found unexpected characterization attribute"
-                if prod.get_nodeattr("outFIFODepth") > 2:
+                if any({[x > 2 for x in prod.get_nodeattr("outFIFODepths")]}):
                     # FIFO depth already set, can skip this node
                     return (node, False)
 
@@ -180,9 +180,6 @@ class DeriveFIFOSizes(NodeLocalTransformation):
                 # set output FIFO depth for this (producing) node
                 # InsertFIFO looks at the max of (outFIFODepth, inFIFODepth)
                 # for each tensor
-                if len(out_fifo_depths) > 0:
-                    prod.set_nodeattr("outFIFODepth", out_fifo_depths[0])
-                # used only for multi-producer nodes
                 prod.set_nodeattr("outFIFODepths", out_fifo_depths)
 
             except KeyError:
diff --git a/src/finn/transformation/fpgadataflow/insert_fifo.py b/src/finn/transformation/fpgadataflow/insert_fifo.py
index e75d1880c..b3c83d96e 100644
--- a/src/finn/transformation/fpgadataflow/insert_fifo.py
+++ b/src/finn/transformation/fpgadataflow/insert_fifo.py
@@ -256,10 +256,11 @@ class InsertFIFO(Transformation):
                     ), """Insert tlast marker should be done
                         after inserting the FIFOs"""
                     n0 = getCustomOp(final_node)
+                    out_ind = list(final_node.output).index(graph_out_name)
                     # determine fifo node attributes
-                    fld_shape = n0.get_folded_output_shape()
-                    dtype = n0.get_output_datatype()
-                    fifo_depth = n0.get_nodeattr("outFIFODepth")
+                    fld_shape = n0.get_folded_output_shape(out_ind)
+                    dtype = n0.get_output_datatype(out_ind)
+                    fifo_depth = n0.get_nodeattr("outFIFODepths")[out_ind]
 
                     if fifo_depth <= 2:
                         warnings.warn("Overriding output FIFO depth to 32")
-- 
GitLab