Skip to content

Placement Refactoring #2396

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 207 commits into from
Jul 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
207 commits
Select commit Hold shift + click to select a range
919b13e
Bringing back iterative improvements (1)
Nov 30, 2022
9845d06
Bringing back iterative improvements (2)
Nov 30, 2022
b15bbb9
Bringing back iterative improvement (3)
Nov 30, 2022
b804664
update the multithreading and locking techniques for iterative improv…
Nov 30, 2022
275fb41
Free cluster_pb_stats at the end of packing
Nov 30, 2022
6b237f3
Change the pointer in pb_graph_node to indeces for faster lookup and …
Dec 2, 2022
cde1d02
extend cluster_placement_stats to be a vector
Dec 2, 2022
6133c43
extending cluster_placement_stats to vector --WIP
Dec 6, 2022
424b4a6
extending cluster_placement_stats to vector --WIP2
Dec 8, 2022
21d4be7
Multitreading working -- need some refactoring to be more readable
Dec 8, 2022
3ee0bc4
Multithreading is working
Dec 8, 2022
99d2cfb
solve a variable size array issue
Dec 8, 2022
28875dd
fix formatting
Dec 8, 2022
a8cd188
Fix all issues with mulithreading
Jan 9, 2023
04fbb77
Fix formatting
Jan 9, 2023
69aa3fb
Add new moves that are evaluated based on absorbed connections not nets
Jan 10, 2023
a943734
change the definition of the Conn moves to be absorbed pins / total n…
Jan 11, 2023
3a34e5a
Fix an issue with calculating the abosorbed connections
Jan 12, 2023
a0e1f8e
Build and print a hash table for the count of connections between CLB…
Jan 16, 2023
30ad1e2
[WIP] implementing multiple moves and evaluation formulas for packing…
Jan 18, 2023
5153c54
update how moves are evaluated
Jan 20, 2023
5c8159a
fix the renaming bug to avoid having two pbs with the same name
Jan 24, 2023
8e2430d
Add a new way to evaluate moves based on the terminals outside
Jan 26, 2023
18feb40
a more generic way to fix the renaming bug
Jan 27, 2023
ff651ef
Hope it is now fixed
Jan 30, 2023
93b9b65
remove unnecesary logging
Jan 31, 2023
be78ac8
WIP fixing the renaming bug by make sure to bring the name back after…
Feb 6, 2023
086ffb8
solve the renaming issue and print a progress bar
Feb 6, 2023
3d1d565
fix formatting
Feb 6, 2023
1a523d6
Fix the bug with more generic way
Feb 6, 2023
c77ffd5
update the evaluation function for terminals outside
Feb 6, 2023
d0b2686
[WIP] working on using packing ost functions to evaluate moves
Feb 10, 2023
e4fb89d
Using packing cost function to evaluate moves
Feb 13, 2023
bb598be
Fix a bug in the API -- setting the mode for all the pb hierarchy lev…
Feb 23, 2023
c256c11
Fixing issues with move_mol_to_new_cluster function
Feb 23, 2023
a775f91
commit the version of the packing cost evaluation before updating it
Feb 28, 2023
e2abf60
Fixing the function to evaluate the moves based on the cutsize
Mar 1, 2023
a8fa346
fix formatting and some debugging code
Mar 1, 2023
d0a9e38
update the cost function to evaluate the packing move
Mar 1, 2023
618cfb7
fix memory leaks
Mar 18, 2023
de79046
create primitive_critical_uniform_move_generator.h/.cpp
amin1377 May 10, 2023
8e341ca
change the name of the file from primitive_*_move* to atom_*_move*
amin1377 May 11, 2023
0e4db8c
write getCriticalAtomBlock under atom_critical_uni*
amin1377 May 11, 2023
8df2762
use cluster_blk_id in functions under atom_critical_uniform*
amin1377 May 11, 2023
1ced777
remove total_primitive_count field from pb_type_graph_node since it w…
amin1377 May 18, 2023
e8af9b4
add primitive num to t_pb_graph_node
amin1377 May 18, 2023
5a72ec0
remove debugging code and adding more comments
Aug 8, 2023
accb38f
prevent double freeing when removing a molecule from cluster
Aug 8, 2023
2354720
Merge branch 'master' into packing-multithreading
Sep 12, 2023
08a68c3
more comments and remove debugging code
Sep 12, 2023
15d7ce3
Add a guard for packing multithreading
Sep 13, 2023
49d3f66
mor guards for multithreading
Sep 13, 2023
5109958
Merge branch 'packing-multithreading' of https://github.com/verilog-t…
amin1377 Sep 15, 2023
3553f5e
create place_re_cluster.cpp/.h
amin1377 Sep 15, 2023
2623ca8
call place_re_cluster after quench
amin1377 Sep 15, 2023
a29e44b
choose random cluster blocks and choose random atoms inside them
amin1377 Sep 15, 2023
d9c433a
write a basic impl for t_pl_atom_loc
amin1377 Sep 15, 2023
7e949b3
add move transaction data structure for atoms
amin1377 Sep 15, 2023
03b9c14
add get_atom_mol to pack_utils
amin1377 Sep 15, 2023
c764bda
Re-clustering API bug fixes
Sep 15, 2023
36aaa4e
remove ClusterAtomsLookup class
amin1377 Sep 15, 2023
1969e17
add operator== to t_pl_atom_loc
amin1377 Sep 15, 2023
d495243
add a method to gridblock to get the atom id from atom loc
amin1377 Sep 15, 2023
9b35c9a
impl for find_affected_blocks for atom blocks
amin1377 Sep 16, 2023
a44efb7
add macros for EMPTY_PRIMITIVE_BLOCK_ID
amin1377 Sep 16, 2023
3f70a1c
add hashing function for t_pl_atom_loc
amin1377 Sep 16, 2023
5fe87fa
write record_block_move for atom blocks
amin1377 Sep 16, 2023
dd01260
write a (temp) helper function to get the location of an atom
amin1377 Sep 16, 2023
13998dc
remove unused variable
Sep 18, 2023
ac31136
fix formatting
Sep 18, 2023
e5486f3
set a default number (-1) to pb_graph_node primitive_num
amin1377 Sep 18, 2023
93be443
rename pb_graph_node_class_range under logical block to primitive_pb_…
amin1377 Sep 18, 2023
8a13c7c
add is_atom_compatible to physical types util
amin1377 Sep 18, 2023
9907633
add place_re_cluster option
amin1377 Sep 18, 2023
b8b9ec1
do reclustring if the option is set
amin1377 Sep 18, 2023
48f77c8
remained from adding the new Cl arg
amin1377 Sep 18, 2023
0c00cf1
impl is_legal_swap for atoms
amin1377 Sep 18, 2023
ea24fbc
remove unused parameters and fix formatting
Sep 18, 2023
f84a792
Merge branch 'master' into reclustering-api-bug-fixes
MohamedElgammal Sep 18, 2023
176c913
implement record_single_block_swap for atom moves
amin1377 Sep 19, 2023
8c11b1b
impl create_move for placement reclustering
amin1377 Sep 19, 2023
a0880e8
floorplan_legal for atom block
amin1377 Sep 19, 2023
ccbf5a3
impl: cluster_pins_connected_to_atom_pin
amin1377 Oct 13, 2023
27f54f4
impl a function to update td and bb costs when a pin of a net is moved
amin1377 Oct 13, 2023
d54036a
fix a bug with passsing criticalities by pointer
amin1377 Oct 13, 2023
0fdc7e0
impl apply_move_blocks for atom blocks affected
amin1377 Oct 13, 2023
6a5430a
impl revert_move_blocks for atom block move
amin1377 Oct 13, 2023
6e41db8
pass move blocks to driven_by_moved_block instead of the whole data s…
amin1377 Oct 13, 2023
04bd8a3
use any_of instead of for loop
amin1377 Oct 13, 2023
9a0c16a
pass moved_blocks and affected_pins to update_td_delta_costs
amin1377 Oct 13, 2023
1911301
pass t_pl_moved_block to update_net_bb instead of all t_pl_blocks_to_…
amin1377 Oct 16, 2023
aee362d
change the update_net_info_on_pin_move to accept related parameters
amin1377 Oct 16, 2023
2da67de
fix a type in find_affected_nets_and_update_costs parameter list
amin1377 Oct 16, 2023
199c12f
add is_src_moving parameter to update_td_delta_costs instead of deter…
amin1377 Oct 16, 2023
59f6e3e
remove unused parameters from update_net_info_on_pin_move and pass is…
amin1377 Oct 16, 2023
dc896f1
write driven_by_moved_block for atom net
amin1377 Oct 16, 2023
ac9d1b0
impl find_affected_nets_and_update_costs for changing atom loc
amin1377 Oct 16, 2023
4491881
add a constructor to t_pl_moved_block
amin1377 Oct 16, 2023
1753662
add place_algorithm to re_cluster
amin1377 Oct 16, 2023
2fca2e0
add net_cost_handler to place dir
amin1377 Oct 16, 2023
9c7d2d4
add driven_by_moved block to net_list_handler.cpp
amin1377 Oct 16, 2023
48fa5b5
add find_affected_nets_and_update_costs for both cluster and atom nets
amin1377 Oct 16, 2023
7ae6bbd
add update_net_bb to net_cost_handler
amin1377 Oct 16, 2023
7adad23
add update_td_delta_costs and record_affected_net to net_list_handler
amin1377 Oct 16, 2023
627e2fe
add update_net_info_on_pin_move to net_cost_handler
amin1377 Oct 16, 2023
6ece0f4
remove static identifiers from find_affected_nets_and_update_costs
amin1377 Oct 16, 2023
113c4e1
add local variables related to net cost to net_cost_handler
amin1377 Oct 16, 2023
eec039b
add alloc_and_load_for_fast_cost_update and its vars to place_util
amin1377 Oct 16, 2023
b161988
add wirelength_crossing_count and get_net_bounding_box_cost to place_…
amin1377 Oct 16, 2023
f04a176
add init_net_cost_structs
amin1377 Oct 17, 2023
2633c6a
add get_non_updateable_bb, update_bb, get_bb_from_scratch, get_net_wi…
amin1377 Oct 17, 2023
e50de51
add comp_bb_cost, update_move_nets, reset_move_nets, recompute_costs_…
amin1377 Oct 17, 2023
c0af5fe
alloc_and_load_for_fast_cost_update & free_fast_cost_update & wirelen…
amin1377 Oct 17, 2023
8975b8d
move functions related to chanx/y_place_cost_fac to net_cost handler …
amin1377 Oct 17, 2023
598d136
remove all the functions moved to net_cost_handler from place.cpp
amin1377 Oct 17, 2023
0d1b039
add ERROR_TOL to placer globals
amin1377 Oct 17, 2023
b0ed53f
impl swap atoms in place re cluster
amin1377 Oct 17, 2023
9c24775
fix parameter names of t_pl_moved_block
amin1377 Oct 17, 2023
d587ac4
merge with master branch
amin1377 Oct 17, 2023
60eee08
fix a bug with passing loc to get_physical_type
amin1377 Oct 17, 2023
daf4352
remove ERROR_TOL and add it to place.cpp and net_cost_handler
amin1377 Oct 17, 2023
d2a9c06
comment unused vars in place_re_cluster
amin1377 Oct 17, 2023
c9b951d
comment unused vars in net_cost_handler and atom_critical...
amin1377 Oct 17, 2023
c747efb
remove assigning invalid to cluster block id
amin1377 Oct 17, 2023
83a7b02
use the interface for propose move of AtomCriticalUniformMoveGenerator
amin1377 Oct 17, 2023
cbef91e
merge with reclustering-api-bug-fixes
amin1377 Oct 18, 2023
cb21aaf
solve conflicts with api debug branch dir: libarchfpga and src/base
amin1377 Oct 18, 2023
cabe15e
remove dir vpr/src/pack/improvements
amin1377 Oct 18, 2023
2613b42
add api debug fixes to files under vpr/src/pack
amin1377 Oct 18, 2023
4076172
fix a typo in a field name
amin1377 Oct 18, 2023
3a16d9b
comment an error in place_recluster
amin1377 Oct 18, 2023
1daf8b9
add algorithm lib to vtr_vec_id
amin1377 Oct 18, 2023
e8bc42c
make format
amin1377 Oct 18, 2023
b04e309
fix placement debugging messages to show double numbers as long f ins…
amin1377 Oct 19, 2023
b94880d
change lf to e
amin1377 Oct 19, 2023
042a8ed
tmp: add some couts for dubbing
amin1377 Oct 19, 2023
cd1ef4d
Revert "tmp: add some couts for dubbing"
amin1377 Oct 19, 2023
f0bb77d
set the capacity instead of creating actual elements
amin1377 Oct 19, 2023
8b8027e
push back to blocks affected
amin1377 Oct 19, 2023
312ca54
clear moved_blocks once swap is done
amin1377 Oct 19, 2023
463d610
add comments for physical_types.h
amin1377 Oct 19, 2023
472b279
comment on is_atom_compatible
amin1377 Oct 19, 2023
25d5267
fix the help of place_re_cluster parameter
amin1377 Oct 19, 2023
2bc377d
add comment on atom block_at_location
amin1377 Oct 19, 2023
21559aa
make format
amin1377 Oct 19, 2023
1a975ad
make the constructor explicit
amin1377 Oct 19, 2023
9e27014
check if pb_graph_node benlongs to the logical type. If it doesn't re…
amin1377 Oct 21, 2023
fba5a66
add some comments and fix atom is_legal_swap_to_location
amin1377 Oct 21, 2023
b1bdfd1
comment on move_transaction & move_utils
amin1377 Oct 21, 2023
b445803
experiment: allocate moved_blocks to max_num_blocks
amin1377 Oct 21, 2023
d1f2e03
Merge branch 'master' of https://github.com/verilog-to-routing/vtr-ve…
amin1377 Nov 10, 2023
85447d8
Merge branch '3d_link_cost_in_placement' of https://github.com/verilo…
amin1377 Nov 10, 2023
b05d57b
debug update_bb
amin1377 Nov 10, 2023
71186a9
fix find_affected_nets_and_update_costs
amin1377 Nov 10, 2023
f94c577
fix update_net_layer_bb
amin1377 Nov 10, 2023
df7fdd4
fix comp_bb_cost
amin1377 Nov 10, 2023
9989f2f
remove pushing back to blocks_affected
amin1377 Nov 11, 2023
268ea24
Merge branch 'master' of https://github.com/verilog-to-routing/vtr-ve…
amin1377 Nov 13, 2023
22f9237
change bbptr to bb
amin1377 Nov 13, 2023
e34d848
change bb pointer to const ref in get_net_bounding_box_cost
amin1377 Nov 13, 2023
6a77e80
comment on ts_bb_coord_new and layer_ts_bb_coord_new usage
amin1377 Nov 13, 2023
49d33b8
fix a type
amin1377 Nov 13, 2023
fa45f03
remove an unused function - comment net_cost_handler helper functions
amin1377 Nov 13, 2023
2de0eca
get net cost based on bb type
amin1377 Nov 13, 2023
6abf300
impl a function to set bb delta c
amin1377 Nov 13, 2023
d20732b
comment functions in net_cost_handler.h
amin1377 Nov 13, 2023
113efec
expr: add static inline for update_net_info_on_pin_move
amin1377 Nov 14, 2023
7dd0e7b
Merge branch 'master' of https://github.com/verilog-to-routing/vtr-ve…
amin1377 Nov 16, 2023
d4e726f
remove unused access to cube_bb
amin1377 Nov 16, 2023
dbbe5f6
reverse inlining of update_net_info_on_pin_move
amin1377 Nov 16, 2023
deb8297
inline the operator overloading for atom_loc
amin1377 Nov 22, 2023
f047590
use string constructor instead casting char* to string
amin1377 Nov 22, 2023
569096a
pass primitive types by value
amin1377 Nov 22, 2023
f19d64a
use empty methon instead of comparing to zero
amin1377 Nov 22, 2023
85c53dc
set the upper bound of the loop outside of the loop body
amin1377 Nov 22, 2023
4e410ce
impl of atom revert_move_blocks was wrong
amin1377 Nov 22, 2023
8e28ea9
use enum class instead of defining net update status
amin1377 Nov 22, 2023
b2eb245
use num_layers variable as upper bound of a loop
amin1377 Nov 22, 2023
16f8fff
store num_moved_blocks before the for loop
amin1377 Nov 22, 2023
321344f
add std algorithm back since std sort is used
amin1377 Nov 22, 2023
4d024d3
Merge branch 'master' of https://github.com/verilog-to-routing/vtr-ve…
amin1377 Nov 23, 2023
a12be62
Merge branch 'master' of https://github.com/verilog-to-routing/vtr-ve…
amin1377 Jun 4, 2024
34d77d8
Merge branch 'master' of https://github.com/verilog-to-routing/vtr-ve…
amin1377 Jun 5, 2024
574b6fc
[vpr] fix the bugs after merge was mastered
amin1377 Jun 5, 2024
2a71a8c
Merge branch 'master' of https://github.com/verilog-to-routing/vtr-ve…
amin1377 Jun 12, 2024
2a76d79
[vpr][place] update bb_from_scratch to update layer too
amin1377 Jun 12, 2024
a6d2fa4
[vpr][place] update get_non_updatable_bb to update layer
amin1377 Jun 12, 2024
8a8345e
[vpr][place] initialize the num_sink_layer to zero per layer
amin1377 Jun 12, 2024
655409e
[vpr][place] update update_bb to update layer info
amin1377 Jun 12, 2024
38e6b31
[vpr][place] get pin direction from get_pin_type_...
amin1377 Jun 12, 2024
ccffd51
[vpr][place] fix update_net_layer declaration
amin1377 Jun 12, 2024
0a1f655
Merge branch 'master' of https://github.com/verilog-to-routing/vtr-ve…
amin1377 Jun 18, 2024
4af56aa
Merge branch 'master' of https://github.com/verilog-to-routing/vtr-ve…
amin1377 Jun 20, 2024
b958964
[vpr][place] remove the parts for reclustering
amin1377 Jun 20, 2024
5adfa2b
[vpr][place] add a library
amin1377 Jun 20, 2024
94b51b9
[vpr][place] add more comments to net_cost_handler.h
amin1377 Jun 26, 2024
e7a6032
Merge branch 'master' of https://github.com/verilog-to-routing/vtr-ve…
amin1377 Jul 4, 2024
7ae2112
add more comments on net_cost_handler
amin1377 Jul 4, 2024
7537c27
[vpr][place] remove block comment sysntax
amin1377 Jul 4, 2024
165931c
[vpr][place] apply Vaughn's comments on net_cost_handler
amin1377 Jul 5, 2024
fbc9452
[vpr][place] apply Vaughn's comments on place.cpp
amin1377 Jul 5, 2024
2d7fbf4
Merge branch 'master' of https://github.com/verilog-to-routing/vtr-ve…
amin1377 Jul 5, 2024
c9afd34
[vpr][place] fix typos in comments
amin1377 Jul 5, 2024
0388cb7
Merge branch 'master' of https://github.com/verilog-to-routing/vtr-ve…
amin1377 Jul 12, 2024
3f1f8e2
fix comment format issue
amin1377 Jul 12, 2024
fd9fce8
[vpr][place] put comments on net_cost_handler file
amin1377 Jul 12, 2024
d000874
Merge branch 'master' of https://github.com/verilog-to-routing/vtr-ve…
amin1377 Jul 17, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions libs/libarchfpga/src/physical_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -924,10 +924,10 @@ struct t_logical_block_type {
std::vector<t_physical_tile_type_ptr> equivalent_tiles; ///>List of physical tiles at which one could
///>place this type of netlist block.

std::unordered_map<int, t_pb_graph_pin*> pin_logical_num_to_pb_pin_mapping; /* pin_logical_num_to_pb_pin_mapping[pin logical number] -> pb_graph_pin ptr} */
std::unordered_map<const t_pb_graph_pin*, int> primitive_pb_pin_to_logical_class_num_mapping; /* primitive_pb_pin_to_logical_class_num_mapping[pb_graph_pin ptr] -> class logical number */
std::vector<t_class> primitive_logical_class_inf; /* primitive_logical_class_inf[class_logical_number] -> class */
std::unordered_map<const t_pb_graph_node*, t_class_range> pb_graph_node_class_range;
std::unordered_map<int, t_pb_graph_pin*> pin_logical_num_to_pb_pin_mapping; /* pin_logical_num_to_pb_pin_mapping[pin logical number] -> pb_graph_pin ptr} */
std::unordered_map<const t_pb_graph_pin*, int> primitive_pb_pin_to_logical_class_num_mapping; /* primitive_pb_pin_to_logical_class_num_mapping[pb_graph_pin ptr] -> class logical number */
std::vector<t_class> primitive_logical_class_inf; /* primitive_logical_class_inf[class_logical_number] -> class */
std::unordered_map<const t_pb_graph_node*, t_class_range> primitive_pb_graph_node_class_range; /* primitive_pb_graph_node_class_range[primitive_pb_graph_node ptr] -> class range for that primitive*/

// Is this t_logical_block_type empty?
bool is_empty() const;
Expand Down Expand Up @@ -1239,6 +1239,12 @@ class t_pb_graph_node {

int placement_index;

/*
* There is a root-level pb_graph_node assigned to each logical type. Each logical type can contain multiple primitives.
* If this pb_graph_node is associated with a primitive, a unique number is assigned to it within the logical block level.
*/
int primitive_num = OPEN;

/* Contains a collection of mode indices that cannot be used as they produce conflicts during VPR packing stage
*
* Illegal modes do arise when children of a graph_node do have inconsistent `edge_modes` with respect to
Expand Down
2 changes: 1 addition & 1 deletion libs/libarchfpga/src/physical_types_util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -965,7 +965,7 @@ t_class_range get_pb_graph_node_class_physical_range(t_physical_tile_type_ptr /*
const t_pb_graph_node* pb_graph_node) {
VTR_ASSERT(pb_graph_node->is_primitive());

t_class_range class_range = logical_block->pb_graph_node_class_range.at(pb_graph_node);
t_class_range class_range = logical_block->primitive_pb_graph_node_class_range.at(pb_graph_node);
int logical_block_class_offset = sub_tile->primitive_class_range[sub_tile_relative_cap].at(logical_block).low;

class_range.low += logical_block_class_offset;
Expand Down
1 change: 1 addition & 0 deletions libs/libvtrutil/src/vtr_vec_id_set.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#define VTR_SET_H

#include <vector>
#include <algorithm>

namespace vtr {

Expand Down
6 changes: 6 additions & 0 deletions vpr/src/base/vpr_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -1919,4 +1919,10 @@ void free_pack_molecules(t_pack_molecule* list_of_pack_molecules);
*/
void free_cluster_placement_stats(t_cluster_placement_stats* cluster_placement_stats);

struct pair_hash {
std::size_t operator()(const std::pair<ClusterBlockId, ClusterBlockId>& p) const noexcept {
return std::hash<ClusterBlockId>()(p.first) ^ (std::hash<ClusterBlockId>()(p.second) << 1);
}
};

#endif
23 changes: 17 additions & 6 deletions vpr/src/pack/pb_type_graph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ static void alloc_and_load_pb_graph(t_pb_graph_node* pb_graph_node,
const int index,
const int flat_index,
bool load_power_structures,
int& pin_count_in_cluster);
int& pin_count_in_cluster,
int& primitive_num);

static void alloc_and_load_pb_graph_pin_sinks(t_pb_graph_node* pb_graph_node);

Expand Down Expand Up @@ -153,13 +154,15 @@ void alloc_and_load_all_pb_graphs(bool load_power_structures, bool is_flat) {
if (type.pb_type) {
type.pb_graph_head = new t_pb_graph_node();
int pin_count_in_cluster = 0;
int primitive_num = 0;
alloc_and_load_pb_graph(type.pb_graph_head,
nullptr,
type.pb_type,
0,
0,
load_power_structures,
pin_count_in_cluster);
pin_count_in_cluster,
primitive_num);
type.pb_graph_head->total_pb_pins = pin_count_in_cluster;
load_pin_classes_in_pb_graph_head(type.pb_graph_head);
if (is_flat) {
Expand Down Expand Up @@ -233,7 +236,8 @@ static void alloc_and_load_pb_graph(t_pb_graph_node* pb_graph_node,
const int index,
const int flat_index,
bool load_power_structures,
int& pin_count_in_cluster) {
int& pin_count_in_cluster,
int& primitive_num) {
int i, j, k, i_input, i_output, i_clockport;

pb_graph_node->placement_index = index;
Expand Down Expand Up @@ -350,6 +354,11 @@ static void alloc_and_load_pb_graph(t_pb_graph_node* pb_graph_node,
pb_graph_node->pb_node_power->transistor_cnt_pb_children = 0.;
}

if (pb_graph_node->is_primitive()) {
pb_graph_node->primitive_num = primitive_num;
primitive_num++;
}

/* Allocate and load child nodes for each mode and create interconnect in each mode */

pb_graph_node->child_pb_graph_nodes = (t_pb_graph_node***)vtr::calloc(pb_type->num_modes, sizeof(t_pb_graph_node**));
Expand All @@ -368,7 +377,8 @@ static void alloc_and_load_pb_graph(t_pb_graph_node* pb_graph_node,
k,
child_flat_index,
load_power_structures,
pin_count_in_cluster);
pin_count_in_cluster,
primitive_num);
}
}
}
Expand All @@ -384,6 +394,7 @@ static void alloc_and_load_pb_graph(t_pb_graph_node* pb_graph_node,
load_power_structures);
}


// update the total number of primitives of that type
if (pb_graph_node->is_primitive()) {
int total_count = 1;
Expand Down Expand Up @@ -549,8 +560,8 @@ static void add_primitive_logical_classes(t_logical_block_type* logical_block) {
}
num_added_classes += add_port_logical_classes(logical_block, pb_graph_pins, num_ports, num_pins);
}
logical_block->pb_graph_node_class_range.insert(std::make_pair(pb_graph_node, t_class_range(first_class_num,
first_class_num + num_added_classes - 1)));
logical_block->primitive_pb_graph_node_class_range.insert(std::make_pair(pb_graph_node, t_class_range(first_class_num,
first_class_num + num_added_classes - 1)));
}
}

Expand Down
4 changes: 2 additions & 2 deletions vpr/src/pack/re_cluster.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -200,9 +200,9 @@ bool swap_two_molecules(t_pack_molecule* molecule_1,
}

t_pb* clb_pb_1 = cluster_ctx.clb_nlist.block_pb(clb_1);
std::string clb_pb_1_name = (std::string)clb_pb_1->name;
std::string clb_pb_1_name = static_cast<std::string>(clb_pb_1->name);
t_pb* clb_pb_2 = cluster_ctx.clb_nlist.block_pb(clb_2);
std::string clb_pb_2_name = (std::string)clb_pb_2->name;
std::string clb_pb_2_name = static_cast<std::string>(clb_pb_2->name);

//remove the molecule from its current cluster
remove_mol_from_cluster(molecule_1, molecule_1_size, clb_1, clb_1_atoms, false, old_1_router_data);
Expand Down
2 changes: 0 additions & 2 deletions vpr/src/pack/re_cluster_util.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#include "re_cluster_util.h"

#include "clustered_netlist_utils.h"
#include "cluster_util.h"
#include "cluster_router.h"
Expand All @@ -8,7 +7,6 @@
#include "initial_placement.h"
#include "read_netlist.h"


// The name suffix of the new block (if exists)
// This suffix is useful in preventing duplicate high-level cluster block names
const char* name_suffix = "_m";
Expand Down
1 change: 1 addition & 0 deletions vpr/src/place/move_transactions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ void clear_move_blocks(t_pl_blocks_to_be_moved& blocks_affected) {

//For run-time, we just reset num_moved_blocks to zero, but do not free the blocks_affected
//array to avoid memory allocation

blocks_affected.num_moved_blocks = 0;

blocks_affected.affected_pins.clear();
Expand Down
9 changes: 7 additions & 2 deletions vpr/src/place/move_transactions.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,17 @@
* old_loc: the location the block is moved from *
* new_loc: the location the block is moved to */
struct t_pl_moved_block {
t_pl_moved_block() = default;
t_pl_moved_block(ClusterBlockId block_num_, const t_pl_loc& old_loc_, const t_pl_loc& new_loc_)
: block_num(block_num_)
, old_loc(old_loc_)
, new_loc(new_loc_) {}
ClusterBlockId block_num;
t_pl_loc old_loc;
t_pl_loc new_loc;
};

/* Stores the list of blocks to be moved in a swap during *
/* Stores the list of cluster blocks to be moved in a swap during *
* placement. *
* Store the information on the blocks to be moved in a swap during *
* placement, in the form of array of structs instead of struct with *
Expand All @@ -29,7 +34,7 @@ struct t_pl_moved_block {
* incrementally invalidate parts of the timing *
* graph. */
struct t_pl_blocks_to_be_moved {
t_pl_blocks_to_be_moved(size_t max_blocks)
explicit t_pl_blocks_to_be_moved(size_t max_blocks)
: moved_blocks(max_blocks) {}

int num_moved_blocks = 0;
Expand Down
14 changes: 14 additions & 0 deletions vpr/src/place/move_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,14 @@ void report_aborted_moves();

e_create_move create_move(t_pl_blocks_to_be_moved& blocks_affected, ClusterBlockId b_from, t_pl_loc to);

/**
* @brief Find the blocks that will be affected by a move of b_from to to_loc
* @param blocks_affected Loaded by this routine and returned via reference; it lists the blocks etc. moved
* @param b_from Id of the cluster-level block to be moved
* @param to Where b_from will be moved to
* @return e_block_move_result ABORT if either of the the moving blocks are already stored, or either of the blocks are fixed, to location is not
* compatible, etc. INVERT if the "from" block is a single block and the "to" block is a macro. VALID otherwise.
*/
e_block_move_result find_affected_blocks(t_pl_blocks_to_be_moved& blocks_affected, ClusterBlockId b_from, t_pl_loc to);

e_block_move_result record_single_block_swap(t_pl_blocks_to_be_moved& blocks_affected, ClusterBlockId b_from, t_pl_loc to);
Expand All @@ -109,6 +117,12 @@ e_block_move_result record_macro_move(t_pl_blocks_to_be_moved& blocks_affected,
e_block_move_result identify_macro_self_swap_affected_macros(std::vector<int>& macros, const int imacro, t_pl_offset swap_offset);
e_block_move_result record_macro_self_swaps(t_pl_blocks_to_be_moved& blocks_affected, const int imacro, t_pl_offset swap_offset);

/**
* @brief Check whether the "to" location is legal for the given "blk"
* @param blk
* @param to
* @return True if this would be a legal move, false otherwise
*/
bool is_legal_swap_to_location(ClusterBlockId blk, t_pl_loc to);

std::set<t_pl_loc> determine_locations_emptied_by_move(t_pl_blocks_to_be_moved& blocks_affected);
Expand Down
Loading