Skip to content

Commit

Permalink
Changes from 2993 to limit parallelism more conservatively
Browse files Browse the repository at this point in the history
  • Loading branch information
ahsan-ca committed Apr 23, 2024
1 parent fad9b78 commit cba5184
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/propagate_constant.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,12 @@ void propagate_constant::apply(module& m) const
// Compute literals in parallel
std::vector<instruction_ref> const_instrs_vec{const_instrs.begin(), const_instrs.end()};
std::vector<argument> literals(const_instrs_vec.size());
std::size_t n = 1;
std::size_t grainsize = 1;
#if !MIGRAPHX_HAS_EXECUTORS
n = std::max<std::size_t>(
std::ceil(static_cast<double>(1024) / std::thread::hardware_concurrency()), 1);
std::size_t n = std::max<std::size_t>(2048 / std::thread::hardware_concurrency(), 1);
grainsize = const_instrs_vec.size() / n;
#endif
simple_par_for(const_instrs_vec.size(), n, [&](const auto i) {
simple_par_for(const_instrs_vec.size(), grainsize, [&](const auto i) {
literals[i] = const_instrs_vec[i]->eval();
});

Expand Down

0 comments on commit cba5184

Please sign in to comment.