diff options
author | 2020-04-13 21:32:00 +0200 | |
---|---|---|
committer | 2020-04-13 21:32:00 +0200 | |
commit | 5b6013caea7999deb8d481fbf67b28969d5e79ff (patch) | |
tree | f7185c986ca46533e8e58db6dbad395552f7b349 /src/lib/netlist/prg/nltool.cpp | |
parent | d4093c59dbd80bcac916c08dd49278f0b1052c26 (diff) |
netlist: improve performance up to 65% on audio netlists. [Couriersud]
This commit introduces precompiled static solver code. Due to
additional optimizations the compiler can use because the detail
calculation steps for the solution are known e.g. the kidniki netlist
sees a 100% speed increase.
In all environments (windows/*nix/osx) the source for the static
solver code can be created using
bash src/lib/netlist/nl_create_mame_solvers.sh
This will create src/lib/netlist/generated/static_solvers.cpp which is
compiled into the mame binary.
The script is just a temporary workaround. The intention is that nltool
whill be able to create this file with one call.
There are other improvements in this commit speeding up the processing
of timestep and dynamic calculations.
Diffstat (limited to 'src/lib/netlist/prg/nltool.cpp')
-rw-r--r-- | src/lib/netlist/prg/nltool.cpp | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/src/lib/netlist/prg/nltool.cpp b/src/lib/netlist/prg/nltool.cpp index 16fa0d0a6ea..bd0ec17f13c 100644 --- a/src/lib/netlist/prg/nltool.cpp +++ b/src/lib/netlist/prg/nltool.cpp @@ -23,6 +23,11 @@ #include <ios> #include <iostream> // scanf +#ifndef NL_DISABLE_DYNAMIC_LOAD +#define NL_DISABLE_DYNAMIC_LOAD 0 +#endif + + class tool_app_t : public plib::app { public: @@ -47,7 +52,8 @@ public: opt_dir(*this, "d", "dir", "", "output directory for the generated files"), opt_grp4(*this, "Options for run command", "These options are only used by the run command."), - opt_ttr (*this, "t", "time_to_run", 1, "time to run the emulation (seconds)\n\n abc def\n\n xyz"), + opt_ttr (*this, "t", "time_to_run", 1, "time to run the emulation (seconds)"), + opt_boostlib(*this, "", "boost_lib", "builtin", "generic: will use generic solvers.\nbuiltin: Use optimized solvers compiled in.\nsomelib.so: Use library with precompiled solvers."), opt_stats(*this, "s", "statistics", "gather runtime statistics"), opt_logs(*this, "l", "log" , "define terminal to log. This option may be specified repeatedly."), opt_inp(*this, "i", "input", "", "input file to process (default is none)"), @@ -94,6 +100,7 @@ public: plib::option_str opt_dir; plib::option_group opt_grp4; plib::option_num<nl_fptype> opt_ttr; + plib::option_str opt_boostlib; plib::option_bool opt_stats; plib::option_vec opt_logs; plib::option_str opt_inp; @@ -191,6 +198,23 @@ public: void vlog(const plib::plog_level &l, const pstring &ls) const noexcept override; + plib::unique_ptr<plib::dynlib_base> static_solver_lib() const override + { + if (m_app.opt_boostlib() == "builtin") + return netlist::callbacks_t::static_solver_lib(); + else if (m_app.opt_boostlib() == "generic") + return plib::make_unique<plib::dynlib_static>(nullptr); + if (NL_DISABLE_DYNAMIC_LOAD) + { + throw netlist::nl_exception("Dynamic library loading not supported due to project security concerns."); + } + else + { + //pstring libpath = plib::util::environment("NL_BOOSTLIB", plib::util::buildpath({".", "nlboost.so"})); + return plib::make_unique<plib::dynlib>(m_app.opt_boostlib()); + } + } + private: tool_app_t &m_app; }; |