Skip to content

Wire the OpenMP runtime into slim bundles alongside ggml - #18

Merged
danielhanchen merged 1 commit into
masterfrom
land-wiring
Aug 9, 2026
Merged

danielhanchen merged 1 commit into
masterfrom
land-wiring

Conversation

@danielhanchen

Copy link
Copy Markdown
Member

What broke

The nightly slim run failed on linux/arm64 (run 31283085719):

ERROR: whisper-server --help produced no usage text (rc=127):
bundle/whisper-server: error while loading shared libraries:
libomp.so.5: cannot open shared object file: no such file or directory

Slim bundles ship no ggml, so validation wires it in from the paired unslothai/llama.cpp cpu bundle. That llama arm64 slice is clang-built:

libggml-base.so         NEEDED libomp.so.5   RUNPATH $ORIGIN
libggml-cpu-armv8.0_1   NEEDED libomp.so.5   RUNPATH $ORIGIN

libomp.so.5 ships inside the llama bundle and is not a system library, but wire_ggml globbed only libggml* (plus libomp*.dll, added earlier for windows-arm64), so it never landed next to whisper-server and $ORIGIN had nothing to resolve. linux/x64 is gcc-built and picks up libgomp.so.1 from the host, which is why only arm64 broke; macOS is Apple clang with no OpenMP at all.

The change

wire_ggml also globs libomp*.so, libomp*.so.* and libomp*.dylib, and the two pattern groups are split so the OpenMP rationale sits next to the patterns instead of inside the loop. Behaviour is unchanged everywhere the llama bundle ships no libomp.

Wiring stays idempotent: names already present are skipped, only the extracted bundle is touched, never the packaged archive. Both properties are now stated in the docstring.

Verification

Against the published v1.9.2-unsloth.5 bundles and their paired llama releases:

  • arm64, the actual bug: walking the transitive NEEDED closure of the real bundle statically gives unresolved -> ['libomp.so.5'] before this change and unresolved -> none after it.
  • x64, no regression: full validate_bundle.py --ggml-dir --cpu-only run wires the same 21 objects as the passing CI job, then --help OK, closure OK, and a real /inference POST returns 'And so my fellow Americans ask not what your country can do for you...'.
  • Idempotent: a second full validate run over the same extracted dir reports wired 0 and leaves the directory tree byte-identical.

Follow-up, not in this PR

requires_ggml_sonames in the published manifest lists only the two ggml sonames, so an installer that wires from that list (or from a libggml* glob) still produces an unloadable bundle on arm64 Linux, and on Windows, where ggml-base.dll imports libomp140.<arch>.dll on both arches. The manifest fix plus a CI gate that asserts every library the loader takes from the llama dir is published in requires_ggml_sonames both touch .github/workflows/, which my token cannot push; I will open that as a separate PR.

The scheduled slim run failed on linux/arm64: whisper-server exited 127 with
"libomp.so.5: cannot open shared object file". llama's arm64 slice is
clang-built, so the libggml-base.so we wire in NEEDS libomp.so.5 with RUNPATH
$ORIGIN. That library ships inside the llama bundle and is not a system
library, but the wiring globbed only libggml* (plus libomp*.dll for
windows-arm64), so it never landed next to whisper-server. linux/x64 is
gcc-built and resolves libgomp.so.1 from the host, which is why only arm64
broke.

Wire libomp*.so / .so.* / .dylib as well, and split the globs so the two
groups are documented apart. Names already present in the bundle are still
skipped, so re-running over an extracted bundle stays a no-op and only the
extracted copy is ever touched, never the packaged archive.

Verified against the published v1.9.2-unsloth.5 bundles and their paired
llama.cpp releases: walking the arm64 loader closure statically leaves
libomp.so.5 unresolved before this change and nothing unresolved after it,
the x64 bundle still wires the same 21 objects and passes end to end (help,
closure, real /inference transcription), and a second validate run leaves the
bundle dir byte-identical.
@danielhanchen
danielhanchen merged commit f6c3464 into master Aug 9, 2026
@danielhanchen
danielhanchen deleted the land-wiring branch August 9, 2026 07:20
danielhanchen added a commit to unslothai/unsloth that referenced this pull request Aug 9, 2026
…8230)

* fix(studio): wire llama's OpenMP runtime into slim whisper installs

The slim wiring mirrors libggml*/ggml*.dll plus libomp*.dll from the paired
llama bin dir. The DLL glob was added for llama's clang-built windows-arm64
ggml-base.dll; the ELF side was left out on the assumption that Linux ggml
takes libgomp.so.1 from the host. That holds for the gcc-built x64 slice but
not for arm64: llama's arm64 libggml-base.so is clang-built and NEEDS
libomp.so.5 with RUNPATH $ORIGIN, and that library ships inside the llama
bundle rather than on the host. Every slim install on linux arm64 therefore
wired a ggml stack whose loader immediately failed with "libomp.so.5: cannot
open shared object file", so dictation fell back to Transformers.

Add libomp*.so* and libomp*.dylib to the globs, and bump
SLIM_RUNTIME_WIRING_VERSION so installs made under the old wiring re-wire
instead of reporting themselves current: their marker does not list
libomp.so.5, so the missing-library check that would otherwise repair them
never fires.

whisper.cpp side is unslothai/whisper.cpp#18 (CI wiring) and #19, which adds
the library to requires_ggml_sonames. That gate reads the llama bin dir, where
libomp.so.5 is a real file, so the new manifests pair correctly with both the
old and the new installer.

Verified against the real published llama.cpp arm64 and x64 cpu bundles:
wiring the arm64 bundle now places libomp.so.5 beside whisper-server and pulls
in no llama libraries; every soname the new whisper manifests require exists as
a file in the paired llama bin dir on both arches; and an x64 whisper-server
wired through link_ggml_runtime starts and returns a real transcription. All
350 whisper/llama/prebuilt-core install tests pass.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Tighten the libomp wiring comments for PR #8230

* Fix the sidecar's ROCm wiring version check for PR #8230

---------

Co-authored-by: danielhanchen <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
pull Bot pushed a commit to Penguinjanator/whisper.cpp that referenced this pull request Aug 9, 2026
unslothai#19)

Wiring the OpenMP runtime in CI (unslothai#18) fixed the build, but the contract the
Studio installer actually reads did not change: requires_ggml_sonames still
listed only the two ggml sonames, so an installer wiring from that list (or
from a libggml* glob) still lands an arm64 bundle whose whisper-server cannot
load. Windows has the same hole - ggml-base.dll imports libomp140.<arch>.dll
on BOTH arches, verified in the PE import tables of the paired llama bundles -
and only passed CI because the wiring globs libomp*.dll.

Make the soname contract per-arch in the platform strategies rather than
per-job, so the manifest is derived where the rest of the packaging contract
lives: libomp.so.5 on linux/arm64, libomp140.<arch>.dll on both Windows
arches. linux/x64 (gcc, libgomp from the host) and macOS (Apple clang, no
OpenMP) are unchanged, and the existing GGML_SONAMES override still wins, so
the macOS jobs that pass their own per-arch closure are untouched.

Then close the loop in CI: on Linux, validate_bundle.py now asserts that every
library the loader resolves out of the paired llama bundle appears in
requires_ggml_sonames. CI wires by glob and the installer wires from the list,
so without this the two drift and the build goes green while every install is
broken - exactly what happened here. A declared name the llama bundle does not
provide is a warning, not a failure, so a llama-side change cannot block a
release on its own.

Verified by packaging synthetic linux slim bundles for both arches (arm64 gains
libomp.so.5, x64 unchanged), by running the full validation against the
published v1.9.2-unsloth.5 x64 bundle and its paired llama release (contract
OK, real /inference transcription), and by a 13-case suite covering both real
llama bundles plus a synthetic ELF chain that proves the gate fails on an
undeclared lib, passes once declared, and only warns on a stale entry.

Co-authored-by: danielhanchen <[email protected]>
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