Correction in python script for compute graph

Buffer numbering issue for memory optimzation and buffer sharing
pull/53/head
Christophe Favergeon 3 years ago
parent 06c439f7e7
commit 142dcec5c3

@ -54,7 +54,7 @@ class Configuration:
# Prefix to add before the global FIFO buffer names # Prefix to add before the global FIFO buffer names
self.prefix = "" self.prefix = ""
# Experimental so disbaled by default # Experimental so disabled by default
self.memoryOptimization = False self.memoryOptimization = False
# Path to CG module for Python simu # Path to CG module for Python simu

@ -359,7 +359,7 @@ class Graph():
allBuffers=[] allBuffers=[]
# Compute a graph describing when FIFOs are used at the same time # Compute a graph describing when FIFOs are used at the same time
# The use graph coloring to allocate buffer to those FIFOs. # Then use graph coloring to allocate buffer to those FIFOs.
# Then size the buffer based on the longest FIFO using it # Then size the buffer based on the longest FIFO using it
if config.memoryOptimization: if config.memoryOptimization:
G = nx.Graph() G = nx.Graph()
@ -376,7 +376,7 @@ class Graph():
currentTime=0 currentTime=0
while currentTime<=maxTime: while currentTime<=maxTime:
# Remove fifo no more active. # Remove fifo no more active.
# Thei stop time < currenTime # Their stop time < currentTime
toDelete=[] toDelete=[]
for k in active: for k in active:
start,stop=k._liveInterval start,stop=k._liveInterval
@ -394,9 +394,11 @@ class Graph():
start,stop=fifo._liveInterval start,stop=fifo._liveInterval
# If a src -> node -> dst # If a src -> node -> dst
# At time t, node will read for src and the stop time # At time t, node will read for src and the stop time
# will be currentTime t. # will be currentTime t because once read
# the buffer can be reused.
# And it will write to dst and the start time will be # And it will write to dst and the start time will be
# currentTime # currentTime because once written the buffer
# cannot be used again until it has been read.
# So, src and dst are both live at this time. # So, src and dst are both live at this time.
# Which means the condition on the stop time must be # Which means the condition on the stop time must be
# stop >= currentTime and not a strict comparison # stop >= currentTime and not a strict comparison
@ -410,6 +412,7 @@ class Graph():
# To debug and display the graph # To debug and display the graph
if False: if False:
import matplotlib.pyplot as plt
labels={} labels={}
for n in G.nodes: for n in G.nodes:
labels[n]="%s -> %s" % (n.src.owner.nodeName,n.dst.owner.nodeName) labels[n]="%s -> %s" % (n.src.owner.nodeName,n.dst.owner.nodeName)
@ -450,6 +453,9 @@ class Graph():
sharedA = FifoBuffer(theID,CType(UINT8),maxSizes[theID]) sharedA = FifoBuffer(theID,CType(UINT8),maxSizes[theID])
allBuffers.append(sharedA) allBuffers.append(sharedA)
# bufferID must start after all shared buffers
bufferID = bufferID + 1
for fifo in allFIFOs: for fifo in allFIFOs:
# Use shared buffer if memory optimization # Use shared buffer if memory optimization
if fifo.isArray and config.memoryOptimization: if fifo.isArray and config.memoryOptimization:
@ -472,6 +478,7 @@ class Graph():
#for fifo in allFIFOs: #for fifo in allFIFOs:
# fifo.dump() # fifo.dump()
return(allBuffers) return(allBuffers)

@ -3,8 +3,7 @@
{% block schedArray %} {% block schedArray %}
/* /*
Description of the scheduling. It is a list of nodes to call. Description of the scheduling.
The values are indexes in the previous array.
*/ */
static unsigned int schedule[{{schedLen}}]= static unsigned int schedule[{{schedLen}}]=

@ -1,2 +1,2 @@
# Python wrapper version # Python wrapper version
__version__ = "1.7.0" __version__ = "1.7.1"

Loading…
Cancel
Save