Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 16 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,11 @@ The engine has no standalone package of its own.
> Strix Halo, and the Lemonade recipe that runs it (`onebit`, in our fork
> [1bit-MONSTER/lemonade](https://github.com/1bit-MONSTER/lemonade)) passes Lemonade's own LLM test
> suite on HRX. Following a review,[^geramyl] the engine no longer
> vendors Lemonade: Lemonade is the host, 1bit is the engine inside it. Ported so far: HRX on AMD's live ggml-hrx
> vendors Lemonade: Lemonade is the host, 1bit is the engine inside it. Ported so far: HRX on AMD's live ggml-hrx,
> pinned since 2026-10-18 to AMD's `e3e6a976` hrx-system line with llama.cpp `8d9ce2c1a` (our four fixes
> replayed plus our long-context live-out fix for ROCm/hrx-system#1535; against the old pins on Strix Halo:
> test-backend-ops 1141/1141, long-prompt needles 20/20 + 5/5 + 5/5, KLD 0 and identical output on two
> models, pp512 +4.4% / +7.8%, tg128 +2.5% / +2.8%)
> ([docs/hrx.md](docs/hrx.md); its decode-split race, #123/#140, is fixed and the kernel is on by default; Q2_K, IQ2 and IQ3_XXS GGUFs run on HRX instead of the CPU, and `--mtp` on Qwen3.8-27B runs NaN-free since #257), the NPU engine on full ELFs and on our own
> NPU runtime, XRT-free ([docs/npu.md](docs/npu.md); its layer kernel and lm-head now decode from
> source, ELF to ELF, with no xclbin at any point, verified on Qwen3-0.6B/1.7B/4B against an fp64
Expand All @@ -72,17 +76,22 @@ The engine has no standalone package of its own.
> 16.3-16.5 tok/s decode ([docs/npu.md](docs/npu.md#private-routes)). GGUFs of six architectures
> (Qwen2.5, Qwen3 MoE, Qwen3.6-35B-A3B, MiniCPM4/5, GLM-4.7-Flash) also answer on the NPU through
> `1bit serve --device npu`: correct, not yet fast (0.006-0.17 tok/s;
> [docs/npu.md](docs/npu.md#from-a-gguf)). DwarfStar reads 1BP packages from our fork
> [docs/npu.md](docs/npu.md#from-a-gguf)). DwarfStar reads 1BP packages from our fork, pinned since
> 2026-10-17 to `5b013dc1bb75` (1BP v5: reader, converter, checker); checked on hardware at that pin,
> DeepSeek V4 Flash Q2 gives identical answers and token counts from its GGUF and from its 1BP package,
> and `1bit serve -m <model>.1bp` routes a package to ds4 by itself
> ([docs/dwarfstar.md](docs/dwarfstar.md)). Step 4, the Laya router, has landed as an opt-in:
> `1bit serve --laya` classifies each conversation (code, prose, short, long document; 95.5% on
> 200 labelled requests) and a measured policy picks the device; the scorer runs on HRX at
> 15-16 ms a decision ([docs/laya.md](docs/laya.md)). ZAYA1-8B is the engine's Project Manager:
> `1bit serve --pm` (Lemonade entry `ZAYA1-8B-PM-1bit`) answers general chat itself and delegates
> code, long reasoning and agentic tasks to expert models Lemonade loads beside it
> ([docs/pm.md](docs/pm.md)). Step 5, the model registry, has landed: of 334,413
> HF text-generation models with an architecture, 94.71% are mapped to a backend and 64.2%
> have an architecture checked end to end on Strix Halo; a daily census keeps the counts
> current ([docs/registry.md](docs/registry.md)). The working engine is being ported from 1bit-MONSTER,
> code, long reasoning and agentic tasks to expert models Lemonade loads beside it; `--pm-router laya`
> has the engine's Laya router pick the expert before the PM's first round, and `--pm-spawn-url` adds a
> `spawn_worker` tool that asks a local executor for a long-running agent worker instead of a single
> expert answer ([docs/pm.md](docs/pm.md)). Step 5, the model registry, has landed: of 338,650
> HF text-generation models with an architecture (the 2026-10-17 census), 94.62% are mapped to a
> backend and 63.9% have an architecture checked end to end on Strix Halo; a daily census keeps the
> counts current ([docs/registry.md](docs/registry.md)). The working engine is being ported from 1bit-MONSTER,
> our private development repository; see [docs/PORTING.md](docs/PORTING.md).
> Measured results are on the [wiki](https://github.com/1bit-MONSTER/engine/wiki). This repository
> holds the verified code without the development history.
Expand Down
6 changes: 3 additions & 3 deletions docs/PORTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ Each step below is one PR (or a short series) that builds and runs on Strix Halo
| Step | Component | Source in 1bit-MONSTER | Done when |
|---|---|---|---|
| 1 | **The engine runs inside Lemonade.** Lemonade runs `1bit serve` as a backend: one model per process behind an OpenAI-compatible API | `tools/unified_server.cpp` | **landed** ([docs/serve.md](serve.md)): NPU and HRX pass `serve_e2e` on Strix Halo (Vulkan and ZINC did too, before RFC #213 stage 3 and the core strip removed them); `smoke_serve` runs in CI. The engine first embedded Lemonade (v11.9.0 plus local recipes); after a review[^geramyl] it is embedded *into* Lemonade instead: the vendored copy is removed, and the Lemonade recipe that runs `1bit serve` (`onebit`) lives in our fork [1bit-MONSTER/lemonade](https://github.com/1bit-MONSTER/lemonade) ([docs/lemonade.md](lemonade.md)) |
| 2 | **HRX.** llama.cpp with `GGML_HRX=ON` on AMD's tested pair (it was built with `GGML_VULKAN=ON` too until RFC #213 stage 3, which removed the engine's Vulkan and ROCm builds) | `1bit-MONSTER/llama.cpp` `1bit/hrx-vulkan-patched` (AMD's `hrx-graph-develop-v2` plus our commits) + `1bit-MONSTER/hrx-system` `1bit/main` (`ROCm/hrx-system` at AMD's pin plus our commits), pinned from `ROCm/ggml-staging-automation` | **landed** ([docs/hrx.md](hrx.md)): `1bit serve` runs GGUF checkpoints on `HRX0` (and the CPU from the same build); kept current by `bump-hrx.yml`. The decode-split flash-attention race (#123, #140) is fixed (llama.cpp `00adc2b`, #176) and the kernel is on by default again (#178) |
| 2 | **HRX.** llama.cpp with `GGML_HRX=ON` on AMD's tested pair (it was built with `GGML_VULKAN=ON` too until RFC #213 stage 3, which removed the engine's Vulkan and ROCm builds) | `1bit-MONSTER/llama.cpp` `1bit/hrx-vulkan-patched` (AMD's `hrx-graph-develop-v2` plus our commits) + `1bit-MONSTER/hrx-system` `1bit/main` (`ROCm/hrx-system` at AMD's pin plus our commits), pinned from `ROCm/ggml-staging-automation` | **landed** ([docs/hrx.md](hrx.md)): `1bit serve` runs GGUF checkpoints on `HRX0` (and the CPU from the same build); kept current by `bump-hrx.yml`. The decode-split flash-attention race (#123, #140) is fixed (llama.cpp `00adc2b`, #176) and the kernel is on by default again (#178). Since 2026-10-18 pinned to AMD's `e3e6a976` hrx-system line (`1bit/e3e6a976-pin-6`: our four fixes replayed plus our live-out fix for ROCm/hrx-system#1535) with llama.cpp `8d9ce2c1a` (#441); test-backend-ops 1141/1141, long-prompt needles 20/20 + 5/5 + 5/5, KLD 0 and identical output on Qwen3-0.6B and ZAYA1-8B, pp512 +4.4% / +7.8%, tg128 +2.5% / +2.8%. The hold in `config/hrx-system-hold.config` now names that pin, so later AMD hrx-system moves stay manual |
| 3 | **NPU engine.** Full ELFs only, and the layer kernel built from source | `engine/npu` (`npu_engine_universal.cpp`, `I8Ctx::init_elf`); ELF dispatch table on `backup/iso-build-elf-native-2026-09-22`; kernel on `bench/fastlane-16tile-corrections-2026-09-22` | **3a–3c landed; 3d verified, not merged** ([docs/npu.md](npu.md)). 3a (#8): full ELFs generated in C++, reproducing all 5,153 captured contexts. 3b/3c (#9): the lane runtime (logits bit-identical to the reference lane, 24/24 steps, 11.0 ms/token; that test, `npu_lane_e2e`, is retired: its kernels were FastFlowLM-derived and its reference is lost, and the NPU check is now the private dx add-on's from-source check, which is not in this repository), tokenizer, `1bit unified`, and Qwen3-0.6B served on the NPU (now through `1bit serve`). The XDNA driver is pinned upstream (#12); since 2026-10-12 the lane runs on our own NPU runtime, compiled in, and the engine no longer builds or links XRT. GGUF on the NPU (#179, #181, #209): `1bit serve -m <gguf> --device npu` repacks a GGUF to Q4NX and runs six architectures on the per-op forward, correct but at 0.006-0.17 tok/s. 3d: both the dense layer kernel and lm-head now decode correctly from source, ELF to ELF, with no xclbin at any point and one compiled program covering every context position (no per-position rebuild). Verified on Qwen3-0.6B, 1.7B and 4B: cosine similarity against an fp64 reference ≥0.9999 at every tested position, and greedy decode matches the reference exactly end to end. Not yet merged (npu.md, "Open") |
| 3x | **35B MoE on the NPU (experimental, closed source).** Qwen3.6-35B-A3B on the NPU | the private `1bit-MONSTER/npu-kernels` repository | **landed as a private add-on** ([docs/npu.md](npu.md#private-routes)): built into `1bit` with `-DONEBIT_NPU_PRIVATE`; parity against the fp64 reference passes (3 positions, argmax 846 / 198 / 3710), 16.3-16.5 tok/s decode, and `1bit serve --device npu` answers "The capital of France is Paris." Without the add-on, `serve` says the route is not part of the build |
| + | **Linux kernel.** The kernel that provides `amdxdna` and `amdgpu`, pinned to upstream | `torvalds/linux` release tags; config from the Strix Halo kernel of 2026-09-23 | **moved** to its own repository, [1bit-MONSTER/kernel](https://github.com/1bit-MONSTER/kernel) (2026-10-04): v7.3-rc4 built into Debian packages with `amdxdna` in-tree, and that repository keeps it current. Installing it on Strix Halo is a separate, deliberate step; 1bit OS (`os/`) takes a built kernel (`KVER=` / `VMLINUZ=`) |
| 4 | **Laya router.** A non-autoregressive scorer that picks where each request runs | `src/laya_scorer.cpp`, `include/laya_scorer.h` on `backup/laya-and-results-2026-09-22`; model at `~/models/laya` | **landed, opt-in** ([docs/laya.md](laya.md)): source `NandhaKishorM/laya` + the three HF checkpoints pinned, hash-verified fetch, `bump-laya.yml` (#18); the C++ scorer matches the Python reference on the root and `typed-decisions/` checkpoints (max logit diff 8.6e-6, same argmax) and `1bit serve --device auto --laya-model <dir>` routes each request (#90). Load 2.8 s once, then 0.38 s per decision (was 8.75 s, #91). Since RFC #186 (#187) it classifies each conversation (95.5% on 200 labelled requests) and `config/route-policy.json` picks the device; the scorer runs on HRX at 15-16 ms a decision (#206, #208). Next: `multilingual/` (mmBERT-base) |
| 5 | **Every HF model, kept current.** The architecture registry and the daily HF census that finds new architectures and ranks the unmapped ones by model count (1bit-MONSTER's registry mapped 2,030 HF arch strings to its own kernels; here the backends' pinned code decides) | `src/model_registry*.cpp`, `Testing/census_*.py` and `.json`, `.github/workflows/census-{watch,sweep,autopr}.yml` | **landed** ([docs/registry.md](registry.md)): `registry/architectures.json` generated from the pinned HRX llama.cpp fork (265 HF architectures at first; ZINC's column left with the core strip); `census.yml` sweeps HF daily. First sweep: 415,414 text-generation models, mapped 94.88%, checked 64.33% of those with an architecture (reported separately). All seven checked GGUF architectures pass on HRX since the llama.cpp pin `96f6b89` (#95) |
| 4 | **Laya router.** A non-autoregressive scorer that picks where each request runs | `src/laya_scorer.cpp`, `include/laya_scorer.h` on `backup/laya-and-results-2026-09-22`; model at `~/models/laya` | **landed, opt-in** ([docs/laya.md](laya.md)): source `NandhaKishorM/laya` + the three HF checkpoints pinned, hash-verified fetch, `bump-laya.yml` (#18; source `ca5045a3f1fa` and checkpoint revision `7b928d828b7b` since #439); the C++ scorer matches the Python reference on the root and `typed-decisions/` checkpoints (max logit diff 8.6e-6, same argmax) and `1bit serve --device auto --laya-model <dir>` routes each request (#90). Load 2.8 s once, then 0.38 s per decision (was 8.75 s, #91). Since RFC #186 (#187) it classifies each conversation (95.5% on 200 labelled requests) and `config/route-policy.json` picks the device; the scorer runs on HRX at 15-16 ms a decision (#206, #208). Next: `multilingual/` (mmBERT-base) |
| 5 | **Every HF model, kept current.** The architecture registry and the daily HF census that finds new architectures and ranks the unmapped ones by model count (1bit-MONSTER's registry mapped 2,030 HF arch strings to its own kernels; here the backends' pinned code decides) | `src/model_registry*.cpp`, `Testing/census_*.py` and `.json`, `.github/workflows/census-{watch,sweep,autopr}.yml` | **landed** ([docs/registry.md](registry.md)): `registry/architectures.json` generated from the pinned HRX llama.cpp fork (265 HF architectures at first; ZINC's column left with the core strip); `census.yml` sweeps HF daily. First sweep: 415,414 text-generation models, mapped 94.88%, checked 64.33% of those with an architecture (reported separately); the 2026-10-17 sweep counts 425,483 text-generation models, 338,650 with an architecture (2,822 architectures), 94.62% mapped and 63.9% checked (#438). All seven checked GGUF architectures pass on HRX since the llama.cpp pin `96f6b89` (#95) |
| 5z | **ZAYA1 (Zyphra) on the GPU.** An architecture upstream llama.cpp lacks, in our llama.cpp; `1bit serve --device hrx` (and `auto`) runs it | `1bit-MONSTER/llama.cpp` `1bit/hrx2-archive` (`src/models/zaya.cpp`) and 1bit-MONSTER's `tools/convert_zaya_safetensors_to_gguf.py` | **landed** ([vulkan.md at 0baf286](https://github.com/1bit-MONSTER/engine/blob/0baf286/docs/vulkan.md#zaya1-zyphra-from-our-llamacpp)): ported to the pinned fork with a converter; matches transformers in FP32 at 95/96 teacher-forced positions; Q4_K_M decodes at 93 tok/s on Vulkan (74.8 on the old ggml-hrx2 build), 61.5 on ROCm and 25.5 on HRX, and passes `serve_e2e` on Vulkan and HRX |
| 6 | **ZINC (NVIDIA and more).** Upstream `zolotukhin/zinc`, a Zig GGUF engine | not in 1bit-MONSTER; was pinned from upstream `main` | **removed** in the core strip (2026-10-04: the engine is HRX + HIP kernels + the NPU; Lemonade's own backends serve other GPUs). It had passed `serve_e2e` on Strix Halo (Vulkan) and answered on an RTX 5090 (CUDA); the record is [zinc.md at 7eaa6e6](https://github.com/1bit-MONSTER/engine/blob/7eaa6e6/docs/zinc.md) |

Expand Down
13 changes: 13 additions & 0 deletions docs/dwarfstar.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,11 @@ and the build fails (`use of undeclared identifier '__ocml_exp10_f32'`).
| `--ssd-streaming` | `--ssd-streaming`: routed experts from the SSD instead of full residency (GLM 5.x needs it on 128 GB) |
| `--ds4 PATH` | a different `ds4-server` (else `$ONEBIT_DS4`, else this build's, else `ds4-server` on PATH) |

`serve` has no flag for ds4's expert-cache size (`--ssd-streaming-cache-experts N|NGB`): it passes only
`--ssd-streaming`, so `ds4-server` sizes the cache itself from the GPU's recommended working set (69 GiB,
76 GiB planned with the resident weights, on a 128 GB Strix Halo). To run under a set memory budget, start
`ds4-server` with the flag yourself and point `serve` at it with `--ds4`.

`ds4-server` opens its port only after the model has loaded, so `1bit serve` waits
for its `/v1/models` (it has no `/health`). `--parallel` and `--mtp` are llama.cpp
options and are refused on `ds4`; DwarfStar has its own batching
Expand All @@ -81,6 +86,14 @@ and the GPU must see that much (`amdgpu.gttsize` / `ttm.pages_limit`, DwarfStar'

## 1BP packages

At the pin of 2026-10-17 (`5b013dc1bb75`, upstream `fc80bd695da7` plus our 1BP v5 work: reader,
converter and checker), DeepSeek V4 Flash Q2 was run on Strix Halo from its GGUF and from its 1BP
package, against the previous pin (`a7f2e1eaf36c`): three fixed prompts at temperature 0, two reps
each, gave **identical answers and token counts in every pairing** (new vs old and GGUF vs package),
and `1bit serve -m <model>.1bp` still routes a package to `ds4` by itself. Both pins ran it with
`--ssd-streaming` and a 32 GB expert cache, because the model does not fit resident beside the box's
other services.

Our fork reads 1BP v5, 1bit-MONSTER's model package: one memory-mappable file with the 1BP
header and tensor index, the model's metadata (encoded as GGUF's key/value section) and
64-byte-aligned weights. The format is in
Expand Down
22 changes: 22 additions & 0 deletions docs/hrx.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,17 @@ HRX0: AMD Radeon 8060S Graphics (Node 1) (gfx1151)
`/dev/accel` in GPU-only processes), plus the +61/−0 `api.h` forward-port the regenerated
passthrough stubs need. Nothing under the held AMD core changes, so the #1535 question is
untouched. Those fixes are now replayed on the e3e6a976 line above, and this branch is history.
- **What guards a pair that no longer compiles.** AMD removes public LoomC symbols without notice
(2026-10-07: Loom `32d0c76a` dropped `loomc_amdgpu_runtime_global_flags_t` and
`loomc_amdgpu_emit_options_t`, which our `ggml/src/ggml-hrx/loom-jit.cpp` used), and CI builds
without HRX, so #353, #357 and #361 once merged a pair that did not compile with `ONEBIT_HRX=ON`
and #359 / #363 had to pin hrx-system back by hand. `bump-hrx.yml` now holds hrx-system itself when
any `loomc_*` / `LOOMC_*` identifier our backend uses is missing from the new revision's
`loom/binding/c/include`, and moves llama.cpp only. The hand move of 2026-10-18 (#441) was validated
the same way at the pinned pair: `onebit`, `llama_hrx`, `test-backend-ops`, `llama-server`,
`llama-bench`, `llama-perplexity`, `libamdhip64` and `libhip_intercept` all build and
`generate_stubs.py --check` passes against the built `libamdhip64.so`. `hrx-backend-test` still
fails to build on either pin (#422), so that check is not covered yet.
- **The token it needs.** The secret `HRX_BUMP_TOKEN` is a fine-grained token with
Contents read/write on `1bit-MONSTER/llama.cpp` and `1bit-MONSTER/engine`, and
Pull requests read/write on `1bit-MONSTER/engine`.
Expand Down Expand Up @@ -394,6 +405,17 @@ program is rebuilt.

(llama-bench `-p 0 -n 32/64`, runs interleaved on a shared strixhalo, 2026-09-27.)
`ONEBIT_HRX_DECODE_SPLIT=0` turns it off; a `GGML_HRX_DISABLE_DISPATCH` you set yourself wins.
- **The ZAYA1-8B NaN abort does not reproduce (engine#433).** Three aborts were reported on 2026-10-16
on the then-current pin (`06cc0ef` with llama.cpp `dd74f6bb0`) with a second HRX process on the GPU:
the sampler guard logged "HRX returned NaN logits" and the server stopped. Re-running that condition
on the current line gave **no abort in 60 fresh loads** — 20 loads alone, 20 with a resident
Qwen3-0.6B process on the GPU, and 20 with that second process on the older pin `1a5dcba2` — with
four slots, unified KV, `--ctx-size 16384` and the game's tool-templated request asserted on every
load, and 0 NaN lines. The report's 458-token prompt also cannot have carried a tool block: this
model's own chat template gives 257 tokens with no tools, 629 with one, 726 with two and 851 with
the four tools the game sends, so a 458-token request either had no tools or came from a different
template. The guard itself is unchanged: NaN still aborts unless `GGML_HRX_NAN_CONTINUE` is set, and
the current line logs `count`, `index range` and `contiguous` with it.
- **GLM-4.7-Flash MLA decode accuracy (engine#310).** The reported 11.79-vs-10.60
perplexity gap is not reproducible on the current pin (`f2099e9b7`), which includes the MLA
strided-V fix ([llama.cpp #70](https://github.com/1bit-MONSTER/llama.cpp/pull/70)) and the
Expand Down
Loading
Loading