Skip to content

bump to latest, add mem64#211

Merged
ngxson merged 4 commits into
masterfrom
xsn/v_2_4
Apr 27, 2026
Merged

bump to latest, add mem64#211
ngxson merged 4 commits into
masterfrom
xsn/v_2_4

Conversation

@ngxson
Copy link
Copy Markdown
Owner

@ngxson ngxson commented Apr 27, 2026

Prepare for 2.4 release

Ref issue: #210

Summary by CodeRabbit

  • New Features

    • 64-bit WASM memory/addressing support for larger workloads.
    • Jinja template runtime added.
    • Local dev server now serves a small example landing page and prints the full local URL.
  • Documentation

    • Requirements updated: Memory64 is mandatory; Safari support removed.
  • Chores

    • Version bumped to 2.4.0 and WASM CDN references refreshed.
    • Build toolchain image and compilation flags updated.
  • Style

    • Minor JSX/markup formatting tweaks.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 27, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: b5a1a846-11e6-406e-bbfb-16ea1d83b94f

📥 Commits

Reviewing files that changed from the base of the PR and between 067a855 and ff9f3de.

📒 Files selected for processing (1)
  • README.md
✅ Files skipped from review due to trivial changes (1)
  • README.md

📝 Walkthrough

Walkthrough

Memory64/Imported memory is required across the build and runtime: package bumped to 2.4.0, WASM/tooling updated for 64-bit memory, worker code switched to BigInt pointer handling, EMSDK/docker flags and CDN/submodule references updated, plus minor README and UI tweaks.

Changes

Cohort / File(s) Summary
Documentation
README.md
Removed "Version 2.0 is released" announcement; added requirement that Memory64 is mandatory and noted dropped Safari support with issue link.
Build & Runtime Flags
scripts/build_wasm.sh, scripts/docker-compose.yml
EMSDK image tag bumped to 4.0.20; added -sMEMORY64=1 and -sIMPORTED_MEMORY=1 to Emscripten flags.
Package & CDN
package.json, src/wasm-from-cdn.ts
Version bumped 2.3.72.4.0; Playwright upgraded; added @huggingface/jinja dependency; CDN WASM URLs updated to @wllama/[email protected].
Worker & WASM Pointer Handling
src/workers-code/llama-cpp.js
Switches to 64-bit pointer handling: WebAssembly.Memory initial/maximum as BigInt with address: 'i64', cwrap pointer types 'bigint', and BigInt↔Number casts when accessing HEAP buffers.
C++ Emscripten Adjustments
cpp/wllama.cpp
wllama_debug memory computations use size_t and cast sbrk(0) to size_t for free-memory math.
Submodule Reference
llama.cpp
Git submodule commit pointer updated to a newer commit (4abef75...42401c72...).
Examples/UI
examples/main/src/components/MarkdownMessage.tsx
Minor JSX formatting change for the <code> opening tag; no behavioral change.
Local Dev Server
scripts/http_server.js
Root ("/") now serves a small HTML page with example links; startup log prints full local URL.

Sequence Diagram(s)

sequenceDiagram
    participant Client as Client
    participant Worker as Worker (llama-cpp.js)
    participant Wasm as WASM Module
    participant Memory as WASM Memory (64-bit)
    Note over Worker,Wasm: BigInt pointer flow with 64-bit WASM memory (MEMORY64 + IMPORTED_MEMORY)

    Client->>Worker: request (infer / embed)
    Worker->>Wasm: module.init() (cwrap pointer type = 'bigint')
    Worker->>Memory: wllama_malloc(size: BigInt)
    Memory-->>Worker: pointer (BigInt)
    Worker->>Wasm: write input at HEAPU8[ Number(pointer) ]
    Worker->>Wasm: call wllama.action(pointer: BigInt, ...)
    Wasm->>Memory: read/write using 64-bit addresses
    Wasm-->>Worker: returns output pointer (BigInt)
    Worker->>Wasm: read output via HEAPU8[ Number(outputPtr) ]
    Worker-->>Client: respond with result
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

Poem

🐰 I nibble bytes and hop on stacks,

BigInt paws leave tiny tracks.
Memory64 makes fields expand,
WASM hills wide across the land.
I dance — a rabbit in compiled sand.

🚥 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 'bump to latest, add mem64' directly reflects the main changes: updating dependencies/versions and adding Memory64 support with the MEMORY64 flag.
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/v_2_4

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

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (1)
examples/main/src/components/MarkdownMessage.tsx (1)

15-15: Formatting change appears unrelated to PR objectives.

This line contains only a formatting change (collapsing attributes onto one line), which doesn't relate to the mem64 feature or version bump described in the PR objectives. This might be an accidental auto-formatter change.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@examples/main/src/components/MarkdownMessage.tsx` at line 15, Revert the
unrelated formatting change in the MarkdownMessage component: restore the
original attribute formatting for the <code ... {...props}> element (i.e., split
attributes back to their previous lines) so the diff only contains
mem64/version-bump related changes; locate the <code className="bg-base-200
rounded px-1 py-[2px] text-sm" {...props}> occurrence inside the MarkdownMessage
(component function) and adjust it to match the prior formatting style used in
the file.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@README.md`:
- Line 14: Update the English in the README sentence that reads "Please follows
[this issue]..." by changing "Please follows" to "Please follow" so the sentence
reads "Please follow [this issue]..." (locate the sentence containing "Memory64
is now a requirement, which drops support for Safari. Please follows" and
correct the verb).

In `@src/workers-code/llama-cpp.js`:
- Line 339: The call to wllamaMalloc uses a numeric 0 for the second parameter
while the cwrap declaration expects a BigInt-sized argument; update the call
where inputPtr is assigned (const inputPtr = await
wllamaMalloc(BigInt(argEncodedMsg.byteLength), 0)) to pass a BigInt literal
(e.g., 0n or BigInt(0)) so the second argument matches the 'bigint' typing
declared for wllamaMalloc.

---

Nitpick comments:
In `@examples/main/src/components/MarkdownMessage.tsx`:
- Line 15: Revert the unrelated formatting change in the MarkdownMessage
component: restore the original attribute formatting for the <code ...
{...props}> element (i.e., split attributes back to their previous lines) so the
diff only contains mem64/version-bump related changes; locate the <code
className="bg-base-200 rounded px-1 py-[2px] text-sm" {...props}> occurrence
inside the MarkdownMessage (component function) and adjust it to match the prior
formatting style used in the file.
🪄 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: c3f888dc-7e64-4834-b44a-98fd3948ded2

📥 Commits

Reviewing files that changed from the base of the PR and between 8778d7b and 3eca561.

⛔ Files ignored due to path filters (3)
  • package-lock.json is excluded by !**/package-lock.json
  • src/multi-thread/wllama.wasm is excluded by !**/*.wasm
  • src/single-thread/wllama.wasm is excluded by !**/*.wasm
📒 Files selected for processing (12)
  • README.md
  • cpp/wllama.cpp
  • examples/main/src/components/MarkdownMessage.tsx
  • llama.cpp
  • package.json
  • scripts/build_wasm.sh
  • scripts/docker-compose.yml
  • src/multi-thread/wllama.js
  • src/single-thread/wllama.js
  • src/wasm-from-cdn.ts
  • src/workers-code/generated.ts
  • src/workers-code/llama-cpp.js

Comment thread README.md Outdated
Comment thread src/workers-code/llama-cpp.js
@ngxson ngxson merged commit c8e1ce4 into master Apr 27, 2026
6 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