@@ -241,7 +241,8 @@ static void start_new_cluster(
241
241
ClusteredNetlist *clb_nlist,
242
242
const std::map<const t_model*,std::vector<t_type_ptr>>& primitive_candidate_block_types,
243
243
int verbosity,
244
- bool enable_pin_feasibility_filter);
244
+ bool enable_pin_feasibility_filter,
245
+ bool balance_block_type_utilization);
245
246
246
247
static t_pack_molecule* get_highest_gain_molecule (
247
248
t_pb *cur_pb,
@@ -505,7 +506,8 @@ std::map<t_type_ptr,size_t> do_clustering(const t_packer_opts& packer_opts, cons
505
506
detailed_routing_stage, &cluster_ctx.clb_nlist ,
506
507
primitive_candidate_block_types,
507
508
packer_opts.pack_verbosity ,
508
- packer_opts.enable_pin_feasibility_filter );
509
+ packer_opts.enable_pin_feasibility_filter ,
510
+ packer_opts.balance_block_type_utilization );
509
511
510
512
if (packer_opts.pack_verbosity > 1 && packer_opts.pack_verbosity < 3 ) {
511
513
VTR_LOG (" Complex block %d: %s, type: %s " ,
@@ -1855,7 +1857,8 @@ static void start_new_cluster(
1855
1857
ClusteredNetlist *clb_nlist,
1856
1858
const std::map<const t_model*,std::vector<t_type_ptr>>& primitive_candidate_block_types,
1857
1859
int verbosity,
1858
- bool enable_pin_feasibility_filter) {
1860
+ bool enable_pin_feasibility_filter,
1861
+ bool balance_block_type_utilization) {
1859
1862
/* Given a starting seed block, start_new_cluster determines the next cluster type to use
1860
1863
It expands the FPGA if it cannot find a legal cluster for the atom block
1861
1864
*/
@@ -1872,19 +1875,21 @@ static void start_new_cluster(
1872
1875
VTR_ASSERT (itr != primitive_candidate_block_types.end ());
1873
1876
std::vector<t_type_ptr> candidate_types = itr->second ;
1874
1877
1875
- // We sort the candidate types in ascending order by their current utilization.
1876
- // This means that the packer will prefer to use types with lower utilization.
1877
- // This is a naive approach to try balancing utilization when multiple types can
1878
- // support the same primitive(s).
1879
- std::sort (candidate_types.begin (), candidate_types.end (),
1880
- [&](t_type_ptr lhs, t_type_ptr rhs) {
1881
- float lhs_util = float (num_used_type_instances[lhs]) / device_ctx.grid .num_instances (lhs);
1882
- float rhs_util = float (num_used_type_instances[rhs]) / device_ctx.grid .num_instances (rhs);
1883
-
1884
- // Lower util first
1885
- return lhs_util < rhs_util;
1886
- }
1887
- );
1878
+ if (balance_block_type_utilization) {
1879
+ // We sort the candidate types in ascending order by their current utilization.
1880
+ // This means that the packer will prefer to use types with lower utilization.
1881
+ // This is a naive approach to try balancing utilization when multiple types can
1882
+ // support the same primitive(s).
1883
+ std::sort (candidate_types.begin (), candidate_types.end (),
1884
+ [&](t_type_ptr lhs, t_type_ptr rhs) {
1885
+ float lhs_util = float (num_used_type_instances[lhs]) / device_ctx.grid .num_instances (lhs);
1886
+ float rhs_util = float (num_used_type_instances[rhs]) / device_ctx.grid .num_instances (rhs);
1887
+
1888
+ // Lower util first
1889
+ return lhs_util < rhs_util;
1890
+ }
1891
+ );
1892
+ }
1888
1893
1889
1894
1890
1895
if (verbosity > 2 ) {
0 commit comments