Skip to content

Commit 0084047

Browse files
committed
Allocate memory arena first
1 parent d50995b commit 0084047

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

Deeploy/DeeployTypes.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2816,7 +2816,7 @@ def generateBufferAllocationCode(self) -> str:
28162816
outputs = self.outputs()
28172817
callStack = ''
28182818

2819-
for node in reversed(ctxt.globalObjects.values()):
2819+
for node in ctxt.globalObjects.values():
28202820
if isinstance(node, VariableBuffer) and not isinstance(node, StructBuffer):
28212821
assert issubclass(node._type, Pointer), f"Global VariableBuffer {node.name} is not a Pointer!"
28222822
if node._deploy:

Deeploy/TilingExtension/TilerExtension.py

+3
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,9 @@ def _convertCtxtToStaticSchedule(self, ctxt: NetworkContext,
220220
scratchBuffer._instance = scratchBuffer._type(arenaName, ctxt)
221221
scratchBuffer._memoryLevel = level
222222

223+
# JUNGVI: Memory Arena buffers should be allocated first since other variable global buffers may belong to a memory arena
224+
ctxt.globalObjects.move_to_end(scratchBuffer.name, last = False)
225+
223226
# SCHEREMO: Adapt homelevel tensors to their respective arena
224227
for memoryLevel, patternList in memoryMap.items():
225228
if not ctxt.is_global(f"{self.arenaName}_{memoryLevel}"):

0 commit comments

Comments
 (0)