Skip to content

Commit 86f3076

Browse files
Merge pull request #540 from janhq/update-dev-from-master-2026-05-30-01-10
Sync master with upstream release b9415
2 parents ba176c2 + 06d26df commit 86f3076

79 files changed

Lines changed: 3051 additions & 675 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/build-vulkan.yml

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,6 @@ jobs:
5252
id: checkout
5353
uses: actions/checkout@v6
5454

55-
- name: ccache
56-
uses: ggml-org/ccache-action@v1.2.21
57-
with:
58-
key: vulkan-${{ matrix.os }}
59-
variant: ccache
60-
evict-old-files: 1d
61-
save: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
62-
6355
- name: Dependencies
6456
id: depends
6557
run: |
@@ -68,14 +60,20 @@ jobs:
6860
echo "CC=gcc-14" >> "$GITHUB_ENV"
6961
echo "CXX=g++-14" >> "$GITHUB_ENV"
7062
63+
- name: ccache
64+
uses: ggml-org/ccache-action@v1.2.21
65+
with:
66+
key: vulkan-${{ matrix.os }}-new
67+
variant: ccache
68+
evict-old-files: 1d
69+
save: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
70+
7171
- name: Configure
7272
id: cmake_configure
7373
run: |
7474
cmake -B build \
7575
-G "Ninja" \
76-
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
77-
-DGGML_BACKEND_DL=ON \
78-
-DGGML_CPU_ALL_VARIANTS=ON \
76+
-DCMAKE_BUILD_TYPE=Release \
7977
-DGGML_VULKAN=ON
8078
8179
- name: Build
@@ -91,13 +89,6 @@ jobs:
9189
id: checkout
9290
uses: actions/checkout@v6
9391

94-
- name: ccache
95-
uses: ggml-org/ccache-action@v1.2.21
96-
with:
97-
key: vulkan-ubuntu-24.04-llvmpipe
98-
evict-old-files: 1d
99-
save: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
100-
10192
- name: Dependencies
10293
id: depends
10394
run: |
@@ -124,6 +115,13 @@ jobs:
124115
path: ./vulkan_sdk
125116
version: ${{ env.VULKAN_SDK_VERSION }}
126117

118+
- name: ccache
119+
uses: ggml-org/ccache-action@v1.2.21
120+
with:
121+
key: vulkan-ubuntu-24.04-llvmpipe
122+
evict-old-files: 1d
123+
save: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
124+
127125
- name: Build
128126
id: cmake_build
129127
run: |
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: UI Build (self-hosted)
2+
3+
on:
4+
workflow_call:
5+
6+
jobs:
7+
build:
8+
runs-on: [self-hosted, fast]
9+
env:
10+
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
11+
12+
steps:
13+
- name: Checkout code
14+
uses: actions/checkout@v6
15+
16+
- name: Setup Node.js
17+
uses: actions/setup-node@v6
18+
with:
19+
node-version: "24"
20+
cache: "npm"
21+
cache-dependency-path: "tools/ui/package-lock.json"
22+
23+
- name: Install dependencies
24+
run: npm ci
25+
working-directory: tools/ui
26+
27+
- name: Build application
28+
run: npm run build
29+
working-directory: tools/ui
30+
31+
- name: Generate checksums
32+
run: |
33+
cd tools/ui/dist
34+
for f in *; do
35+
sha256sum "$f" | awk '{print $1, $2}' >> checksums.txt
36+
done
37+
38+
- name: Upload built UI
39+
uses: actions/upload-artifact@v6
40+
with:
41+
name: ui-build
42+
path: tools/ui/dist/
43+
retention-days: 1

.github/workflows/ui-build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ on:
55

66
jobs:
77
build:
8-
runs-on: [self-hosted, fast]
8+
runs-on: ubuntu-slim
99
env:
1010
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
1111

.github/workflows/ui-publish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
publish:
2121
name: Publish UI Static Output
2222
needs: build
23-
runs-on: ubuntu-24.04-arm
23+
runs-on: ubuntu-slim
2424

2525
permissions:
2626
contents: read

.github/workflows/ui-self-hosted.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@ on:
1616
- master
1717
paths: [
1818
'.github/workflows/ui-self-hosted.yml',
19-
'.github/workflows/ui-build.yml',
19+
'.github/workflows/ui-build-self-hosted.yml',
2020
'tools/ui/**.*',
2121
'tools/server/tests/**.*'
2222
]
2323
pull_request:
2424
types: [opened, synchronize, reopened]
2525
paths: [
2626
'.github/workflows/ui-self-hosted.yml',
27-
'.github/workflows/ui-build.yml',
27+
'.github/workflows/ui-build-self-hosted.yml',
2828
'tools/ui/**.*',
2929
'tools/server/tests/**.*'
3030
]
@@ -42,7 +42,7 @@ concurrency:
4242
jobs:
4343
ui-build:
4444
name: Build static output
45-
uses: ./.github/workflows/ui-build.yml
45+
uses: ./.github/workflows/ui-build-self-hosted.yml
4646

4747
ui-checks:
4848
name: Checks

CMakeLists.txt

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -222,19 +222,6 @@ if (LLAMA_BUILD_APP)
222222
add_subdirectory(app)
223223
endif()
224224

225-
# Automatically add all files from the 'licenses' directory
226-
file(GLOB EXTRA_LICENSES "${CMAKE_SOURCE_DIR}/licenses/LICENSE-*")
227-
228-
foreach(FILE_PATH ${EXTRA_LICENSES})
229-
get_filename_component(FILE_NAME "${FILE_PATH}" NAME)
230-
string(REGEX REPLACE "^LICENSE-" "" NAME "${FILE_NAME}")
231-
license_add_file("${NAME}" "${FILE_PATH}")
232-
endforeach()
233-
234-
if (LLAMA_BUILD_COMMON)
235-
license_generate(llama-common)
236-
endif()
237-
238225
#
239226
# install
240227
#

app/CMakeLists.txt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,17 @@ target_link_libraries(${TARGET} PRIVATE
1515
)
1616
target_compile_features(${TARGET} PRIVATE cxx_std_17)
1717

18+
# Automatically add all files from the 'licenses' directory
19+
file(GLOB EXTRA_LICENSES "${CMAKE_SOURCE_DIR}/licenses/LICENSE-*")
20+
21+
foreach(FILE_PATH ${EXTRA_LICENSES})
22+
get_filename_component(FILE_NAME "${FILE_PATH}" NAME)
23+
string(REGEX REPLACE "^LICENSE-" "" NAME "${FILE_NAME}")
24+
license_add_file("${NAME}" "${FILE_PATH}")
25+
endforeach()
26+
27+
license_generate(${TARGET})
28+
1829
if(LLAMA_TOOLS_INSTALL)
1930
install(TARGETS ${TARGET} RUNTIME)
2031
endif()

app/llama.cpp

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
#include <string>
66
#include <vector>
77

8+
// embedded data generated by cmake
9+
extern const char * LICENSES[];
10+
811
// visible
912
int llama_server(int argc, char ** argv);
1013
int llama_cli(int argc, char ** argv);
@@ -17,8 +20,11 @@ int llama_fit_params(int argc, char ** argv);
1720
int llama_quantize(int argc, char ** argv);
1821
int llama_perplexity(int argc, char ** argv);
1922

23+
static const char * progname;
24+
2025
static int help(int argc, char ** argv);
2126
static int version(int argc, char ** argv);
27+
static int licenses(int argc, char ** argv);
2228

2329
struct command {
2430
const char * name;
@@ -37,26 +43,39 @@ static const command cmds[] = {
3743
{"fit-params", "Compute parameters to fit a model in device memory", {}, true, llama_fit_params },
3844
{"quantize", "Quantize a model", {}, true, llama_quantize },
3945
{"perplexity", "Compute model perplexity and KL divergence", {}, true, llama_perplexity },
40-
{"version", "Show version", {}, true, version },
41-
{"help", "Show available commands", {}, true, help },
46+
{"version", "Show version", {}, false, version },
47+
{"licenses", "Show third-party licenses", {"credits"}, false, licenses },
48+
{"help", "Show available commands", {}, false, help },
4249
};
4350

4451
static int version(int argc, char ** argv) {
4552
printf("%s\n", llama_build_info());
4653
return 0;
4754
}
4855

56+
static int licenses(int argc, char ** argv) {
57+
for (int i = 0; LICENSES[i]; ++i) {
58+
printf("%s\n", LICENSES[i]);
59+
}
60+
return 0;
61+
}
62+
4963
static int help(int argc, char ** argv) {
5064
const bool show_all = argc >= 2 && std::string(argv[1]) == "all";
5165

52-
printf("Usage: llama <command> [options]\n\nAvailable commands:\n");
66+
printf("Usage: %s <command> [options]\n\nAvailable commands:\n", progname);
5367

5468
for (const auto & cmd : cmds) {
5569
if (show_all || !cmd.hidden) {
5670
printf(" %-15s %s\n", cmd.name, cmd.desc);
5771
}
5872
}
59-
printf("\nRun 'llama <command> --help' for command-specific usage.\n");
73+
printf("\n");
74+
75+
if (!show_all) {
76+
printf("Run '%s help all' to show additional commands.\n", progname);
77+
}
78+
printf("Run '%s <command> --help' for command-specific usage.\n", progname);
6079

6180
return 0;
6281
}
@@ -74,13 +93,12 @@ static bool matches(const std::string & arg, const command & cmd) {
7493
}
7594

7695
int main(int argc, char ** argv) {
96+
progname = argv[0];
7797
const std::string arg = argc >= 2 ? argv[1] : "help";
7898

7999
for (const auto & cmd : cmds) {
80100
if (matches(arg, cmd)) {
81-
82-
// router spawns children through this same binary, it needs the
83-
// subcommand to relaunch as 'llama serve' and not bare options
101+
// keep cmd.name so the router's child processes re-invoke correctly
84102
#ifdef _WIN32
85103
_putenv_s("LLAMA_APP_CMD", cmd.name);
86104
#else

0 commit comments

Comments
 (0)