Skip to content

Commit 753d57f

Browse files
committed
fix: resolve conflicts after rebase
1 parent bdf735d commit 753d57f

10 files changed

Lines changed: 63 additions & 57 deletions

File tree

Deeploy/Targets/Magia/Deployer.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
from Deeploy.CommonExtensions.NetworkDeployers.SignPropDeployer import SignPropDeployer
1212
from Deeploy.DeeployTypes import ConstantBuffer, DeploymentPlatform, NodeTemplate, TopologyOptimizer, VariableBuffer
1313

14+
1415
class MagiaDeployer(SignPropDeployer):
1516

1617
def __init__(self,

Deeploy/Targets/Magia/Platform.py

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,16 @@
77

88
from Deeploy.DeeployTypes import ConstantBuffer, DeploymentEngine, DeploymentPlatform, NetworkContext, NodeMapper, \
99
NodeTemplate, StructBuffer, TopologyOptimizer, TransientBuffer, VariableBuffer
10-
11-
from Deeploy.Targets.Generic.Templates import AllocateTemplate as BasicAllocateTemplate
1210
from Deeploy.Targets.Generic.Bindings import BasicAddBindings
13-
from Deeploy.Targets.Generic.Parsers import AddParser
1411
from Deeploy.Targets.Generic.Layers import AddLayer
15-
12+
from Deeploy.Targets.Generic.Parsers import AddParser
13+
from Deeploy.Targets.Generic.Templates import AllocateTemplate as BasicAllocateTemplate
1614
from Deeploy.Targets.Magia.Templates import AllocateTemplate, FreeTemplate
1715

1816
AddMapper = NodeMapper(AddParser(), BasicAddBindings)
1917

20-
MagiaMapping = {
21-
'Add': AddLayer([AddMapper])
22-
}
18+
MagiaMapping = {'Add': AddLayer([AddMapper])}
19+
2320

2421
class MagiaVariableBuffer(VariableBuffer):
2522

@@ -41,6 +38,7 @@ def _bufferRepresentation(self):
4138
"_memoryLevel": memoryLevel
4239
}
4340

41+
4442
class MagiaTransientBuffer(TransientBuffer):
4543

4644
initTemplate = AllocateTemplate.magiaInitTemplate
@@ -54,11 +52,8 @@ def _bufferRepresentation(self):
5452
else:
5553
memoryLevel = None
5654

57-
return {"type": self._type,
58-
"name": self.name,
59-
"size": self.size,
60-
"_memoryLevel": memoryLevel
61-
}
55+
return {"type": self._type, "name": self.name, "size": self.size, "_memoryLevel": memoryLevel}
56+
6257

6358
class MagiaConstantBuffer(ConstantBuffer):
6459

@@ -78,6 +73,7 @@ def _bufferRepresentation(self):
7873

7974
return operatorRepresentation
8075

76+
8177
class MagiaStructBuffer(StructBuffer):
8278

8379
initTemplate = BasicAllocateTemplate.referenceStructInitTemplate
@@ -91,10 +87,7 @@ class MagiaStructBuffer(StructBuffer):
9187
],
9288
name = "MagiaOptimizer")
9389

94-
95-
_includeList = [
96-
"tile.h", "idma.h", "redmule.h", "eventunit.h"
97-
]
90+
_includeList = ["tile.h", "idma.h", "redmule.h", "eventunit.h"]
9891

9992

10093
class MagiaMeshEngine(DeploymentEngine):
@@ -108,6 +101,7 @@ def __init__(self,
108101
super().__init__(name, Mapping, initCode, includeList)
109102
self.n_tiles = n_tiles
110103

104+
111105
class MagiaPlatform(DeploymentPlatform):
112106

113107
def __init__(self,
@@ -116,4 +110,4 @@ def __init__(self,
116110
constantBuffer = MagiaConstantBuffer,
117111
structBuffer = MagiaStructBuffer,
118112
transientBuffer = MagiaTransientBuffer) -> None:
119-
super().__init__(engines, variableBuffer, constantBuffer, structBuffer, transientBuffer)
113+
super().__init__(engines, variableBuffer, constantBuffer, structBuffer, transientBuffer)

DeeployTest/deeployRunner_magia.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/usr/bin/env python
2+
# SPDX-FileCopyrightText: 2025 ETH Zurich and University of Bologna
3+
#
4+
# SPDX-License-Identifier: Apache-2.0
5+
6+
import sys
7+
8+
from testUtils.deeployRunner import main
9+
10+
if __name__ == "__main__":
11+
12+
# Define parser setup callback to add Siracusa-specific arguments
13+
def setup_parser(parser):
14+
parser.add_argument('--tiles', type = int, default = 4, help = 'Number of mesh tiles (default: 4)')
15+
16+
sys.exit(
17+
main(
18+
default_platform = "Magia",
19+
default_simulator = "none",
20+
tiling_enabled = False,
21+
parser_setup_callback = setup_parser,
22+
))

DeeployTest/generateNetwork.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020
from Deeploy.DeeployTypes import _NoVerbosity
2121
from Deeploy.Logging import DEFAULT_LOGGER as log
2222
from Deeploy.Targets.CortexM.Platform import CMSISPlatform
23-
from Deeploy.Targets.PULPOpen.Platform import PULPClusterEngine, PULPPlatform
2423
from Deeploy.Targets.Magia.Platform import MagiaMeshEngine, MagiaPlatform
24+
from Deeploy.Targets.PULPOpen.Platform import PULPClusterEngine, PULPPlatform
2525

2626

2727
def generateNetwork(args):
@@ -88,7 +88,7 @@ def generateNetwork(args):
8888
clusters = [engine for engine in platform.engines if isinstance(engine, PULPClusterEngine)]
8989
for cluster in clusters:
9090
cluster.n_cores = args.cores
91-
91+
9292
meshes = [engine for engine in platform.engines if isinstance(engine, MagiaMeshEngine)]
9393
for mesh in meshes:
9494
mesh.n_tiles = args.tiles
@@ -195,7 +195,7 @@ def generateNetwork(args):
195195
parser.add_argument("--cores",
196196
type = int,
197197
default = 1,
198-
help = 'Number of cores on which the network is run.'
198+
help = 'Number of cores on which the network is run.'
199199
'Currently, required for im2col buffer sizing on Siracusa. Default: 1.\n')
200200
parser.add_argument("--tiles",
201201
type = int,

DeeployTest/testRunner_magia.py

Lines changed: 0 additions & 24 deletions
This file was deleted.

DeeployTest/testUtils/codeGenerate.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88
import numpy as np
99

1010
from Deeploy.DeeployTypes import CodeGenVerbosity, ConstantBuffer, NetworkDeployer, VariableBuffer
11+
from Deeploy.Targets.Magia.Platform import MagiaPlatform
1112
from Deeploy.Targets.MemPool.Platform import MemPoolPlatform
1213
from Deeploy.Targets.PULPOpen.Platform import MemoryPULPPlatform, MemoryPULPPlatformWrapper, PULPPlatform
13-
from Deeploy.Targets.Magia.Platform import MagiaPlatform
1414

1515
_TEXT_ALIGN = 30
1616

@@ -128,7 +128,7 @@ def generateTestNetworkHeader(deployer: NetworkDeployer) -> str:
128128
#include <stdio.h>
129129
#include <stdlib.h>
130130
"""
131-
131+
132132
retStr += deployer.generateIncludeString()
133133
if isinstance(deployer.Platform, (PULPPlatform, MemoryPULPPlatform, MemoryPULPPlatformWrapper, MagiaPlatform)):
134134
retStr += """
@@ -160,7 +160,7 @@ def generateTestNetworkImplementation(deployer: NetworkDeployer, verbosityCfg: C
160160
#include <math.h>
161161
"""
162162
retStr += deployer.generateIncludeString()
163-
163+
164164
retStr += """
165165
#include "Network.h"
166166
"""

DeeployTest/testUtils/core/execution.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,10 @@ def run_simulation(config: DeeployTestConfig, skip: bool = False) -> TestResult:
199199
return test_result
200200

201201

202-
def run_complete_test(config: DeeployTestConfig, skipgen: bool = False, skipsim: bool = False) -> TestResult:
202+
def run_complete_test(config: DeeployTestConfig,
203+
skipgen: bool = False,
204+
skipbuild: bool = False,
205+
skipsim: bool = False) -> TestResult:
203206
"""
204207
Run a complete test: generate, configure, build, and simulate.
205208
"""
@@ -208,11 +211,14 @@ def run_complete_test(config: DeeployTestConfig, skipgen: bool = False, skipsim:
208211
# Step 1: Generate network
209212
generate_network(config, skip = skipgen)
210213

211-
# Step 2: Configure CMake
212-
configure_cmake(config)
214+
if skipbuild:
215+
log.info(f"Skipping cmake configuration and binary building for {config.test_name}")
216+
else:
217+
# Step 2: Configure CMake
218+
configure_cmake(config)
213219

214-
# Step 3: Build binary
215-
build_binary(config)
220+
# Step 3: Build binary
221+
build_binary(config)
216222

217223
# Step 4: Run simulation
218224
result = run_simulation(config, skip = skipsim)

DeeployTest/testUtils/deeployRunner.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,11 @@ def __init__(self,
8383
action = 'store_true',
8484
default = False,
8585
help = 'Skip network generation (reuse existing generated code)\n')
86+
self.add_argument('--skipbuild',
87+
dest = 'skipbuild',
88+
action = 'store_true',
89+
default = False,
90+
help = 'Skip network simulation\n')
8691
self.add_argument('--skipsim',
8792
dest = 'skipsim',
8893
action = 'store_true',
@@ -347,6 +352,7 @@ def main(default_platform: Optional[str] = None,
347352
"snitch": "Snitch",
348353
"chimera": "Chimera",
349354
"softhier": "SoftHier",
355+
"magia": "Magia",
350356
}
351357

352358
if args.platform:
@@ -387,6 +393,7 @@ def main(default_platform: Optional[str] = None,
387393
"Snitch": "gvsoc",
388394
"Chimera": "gvsoc",
389395
"SoftHier": "gvsoc",
396+
"Magia": "none",
390397
}
391398
simulator = simulator_map.get(platform, "host")
392399
log.info(f"No simulator specified, using default for {platform}: {simulator}")
@@ -409,7 +416,7 @@ def main(default_platform: Optional[str] = None,
409416
print_configuration(config)
410417

411418
try:
412-
result = run_complete_test(config, skipgen = args.skipgen, skipsim = args.skipsim)
419+
result = run_complete_test(config, skipgen = args.skipgen, skipbuild = args.skipbuild, skipsim = args.skipsim)
413420

414421
print_colored_result(result, config.test_name)
415422

DeeployTest/testUtils/platformMapping.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
from Deeploy.Targets.Neureka.Platform import MemoryNeurekaPlatform, MemoryNeurekaPlatformWrapper, NeurekaOptimizer, \
2525
NeurekaPlatform
2626
from Deeploy.Targets.PULPOpen.Deployer import PULPDeployer
27-
from Deeploy.Targets.PULPOpen.Platform import MemoryPULPPlatform, MemoryPULPPlatformWrapper, PULPOptimizer, PULPPlatform
27+
from Deeploy.Targets.PULPOpen.Platform import MemoryPULPPlatform, MemoryPULPPlatformWrapper, PULPOptimizer, PULPPlatform
2828
from Deeploy.Targets.Snitch.Deployer import SnitchDeployer
2929
from Deeploy.Targets.Snitch.Platform import SnitchOptimizer, SnitchPlatform
3030
from Deeploy.Targets.SoftHier.Deployer import SoftHierDeployer
@@ -256,11 +256,11 @@ def mapDeployer(platform: DeploymentPlatform,
256256

257257
elif isinstance(platform, (MagiaPlatform)):
258258
if loweringOptimizer is None:
259-
loweringOptimizer = MagiaOptimizer
259+
loweringOptimizer = MagiaOptimizer
260260

261261
if default_channels_first is None:
262262
default_channels_first = False
263-
263+
264264
deployer = MagiaDeployer(graph,
265265
platform,
266266
inputTypes,

DeeployTest/testUtils/testRunner.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,7 @@ def generate_test(self):
357357

358358
if self._platform in ["Siracusa", "Siracusa_w_neureka"]:
359359
command += f" --cores={self._args.cores}"
360-
360+
361361
if self._platform in ["Magia"]:
362362
command += f" --tiles={self._args.tiles}"
363363

0 commit comments

Comments
 (0)