feat: checkpoint distributed gguf runtime stories
This commit is contained in:
24
packages/node/native/llama/README.md
Normal file
24
packages/node/native/llama/README.md
Normal file
@@ -0,0 +1,24 @@
|
||||
# Pinned llama.cpp source dependency
|
||||
|
||||
This directory keeps the llama.cpp fork boundary explicit and auditable.
|
||||
|
||||
Layout:
|
||||
|
||||
- `UPSTREAM_COMMIT` - the exact pinned commit.
|
||||
- `UPSTREAM_REPOSITORY` - the reproducible source dependency URL.
|
||||
- `UPSTREAM_ASSUMPTIONS.md` - the file/ABI assumptions that the build scripts
|
||||
validate.
|
||||
- `patches/` - numbered patch files applied on top of the pinned checkout.
|
||||
|
||||
The intended flow is:
|
||||
|
||||
1. Fetch or clone the pinned upstream checkout.
|
||||
2. Verify the checkout commit matches `UPSTREAM_COMMIT`.
|
||||
3. Check and apply the numbered patch stack.
|
||||
4. Build the worker scaffold from `examples/meshnet-worker/`.
|
||||
5. Copy the upstream `LICENSE` and `AUTHORS` files into the worker build tree so
|
||||
the attribution notices remain attached to the built artifact.
|
||||
|
||||
The patch stack in this story is intentionally minimal. It creates the project
|
||||
worker scaffold and the smoke-test CMake target without pulling Meshnet
|
||||
networking code into llama.cpp.
|
||||
35
packages/node/native/llama/UPSTREAM_ASSUMPTIONS.md
Normal file
35
packages/node/native/llama/UPSTREAM_ASSUMPTIONS.md
Normal file
@@ -0,0 +1,35 @@
|
||||
# llama.cpp upstream assumptions
|
||||
|
||||
This directory records the reproducible source dependency boundary for the
|
||||
pinned llama.cpp checkout used by the distributed GGUF runtime program.
|
||||
|
||||
Pinned upstream commit:
|
||||
|
||||
- `b3c9d1b846cc80a6360adb6aeaa4fcd8c4c8dcac`
|
||||
|
||||
Pinned upstream repository:
|
||||
|
||||
- `https://github.com/ggml-org/llama.cpp.git`
|
||||
|
||||
Assumptions checked by the build script:
|
||||
|
||||
- The checkout is exactly the pinned commit above.
|
||||
- The upstream source tree still ships `LICENSE`, `AUTHORS`, and
|
||||
`CMakeLists.txt` at the repository root.
|
||||
- The project-owned worker scaffold is built from
|
||||
`examples/meshnet-worker/`, which is introduced by the patch stack below.
|
||||
- The upstream license and attribution notices are preserved in the build
|
||||
output by copying the root `LICENSE` and `AUTHORS` files into the worker
|
||||
staging directory.
|
||||
|
||||
Compatibility notes:
|
||||
|
||||
- The current patch stack does not modify upstream llama.cpp runtime code yet.
|
||||
It adds a project-owned worker scaffold that can be built reproducibly from
|
||||
the pinned source checkout.
|
||||
- Later stories extend this boundary with actual llama.cpp execution patches.
|
||||
|
||||
Failure mode:
|
||||
|
||||
- If the checkout commit does not match the pin, the build script fails with a
|
||||
clear pin-mismatch error before patch application or compilation starts.
|
||||
1
packages/node/native/llama/UPSTREAM_COMMIT
Normal file
1
packages/node/native/llama/UPSTREAM_COMMIT
Normal file
@@ -0,0 +1 @@
|
||||
b3c9d1b846cc80a6360adb6aeaa4fcd8c4c8dcac
|
||||
1
packages/node/native/llama/UPSTREAM_REPOSITORY
Normal file
1
packages/node/native/llama/UPSTREAM_REPOSITORY
Normal file
@@ -0,0 +1 @@
|
||||
https://github.com/ggml-org/llama.cpp.git
|
||||
@@ -0,0 +1,35 @@
|
||||
diff --git a/examples/meshnet-worker/CMakeLists.txt b/examples/meshnet-worker/CMakeLists.txt
|
||||
new file mode 100644
|
||||
index 0000000000..8d9f9a1a2f
|
||||
--- /dev/null
|
||||
+++ b/examples/meshnet-worker/CMakeLists.txt
|
||||
@@ -0,0 +1,19 @@
|
||||
+cmake_minimum_required(VERSION 3.16)
|
||||
+project(meshnet_llama_worker CXX)
|
||||
+
|
||||
+set(CMAKE_CXX_STANDARD 17)
|
||||
+set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
+
|
||||
+configure_file(
|
||||
+ "${CMAKE_CURRENT_SOURCE_DIR}/version.h.in"
|
||||
+ "${CMAKE_CURRENT_BINARY_DIR}/version.h"
|
||||
+ @ONLY)
|
||||
+
|
||||
+add_executable(meshnet_worker
|
||||
+ meshnet_worker.cpp)
|
||||
+
|
||||
+target_include_directories(meshnet_worker PRIVATE "${CMAKE_CURRENT_BINARY_DIR}")
|
||||
+
|
||||
+enable_testing()
|
||||
+add_test(NAME meshnet_worker_smoke
|
||||
+ COMMAND meshnet_worker --smoke)
|
||||
diff --git a/examples/meshnet-worker/version.h.in b/examples/meshnet-worker/version.h.in
|
||||
new file mode 100644
|
||||
index 0000000000..0b75c4e60f
|
||||
--- /dev/null
|
||||
+++ b/examples/meshnet-worker/version.h.in
|
||||
@@ -0,0 +1,4 @@
|
||||
+#pragma once
|
||||
+
|
||||
+#define MESHNET_LLAMA_UPSTREAM_COMMIT "@MESHNET_LLAMA_UPSTREAM_COMMIT@"
|
||||
+#define MESHNET_LLAMA_PATCHSET_VERSION "@MESHNET_LLAMA_PATCHSET_VERSION@"
|
||||
43
packages/node/native/llama/templates/meshnet_worker.cpp
Normal file
43
packages/node/native/llama/templates/meshnet_worker.cpp
Normal file
@@ -0,0 +1,43 @@
|
||||
#include "version.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
namespace {
|
||||
|
||||
bool fail(const std::string& why) {
|
||||
std::cerr << "meshnet_worker: FAIL: " << why << std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
bool smoke = argc == 1;
|
||||
|
||||
for (int i = 1; i < argc; ++i) {
|
||||
const std::string arg = argv[i];
|
||||
if (arg == "--smoke") {
|
||||
smoke = true;
|
||||
} else {
|
||||
std::cerr << "unknown arg: " << arg << std::endl;
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
|
||||
if (!smoke) {
|
||||
return fail("smoke mode not requested"), 1;
|
||||
}
|
||||
|
||||
if (MESHNET_LLAMA_UPSTREAM_COMMIT[0] == '\0') {
|
||||
return fail("upstream commit missing"), 1;
|
||||
}
|
||||
if (MESHNET_LLAMA_PATCHSET_VERSION[0] == '\0') {
|
||||
return fail("patchset version missing"), 1;
|
||||
}
|
||||
|
||||
std::cout << "meshnet worker scaffold ok" << std::endl;
|
||||
std::cout << "upstream commit: " << MESHNET_LLAMA_UPSTREAM_COMMIT << std::endl;
|
||||
std::cout << "patchset version: " << MESHNET_LLAMA_PATCHSET_VERSION << std::endl;
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user