Skip to content

sync with latest upstream llama.cpp (v3.5.0)#252

Merged
ngxson merged 5 commits into
masterfrom
xsn/sync29
Jun 15, 2026
Merged

sync with latest upstream llama.cpp (v3.5.0)#252
ngxson merged 5 commits into
masterfrom
xsn/sync29

Conversation

@ngxson

@ngxson ngxson commented Jun 15, 2026

Copy link
Copy Markdown
Owner

Summary by CodeRabbit

  • Chores
    • Released version 3.5.0
    • Updated WebAssembly runtime settings (increased stack size) and disabled MTMD video support
    • Improved build/publish flow: docs generated during build; compat build can be skipped via an environment flag
    • Updated default CDN URLs to the latest 3.5.0 artifacts
  • Tests
    • Added CI-friendly auto test mode (disables watch)
    • Improved automated bisect testing for locale-related crashes
  • Bug Fixes
    • Clear runtime error when device memory data isn’t available/implemented

@coderabbitai

coderabbitai Bot commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 3dca1796-1d78-486c-a634-9d738582701b

📥 Commits

Reviewing files that changed from the base of the PR and between 7072f84 and 4f9a21d.

📒 Files selected for processing (1)
  • compat/.npmignore

📝 Walkthrough

Walkthrough

Bumps the llama.cpp submodule to a new commit, adds CMake build fixes (disabling MTMD_VIDEO, setting 5MB WASM stack), updates the common_get_device_memory_data C++ stub signature, introduces SKIP_COMPAT build flag and a bisect_test.sh debug script, adds an AUTO non-watch test mode, and cuts the 3.5.0 release across all version references.

Changes

wllama 3.5.0 Release with llama.cpp Update

Layer / File(s) Summary
llama.cpp submodule bump
llama.cpp
The pinned llama.cpp git subproject reference is advanced to a new commit hash.
WASM build fixes for new llama.cpp
CMakeLists.txt, cpp/wllama-context.h
CMakeLists.txt forcibly disables MTMD_VIDEO and adds -sSTACK_SIZE=5MB to Emscripten linker flags. The common_get_device_memory_data stub in wllama-context.h is wrapped in #if 1/#endif and its parameter types are updated to remove struct/enum prefixes to match the new llama.cpp API.
SKIP_COMPAT build flag and bisect script
scripts/docker-compose.yml, scripts/bisect_test.sh
docker-compose.yml adds a SKIP_COMPAT environment variable and wraps the compat WASM build steps in a conditional. The new bisect_test.sh script patches wllama-context.h based on detected fit.h signature, rebuilds with SKIP_COMPAT=1, and drives git bisect using AUTO=1 test results.
Automated test mode and script updates
vitest.config.ts, package.json
vitest.config.ts conditionally sets watch: false when process.env.AUTO === '1'. package.json adds a test:auto script, moves post_build.sh and docs generation into the build script, and removes prepublishOnly.
3.5.0 version bump and CDN URLs
package.json, compat/package.json, src/wasm-from-cdn.ts
Versions bumped from 3.4.1 to 3.5.0 in both package files. CDN URLs in wasm-from-cdn.ts updated to @wllama/wllama@3.5.0 and @wllama/wllama-compat@3.5.0. The compat prepublishOnly script is removed.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • ngxson/wllama#243: Directly modifies the same common_get_device_memory_data stub in cpp/wllama-context.h, toggling its compilation with comment-style delimiters where this PR uses #if 1.
  • ngxson/wllama#187: Also advances the llama.cpp submodule commit and bumps WasmFromCDN/WasmCompatFromCDN CDN URLs in src/wasm-from-cdn.ts.
  • ngxson/wllama#244: Modifies the same WasmFromCDN.default and WasmCompatFromCDN.worker/wasm CDN URL constants in src/wasm-from-cdn.ts to point at a bumped package version.

Poem

🐇 Hop hop, the submodule's new,
The stack grew big — five megabytes too!
MTMD_VIDEO? Off it goes,
bisect_test.sh hunts bugs in rows.
Version 3.5.0 hops into view,
A rabbit ships the build anew! 🎉

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'sync with latest upstream llama.cpp (v3.5.0)' is partially related to the changeset. While the PR does update the llama.cpp submodule commit, the primary changes include package version bumps (3.4.1 → 3.5.0), build script modifications, conditional compilation updates, and test automation additions.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch xsn/sync29

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@scripts/bisect_test.sh`:
- Around line 21-24: The sed commands modifying CONTEXT_H at lines 21 and 24 use
overly broad regex patterns that match any standalone `#if` 0 or `#if` 1 line in the
file, potentially rewriting unrelated preprocessor blocks and invalidating the
bisect test. To fix this, scope the sed replacements to target only the
common_get_device_memory_data compatibility block by including surrounding
context lines in the sed command. This could be done by matching a few lines of
context before or after the target `#if` statement, or by anchoring the pattern to
a nearby function name or comment that uniquely identifies the compatibility
block you intend to modify. This ensures only the specific block gets rewritten
while leaving other `#if` blocks in the file untouched.

In `@scripts/docker-compose.yml`:
- Around line 53-67: The `SKIP_COMPAT` conditional block (lines 54-67) skips
creation of the `build-compat` directory when the flag is set, but a subsequent
`ls` command at line 74 unconditionally attempts to access this directory. With
`set -e`, this causes the script to fail even when the main build succeeds. Wrap
the `ls build-compat` command at line 74 with the same `if [ -z "${SKIP_COMPAT}"
]` conditional guard used for the build block so it only executes when the
directory actually exists.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: ca935937-3f17-4ed4-b2c6-16547340efe8

📥 Commits

Reviewing files that changed from the base of the PR and between c878eee and 16e0b68.

⛔ Files ignored due to path filters (1)
  • src/wasm/wllama.wasm is excluded by !**/*.wasm
📒 Files selected for processing (13)
  • CMakeLists.txt
  • compat/package.json
  • compat/wasm/wllama.js
  • cpp/wllama-context.h
  • llama.cpp
  • package.json
  • scripts/bisect_test.sh
  • scripts/docker-compose.yml
  • src/wasm-from-cdn.ts
  • src/wasm/source-map.ts
  • src/wasm/wllama.js
  • src/workers-code/generated.ts
  • vitest.config.ts

Comment thread scripts/bisect_test.sh
Comment thread scripts/docker-compose.yml
@ngxson ngxson merged commit 3c0315c into master Jun 15, 2026
3 of 4 checks passed
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