Skip to content

feat: add llamacpp 0.1.0 C++23 module package - #138

Merged
Sunrisepeak merged 1 commit into
mcpplibs:mainfrom
wellwei:feat/llamacpp-0.1.0-form-a
Jul 29, 2026
Merged

feat: add llamacpp 0.1.0 C++23 module package#138
Sunrisepeak merged 1 commit into
mcpplibs:mainfrom
wellwei:feat/llamacpp-0.1.0-form-a

Conversation

@wellwei

@wellwei wellwei commented Jul 29, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • add mcpplibs.llamacpp 0.1.0 as a minimal Form A descriptor backed by the released llama.cpp-m archive
  • add CPU and macOS ARM64 Metal consumers that import the public llamacpp C++23 module and execute real API assertions
  • supersede feat(pkg): add ggml-org.llamacpp b10069 C++23 module #132 by keeping the llama.cpp adaptation, vendored checkpoint, generated API, backend selection, and update tooling in mcpplibs/llama.cpp-m

Release identity

  • package release: llama.cpp-m v0.1.0
  • immutable tag archive SHA-256: 9af34d44349e520f2f9bd2eace29eb6a634ab4633a7f3bafa225f77be178ca84
  • package version mapping: llama.cpp-m 0.1.0 -> llama.cpp b10069 (178a6c44937154dc4c4eff0d166f4a044c4fceba)
  • exact release commit: 8876f2cec7294a938fadb50dfbd9296dff6d0beb
  • package CI on that commit: all jobs passed, including real CPU inference on Linux x86_64, Linux ARM64, macOS ARM64, and Windows x86_64, plus real Metal inference on macOS ARM64
  • release workflow: passed, including immutable mapping and exact-commit CI gates

The archive contains its own mcpp.toml, so the index descriptor intentionally omits the mcpp field. There is no authorized byte-identical CN mirror yet; the descriptor uses the plain upstream GitHub URL.

Use

Consumers do not download or unpack the Release manually:

mcpp add llamacpp@0.1.0
import std;
import llamacpp;

int main() {
    llama_backend_init();
    auto params = llama_model_default_params();
    llama_backend_free();
}

CPU is enabled by default. Enable Metal on macOS ARM64 in mcpp.toml:

[dependencies]
llamacpp = { version = "0.1.0", features = ["backend-metal"] }

Supported boundary

  • CPU: Linux x86_64, Linux ARM64, macOS ARM64, Windows x86_64
  • Metal: macOS ARM64 only, via backend-metal
  • public API: import llamacpp; exposing the audited llama.cpp C API surface
  • not included in 0.1.0: mtmd, CUDA, Vulkan, RPC, or other upstream backends

Update policy

llama.cpp-m does not chase every daily llama.cpp commit. Each package version pins one reviewed upstream checkpoint and keeps that mapping immutable. A new wrapper/index version is cut when an upstream change has consumer value, such as required model/API support, a relevant correctness or security fix, or a measured backend improvement.

Each update imports a new checkpoint, regenerates and audits the module API, runs cold package builds and real inference across the supported matrix, then publishes a new llama.cpp-m version. The index appends that version; it never changes the URL or SHA-256 of 0.1.0. The repository's scheduled upstream check reports drift without automatically publishing unreviewed snapshots. See the full update policy.

Validation

  • mcpp 0.0.109 xpkg parse pkgs/l/llamacpp.lua: Form A, parse OK
  • Lua syntax, mirror policy, atomic package name, cross-package references, and git diff --check: passed
  • RED before descriptor: local checkout resolution reported no (mcpplibs, llamacpp) package
  • CPU index member: downloaded the tag archive, compiled/linked the module, initialized the CPU backend, created/free'd real samplers, and printed LLAMACPP_INDEX_TEST=PASS
  • Metal index member: enabled backend-metal, loaded the embedded Metal library, registered MTL0 (Apple M4), and printed LLAMACPP_METAL_INDEX_TEST=PASS
  • fresh mcpp new consumer: mcpp add llamacpp@0.1.0 wrote llamacpp = "0.1.0", then cold-downloaded, built, and ran the package
  • fresh Metal consumer with Qwen3.5-4B Q4_K_M: offloaded 33/33 layers, allocated a 2571.63 MiB Metal model buffer and 10.64 MiB Metal compute buffer, then decoded/sampled 32 tokens at 23.43 tokens/s on Apple M4
  • affected-member scan finds both llamacpp and llamacpp-metal

No index.toml or workflow pin change is required; the existing mcpp floor remains 0.0.109.

@TPPPP72 TPPPP72 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

看起来不错

@Sunrisepeak
Sunrisepeak self-requested a review July 29, 2026 23:11
@Sunrisepeak

Copy link
Copy Markdown
Member

感觉0.0.2上面可以加几个模板功能, 这样就可以

mcpp new xxx --template llamacpp

具体可以参考 这个 imgui 模块化的封装层里的 模板示例

@Sunrisepeak
Sunrisepeak merged commit 1d8c8d6 into mcpplibs:main Jul 29, 2026
5 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.

3 participants