@@ -997,61 +997,28 @@ static void update_molecule_chain_info(t_pack_molecule* chain_molecule, const t_
997
997
VTR_ASSERT (false );
998
998
}
999
999
1000
- /* *
1001
- * @brief Revalidate the molecules associated with this pb. The mol_validated
1002
- * flag is used to check if the mol has already been validated.
1000
+ /*
1001
+ * @brief Reset molecule information created while trying to cluster it.
1002
+ *
1003
+ * This code only resets information that has to do with long chains.
1004
+ *
1005
+ * TODO: This information should not be stored in the molecule, but should be
1006
+ * stored in the ClusterLegalizer class instead.
1007
+ *
1008
+ * TODO: This code may be removable. Tried turning it off and found no test
1009
+ * failures or QoR degredations. Should be investigated in more detail.
1003
1010
*/
1004
- static void revalid_molecules (const t_pb* pb,
1005
- bool &mol_validated,
1006
- const Prepacker& prepacker) {
1007
- const t_pb_type* pb_type = pb->pb_graph_node ->pb_type ;
1008
-
1009
- if (pb_type->blif_model == nullptr ) {
1010
- int mode = pb->mode ;
1011
- for (int i = 0 ; i < pb_type->modes [mode].num_pb_type_children && pb->child_pbs != nullptr ; i++) {
1012
- for (int j = 0 ; j < pb_type->modes [mode].pb_type_children [i].num_pb && pb->child_pbs [i] != nullptr ; j++) {
1013
- if (pb->child_pbs [i][j].name != nullptr || pb->child_pbs [i][j].child_pbs != nullptr ) {
1014
- revalid_molecules (&pb->child_pbs [i][j], mol_validated, prepacker);
1015
- }
1016
- }
1017
- }
1018
- } else {
1019
- // Primitive
1020
- auto & atom_ctx = g_vpr_ctx.mutable_atom ();
1021
-
1022
- auto blk_id = atom_ctx.lookup .pb_atom (pb);
1023
- if (blk_id) {
1024
- /* If any molecules were marked invalid because of this logic block getting packed, mark them valid */
1025
-
1026
- // Update atom netlist mapping
1027
- atom_ctx.lookup .set_atom_clb (blk_id, ClusterBlockId::INVALID ());
1028
- atom_ctx.lookup .set_atom_pb (blk_id, nullptr );
1029
-
1030
- t_pack_molecule* cur_molecule = prepacker.get_atom_molecule (blk_id);
1031
- if (!mol_validated) {
1032
- int i;
1033
- for (i = 0 ; i < get_array_size_of_molecule (cur_molecule); i++) {
1034
- if (cur_molecule->atom_block_ids [i]) {
1035
- if (atom_ctx.lookup .atom_clb (cur_molecule->atom_block_ids [i]) != ClusterBlockId::INVALID ()) {
1036
- break ;
1037
- }
1038
- }
1039
- }
1040
- /* All atom blocks are open for this molecule, place back in queue */
1041
- if (i == get_array_size_of_molecule (cur_molecule)) {
1042
- mol_validated = true ;
1043
- // when invalidating a molecule check if it's a chain molecule
1044
- // that is part of a long chain. If so, check if this molecule
1045
- // have modified the chain_id value based on the stale packing
1046
- // then reset the chain id and the first packed molecule pointer
1047
- // this is packing is being reset
1048
- if (cur_molecule->is_chain () && cur_molecule->chain_info ->is_long_chain && cur_molecule->chain_info ->first_packed_molecule == cur_molecule) {
1049
- cur_molecule->chain_info ->first_packed_molecule = nullptr ;
1050
- cur_molecule->chain_info ->chain_id = -1 ;
1051
- }
1052
- }
1053
- }
1054
- }
1011
+ static void reset_molecule_info (t_pack_molecule* mol) {
1012
+ // when invalidating a molecule check if it's a chain molecule
1013
+ // that is part of a long chain. If so, check if this molecule
1014
+ // has modified the chain_id value based on the stale packing
1015
+ // then reset the chain id and the first packed molecule pointer
1016
+ // this is packing is being reset
1017
+ if (mol->is_chain ()
1018
+ && mol->chain_info ->is_long_chain
1019
+ && mol->chain_info ->first_packed_molecule == mol) {
1020
+ mol->chain_info ->first_packed_molecule = nullptr ;
1021
+ mol->chain_info ->chain_id = -1 ;
1055
1022
}
1056
1023
}
1057
1024
@@ -1060,8 +1027,6 @@ static void revalid_molecules(const t_pb* pb,
1060
1027
*/
1061
1028
static void revert_place_atom_block (const AtomBlockId blk_id,
1062
1029
t_lb_router_data* router_data,
1063
- bool &mol_validated,
1064
- const Prepacker& prepacker,
1065
1030
vtr::vector_map<AtomBlockId, LegalizationClusterId>& atom_cluster) {
1066
1031
const AtomContext& atom_ctx = g_vpr_ctx.atom ();
1067
1032
AtomContext& mutable_atom_ctx = g_vpr_ctx.mutable_atom ();
@@ -1079,7 +1044,6 @@ static void revert_place_atom_block(const AtomBlockId blk_id,
1079
1044
*/
1080
1045
1081
1046
t_pb* next = pb->parent_pb ;
1082
- revalid_molecules (pb, mol_validated, prepacker);
1083
1047
free_pb (pb);
1084
1048
pb = next;
1085
1049
@@ -1096,7 +1060,6 @@ static void revert_place_atom_block(const AtomBlockId blk_id,
1096
1060
/* If the code gets here, then that means that placing the initial seed molecule
1097
1061
* failed, don't free the actual complex block itself as the seed needs to find
1098
1062
* another placement */
1099
- revalid_molecules (pb, mol_validated, prepacker);
1100
1063
free_pb (pb);
1101
1064
}
1102
1065
}
@@ -1472,13 +1435,13 @@ e_block_pack_status ClusterLegalizer::try_pack_molecule(t_pack_molecule* molecul
1472
1435
remove_atom_from_target (cluster.router_data , atom_blk_id);
1473
1436
}
1474
1437
}
1475
- bool mol_validated = false ;
1476
1438
for (int i = 0 ; i < failed_location; i++) {
1477
1439
AtomBlockId atom_blk_id = molecule->atom_block_ids [i];
1478
1440
if (atom_blk_id) {
1479
- revert_place_atom_block (atom_blk_id, cluster.router_data , mol_validated, prepacker_, atom_cluster_);
1441
+ revert_place_atom_block (atom_blk_id, cluster.router_data , atom_cluster_);
1480
1442
}
1481
1443
}
1444
+ reset_molecule_info (molecule);
1482
1445
1483
1446
// Record the failure of this molecule in the current pb stats
1484
1447
record_molecule_failure (molecule, cluster.pb );
@@ -1615,14 +1578,14 @@ void ClusterLegalizer::destroy_cluster(LegalizationClusterId cluster_id) {
1615
1578
molecule_cluster_[mol] == cluster_id);
1616
1579
molecule_cluster_[mol] = LegalizationClusterId::INVALID ();
1617
1580
// Revert the placement of all blocks in the molecule.
1618
- bool mol_validated = false ;
1619
1581
int molecule_size = get_array_size_of_molecule (mol);
1620
1582
for (int i = 0 ; i < molecule_size; i++) {
1621
1583
AtomBlockId atom_blk_id = mol->atom_block_ids [i];
1622
1584
if (atom_blk_id) {
1623
- revert_place_atom_block (atom_blk_id, cluster.router_data , mol_validated, prepacker_, atom_cluster_);
1585
+ revert_place_atom_block (atom_blk_id, cluster.router_data , atom_cluster_);
1624
1586
}
1625
1587
}
1588
+ reset_molecule_info (mol);
1626
1589
}
1627
1590
cluster.molecules .clear ();
1628
1591
// Free the rest of the cluster data.
0 commit comments