Repository navigation
Commit 3ca60da
committed
server: report measured weight residency per backend on /props
A caller that must VERIFY where a model actually ran had no way to ask. The two
things that look like an answer are both the REQUEST reflected back:
- `n_gpu_layers` is what was asked for.
- `load_tensors: offloaded N/M layers to GPU` is
`min(n_gpu_layers, n_layer + 1)` — the ask, clamped to the layer count. Pass
`--n-gpu-layers 999` to a 29-layer model and it prints "offloaded 29/29"
because you asked for 999 and there are 29, not because 29 reached a GPU.
So an engine that requested the GPU and silently ran on the CPU prints numbers
identical to one that succeeded. Measured on a host where exactly that happened:
the server served from system RAM with 500 MiB of a 32 GiB card in use, while
every number a caller could reach said the GPU had been used.
The banner is also wrapped in `if (llama_supports_gpu_offload())`, so on a build
without GPU support it never prints at all — a third distinct meaning for the
same absence, and none of the three are distinguishable by a caller.
/props now carries the ALLOCATION:
"model_weight_buffers": [
{ "backend": "CPU_Mapped", "size_bytes": 377487360 },
{ "backend": "CUDA0", "size_bytes": 13948538880 }
]
Sum the non-CPU backends to get accelerator-resident bytes. This is a thin C view
over `llama_model::memory_breakdown()`, which already walks `ctxs_bufs`,
aggregates per buffer type and handles the `no_alloc` case — not a second walk of
the same data.
Note for consumers: a healthy fully-offloaded lane still reports CPU bytes (mapped
metadata), so the test is "are there any accelerator bytes", never "are there no
host bytes".
Verified on Windows/CUDA, RTX 5090, Devstral-Small-2507-Q4_K_M: GET /props returns
CUDA0 = 12.99 GiB, CPU_Mapped = 0.35 GiB.1 parent fb668a8 commit 3ca60da
4 files changed
Lines changed: 64 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
653 | 653 | | |
654 | 654 | | |
655 | 655 | | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
| 661 | + | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
| 670 | + | |
| 671 | + | |
656 | 672 | | |
657 | 673 | | |
658 | 674 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3043 | 3043 | | |
3044 | 3044 | | |
3045 | 3045 | | |
| 3046 | + | |
| 3047 | + | |
| 3048 | + | |
| 3049 | + | |
| 3050 | + | |
| 3051 | + | |
| 3052 | + | |
| 3053 | + | |
| 3054 | + | |
| 3055 | + | |
| 3056 | + | |
| 3057 | + | |
| 3058 | + | |
| 3059 | + | |
| 3060 | + | |
| 3061 | + | |
| 3062 | + | |
| 3063 | + | |
| 3064 | + | |
| 3065 | + | |
| 3066 | + | |
| 3067 | + | |
| 3068 | + | |
| 3069 | + | |
| 3070 | + | |
3046 | 3071 | | |
3047 | 3072 | | |
3048 | 3073 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4104 | 4104 | | |
4105 | 4105 | | |
4106 | 4106 | | |
| 4107 | + | |
| 4108 | + | |
| 4109 | + | |
| 4110 | + | |
| 4111 | + | |
| 4112 | + | |
| 4113 | + | |
| 4114 | + | |
| 4115 | + | |
| 4116 | + | |
| 4117 | + | |
| 4118 | + | |
| 4119 | + | |
| 4120 | + | |
| 4121 | + | |
| 4122 | + | |
| 4123 | + | |
4107 | 4124 | | |
4108 | 4125 | | |
4109 | 4126 | | |
| |||
4498 | 4515 | | |
4499 | 4516 | | |
4500 | 4517 | | |
| 4518 | + | |
4501 | 4519 | | |
4502 | 4520 | | |
4503 | 4521 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
55 | 60 | | |
56 | 61 | | |
57 | 62 | | |
| |||
0 commit comments