Skip to content
Closed
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
2 changes: 1 addition & 1 deletion config/npu-kernels.config
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@
#
# Move the pin by hand, after the NPU check on Strix Halo (docs/npu.md, "Checking the NPU").
repo=1bit-MONSTER/npu-kernels
sha=6eee76074347f649282dcc8d25c36e2269b84be3
sha=17ed5be7a28a3e4038d084a27a9b290f5642db57
path=addons
require=CMakeLists.txt register.cpp release-kernels.sh
10 changes: 5 additions & 5 deletions docs/releases.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,12 @@ release carries the NPU runtime, compiled into `1bit`, and the `onebit` recipe's
The NPU kernels are closed too: they ship as compiled, encrypted artifacts (`config/npu-kernels.config`,
`ONEBIT_NPU_PRIVATE`) that `1bit` verifies and decrypts in memory at load, failing cleanly on a
wrong key with no network callback of any kind; a lifted kernel file is ciphertext and does not run
([npu.md](npu.md)). Wiring the kernels into the weekly release package is the last step; until a
package carries them, HRX serves the GGUF models.
([npu.md](npu.md)). The release package carries them, and serves dense Qwen3 (0.6B, 1.7B, 4B)
on the NPU.

`scripts/weekly.sh` packs them with `WEEKLY_NPU_KERNELS=1` (off until the hardware gate's `npu`
phase passes on Strix Halo): the sealed kernel sets go beside `1bit` in `npu/kernels`, the build
loads sealed kernels only (`ONEBIT_NPU_RELEASE`), and the package checks refuse a plaintext kernel,
`scripts/weekly.sh` packs them by default (`WEEKLY_NPU_KERNELS=0` builds without): the sealed
kernel sets go beside `1bit` in `npu/kernels`, the build loads sealed kernels only
(`ONEBIT_NPU_RELEASE`), the `lemond-onebit` launcher sets `ONEBIT_KCRYPT_REQUIRE_SEALED=1`, and the package checks refuse a plaintext kernel,
an ELF for anything but the host, a symbol table in `1bit`, or a private source name in it. The
release machine holds the kernel key in `ONEBIT_NPU_KEY_DIR` (default `~/.config/1bit-npu-key`).

Expand Down
3 changes: 3 additions & 0 deletions scripts/lemond-onebit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,8 @@
set -euo pipefail
here=$(cd "$(dirname "$(readlink -f "$0")")" && pwd)
export LEMONADE_ONEBIT_BIN=${LEMONADE_ONEBIT_BIN:-$here/1bit/1bit}
# the NPU engine loads sealed kernels only, always: no opt-out (the release 1bit refuses plain
# kernel sets on its own too)
export ONEBIT_KCRYPT_REQUIRE_SEALED=1
export PATH=$here/bin:$PATH
exec "$here/bin/lemond" "$@"
13 changes: 10 additions & 3 deletions scripts/weekly.sh
Original file line number Diff line number Diff line change
Expand Up @@ -124,11 +124,11 @@ build() {
# shellcheck disable=SC2206
extra+=(${WEEKLY_CMAKE_ARGS:-})
# The NPU kernels (docs/releases.md, "The NPU engine"): sealed, packed beside 1bit in
# npu/kernels. Off until the hardware gate's npu phase passes on Strix Halo; then
# WEEKLY_NPU_KERNELS defaults to 1. The private checkout does the work through its one entry
# npu/kernels. On by default (the npu gate phase passed on Strix Halo; WEEKLY_NPU_KERNELS=0
# builds a package without them). The private checkout does the work through its one entry
# point (key install, sealing, the per-commit kernel cache); this script names nothing in it.
# ONEBIT_NPU_RELEASE makes the built 1bit load sealed kernels only.
if [ "${WEEKLY_NPU_KERNELS:-0}" = 1 ]; then
if [ "${WEEKLY_NPU_KERNELS:-1}" = 1 ]; then
"$SRC/scripts/fetch-private.sh" "$SRC/config/npu-kernels.config" "$W/npu-kernels" > /dev/null 2>> "$LOGS/private.log" ||
{ cat "$LOGS/private.log"; return 1; }
guard "$W/npu-kernels/addons/release-kernels.sh" "$BUILD/npu/kernels" "${ONEBIT_NPU_KEY_DIR:-$HOME/.config/1bit-npu-key}" \
Expand Down Expand Up @@ -320,6 +320,10 @@ package_checks() { # package_checks <linux tarball>
# kernel would be), the shipped 1bit has no symbol table, and its strings name no private
# source file and no build-machine home.
local nk=0 m privsrc
if [ "${WEEKLY_NPU_KERNELS:-1}" = 1 ]; then
n=$(find "$t" -path '*/npu/kernels/*/layout.json' -type f | wc -l)
[ "$n" -ge 3 ] || { echo "FAIL WEEKLY_NPU_KERNELS=1 but $(basename "$1") carries $n NPU kernel sets (want the 0.6B, 1.7B and 4B sets)"; bad=1; }
fi
while IFS= read -r -d '' f; do
[ "$(basename "$f")" = layout.json ] && continue
[ "$(head -c 8 "$f")" = 1BPKCRYP ] || { echo "FAIL $f is not a sealed kernel artifact"; nk=$((nk + 1)); }
Expand Down Expand Up @@ -405,6 +409,9 @@ lemonade_package_checks() { # lemonade_package_checks <tarball>
n=$(find "$t" -path '*/bin/resources/web-app/index.html' -type f | wc -l)
if [ "$n" != 0 ]; then echo "ok Lemonade's web app: bin/resources/web-app/index.html and $(find "$t" -path '*/bin/resources/web-app/*' -type f | wc -l) files in $(basename "$1")"
else echo "FAIL no Lemonade web app (bin/resources/web-app/index.html) in $(basename "$1")"; rc=1; fi
n=$(find "$t" -maxdepth 2 -name lemond-onebit -type f -exec grep -c '^export ONEBIT_KCRYPT_REQUIRE_SEALED=1$' {} + 2>/dev/null | head -1)
if [ "${n:-0}" != 0 ]; then echo "ok lemond-onebit loads sealed NPU kernels only (ONEBIT_KCRYPT_REQUIRE_SEALED=1)"
else echo "FAIL lemond-onebit does not export ONEBIT_KCRYPT_REQUIRE_SEALED=1"; rc=1; fi
rm -rf "$t"
return $rc
}
Expand Down
Loading