Skip to content

Ship the engine only inside the Lemonade package; drop Windows, Apple/Metal, mlx (replaces #396) - #431

Merged
bong-water-water-bong merged 1 commit into
mainfrom
1bit/backend-purge-v2
Oct 16, 2026
Merged

bong-water-water-bong merged 1 commit into
mainfrom
1bit/backend-purge-v2

Conversation

@bong-water-water-bong

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

Copy link
Copy Markdown
Collaborator

Replaces #396 (closed as stale: it predated the self-contained-runtime work and encoded an undecided packaging policy). This re-creates its intent on current main, after the policy decision.

Policy

The engine ships only inside the Lemonade package. There is no standalone engine tarball and no Windows package. On the GPU the engine is HRX with HIP kernels; every other backend (Vulkan, ROCm, CUDA, Metal/MLX, Windows) is Lemonade's, through Lemonade's own backends and builds.

Removed

  1. The standalone 1bit-<tag>-linux-x86_64.tar.zst. scripts/package-linux.sh still packs the engine tree (it is the layout 1bit expects), but scripts/weekly.sh now unpacks it into the Lemonade + onebit package as 1bit/ and adds a lemond-onebit launcher (scripts/lemond-onebit.sh) that points Lemonade's onebit backend at the packaged engine (LEMONADE_ONEBIT_BIN). The staging tarball is never published; docs/releases.md and tools/weekly_changes.py list the two remaining artifacts.
  2. The Windows zip and its build. Deleted scripts/build-windows.sh and docs/windows.md; dropped the 1bit-<tag>-windows-x64.zip row/steps from scripts/weekly.sh, docs/releases.md, tools/weekly_changes.py, and the Windows notes from docs/onnx.md, docs/serve.md, README.md, SECURITY.md.
  3. Apple/Metal and the mlx device route. Deleted docs/apple.md; removed the MLX path from app/serve.cpp (launch_for, default_mlx, --mlx-server, the usage and <model> help) and app/main.cpp, and the serve_e2e_mlx test from CMakeLists.txt. --device mlx and --mlx-server now refuse by name and point at Lemonade's own MLX backend. --device ds4 and --device onnx are untouched.
  4. os/mini/vmtest.sh and os/README.md: the onebit recipe's backends are hrx and npu (the CPU stays the engine's own fallback, not a recipe backend); vulkan and cuda are gone from those lists.
  5. cmake/laya-ggml.cmake: the Laya ggml sub-build now passes the same explicit -DGGML_VULKAN=OFF -DGGML_HIP=OFF -DGGML_CUDA=OFF -DGGML_METAL=OFF as cmake/hrx.cmake, so no other backend can be compiled into it (from Remove the remaining non-HRX backend paths #396).

Kept

  • The self-contained-runtime state on main: unchanged. No external-runtime argument or library is re-added (grep below).
  • HRX, CPU (via llama.cpp), the NPU route, DwarfStar (--device ds4), ONNX (--device onnx; docs/onnx.md keeps its ONNX content, only the Windows note changed).
  • scripts/package-linux.sh still takes no runtime argument.

Build and test

Every step under ~/lb/thermal-run.sh (nice 19, 4 spread cores, freeze at 78 °C) on strixhalo. The build resumed across thermal aborts caused by the concurrent #315 campaign (the box ran 89–95 °C) and finished on its third attempt.

cmake -S . -B build-purge -G Ninja -DCMAKE_BUILD_TYPE=Release -DONEBIT_HRX=ON
# CONFIGURE_RC=0   (llama.cpp 1a5dcba2, hrx-system 3319e536)

cmake --build build-purge -j2 --target onebit \
  npu_full_elf_test npu_pack_test npu_q4nx_test npu_private_route_test \
  tokenizer_test think_split_test gguf_meta_test mem_admit_test laya_encoder_test \
  http_guard_test moe_gguf_index_test laya_bounds_test \
  npu_model_bounds_test npu_forward_loader_test tokenizer_linear_test
# BUILD_OK (rc=0)  ->  build-purge/1bit (2.2 MB)

ctest --test-dir build-purge --output-on-failure -j2
# 100% tests passed, 0 tests failed out of 30

Route check on the built binary:

$ build-purge/1bit serve -m /dev/null --device mlx
1bit serve: --device mlx was removed: the engine has no MLX or Metal route (its GPU route is HRX). Lemonade's own MLX backend serves Apple Silicon (docs/lemonade.md)
$ build-purge/1bit serve --help | grep -E 'device auto|llama-server|ds4'
                  [--device auto|npu|hrx|cpu|ds4|onnx] [--ctx-size N] [--alias NAME]
                  [--llama-server PATH] [--hrx-libhsa PATH]
                  [--ds4 PATH] [--ssd-streaming]   DwarfStar (--device ds4; docs/dwarfstar.md)

Not run: serve_e2e_hrx / serve_e2e_cpu (they load a real GGUF on HRX0 through llama-server) — the GPU is held by the #315 campaign (~/box.lock), and those tests are only registered with -DONEBIT_SERVE_TEST_GGUF. laya_route_e2e / laya_gate need a Laya model root. All 30 registered tests are CPU/configure-level and passed (including device_route, which covers the --device mlx refusal added here).

python3 tools/copyright.py --check passes (the new scripts/lemond-onebit.sh carries the notice).

Not exercised by that build: cmake/laya-ggml.cmake's new explicit GGML_VULKAN/HIP/CUDA/METAL=OFF line (Laya is off by default; cmake/hrx.cmake already passes the same four flags for the HRX llama.cpp). DwarfStar and ONNX are off by default too and untouched by this PR.

the vendor runtime

scripts/package-linux.sh:# beside itself ($ORIGIN). The NPU lane has no separate runtime library to ship (no external runtime;
scripts/weekly.sh:#             strings), and no the external runtime library* file is packed; the NPU runtime is compiled into 1bit
scripts/weekly.sh:        [ "$n" = 0 ] || { echo "FAIL $f needs the external runtime library"; bad=1; }
scripts/weekly.sh:        n=$(ldd "$f" 2>/dev/null | grep -c the external runtime library || true)
scripts/weekly.sh:        n=$(strings -a "$f" | grep -c the external runtime library || true)
scripts/weekly.sh:    n=$(find "$t" -name 'the external runtime library*' | wc -l)
CMakeLists.txt:# and npu_rt.cpp, built here into the static library onebit_npu_rt and linked into 1bit. AMD's the vendor runtime
CMakeLists.txt:# is not supported: the engine links no external runtime library. The release build takes the runtime from the
CMakeLists.txt:                        "no external runtime NPU lane (docs/npu.md, \"The NPU runtime\")")

Every one of these is pre-existing on main (the self-contained-runtime package checks in scripts/weekly.sh, the CMakeLists.txt comments, and app/forward_serve.cpp's use of the runtime's own API names in the NPU-only translation unit). This PR adds none of them and reintroduces no external runtime dependency.

The packaging rows this PR rewrites state only the negative fact (no external runtime); they do not carry any wording about how the NPU route is implemented.

🤖 Generated with Claude Code

@github-actions

github-actions Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

PR Reviewer Guide 🔍

(Review updated until commit 560bf03)

Here are some key observations to aid the review process:

🎫 Ticket compliance analysis 🔶

396 - Partially compliant

Compliant requirements:

  • Remove the remaining non-HRX backend paths
  • Remove --device mlx and --mlx-server
  • Remove Windows package
  • Remove standalone Linux tarball as a release asset
  • Update cmake/laya-ggml.cmake to pass GGML_VULKAN/HIP/CUDA/METAL=OFF explicitly
  • Update docs to reflect pure HRX with HIP kernels
  • Remove comments about MLX and Windows in os/README.md and os/mini/vmtest.sh

Non-compliant requirements:

  • None

Requires further human verification:

  • None

315 - Partially compliant

Compliant requirements:

  • None

Non-compliant requirements:

  • The PR does not address the pre-existing GLM varied-length fault on the public HRX path mentioned in the ticket description

Requires further human verification:

  • The intermittent HSA memory fault and NaN logits issue needs further verification on hardware to ensure it's not introduced by this PR
⏱️ Estimated effort to review: 4 🔵🔵🔵🔵⚪
🧪 No relevant tests
🔒 No security concerns identified
⚡ Recommended focus areas for review

Incorrect device validation

The device validation logic in refuse_removed_device function does not properly handle the case where --device mlx is passed. The function throws an error for --device mlx, but the code in launch_for function still has a conditional check for device == "mlx" which is now unreachable. This could lead to confusion or unexpected behavior if the validation is bypassed or if there are other code paths that still reference the MLX device.

    if (device == "mlx")
        throw std::runtime_error("--device mlx was removed: the engine has no MLX or Metal route (its GPU route is HRX). "
                                 "Lemonade's own MLX backend serves Apple Silicon (docs/lemonade.md)");
}
Package stage overlap

The package stage in scripts/weekly.sh overlaps with an open PR that also edits weekly.sh. This could lead to merge conflicts or unexpected behavior in the release process. The PR description mentions this conflict but does not provide a resolution.

local tag=${WEEKLY_TAG:-v$(date +%G.%V)} n=0
while gh release view "$tag" -R "$REPO" > /dev/null 2>&1; do n=$((n + 1)); tag=v$(date +%G.%V).$n; done
echo "$tag" > "$TAG_FILE"
rm -rf "$OUT" && mkdir -p "$OUT"
say "package $tag: the engine (into the Lemonade + onebit package)"
# the engine tree (package-linux.sh) is not published on its own: it goes into the Lemonade
# package below as 1bit/ (docs/releases.md), next to the lemond-onebit launcher
rm -rf "$W/engine-pkg"
"$SRC/scripts/package-linux.sh" "$BUILD" "$W/engine-pkg" "$tag" > "$LOGS/package-linux.log" 2>&1
package_checks "$W/engine-pkg/1bit-$tag-linux-x86_64.tar.zst" > "$LOGS/package-checks.log" 2>&1 ||
    { cat "$LOGS/package-checks.log"; return 1; }
say "package $tag: Lemonade + onebit, with the engine"
guard "$SRC/scripts/build-lemonade.sh" "$W/lemonade" > "$LOGS/lemonade-build.log" 2>&1
rm -rf "$W/lemonade/1bit" && mkdir -p "$W/lemonade/1bit"
zstd -dc "$W/engine-pkg/1bit-$tag-linux-x86_64.tar.zst" | tar -C "$W/lemonade/1bit" --strip-components=1 -xf -
install -m 755 "$SRC/scripts/lemond-onebit.sh" "$W/lemonade/lemond-onebit"
tar -C "$W/lemonade" --transform "s,^,lemonade-onebit-$tag/," -cf - bin 1bit lemond-onebit | zstd -q -T4 -19 \
    -o "$OUT/lemonade-onebit-$tag-linux-x86_64.tar.zst"
say "package $tag: 1bit OS"

…ple/Metal (replaces #396)

Policy: the engine is Lemonade's backend, not a distribution of its own. There is no
standalone engine tarball and no Windows package, and the engine is HRX with HIP kernels
on the GPU; every other backend (Vulkan, ROCm, CUDA, Metal/MLX, Windows) is Lemonade's.

- Unpublish 1bit-<tag>-linux-x86_64.tar.zst: weekly.sh unpacks the package-linux.sh tree
  into the Lemonade + onebit package as 1bit/, next to the new lemond-onebit launcher
  (scripts/lemond-onebit.sh) that points the onebit backend at the packaged engine.
  docs/releases.md and tools/weekly_changes.py list the two remaining artifacts.
- Delete the Windows zip and its build: scripts/build-windows.sh, docs/windows.md, and
  the package rows/steps and Windows doc notes elsewhere.
- Drop Apple/Metal: docs/apple.md is deleted, the mlx path and --mlx-server are gone from
  app/serve.cpp and app/main.cpp (both now refused by name), and the serve_e2e_mlx test
  is gone from CMakeLists.txt. --device ds4, --device onnx, hrx, cpu and npu are untouched.
- os/mini/vmtest.sh and os/README.md: the onebit recipe's backends are hrx and npu.
- cmake/laya-ggml.cmake: pass the same explicit GGML_VULKAN/HIP/CUDA/METAL=OFF as
  cmake/hrx.cmake.

The XRT-free state on main is unchanged: no XRT argument, library or reference is
re-added, and scripts/package-linux.sh still takes no xrt argument.
@github-actions

Copy link
Copy Markdown

Persistent review updated to latest commit 1b3e61a

@github-actions

Copy link
Copy Markdown

Persistent review updated to latest commit 560bf03

@bong-water-water-bong
bong-water-water-bong merged commit 6dd709f into main Oct 16, 2026
8 checks passed
@bong-water-water-bong
bong-water-water-bong deleted the 1bit/backend-purge-v2 branch October 16, 2026 12:25
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