@@ -1194,12 +1194,12 @@ e_block_pack_status ClusterLegalizer::try_pack_molecule(t_pack_molecule* molecul
1194
1194
}
1195
1195
}
1196
1196
1197
+ std::vector<t_pb_graph_node*> primitives_list (max_molecule_size, nullptr );
1197
1198
e_block_pack_status block_pack_status = e_block_pack_status::BLK_STATUS_UNDEFINED;
1198
1199
while (block_pack_status != e_block_pack_status::BLK_PASSED) {
1199
1200
if (!get_next_primitive_list (cluster_placement_stats_ptr,
1200
1201
molecule,
1201
- primitives_list,
1202
- force_site)) {
1202
+ primitives_list.data ())) {
1203
1203
VTR_LOGV (log_verbosity > 3 , " \t\t FAILED No candidate primitives available\n " );
1204
1204
block_pack_status = e_block_pack_status::BLK_FAILED_FEASIBLE;
1205
1205
break ; /* no more candidate primitives available, this molecule will not pack, return fail */
@@ -1392,7 +1392,6 @@ ClusterLegalizer::start_new_cluster(t_pack_molecule* molecule,
1392
1392
!molecule_cluster[molecule].is_valid ());
1393
1393
// Safety asserts to ensure that the API was initialized properly.
1394
1394
VTR_ASSERT_SAFE (cluster_placement_stats != nullptr &&
1395
- primitives_list != nullptr &&
1396
1395
lb_type_rr_graphs != nullptr );
1397
1396
1398
1397
const AtomContext& atom_ctx = g_vpr_ctx.atom ();
@@ -1465,7 +1464,6 @@ e_block_pack_status ClusterLegalizer::add_mol_to_cluster(t_pack_molecule* molecu
1465
1464
!molecule_cluster[molecule].is_valid ());
1466
1465
// Safety asserts to ensure that the API was initialized properly.
1467
1466
VTR_ASSERT_SAFE (cluster_placement_stats != nullptr &&
1468
- primitives_list != nullptr &&
1469
1467
lb_type_rr_graphs != nullptr );
1470
1468
1471
1469
// Get the cluster.
@@ -1570,25 +1568,16 @@ ClusterLegalizer::ClusterLegalizer(const AtomNetlist& atom_netlist,
1570
1568
ClusterLegalizationStrategy t_cluster_legalization_strategy,
1571
1569
bool t_enable_pin_feasibility_filter,
1572
1570
int t_feasible_block_array_size,
1573
- int t_log_verbosity,
1574
- int t_force_site) : prepacker(t_prepacker) {
1575
- // Ensure that this is not being initialized twice.
1576
- VTR_ASSERT (cluster_placement_stats == nullptr &&
1577
- primitives_list == nullptr &&
1578
- lb_type_rr_graphs == nullptr );
1571
+ int t_log_verbosity) : prepacker(t_prepacker) {
1579
1572
// Verify that the inputs are valid.
1580
1573
VTR_ASSERT (t_lb_type_rr_graphs != nullptr );
1581
1574
1582
1575
// Resize the atom_cluster lookup to make the accesses much cheaper.
1583
1576
atom_cluster.resize (atom_netlist.blocks ().size (), LegalizationClusterId::INVALID ());
1584
1577
// Allocate the cluster_placement_stats
1585
1578
cluster_placement_stats = alloc_and_load_cluster_placement_stats ();
1586
- // Allocate the primitives_lists
1587
- size_t max_molecule_size = prepacker.get_max_molecule_size ();
1588
- primitives_list = new t_pb_graph_node*[max_molecule_size];
1589
- for (size_t i = 0 ; i < max_molecule_size; i++) {
1590
- primitives_list[i] = nullptr ;
1591
- }
1579
+ // Pre-compute the max size of any molecule.
1580
+ max_molecule_size = prepacker.get_max_molecule_size ();
1592
1581
// Calculate the max cluster size
1593
1582
// - Limit maximum number of elements for each cluster to MAX_SHORT
1594
1583
max_cluster_size = calc_max_cluster_size (logical_block_types);
@@ -1608,7 +1597,6 @@ ClusterLegalizer::ClusterLegalizer(const AtomNetlist& atom_netlist,
1608
1597
enable_pin_feasibility_filter = t_enable_pin_feasibility_filter;
1609
1598
feasible_block_array_size = t_feasible_block_array_size;
1610
1599
log_verbosity = t_log_verbosity;
1611
- force_site = t_force_site;
1612
1600
// Get the target external pin utilization
1613
1601
// NOTE: This is really silly, but this can potentially fail. If it does
1614
1602
// it is important that everything is allocated. If not, when it fails
@@ -1714,24 +1702,9 @@ void ClusterLegalizer::finalize() {
1714
1702
}
1715
1703
1716
1704
ClusterLegalizer::~ClusterLegalizer () {
1717
- // Protect against double freeing.
1718
- // TODO: This may be able to be done better if this class had some flag
1719
- // to indicate if it has been initialized or not.
1720
- if (primitives_list == nullptr ) {
1721
- // Ensure that all of the allocated structures are nullptr.
1722
- VTR_ASSERT (cluster_placement_stats == nullptr &&
1723
- primitives_list == nullptr &&
1724
- lb_type_rr_graphs == nullptr );
1725
- return ;
1726
- }
1727
- VTR_ASSERT (cluster_placement_stats != nullptr &&
1728
- primitives_list != nullptr &&
1729
- lb_type_rr_graphs != nullptr );
1730
1705
// Reset. This is necessary to free the data within the clusters themselves.
1731
1706
reset ();
1732
1707
// Free the cluster_placement_stats
1733
1708
free_cluster_placement_stats (cluster_placement_stats);
1734
- // Free the primitives_list
1735
- delete[] primitives_list;
1736
1709
}
1737
1710
0 commit comments