@@ -57,7 +57,8 @@ bool try_pack(t_packer_opts* packer_opts,
57
57
const t_model* user_models,
58
58
const t_model* library_models,
59
59
float interc_delay,
60
- std::vector<t_lb_type_rr_node>* lb_type_rr_graphs) {
60
+ std::vector<t_lb_type_rr_node>* lb_type_rr_graphs,
61
+ bool noc_enabled) {
61
62
auto & helper_ctx = g_vpr_ctx.mutable_cl_helper ();
62
63
auto & atom_ctx = g_vpr_ctx.atom ();
63
64
auto & atom_mutable_ctx = g_vpr_ctx.mutable_atom ();
@@ -142,7 +143,22 @@ bool try_pack(t_packer_opts* packer_opts,
142
143
143
144
int pack_iteration = 1 ;
144
145
bool floorplan_regions_overfull = false ;
145
- bool allow_high_fanout_connectivity_clustering = false ;
146
+ bool allow_high_fanout_connectivity_clustering;
147
+
148
+ /* If the design contains NoC routers, don't use high fanout connectivity
149
+ * to find candidate atoms for growing the current cluster. In NoC-based designs,
150
+ * modules connected to different routers may not have any shared net except for
151
+ * clock and other global signals. By not using high fanout connectivity,
152
+ * atoms belonging to different modules become less likely to be clustered together.
153
+ * This allows the placement engine to place clustered blocks closer to their
154
+ * corresponding NoC router, reducing WL as a result. Otherwise, blocks containing
155
+ * atoms from two different modules would be stretched between two routers.
156
+ */
157
+ if (noc_enabled) {
158
+ allow_high_fanout_connectivity_clustering = false ;
159
+ } else {
160
+ allow_high_fanout_connectivity_clustering = true ;
161
+ }
146
162
147
163
while (true ) {
148
164
free_clustering_data (*packer_opts, clustering_data);
@@ -174,15 +190,20 @@ bool try_pack(t_packer_opts* packer_opts,
174
190
175
191
if (fits_on_device && !floorplan_regions_overfull) {
176
192
break ; // Done
177
- } else if (pack_iteration == 1 && !floorplan_not_fitting) {
193
+ /*
194
+ * If NoC is enabled and the first packing attempt has failed, we don't care whether a floorplan constraint couldn't be satisfied
195
+ * or the clustered netlist does not fit into the target FPGA device. Enabling high fanout connectivity clustering
196
+ * can help with both, so we enable it.
197
+ */
198
+ } else if (noc_enabled && pack_iteration == 1 ) {
178
199
VTR_ASSERT (allow_high_fanout_connectivity_clustering == false );
179
200
allow_high_fanout_connectivity_clustering = true ;
180
201
VTR_LOG (" Packing failed to fit on device. Re-packing with: unrelated_logic_clustering=%s balance_block_type_util=%s allow_high_fanout_connectivity_clustering=%s\n " ,
181
202
(allow_unrelated_clustering ? " true" : " false" ),
182
203
(balance_block_type_util ? " true" : " false" ),
183
204
(allow_high_fanout_connectivity_clustering ? " true" : " false" ));
184
- } else if (pack_iteration == 2 && !floorplan_not_fitting ) {
185
- // 1st pack attempt was unsucessful (i.e. not dense enough) and we have control of unrelated clustering
205
+ } else if (!floorplan_not_fitting && ((noc_enabled && pack_iteration == 2 ) || (!noc_enabled && pack_iteration == 1 )) ) {
206
+ // 1st pack attempt was unsuccessful (i.e. not dense enough) and we have control of unrelated clustering
186
207
//
187
208
// Turn it on to increase packing density
188
209
if (packer_opts->allow_unrelated_clustering == e_unrelated_clustering::AUTO) {
@@ -207,21 +228,21 @@ bool try_pack(t_packer_opts* packer_opts,
207
228
* we create attraction groups for partitions with overfull regions (pack those atoms more densely). We continue this way
208
229
* until the last iteration, when we create attraction groups for every partition, if needed.
209
230
*/
210
- } else if (pack_iteration == 1 && floorplan_not_fitting ) {
231
+ } else if (floorplan_not_fitting && ((!noc_enabled && pack_iteration == 1 ) || (noc_enabled && pack_iteration == 2 )) ) {
211
232
VTR_LOG (" Floorplan regions are overfull: trying to pack again using cluster attraction groups. \n " );
212
233
attraction_groups.create_att_groups_for_overfull_regions ();
213
234
attraction_groups.set_att_group_pulls (1 );
214
235
215
- } else if (pack_iteration >= 2 && pack_iteration < 5 && floorplan_not_fitting ) {
216
- if (pack_iteration == 2 ) {
236
+ } else if (floorplan_not_fitting && ((!noc_enabled && pack_iteration >= 2 && pack_iteration < 5 ) || (noc_enabled && pack_iteration >= 3 && pack_iteration < 6 )) ) {
237
+ if ((!noc_enabled && pack_iteration == 2 ) || (noc_enabled && pack_iteration == 3 ) ) {
217
238
VTR_LOG (" Floorplan regions are overfull: trying to pack again with more attraction groups exploration. \n " );
218
239
attraction_groups.create_att_groups_for_overfull_regions ();
219
240
VTR_LOG (" Pack iteration is %d\n " , pack_iteration);
220
- } else if (pack_iteration == 3 ) {
241
+ } else if ((!noc_enabled && pack_iteration == 3 ) || (noc_enabled && pack_iteration == 4 ) ) {
221
242
attraction_groups.create_att_groups_for_all_regions ();
222
243
VTR_LOG (" Floorplan regions are overfull: trying to pack again with more attraction groups exploration. \n " );
223
244
VTR_LOG (" Pack iteration is %d\n " , pack_iteration);
224
- } else if (pack_iteration == 4 ) {
245
+ } else if ((!noc_enabled && pack_iteration == 4 ) || (noc_enabled && pack_iteration == 5 ) ) {
225
246
attraction_groups.create_att_groups_for_all_regions ();
226
247
VTR_LOG (" Floorplan regions are overfull: trying to pack again with more attraction groups exploration and higher target pin utilization. \n " );
227
248
VTR_LOG (" Pack iteration is %d\n " , pack_iteration);
@@ -230,9 +251,7 @@ bool try_pack(t_packer_opts* packer_opts,
230
251
helper_ctx.target_external_pin_util .set_block_pin_util (" clb" , pin_util);
231
252
}
232
253
233
- } else {
234
- // Unable to pack densely enough: Give Up
235
-
254
+ } else { // Unable to pack densely enough: Give Up
236
255
if (floorplan_regions_overfull) {
237
256
VPR_FATAL_ERROR (VPR_ERROR_OTHER,
238
257
" Failed to find pack clusters densely enough to fit in the designated floorplan regions.\n "
@@ -258,7 +277,7 @@ bool try_pack(t_packer_opts* packer_opts,
258
277
resource_avail += std::string (iter->first ->name ) + " : " + std::to_string (num_instances);
259
278
}
260
279
261
- VPR_FATAL_ERROR (VPR_ERROR_OTHER, " Failed to find device which satisifies resource requirements required: %s (available %s)" , resource_reqs.c_str (), resource_avail.c_str ());
280
+ VPR_FATAL_ERROR (VPR_ERROR_OTHER, " Failed to find device which satisfies resource requirements required: %s (available %s)" , resource_reqs.c_str (), resource_avail.c_str ());
262
281
}
263
282
264
283
// Reset clustering for re-packing
0 commit comments