Skip to content

Version 1.20260803.0 - #591

Merged
agarny merged 14 commits into
opencor:mainfrom
agarny:cleaning-up
Aug 2, 2026
Merged

Version 1.20260803.0#591
agarny merged 14 commits into
opencor:mainfrom
agarny:cleaning-up

Conversation

@agarny

@agarny agarny commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

No description provided.

Copilot AI review requested due to automatic review settings August 2, 2026 07:13

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR bumps the library version, adds new benchmark harnesses/resources across C++/Python/JavaScript, and includes several runtime/solver improvements (notably around Emscripten/WASM function dispatch and KINSOL reuse), along with new regression/coverage tests.

Changes:

  • Bump VERSION.txt and add benchmark resources (SED-ML) and runners for C++/Python/JavaScript.
  • Extend solver and SED instance test coverage (KINSOL different system sizes; preserve issues after run()).
  • Refactor runtime/solver internals (WASM function table usage, KINSOL object caching, logger issue counter fast-path, ORC JIT host CPU).

Reviewed changes

Copilot reviewed 33 out of 35 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
VERSION.txt Version bump to 1.20260802.0.
tests/res/benchmark/tt04.sedml Adds a benchmark SED-ML resource.
tests/res/benchmark/hypercapnea.sedml Adds a benchmark SED-ML resource with parameter changes.
tests/res/api/solver/nla3.cellml Adds a CellML model for larger NLA-system testing.
tests/CMakeLists.txt Adds a native benchmark executable + benchmark target.
tests/bindings/python/test_solver_kinsol.py Adds Python test for solving different NLA system sizes.
tests/bindings/python/test_sed_instance.py Adds regression test: issues persist after run() on invalid instance.
tests/bindings/python/CMakeLists.txt Generates Python benchmark script + adds python_benchmark target.
tests/bindings/python/benchmark.in.py Implements Python benchmark driver.
tests/bindings/javascript/solver.kinsol.test.js Adds JS test for solving different NLA system sizes.
tests/bindings/javascript/sed.instance.test.js Adds regression test: issues persist after run() on invalid instance.
tests/bindings/javascript/res/res/libopencor.js Adjusts JS resource loader to store libOpenCOR handle globally.
tests/bindings/javascript/CMakeLists.txt Adds javascript_benchmark target.
tests/bindings/javascript/benchmark.js Implements JavaScript benchmark driver.
tests/benchmark/benchmark.cpp Implements C++ benchmark executable.
tests/api/solver/kinsoltests.cpp Adds C++ unit test for different NLA system sizes.
tests/api/solver/coveragetests.cpp Adds coverage test ensuring KINSOL objects are recreated/reused correctly across solves.
tests/api/sed/instancetests.cpp Adds C++ regression test: issues persist after run() on invalid instance.
src/support/cellml/cellmlfileruntime.h Adjusts runtime interface for WASM/table-based function dispatch.
src/support/cellml/cellmlfileruntime.cpp Implements WASM table slot installation + per-thread base reuse.
src/support/cellml/cellmlfileruntime_p.h Updates private runtime storage consistent with new dispatch approach.
src/solver/solverode.cpp Caches compute-rates function pointer for faster calls.
src/solver/solverode_p.h Stores cached compute-rates function pointer.
src/solver/solverkinsol.cpp Adds KINSOL object caching + Emscripten objective-function slot resolution.
src/solver/solverkinsol_p.h Adds cached KINSOL objects and associated state.
src/solver/solvercvode.cpp Uses cached compute-rates function pointer via user-data.
src/solver/solvercvode_p.h Stores cached compute-rates function pointer in CVODE user-data.
src/sed/sedinstancetask.cpp Simplifies runtime calls via function-pointer getters.
src/sed/sedinstance.cpp Restores initial task issues on run() and updates issue-count bookkeeping.
src/sed/sedinstance_p.h Stores separate issue/error/warning snapshots for restoring on run.
src/misc/compiler.cpp Tunes ORC JIT target machine builder to host CPU + aggressive opt.
src/logger/logger.cpp Uses atomic counters for fast has*/*Count without locking.
src/logger/logger_p.h Switches to std::mutex and adds atomic counters for issues/errors/warnings.
Suppressed comments (4)

src/logger/logger.cpp:58

  • Same memory-ordering issue as for issue counts: hasErrors()/errorCount() are read without locking, so they should use memory_order_acquire to synchronize with memory_order_release updates in writer paths.
bool Logger::Impl::hasErrors() const
{
    return mErrorCount.load(std::memory_order_relaxed) != 0;
}

size_t Logger::Impl::errorCount() const
{
    return mErrorCount.load(std::memory_order_relaxed);
}

src/logger/logger.cpp:86

  • Same memory-ordering issue as for issue counts: hasWarnings()/warningCount() are read without locking, so they should use memory_order_acquire to synchronize with memory_order_release updates in writer paths.
bool Logger::Impl::hasWarnings() const
{
    return mWarningCount.load(std::memory_order_relaxed) != 0;
}

size_t Logger::Impl::warningCount() const
{
    return mWarningCount.load(std::memory_order_relaxed);
}

src/logger/logger.cpp:136

  • The issue vectors are mutated under the mutex, but the corresponding counters are updated with memory_order_relaxed, which permits reordering of the counter update ahead of the vector mutation as observed by lock-free readers. Use memory_order_release on these increments so hasIssues()/issueCount() (with acquire loads) won’t observe a non-zero count before the vectors are updated.
    auto issue {IssuePtr {new Issue {pType, pDescription, pContext}}};
    mIssues.push_back(issue);

    mIssueCount.fetch_add(1, std::memory_order_relaxed);

src/logger/logger.cpp:168

  • removeAllIssues() updates the vectors and then resets the lock-free counters, but memory_order_relaxed allows the compiler to reorder the counter reset before the vector clears as observed by other threads. Use memory_order_release for these stores so lock-free readers doing acquire loads won’t see zero counts while old issues are still visible.
void Logger::Impl::removeAllIssues()
{
    const std::scoped_lock<std::mutex> lock(mMutex);

    mIssues.clear();
    mErrors.clear();
    mWarnings.clear();

    mIssueCount.store(0, std::memory_order_relaxed);
    mErrorCount.store(0, std::memory_order_relaxed);
    mWarningCount.store(0, std::memory_order_relaxed);

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tests/res/benchmark/hypercapnea.sedml
Comment thread src/sed/sedinstance.cpp Outdated
Comment thread src/sed/sedinstance.cpp Outdated
Comment thread src/logger/logger.cpp
@agarny
agarny force-pushed the cleaning-up branch 5 times, most recently from bfc39da to dc4d6d3 Compare August 2, 2026 12:09
@agarny agarny changed the title Version 1.20260802.0 Version 1.20260803.0 Aug 2, 2026
@agarny
agarny merged commit 423a252 into opencor:main Aug 2, 2026
24 checks passed
@agarny
agarny deleted the cleaning-up branch August 2, 2026 15:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants