Skip to content

feat!: upgrade llama.cpp from b10870 to b10878 - #425

Merged
bernardladenthin merged 1 commit into
mainfrom
claude/llama-cpp-b10878
Sep 9, 2026
Merged

feat!: upgrade llama.cpp from b10870 to b10878#425
bernardladenthin merged 1 commit into
mainfrom
claude/llama-cpp-b10878

Conversation

@bernardladenthin

Copy link
Copy Markdown
Owner

50.3 KiB / 8 commits / 25 files — under the runbook's 100 KiB chunking threshold, so bumped straight through rather than stepped.

Four pin sites moved (CMakeLists GIT_TAG, LlamaCppVersion.LLAMA_CPP_VERSION, CLAUDE.md, README badge), plus the two incidental b10870 mentions in CLAUDE.md's local-WebUI recipe and sccache section.

⚠️ Why this is marked breaking — it reaches the public Java API

Upstream deleted the deprecated --mlock, --mmap, --no-mmap, -dio/--direct-io and -ndio/--no-direct-io options in favour of -lm/--load-mode. Two of them are public API here:

ModelFlag.MLOCK("--mlock")      // emitted by ModelParameters.enableMlock()
ModelFlag.NO_MMAP("--no-mmap")  // emitted by ModelParameters.disableMmap()

LlamaModel.loadModel(parameters.toArray()) hands that argv straight to common_params_parse, where an unknown option is a hard error, not a warning. So both builder methods now produce a model load that fails.

No test catches this. ModelFlagTest and ModelParametersExtendedTest#testEnableMlock/#testDisableMmap assert only the string mapping (hasKey("--mlock")), never that llama.cpp still accepts it — they stay green while the flag is dead. Same "pins the mapping, not the contract" shape as the getMetrics() payload drift at b10408.

The whole deprecation window opened and closed inside this 8-tag range — --load-mode already existed at b10870:

tag --load-mode --mlock
b10850
b10870 (previous pin) (deprecation window)
b10878 removed

Faithful replacement is --mlock--load-mode mlock and --no-mmap--load-mode none. Deliberately not done here: choosing between re-pointing the two builders, adding a LoadMode value-taking setter, or removing the constants outright is a public-API decision, and a new enum-valued ModelParameters setter also drags in the by-name OCP_OVERLY_CONCRETE_PARAMETER list in spotbugs-exclude.xml. It belongs in its own change.

Patches — verified against the pristine tag, not assumed

The range touches two patch targets, so both were checked rather than left to the fail-loud applier:

  • 0001 (common/arg.cpp) — b10878 still carries the #ifdef _WIN32 count-guarded argv = utf8.ptrs.data() override, and common_params_parse_main appears 0 times in b10878:common/arg.h. Upstream has still not adopted the fix; the patch stays.
  • 0012 (src/llama-model.{cpp,h}) — b10878 still normalises with a bare splits[i] /= split_sum; and has no split_sum == 0 guard of its own, so CLAUDE.md's "drop rather than refresh" instruction does not fire. Its llama-model diff is only a new LLM_TYPE_1B_A400M enumerator (Granite3 MoE), far from the patch hunks.

Verification

check result
fresh configure through the real FetchContent path clean; stamp at head 4850c7727fa73bbe3098e10ee369fbc3467c445f (= b10878) with all nine patch hashes
cmake --build --config Release clean
ctest 527/527, incl. the four LlamaModelSplits.* cases — the only place 0012's extracted functions are linked
nm -D libjllama.so 40 Java_* exports
mvn -pl llama clean test -Dtest=NativeLibraryLoadSmokeTest 4/4, incl. nativeBuildInfoMatchesPinnedVersionConstant — the end-to-end proof that the pin sites and the linked binary agree

clean is required for the last one: LLAMA_CPP_VERSION is a compile-time constant javac inlines into the test class, and Maven's incremental compilation cannot see that dependency.

Other API movement in range — all unreachable here, checked not assumed

  • include/llama.h: llama_sampler_chain_n returns int32_t instead of int. No project TU calls it, and the two are the same type on every platform this builds for.
  • tools/mtmd/mtmd-helper.cpp: internal video frame-id propagation. mtmd-helper.h is untouched, so mtmd_helper::gen_audio and therefore TextToSpeech are unaffected.
  • ggml build system: GGML_CUDA_FA_ALL_QUANTS deprecated in favour of GGML_CUDA_FA_QUANTS. Not set anywhere in this repo, so it cannot reach the CUDA/HIP jobs.

docs/history/llama-cpp-breaking-changes.md carries the full analysis in two new rows.

🤖 Generated with Claude Code

https://claude.ai/code/session_01AnNYn8W1xuVxVJtyL34GyH


Generated by Claude Code

50.3 KiB / 8 commits / 25 files -- under the runbook's 100 KiB chunking
threshold, so bumped straight through rather than stepped.

Four pin sites moved (CMakeLists GIT_TAG, LlamaCppVersion.LLAMA_CPP_VERSION,
CLAUDE.md, README badge), plus the two incidental b10870 mentions in CLAUDE.md's
local-WebUI recipe and sccache section.

Verified rather than assumed, because the range touches two patch targets:

  * 0001 (common/arg.cpp): b10878 still carries the #ifdef _WIN32 count-guarded
    `argv = utf8.ptrs.data()` override, and common_params_parse_main appears 0
    times in b10878:common/arg.h -- upstream has still not adopted the fix.
  * 0012 (src/llama-model.{cpp,h}): b10878 still normalises with a bare
    `splits[i] /= split_sum;` and has no split_sum == 0 guard of its own, so
    CLAUDE.md's "drop rather than refresh" instruction does not fire. Its
    llama-model diff is only a new LLM_TYPE_1B_A400M enumerator, far from the
    patch hunks.

Fresh configure through the real FetchContent path: stamp written at head
4850c7727fa73bbe3098e10ee369fbc3467c445f (= b10878) with all nine hashes.
Release build clean. ctest 527/527, including the four LlamaModelSplits.* cases
that are the only place 0012's extracted functions are linked. 40 Java_* exports.
`mvn -pl llama clean test -Dtest=NativeLibraryLoadSmokeTest` 4/4, including
nativeBuildInfoMatchesPinnedVersionConstant -- the end-to-end proof that the pin
sites and the linked binary agree. (clean is required: javac inlines the constant
into the test class and Maven's incremental compile cannot see that dependency.)

NOT fixed here, and the reason this commit is marked breaking: upstream deleted
the deprecated --mlock, --mmap, --no-mmap, -dio/--direct-io and
-ndio/--no-direct-io options in favour of --load-mode. Two of them are public
Java API here -- ModelFlag.MLOCK and ModelFlag.NO_MMAP, emitted by
ModelParameters.enableMlock() and disableMmap() -- and loadModel() hands that
argv straight to common_params_parse, where an unknown option is a hard error.
So both builder methods now produce a failing model load.

No test catches it: ModelFlagTest and ModelParametersExtendedTest assert only
the string mapping, never that llama.cpp still accepts the flag, so they stay
green while the flag is dead. The whole deprecation window opened and closed
inside this 8-tag range -- --load-mode already existed at b10870.

The faithful replacement is --mlock -> --load-mode mlock and --no-mmap ->
--load-mode none, but choosing between re-pointing the two builders, adding a
LoadMode value-taking setter, or removing the constants outright is a public-API
decision and is left to its own change. docs/history records the full analysis.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AnNYn8W1xuVxVJtyL34GyH
@bernardladenthin
bernardladenthin merged commit 3eff05d into main Sep 9, 2026
8 of 14 checks passed
@bernardladenthin
bernardladenthin deleted the claude/llama-cpp-b10878 branch September 9, 2026 15:14
@sonarqubecloud

sonarqubecloud Bot commented Sep 9, 2026

Copy link
Copy Markdown

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