Skip to content

Commit 109e475

Browse files
committed
[vpr][route][crr] fix the problem with ranges::max_element
1 parent 2f84367 commit 109e475

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

vpr/src/route/rr_graph_generation/rr_graph_area.cpp

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -290,10 +290,12 @@ static void count_bidir_routing_transistors(int num_switch, float R_minW_nmos, f
290290
/* Now add in the input connection block transistors. */
291291

292292
// Get most frequent ipin switch
293-
std::pair<RRSwitchId, size_t> most_frequent_ipin_switch_pair = std::ranges::max(ipin_switch_count,
294-
{},
295-
[](const auto& p) { return p.second; });
296-
RRSwitchId most_frequent_ipin_switch = most_frequent_ipin_switch_pair.first;
293+
auto most_frequent_ipin_switch_it = std::ranges::max_element(
294+
ipin_switch_count,
295+
[](const auto& a, const auto& b) noexcept { return a.second < b.second; }
296+
);
297+
VTR_ASSERT(most_frequent_ipin_switch_it != ipin_switch_count.end());
298+
RRSwitchId most_frequent_ipin_switch = most_frequent_ipin_switch_it->first;
297299

298300
input_cblock_trans = get_cblock_trans(num_inputs_to_cblock,
299301
most_frequent_ipin_switch,
@@ -490,10 +492,12 @@ static void count_unidir_routing_transistors(std::vector<t_segment_inf>& /*segme
490492
/* Now add in the input connection block transistors. */
491493

492494
// Get most frequent ipin switch
493-
std::pair<RRSwitchId, size_t> most_frequent_ipin_switch_pair = std::ranges::max(ipin_switch_count,
494-
{},
495-
[](const auto& p) { return p.second; });
496-
RRSwitchId most_frequent_ipin_switch = most_frequent_ipin_switch_pair.first;
495+
auto most_frequent_ipin_switch_it = std::ranges::max_element(
496+
ipin_switch_count,
497+
[](const auto& a, const auto& b) noexcept { return a.second < b.second; }
498+
);
499+
VTR_ASSERT(most_frequent_ipin_switch_it != ipin_switch_count.end());
500+
RRSwitchId most_frequent_ipin_switch = most_frequent_ipin_switch_it->first;
497501

498502
input_cblock_trans = get_cblock_trans(num_inputs_to_cblock,
499503
most_frequent_ipin_switch,

0 commit comments

Comments
 (0)