Skip to content

Add wasm-jit testing - #289

Merged
sjoelund merged 2 commits into
masterfrom
wasm-jit-testing
Aug 4, 2026
Merged

Add wasm-jit testing#289
sjoelund merged 2 commits into
masterfrom
wasm-jit-testing

Conversation

@sjoelund

@sjoelund sjoelund commented Aug 4, 2026

Copy link
Copy Markdown
Member

No description provided.

sjoelund and others added 2 commits August 4, 2026 13:49
wasm-jit generates neither a makefile nor an executable; the model is
JIT-compiled inside the omc that translated it. Detect the target from
the customCommands (so `--extraflags` selects it), skip the build step
and simulate with `simulate(..., resimulateExecutable=...)` in that same
session instead of running an executable that does not exist.

Two things turned a failure into a hang rather than a reported error:

- `writeResultAndExit` called the builtin `quit()` instead of
  `quit_omc()`, so `SystemExit` was raised before `os._exit()` and the
  interpreter then waited forever for a thread stuck in a ZMQ receive.
- `sendExpressionTimeout` only joined that thread with a timeout, so an
  omc that died mid-command was not noticed until the full `ulimitOmc`
  had elapsed. It now polls the process and exits as soon as it dies.

The C path checks that the executable exists before running it.

The default 8 GB virtual memory limit is too small for wasm-jit: omc
peaks at ~5.8 GB and the JIT then reserves 4 GB of address space for the
wasm memory, so every simulation failed with `mmap failed to reserve
0x104000000 bytes`. Use 16 GB for that target.

Also adds the experimental wasm-jit regression job to the Jenkinsfile.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The wasm-jit target JIT-compiles the model inside omc, and the test
tool ran `translateModel` followed by `simulate(resimulateExecutable=)`.
That path never calls `buildModel`, so `timeCompile` is not measured and
the compile lands in the simulation time instead — reported as a build
time of 0 and a correspondingly inflated `sim`.

`--nobuildmodel` translates, builds and runs in a single `simulate()`
call, which reports the phase times itself, and takes the build and
simulation times from that record rather than the wall clock around the
command. For VehicleInterfaces the same run splits as:

| Flag              | build   | sim     |
|-------------------|---------|---------|
| (none)            | 0.00000 | 0.44668 |
| `--nobuildmodel`  | 0.21299 | 0.21309 |

`--coldhot` simulates each model twice in the same omc. The second run
reuses the module compiled for the first, so it is the hot number; both
are printed but only the hot one is stored, since the database columns
are enumerated in the insert.

Both flags only apply to `simCodeTarget=wasm-jit`, and only set their
config key when passed, so the confighash — and therefore the stored
history — of a normal run is unchanged.

`runRegressiontest` gains a `testFlags` argument, passed to `test.py`
verbatim; the wasm-jit job uses it for `--nobuildmodel`.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@sjoelund
sjoelund merged commit 7bfa82f into master Aug 4, 2026
7 checks passed
@sjoelund
sjoelund deleted the wasm-jit-testing branch August 4, 2026 15:59
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.

1 participant