diff options
author | 2020-06-13 15:49:35 +0200 | |
---|---|---|
committer | 2020-06-13 15:49:35 +0200 | |
commit | e949e9c29de82ee7c32692e7b65da05dd22bdc9d (patch) | |
tree | 8770696a48827e3b63d94063f8162eaadeff6539 /src/lib/netlist/nl_base.cpp | |
parent | 75681d760c478f772fdb1603222498f96a9b61e7 (diff) |
netlist: Performance improvement and refactoring. [Couriersud]
Kidniki now achieves up to 910% when run with static solvers and with
nltool. That is significant better than the 860% we have seen
previously.
This increase is driven by using a global memory pool in the solver
code.
In addition the following refactoring and code maintenance work is
included. Please excuse the large commit, some of this took interfered
with other work and the detail development steps were ugly.
- gsl support: This commit adds pgsl.h which implements a very limited
number of the functionality of the gsl header described in the c++ core
guidelines.
- clang-tidy fixes
- A significant refactoring of palloc.h. Aligned hints were removed,
they added complexity without a significant performance gain. Vector
operations should better be done on special spans/views.
The code has been tested on linux with g++-7, g++-9, clang-11.
On Windows mingw-10 and VS2019, OSX clang-11.
Diffstat (limited to 'src/lib/netlist/nl_base.cpp')
-rw-r--r-- | src/lib/netlist/nl_base.cpp | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/lib/netlist/nl_base.cpp b/src/lib/netlist/nl_base.cpp index 42104458f7a..a9ac57f620d 100644 --- a/src/lib/netlist/nl_base.cpp +++ b/src/lib/netlist/nl_base.cpp @@ -27,7 +27,7 @@ namespace netlist host_arena::unique_ptr<plib::dynlib_base> callbacks_t:: static_solver_lib() const { - return host_arena::make_unique<plib::dynlib_static>(nullptr); + return plib::make_unique<plib::dynlib_static, host_arena>(nullptr); } // ---------------------------------------------------------------------------------------- @@ -129,9 +129,9 @@ namespace netlist m_lib = m_callbacks->static_solver_lib(); - m_setup = host_arena::make_unique<setup_t>(*this); + m_setup = plib::make_unique<setup_t, host_arena>(*this); // create the run interface - m_netlist = m_pool.make_unique<netlist_t>(*this, name); + m_netlist = plib::make_unique<netlist_t>(m_pool, *this, name); // Make sure save states are invalidated when a new version is deployed @@ -313,7 +313,7 @@ namespace netlist case 0: { std::vector<core_device_t *> d; - std::vector<nldelegate *> t; + std::vector<const nldelegate *> t; log().verbose("Using default startup strategy"); for (auto &n : m_nets) for (auto & term : n->core_terms()) @@ -402,7 +402,7 @@ namespace netlist } log().verbose("Total calls : {1:12} {2:12} {3:12}", total_count, - total_time, total_time / static_cast<decltype(total_time)>((total_count > 0) ? total_count : 1)); + total_time, total_time / gsl::narrow<decltype(total_time)>((total_count > 0) ? total_count : 1)); log().verbose("Total loop {1:15}", si.m_stat_mainloop()); log().verbose("Total time {1:15}", total_time); @@ -424,8 +424,8 @@ namespace netlist } plib::pperftime_t<true>::type total_overhead = overhead() - * static_cast<plib::pperftime_t<true>::type>(total_count) - / static_cast<plib::pperftime_t<true>::type>(200000); + * gsl::narrow<plib::pperftime_t<true>::type>(total_count) + / gsl::narrow<plib::pperftime_t<true>::type>(200000); log().verbose("Queue Pushes {1:15}", si.m_queue.m_prof_call()); log().verbose("Queue Moves {1:15}", si.m_queue.m_prof_sortmove()); @@ -436,7 +436,7 @@ namespace netlist log().verbose("Take the next lines with a grain of salt. They depend on the measurement implementation."); log().verbose("Total overhead {1:15}", total_overhead); plib::pperftime_t<true>::type overhead_per_pop = (si.m_stat_mainloop()-2*total_overhead - (total_time - total_overhead)) - / static_cast<plib::pperftime_t<true>::type>(si.m_queue.m_prof_call()); + / gsl::narrow<plib::pperftime_t<true>::type>(si.m_queue.m_prof_call()); log().verbose("Overhead per pop {1:11}", overhead_per_pop ); log().verbose(""); } @@ -450,7 +450,7 @@ namespace netlist if (stats->m_stat_inc_active() > 3 * stats->m_stat_total_time.count() && stats->m_stat_inc_active() > trigger) log().verbose("HINT({}, NO_DEACTIVATE) // {} {} {}", ep->name(), - static_cast<nl_fptype>(stats->m_stat_inc_active()) / static_cast<nl_fptype>(stats->m_stat_total_time.count()), + gsl::narrow<nl_fptype>(stats->m_stat_inc_active()) / gsl::narrow<nl_fptype>(stats->m_stat_total_time.count()), stats->m_stat_inc_active(), stats->m_stat_total_time.count()); } log().verbose(""); @@ -856,14 +856,14 @@ namespace netlist pstring param_t::get_initial(const core_device_t *dev, bool *found) const { pstring res = dev->state().setup().get_initial_param_val(this->name(), ""); - *found = (res != ""); + *found = (!res.empty()); return res; } param_str_t::param_str_t(core_device_t &device, const pstring &name, const pstring &val) : param_t(device, name) { - m_param = host_arena::make_unique<pstring>(val); + m_param = plib::make_unique<pstring, host_arena>(val); *m_param = device.state().setup().get_initial_param_val(this->name(),val); } @@ -871,7 +871,7 @@ namespace netlist : param_t(name) { // deviceless parameter, no registration, owner is responsible - m_param = host_arena::make_unique<pstring>(val); + m_param = plib::make_unique<pstring, host_arena>(val); *m_param = state.setup().get_initial_param_val(this->name(),val); } |