Skip to content

Commit d0ed93d

Browse files
committed
fix tiling constraints for Dense and DW
1 parent 97c25b1 commit d0ed93d

2 files changed

Lines changed: 8 additions & 15 deletions

File tree

Deeploy/Targets/Neureka/TileConstraints/NeurekaDenseConstraint.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -219,9 +219,8 @@ def serializeTilingSolution(
219219
for absoluteCube in absoluteOutputCubes:
220220
COffset, CSize = absoluteCube.absoluteOffset[-1], absoluteCube.rectangle.dims[-1]
221221
# WeightCube = HyperRectangle((COffset, 0, 0), (CSize, weightShape[-2], weightShape[-1]))
222-
WeightCube = HyperRectangle(
223-
(COffset, 0, 0, 0),
224-
(CSize, weightShape[-3], weightShape[-2], weightShape[-1]))
222+
WeightCube = HyperRectangle((COffset, 0, 0, 0),
223+
(CSize, weightShape[-3], weightShape[-2], weightShape[-1]))
225224
replacements['weight_addr_offset'].append(calculateFlatOffsetInBytes(WeightCube, weightBuffer))
226225
else:
227226
inputWeightBaseOffsets, outputWeightBaseOffsets = cls.extractBaseAddr(tilingSolution, targetMemLevel,
@@ -231,7 +230,8 @@ def serializeTilingSolution(
231230

232231
for cube, load in zip(outputCubes, inputLoadSchedule):
233232
COffset, CSize = cube.offset[-1], cube.dims[-1]
234-
load['weight'] = HyperRectangle((COffset, 0, 0), (CSize, weightShape[-2], weightShape[-1]))
233+
load['weight'] = HyperRectangle((COffset, 0, 0, 0),
234+
(CSize, weightShape[-3], weightShape[-2], weightShape[-1]))
235235

236236
tilingSchedule = TilingSchedule(inputBaseOffsets, outputBaseOffsets, inputLoadSchedule, outputLoadSchedule)
237237
variableReplacementSchedule = VariableReplacementScheme(replacements, replacementTypes)

Deeploy/Targets/Neureka/TileConstraints/NeurekaDepthwiseConstraint.py

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,7 @@ def addGeometricalConstraint(tilerModel: TilerModel, parseDict: Dict, ctxt: Netw
4949
tilerModel.addConstraint(outputBatchVar == inputBatchVar)
5050
tilerModel.addConstraint(outputChannelVar == inputChannelVar)
5151

52-
weightBuffer = ctxt.lookup(weightBufferName)
53-
if hasattr(weightBuffer, "_memoryLevel") and weightBuffer._memoryLevel == "WeightMemory_SRAM":
54-
tilerModel.addConstraint(weightOutChannelVar == weightOutChannelVar.Max())
55-
else:
56-
tilerModel.addConstraint(weightOutChannelVar == outputChannelVar)
52+
tilerModel.addConstraint(weightOutChannelVar == weightOutChannelVar.Max())
5753

5854
tilerModel.addConstraint(inputHeightVar >= 3)
5955
tilerModel.addConstraint(inputWidthVar >= 3)
@@ -214,10 +210,8 @@ def serializeTilingSolution(
214210
replacementTypes['weight_addr_offset'] = PointerClass(uint32_t)
215211
for absoluteCube in absoluteOutputCubes:
216212
COffset, CSize = absoluteCube.absoluteOffset[-1], absoluteCube.rectangle.dims[-1]
217-
# WeightCube = HyperRectangle((COffset, 0, 0), (CSize, weightShape[-2], weightShape[-1]))
218-
WeightCube = HyperRectangle(
219-
(COffset, 0, 0, 0),
220-
(CSize, weightShape[-3], weightShape[-2], weightShape[-1]))
213+
WeightCube = HyperRectangle((COffset, 0, 0, 0),
214+
(CSize, weightShape[-3], weightShape[-2], weightShape[-1]))
221215
replacements['weight_addr_offset'].append(calculateFlatOffsetInBytes(WeightCube, weightBuffer))
222216
else:
223217
inputWeightBaseOffsets, outputWeightBaseOffsets = cls.extractBaseAddr(tilingSolution, targetMemLevel,
@@ -226,8 +220,7 @@ def serializeTilingSolution(
226220
outputBaseOffsets.update(outputWeightBaseOffsets)
227221

228222
for cube, load in zip(outputCubes, inputLoadSchedule):
229-
COffset, CSize = cube.offset[-1], cube.dims[-1]
230-
load['weight'] = HyperRectangle((COffset, 0, 0), (CSize, weightShape[-2], weightShape[-1]))
223+
load['weight'] = HyperRectangle((0,) * len(weightShape), tuple(weightShape))
231224

232225
tilingSchedule = TilingSchedule(inputBaseOffsets, outputBaseOffsets, inputLoadSchedule, outputLoadSchedule)
233226
variableReplacementSchedule = VariableReplacementScheme(replacements, replacementTypes)

0 commit comments

Comments
 (0)