Skip to content
Snippets Groups Projects
Commit 667e6211 authored by Yaman Umuroglu's avatar Yaman Umuroglu
Browse files

[Lookup] add BRAM estimation

parent 33aecc82
No related branches found
No related tags found
No related merge requests found
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
import numpy as np import numpy as np
import os import os
import warnings import warnings
from math import ceil
from finn.core.datatype import DataType from finn.core.datatype import DataType
from finn.custom_op.fpgadataflow.hlscustomop import HLSCustomOp from finn.custom_op.fpgadataflow.hlscustomop import HLSCustomOp
...@@ -321,3 +322,17 @@ class Lookup(HLSCustomOp): ...@@ -321,3 +322,17 @@ class Lookup(HLSCustomOp):
assert ( assert (
context[node.output[0]].shape == exp_oshape context[node.output[0]].shape == exp_oshape
), """Output shape doesn't match expected shape.""" ), """Output shape doesn't match expected shape."""
def bram_estimation(self):
# current calculation assumes embeddings always stored in BRAM_18Ks
width_factor = ceil(self.get_outstream_width() / 16)
depth_factor = ceil(self.get_nodeattr("NumEmbeddings") / 1024)
return width_factor * depth_factor
def bram_efficiency_estimation(self):
bram16_est = self.bram_estimation()
if bram16_est == 0:
return 1
ebits = self.get_outstream_width() * self.get_nodeattr("NumEmbeddings")
bram16_est_capacity = bram16_est * 18 * 1024
return ebits / bram16_est_capacity
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment