Skip to content

Commit e7b21c8

Browse files
committed
Merge branch 'master' into remove-yosys+odin
2 parents 21f485a + d7ebb97 commit e7b21c8

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

vpr/src/place/simpleRL_move_generator.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -242,12 +242,12 @@ void SoftmaxAgent::set_action_prob() {
242242
}
243243
}
244244

245-
// normalize all the action probabilities to guarantee the sum(all actyion probs) = 1
245+
// normalize all the action probabilities to guarantee the sum(all action probs) = 1
246246
float sum_prob = std::accumulate(action_prob_.begin(), action_prob_.end(), 0.0);
247247
std::transform(action_prob_.begin(), action_prob_.end(), action_prob_.begin(),
248-
bind2nd(std::plus<float>(), (1.0 - sum_prob) / num_available_actions_));
248+
[sum_prob, this](float x) { return x + ((1.0 - sum_prob) / this->num_available_actions_); });
249249

250-
//calulcate the accumulative action probability of each action
250+
// calculate the accumulative action probability of each action
251251
// e.g. if we have 5 actions with equal probability of 0.2, the cumm_action_prob will be {0.2,0.4,0.6,0.8,1.0}
252252
float accum = 0;
253253
for (size_t i = 0; i < num_available_actions_; ++i) {

vpr/src/route/clock_connection_builders.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@ void RoutingToClockConnection::create_switches(const ClockRRGraphBuilder& clock_
4949
// Initialize random seed
5050
// Must be done during every call in order for restored rr_graphs after a binary
5151
// search to be consistent
52-
std::srand(seed);
52+
std::mt19937 rand_generator;
53+
rand_generator.seed(seed);
5354

5455
auto& device_ctx = g_vpr_ctx.device();
5556
const auto& node_lookup = device_ctx.rr_graph.node_lookup();
@@ -68,8 +69,8 @@ void RoutingToClockConnection::create_switches(const ClockRRGraphBuilder& clock_
6869

6970
for (auto clock_index : clock_indices) {
7071
// Select wires to connect to at random
71-
std::random_shuffle(x_wire_indices.begin(), x_wire_indices.end());
72-
std::random_shuffle(y_wire_indices.begin(), y_wire_indices.end());
72+
std::shuffle(x_wire_indices.begin(), x_wire_indices.end(), rand_generator);
73+
std::shuffle(y_wire_indices.begin(), y_wire_indices.end(), rand_generator);
7374

7475
// Connect to x-channel wires
7576
unsigned num_wires_x = x_wire_indices.size() * fc;

0 commit comments

Comments
 (0)