1111from fpgadataflow .multifpga .utils import get_model
1212from pathlib import Path
1313from test_multifpga_sdp_creation import create_sdp_ready_model_no_branches
14- from typing import TYPE_CHECKING , Any , Literal
1514
1615from finn .builder .build_dataflow_config import (
1716 DataflowBuildConfig ,
1817 MFCommunicationKernel ,
1918 MFTopology ,
2019 MFVerbosity ,
21- MIPSolver ,
2220 PartitioningConfiguration ,
2321 PartitioningStrategy ,
2422 ShellFlowType ,
2523)
26- from finn .transformation .fpgadataflow .multifpga .assign_metadata import AssignNetworkMetadata
27- from finn .transformation .fpgadataflow .multifpga .aurora_metadata import AuroraNetworkMetadata
24+ from finn .transformation .fpgadataflow .multifpga .aurora . metadata import AuroraNetworkMetadata
25+ from finn .transformation .fpgadataflow .multifpga .aurora . partitioner import AuroraPartitioner
2826from finn .transformation .fpgadataflow .multifpga .communication_kernels import PrepareAuroraFlow
2927from finn .transformation .fpgadataflow .multifpga .create_multi_sdp import (
3028 CreateMultiFPGAStreamingDataflowPartition ,
3129)
32- from finn .transformation .fpgadataflow .multifpga .partitioner import (
33- AuroraPartitioner ,
34- PartitionForMultiFPGA ,
35- )
36- from finn .transformation .fpgadataflow .multifpga .utils import available_resources , get_device_id
30+ from finn .transformation .fpgadataflow .multifpga .create_network_metadata import CreateNetworkMetadata
31+ from finn .transformation .fpgadataflow .multifpga .partition_model import PartitionForMultiFPGA
3732from finn .util .basic import make_build_dir
3833from finn .util .exception import (
3934 FINNError ,
4035 FINNMultiFPGAConfigError ,
4136 FINNMultiFPGANoPartitionerSolutionError ,
4237)
38+ from finn .util .fpgadataflow import get_device_id
4339from finn .util .platforms import platforms
44-
45- if TYPE_CHECKING :
46- from qonnx .core .modelwrapper import ModelWrapper
40+ from finn .util .resources import available_resources
4741
4842
4943@pytest .mark .auroraflow
5044@pytest .mark .multifpga
51- @pytest .mark .parametrize ("board" , ["U280" , "U55C" , "Pynq-Z1" ])
45+ @pytest .mark .parametrize ("board" , ["U280" , "U55C" ])
5246@pytest .mark .parametrize ("topology" , [MFTopology .CHAIN ])
5347@pytest .mark .parametrize (
5448 "communication_kernel_args" ,
@@ -78,13 +72,8 @@ def test_aurora_packaging_integrated(
7872 """
7973 devices , nodes = device_node_combinations
8074
81- # Check which creator we use
82- assignment_order = {MFTopology .CHAIN : "linear" }[topology ]
83-
8475 # Create an SDP ready branchless model
85- model = create_sdp_ready_model_no_branches (
86- nodes , devices , assignment_type , assignment_order , shuffle_devices
87- )
76+ model = create_sdp_ready_model_no_branches (nodes , devices , assignment_type , shuffle_devices )
8877
8978 # Create a config based on the test parameters
9079 cfg = DataflowBuildConfig (
@@ -108,12 +97,19 @@ def test_aurora_packaging_integrated(
10897 )
10998 )
11099 model = model .transform (
111- AssignNetworkMetadata (
112- communication_kernel = cfg .partitioning_configuration .communication_kernel ,
113- topology = topology ,
114- verbosity = MFVerbosity .NONE ,
100+ CreateNetworkMetadata (
101+ cfg .partitioning_configuration .communication_kernel , MFVerbosity .NONE
115102 )
116103 )
104+
105+ # No kernels packaged yet
106+ meta = AuroraNetworkMetadata .from_model (model )
107+ unprepared_aurora_kernels = len (meta .get_unprepared_aurora_kernels ())
108+ if devices > 1 :
109+ assert unprepared_aurora_kernels == (devices - 1 ) * 2
110+ else :
111+ assert unprepared_aurora_kernels == 0
112+
117113 model = model .transform (
118114 PrepareAuroraFlow (
119115 cfg ._resolve_vitis_platform (), # noqa
@@ -124,6 +120,8 @@ def test_aurora_packaging_integrated(
124120
125121 # Try and load the previously generated metadata from the models metadata prop
126122 meta = AuroraNetworkMetadata .from_model (model )
123+ unprepared_aurora_kernels = len (meta .get_unprepared_aurora_kernels ())
124+ assert unprepared_aurora_kernels == 0
127125
128126 # Check that the AuroraFlow storage directory got saved in the model metadata
129127 aurora_storage = model .get_metadata_prop ("aurora_storage" )
@@ -134,6 +132,10 @@ def test_aurora_packaging_integrated(
134132 assert aurora_storage .exists ()
135133
136134 # Check if each device had its respective kernels packaged
135+ if devices == 1 :
136+ assert len (meta .data .keys ()) == 0
137+ else :
138+ assert len (meta .data .keys ()) == devices
137139 for kerneldata in meta .data .values ():
138140 for aurora in kerneldata :
139141 assert aurora .aurora_xo is not None
@@ -142,7 +144,7 @@ def test_aurora_packaging_integrated(
142144 @pytest .mark .multifpga
143145 @pytest .mark .slow
144146 def test_aurora_package_single (
145- self , communication_kernel_args : dict [str , str ], board : str
147+ self , communication_kernel_args : dict [str , str ], board : str , topology : MFTopology
146148 ) -> None :
147149 """Test Aurora packaging. In detail:
148150 - Check that the names of the XO files produced by AuroraFlow didn't change.
@@ -154,6 +156,7 @@ def test_aurora_package_single(
154156 board = board ,
155157 partitioning_configuration = PartitioningConfiguration (
156158 num_fpgas = 2 ,
159+ topology = topology ,
157160 communication_kernel = MFCommunicationKernel .AURORA ,
158161 communication_kernel_arguments = communication_kernel_args ,
159162 ),
@@ -169,10 +172,14 @@ def test_aurora_package_single(
169172 build_dir = prep .aurora_storage / "auroraflow_build_dev0_ind0"
170173 assert build_dir .exists ()
171174 assert res .exists ()
172- res = prep .package_single ("" , 1 , 2 )
173- build_dir = prep .aurora_storage / "auroraflow_build_dev1_ind2"
174- assert build_dir .exists ()
175- assert res .exists ()
175+
176+ # On devices like the U280, there are only 2 QSFPs, so an index 2 (third kernel) cannot
177+ # be produced, hence the kernel should not be there.
178+ with pytest .raises (FINNError ):
179+ res = prep .package_single ("" , 1 , 2 )
180+ build_dir = prep .aurora_storage / "auroraflow_build_dev1_ind2"
181+ assert build_dir .exists ()
182+ assert res .exists ()
176183
177184
178185@pytest .mark .auroraflow
@@ -441,33 +448,15 @@ def test_objective_regression(
441448 TODO: Save recent CI run data in proper infrastructure as soon as we have set it
442449 up, instead of hardcoding the values.
443450 """
444- flow_type = self .get_shell_flow_type (board )
445- model , _ = self .make_model (
446- model_type , f"test_regression_model_{ '_' .join (map (str , (model_type )))} "
447- )
448- _ , _ , part = self .prepare_and_partition_model (
449- model ,
450- board ,
451- flow_type ,
452- 2 ,
453- topology ,
454- strategy ,
455- True ,
456- model_type [0 ],
457- max_util = 0.85 ,
458- ideal_util = 0.75 ,
459- ports_per_device = 2 ,
460- separate_iodmas = True ,
461- target_fps = 10 ,
462- mvau_wwidth_max = 1024 ,
463- synth_clk_ns = 5.0 ,
464- solver = None ,
465- )
466- assert part .partitioner is not None
467- assert part .partitioner .model .objective .x is not None
468- assert part .partitioner .model .objective .x < 0
451+ # flow_type = self.get_shell_flow_type(board)
452+
453+ # TODO
469454 raise NotImplementedError ()
470455
456+ # assert part.partitioner is not None
457+ # assert part.partitioner.model.objective.x is not None
458+ # assert part.partitioner.model.objective.x < 0
459+
471460 @pytest .mark .parametrize (
472461 "distribution" ,
473462 ["equal-LUT" , "equal-FF" ],
0 commit comments