Skip to content

Commit 0da9cd5

Browse files
committed
fix: resolve conflicts after rebase
1 parent bdf735d commit 0da9cd5

10 files changed

Lines changed: 59 additions & 51 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: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,8 @@
1717

1818
AddMapper = NodeMapper(AddParser(), BasicAddBindings)
1919

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

2423
class MagiaVariableBuffer(VariableBuffer):
2524

@@ -41,6 +40,7 @@ def _bufferRepresentation(self):
4140
"_memoryLevel": memoryLevel
4241
}
4342

43+
4444
class MagiaTransientBuffer(TransientBuffer):
4545

4646
initTemplate = AllocateTemplate.magiaInitTemplate
@@ -54,11 +54,8 @@ def _bufferRepresentation(self):
5454
else:
5555
memoryLevel = None
5656

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

6360
class MagiaConstantBuffer(ConstantBuffer):
6461

@@ -78,6 +75,7 @@ def _bufferRepresentation(self):
7875

7976
return operatorRepresentation
8077

78+
8179
class MagiaStructBuffer(StructBuffer):
8280

8381
initTemplate = BasicAllocateTemplate.referenceStructInitTemplate
@@ -91,10 +89,7 @@ class MagiaStructBuffer(StructBuffer):
9189
],
9290
name = "MagiaOptimizer")
9391

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

9994

10095
class MagiaMeshEngine(DeploymentEngine):
@@ -108,6 +103,7 @@ def __init__(self,
108103
super().__init__(name, Mapping, initCode, includeList)
109104
self.n_tiles = n_tiles
110105

106+
111107
class MagiaPlatform(DeploymentPlatform):
112108

113109
def __init__(self,
@@ -116,4 +112,4 @@ def __init__(self,
116112
constantBuffer = MagiaConstantBuffer,
117113
structBuffer = MagiaStructBuffer,
118114
transientBuffer = MagiaTransientBuffer) -> None:
119-
super().__init__(engines, variableBuffer, constantBuffer, structBuffer, transientBuffer)
115+
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: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -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: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -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)