Skip to content

engine: models with modules or SMOOTH/DELAY skip incremental compile #295

Closed

Description

@bpowers

The salsa-based incremental compiler could not handle models with modules or with SMOOTH/DELAY/TREND, so those models fell back to the older whole-model compiler on every simlin_sim_new call.
Results were correct; the fallback just threw away the incremental speedup.

The gaps were:

  • module instances got no stock-phase code, even though the dependency graph ordered them with the stocks;
  • the helper stocks and flows that SMOOTH/DELAY/TREND expand into had no slots in the variable layout;
  • module output references (sub.out) could not be resolved, because the per-variable compile never saw the module's model;
  • every instance of a module compiled to the same code, ignoring which outside variables feed its inputs.

Current state

The whole-model compiler was deleted in #375, so every model, including modules and stdlib builtins, now compiles through compile_project_incremental.

Pointers

  • src/simlin-engine/src/db.rs (compile_project_incremental)
  • src/simlin-engine/src/db/assemble.rs, src/simlin-engine/src/db/layout.rs

Activity

  1. added
    engine
    on Jun 8, 2026
  2. changed the title [-]Incremental compilation gaps: modules, builtins, variable layout[/-] [+]engine: models with modules or SMOOTH/DELAY skip incremental compile[/+] on Oct 12, 2026
  3. added
    enhancement
    on Oct 12, 2026
  4. bpowers commented on Oct 12, 2026

    @bpowers
    OwnerAuthor

    Closing: already fixed on main.

    The monolithic compiler was deleted in 22978a5 (#375); simlin_sim_new calls queue_compile::compile_sim (src/libsimlin/src/simulation.rs:118), which sends every ordinary model through compile_project_incremental with no fallback. Module instances are enumerated per (target model, bound-port set) and implicit SMOOTH/DELAY helpers get layout slots and fragments in db/assemble.rs and db/layout.rs, and the corpus in tests/integration/simulate.rs runs module and builtin models through this one path.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    engineenhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions