Skip to content

1bit OS: the image carries the new Lemonade, and its NPU registers say so the way the server reads it - #523

Merged
bong-water-water-bong merged 5 commits into
mainfrom
1bit/os-npu-registration
Oct 23, 2026
Merged

bong-water-water-bong merged 5 commits into
mainfrom
1bit/os-npu-registration

Conversation

@bong-water-water-bong

@bong-water-water-bong bong-water-water-bong commented Oct 23, 2026 •

Copy link
Copy Markdown
Collaborator

Why

1bit OS is Lemonade on its own, with the 1bit engine embedded: the fork's lemond, our engine with the HRX
HIP kernels and the sealed NPU sets, one image (os/README.md). Two things were wrong at the image level:

  1. The image was built against the old Lemonade pin (a98f3e23): 271 models and a single NPU entry
    (Qwen3.6-35B-A3B-NPU-1bit), so the three Qwen3 NPU catalog entries could not be addressed by name in a
    shipped image.

  2. os/mini/init.sh registered an NPU model directory with a top-level "onebit_backend": "npu". The
    Lemonade server as of the #3771 refactor does not read that. Measured on the box with a wrapper around
    the engine binary: for such a register lemond passed

    serve -m <dir> --port 8001 --device auto --alias user.<name> --ctx-size 32768
    

    i.e. no device at all — the directory reached the NPU only because the engine's own routing recognised a
    .q4nx set. The catalog says it the way the server reads it: recipe_options.onebit_backend.

What changes

File Change
os/mini/init.sh an NPU model directory registers as recipe onebit plus recipe_options.onebit_backend: npu, the shape the merged server reads. The comment also records that the catalog carries the three NPU entries by name.
os/mini/vmtest.sh four assertions the VM test never made: the LIVE banner reaches the console; 1bit-selftest runs and reports the LIVE mode; Lemonade lists Qwen3-{0.6B,1.7B,4B}-NPU-1bit by name; the Guest tier still hides onebit when the engine binary is moved aside (a second lemond on 13399 must report 0 entries, then the binary is restored).

Both files keep their Apache-2.0 notices; python3 tools/copyright.py --check -> rc=0.

Evidence (labelled "90 W cap, PCM pad (23 Oct)")

Check Result
Image build from b51c2e8 (Lemonade pin 27abcc24) PASS — ~/wt/npupkg-wrun/os-k/1bit-os.img, 3,089,104,896 B; initramfs 91.3 MB; ESP = shim + signed grub + separate vmlinuz/initramfs + grub.cfg; 3 sealed NPU sets (30 kernels) on the data partition; HRX llama-server and the HSA runtime included
Lemonade in the image lemond 2026.45.0~1718.27abcc24 — built from the pin itself, not reused from an earlier tree, so the version string names 27abcc24. Web app present (41 files, 5.8 MB, built with the ~/.nvm node since the box has no system node/npm)
VMTEST PASS (UEFI boot from the USB image in QEMU; SSH up 27 s)
VM check Result
web app HTTP 200 text/html; KaTeX_Main-Regular.woff2 200, 26272 B (woff2)
API key enforced 401 without it
/api/v1/models the stick's GGUF listed (Qwen3-0.6B-Q4_K_M)
chat Paris. on the llamacpp:vulkan backend
downloads during the test 0 — the backends came from the stick
live banner on the console 1bit OS v2026.43 - LIVE: runs from RAM, nothing is installed, disks…
1bit-selftest runs, reports the LIVE mode; NPU line reported as FAIL (no NPU in QEMU — see below)
image's catalog carries Qwen3-{0.6B,1.7B,4B}-NPU-1bit by name, each with recipe_options.onebit_backend: npu
Guest tier with the engine binary hidden, 0 onebit entries (upstream v2026.43.3 semantics)
artifact ~/wt/npupkg-wrun/out/1bit-os-v2026.43-pin27abcc24.img.zst — 921,992,337 B, sha256 dd2b41a73c8d0e483089dbc55c3dbe06b55088200b8c14c208217a9e03870a52

What the VM proves, and what it cannot

The VM has no Radeon GPU and no XDNA NPU, so:

  • Proved in the VM: the image boots to userspace through UEFI from the USB image, the data partition
    mounts, the LIVE banner is on the console, 1bit-selftest runs and reports the LIVE mode, Lemonade serves
    with its key, the onebit entries and the three NPU catalog names are listed, and the Guest tier hides them
    when the engine is absent.
  • Not proved in the VM, by construction: any NPU placement line or NPU chat answer (there is no NPU), and
    a GPU/HRX chat. 1bit-selftest reports the NPU line as it comes out instead of requiring it to pass; the
    NPU PASS and the placement line belong to the real boot.

Owner's step (the real hardware boot — I did not write any device)

~/bin/1bit-usb-write.sh ~/wt/npupkg-wrun/out/1bit-os-v2026.43-pin27abcc24.img.zst /dev/sdX --yes
#   sha256 dd2b41a73c8d0e483089dbc55c3dbe06b55088200b8c14c208217a9e03870a52  (921,992,337 bytes)

The writer refuses anything that is not a whole removable USB device, refuses a device that backs / or
/boot or has a mounted partition, and prints what it is about to destroy before doing it; --yes is
required. Then boot the stick: on strixhalo the firmware keeps rewriting the USB entry into a dead
VenHw stub, so recreate and arm it in one step:

sudo efibootmgr -c -d /dev/sda -p 1 -L "1bit OS USB" -l '\EFI\BOOT\BOOTX64.EFI'
sudo efibootmgr --bootnext 0002

On the booted stick: log in on the screen (/ # on tty1), run 1bit-selftest, and expect RESULT: PASS
plus RESULT-NPU: PASS with the placement line in /data/selftest.log.

One thing to decide before this ships: the image still reports v2026.43 in the banner and the grub menu
while it carries Lemonade 2026.45.0~1718.27abcc24. I did not rename a release on my own authority — the
artifact is named …-pin27abcc24 so it cannot be confused with the previous one.

🤖 Generated with Claude Code

bong-water-water-bong and others added 4 commits October 23, 2026 05:47
…he new server reads it

On the Lemonade this image now carries (fork main after the #3771 server refactor), a top-level
"onebit_backend" in user_models.json is not read. Measured with a wrapper around the engine binary:
lemond passed `serve -m <dir> --port 8001 --device auto --alias ... --ctx-size 32768` for a register
that carried "onebit_backend": "npu", so the directory only reached the NPU because the engine's own
routing recognised a .q4nx set. The catalog's NPU entries carry the option as
recipe_options.onebit_backend, and that is what the server reads, so register the stick's directories
the same way.

Also notes in the comment that Lemonade's own catalog carries the three NPU entries by name
(Qwen3-{0.6B,1.7B,4B}-NPU-1bit): they list from the image, and this registration makes the copy on the
stick loadable without the Hub.

Verified on the merged server separately (fork PR #21): with the option honoured the load reports
`1bit unified: loading ... on the NPU`, ready in 977 ms, and the chat answers `NPU OK.` at 52.8-69.0 tok/s
(90 W cap, PCM pad (23 Oct)). Image-level VMTEST follows once engine #520 (the pin bump) merges.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
…NPU names, the guest tier

The VM test checked that the appliance boots and that Lemonade serves; it did not check the four things
this image exists to do, so a regression in any of them could ship green.

Added, in the order the owner meets them:
  * the LIVE banner reaches the console (the serial line is the VM's screen - a blank screen is what made
    the real appliance look dead);
  * `1bit-selftest` runs from the image and reports the LIVE mode; the VM has no Radeon GPU and no XDNA
    NPU, so the NPU line is reported as it comes out rather than required to pass - the NPU PASS belongs
    to the real boot;
  * Lemonade lists the three catalog NPU entries by name (Qwen3-{0.6B,1.7B,4B}-NPU-1bit). Listing only:
    the NPU cannot run under QEMU, and the check says so;
  * the Guest tier still behaves as upstream v2026.43.3 defines it: with the engine binary moved aside,
    a second lemond reports 0 onebit entries, and the binary is put back afterwards.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
…ctually be seen

Two of the assertions I added were wrong, and the first VM run said so:

  * "the live banner reaches the console" matched grub's own menu line ("1bit OS v2026.43 ..."), not
    init's banner - grub says "1bit OS" too. It now matches init's live-mode line ("LIVE. You are root,
    on RAM"), which say() writes to /dev/console (this serial line in the VM) and to tty1, and it falls
    back to the /etc/1bit/live marker rather than passing on the wrong line.
  * "Lemonade lists the three NPU entries" cannot pass under QEMU: this Lemonade hides every onebit model
    when the machine has no AMD GPU and no NPU - the stick's own onebit register answered model_not_found
    in the VM, not just the catalog entries. The check now reads the IMAGE's own catalog
    (/opt/lemonade/bin/resources/server_models.json) for the three names and for
    recipe_options.onebit_backend: npu, which is what "carries them by name" actually means, and prints a
    line saying why the listing cannot show them here.

The rest of the run was good: SSH, the data partition, the HRX JIT cache, Lemonade's backends on the stick
(11 of them, no download), the API key refusing an unauthenticated request, a CPU chat answering "Paris.",
and the Guest tier reporting 0 onebit entries with the engine binary moved aside.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
…e way the file spells it

Two leftovers from the previous commit, both caught by running it:

  * the banner check looked for a string that only ever goes to tty1, so it could not see it over the
    serial console. init's menu banner - "1bit OS v2026.43 - LIVE: runs from RAM, nothing is installed,
    disks are never touched", written through mc() to /dev/console and tty1 - is the line that actually
    appears on the VM's screen.
  * the recipe_options check used a case pattern whose quoting did not survive into the script, so it
    failed against a catalog that does carry "recipe_options": {"onebit_backend": "npu"}. It greps the
    catalog text now.

VMTEST PASS on the pinned Lemonade (27abcc24), 90 W cap, PCM pad (23 Oct):
  SSH up 27 s after a UEFI boot from the USB image; web app HTTP 200 text/html (the prefix now builds it
  with the nvm node); KaTeX font 200 woff2; 401 without the key; the stick's GGUF lists and answers
  "Paris." on llamacpp:vulkan; 0 downloads (the backends came from the stick); the live banner is on the
  console; 1bit-selftest runs and reports the LIVE mode, with the NPU line reported as FAIL because QEMU
  has no NPU (the NPU PASS is the real boot's); the image's catalog carries Qwen3-{0.6B,1.7B,4B}-NPU-1bit
  with recipe_options.onebit_backend: npu; the Guest tier reports 0 onebit entries with the engine hidden.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
@github-actions

github-actions Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

PR Reviewer Guide 🔍

(Review updated until commit 86a4c06)

Here are some key observations to aid the review process:

⏱️ Estimated effort to review: 3 🔵🔵🔵⚪⚪
🧪 PR contains tests
🔒 No security concerns identified
⚡ Recommended focus areas for review

Incorrect NPU registration format

The NPU model directory registration in init.sh was previously using a top-level "onebit_backend" field which is not read by the Lemonade server as of the #3771 refactor. This has been corrected to use the proper recipe_options.onebit_backend format, ensuring that the NPU models are correctly recognized and routed by the server.

# A recipe option belongs in recipe_options. A top-level "onebit_backend" is not read by the
# Lemonade server as of the #3771 refactor (measured: lemond passed --device auto and the engine
# only found the NPU by luck), so an NPU model directory says it the way the catalog does.
e="\"$1\": {\"checkpoint\": \"$2\", \"source\": \"local_path\", \"recipe\": \"onebit\"${3:+, \"recipe_options\": {\"onebit_backend\": \"$3\"}}}"
Missing assertions for NPU catalog entries

The VM test now includes assertions to verify that the image's catalog carries the three NPU entries by name (Qwen3-{0.6B,1.7B,4B}-NPU-1bit) and that these entries have the correct recipe_options.onebit_backend: npu field. This ensures that the catalog entries are properly configured for NPU execution.

# Lemonade's own catalog carries the three NPU entries by name (catalog: onebit, recipe_options
# onebit_backend npu). They must LIST in the image - loading is impossible here because the NPU cannot
# run in QEMU, and saying so is the point of this check.
catalog=$(ssh_vm 'cat /opt/lemonade/bin/resources/server_models.json 2>/dev/null' 2>/dev/null || true)
if [ -n "$catalog" ]; then
    for want in Qwen3-0.6B-NPU-1bit Qwen3-1.7B-NPU-1bit Qwen3-4B-NPU-1bit; do
        case "$catalog" in
            *"\"$want\""*) echo "The image's catalog carries the NPU entry by name: $want";;
            *) echo "The image's catalog is missing the NPU entry: $want"; ok=0;;
        esac
    done
    if printf '%s' "$catalog" | grep -q '\"onebit_backend\": \"npu\"'; then
        echo "The catalog's NPU entries carry recipe_options.onebit_backend: npu"
    else echo "The catalog's NPU entries do not carry recipe_options.onebit_backend"; ok=0; fi
else echo "could not read the image's server_models.json"; ok=0; fi

@github-actions

Copy link
Copy Markdown

Persistent review updated to latest commit 86a4c06

@bong-water-water-bong
bong-water-water-bong merged commit 702b077 into main Oct 23, 2026
8 checks passed
@bong-water-water-bong
bong-water-water-bong deleted the 1bit/os-npu-registration branch October 23, 2026 09:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant