Skip to content

release: the catalogue offers only the NPU models whose kernel set ships - #3300

Merged
bong-water-water-bong merged 1 commit into
mainfrom
catalogue/npu-needs-its-set
Nov 22, 2026
Merged

bong-water-water-bong merged 1 commit into
mainfrom
catalogue/npu-needs-its-set

Conversation

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator

Part of #3287 ("Qwen3-1.7B on the NPU … did not ship").

Problem. The Lemonade fork's catalogue lists four onebit NPU models; v2026.47 ships kernel sets for two. Choosing Qwen3-1.7B-NPU-1bit in the Lemonade page loaded nothing and returned a 500 that blamed the hardware:

Failed to load model 'Qwen3-1.7B-NPU-1bit': 1bit serve failed to start … the NPU did not start the backend in 7 attempt(s) …
another client may still be releasing the array, or the driver needs a reload (modprobe -r amdxdna && modprobe amdxdna)

Change.

  • config/npu-catalogue-sets.json: catalogue entry → the kernel set it needs (sets are named by geometry, hidden×ffn×heads×kv_heads); null = a route this payload does not ship.
  • tools/npu_catalogue_filter.py: keeps an onebit NPU entry only if its set is in 1bit/npu/kernels with a manifest; drops unmapped NPU entries too (a row nobody mapped is a row nobody proved); HRX and non-onebit entries untouched; prints each drop; rewrites only when something was dropped. --self-test (11 cases) registered with ctest.
  • scripts/weekly.sh: runs it where the payload is assembled, before the modes fold and the tar.

Measured on the c35 payload:

dropped Qwen3.6-35B-A3B-NPU-1bit: needs a route this payload does not ship (mapped to null)
dropped Qwen3-1.7B-NPU-1bit: no kernel set 2048x6144x16x8 in the payload
2 NPU entr(y/ies) offered: Qwen3-0.6B-NPU-1bit Qwen3-4B-NPU-1bit

23 HRX entries unchanged; tools/copyright.py --check clean. catalogue-manifest.py reads the filtered file, so the release check's models row follows automatically.

🤖 Generated with Claude Code

@github-actions

github-actions Bot commented Nov 22, 2026 •

Copy link
Copy Markdown

PR Reviewer Guide 🔍

(Review updated until commit a4ffbf2)

Here are some key observations to aid the review process:

🎫 Ticket compliance analysis 🔶

3287 - Partially compliant

Compliant requirements:

  • The catalogue now only offers NPU models whose kernel set ships with the payload.
  • The npu_catalogue_filter.py tool is implemented and integrated into weekly.sh.
  • The config/npu-catalogue-sets.json file maps each onebit NPU model to its required kernel set.
  • The CMakeLists.txt includes a self-test for npu_catalogue_filter.py.

Non-compliant requirements:

  • The cut must use the freshly rolled payload.
  • The pre-write probe must be able to stop the write.
  • Keep the shipped image.

Requires further human verification:

  • The release tooling requirements related to the image cut, pre-write probe, and image archiving are not addressed in this PR.
⏱️ Estimated effort to review: 3 🔵🔵🔵⚪⚪
🧪 PR contains tests
🔒 No security concerns identified
⚡ Recommended focus areas for review

Manifest validation is not comprehensive

The has_set function in npu_catalogue_filter.py only checks for the existence of manifest or manifest.json files but does not validate their content. This could lead to false positives if a file named manifest or manifest.json exists but is not a valid manifest, potentially causing incorrect filtering of NPU models.

def has_set(kernels, name):
    d = os.path.join(kernels, name)
    return bool(name) and (os.path.isfile(os.path.join(d, "manifest")) or os.path.isfile(os.path.join(d, "manifest.json")))
Self-test may not cover all edge cases

The self-test in npu_catalogue_filter.py covers several cases but may not cover all edge cases for manifest validation or kernel set handling. Specifically, it does not test for cases where the manifest file might be malformed or contain invalid data. While the test ensures basic functionality, it may not be comprehensive enough to catch all potential issues in a production environment.

def self_test():
    bad = 0

    def check(cond, what):
        nonlocal bad
        print(("ok   " if cond else "FAIL ") + what)
        bad += 0 if cond else 1

    npu = {"recipe": "onebit", "recipe_options": {"onebit_backend": "npu"}}
    hrx = {"recipe": "onebit", "recipe_options": {}}
    other = {"recipe": "llamacpp"}
    with tempfile.TemporaryDirectory() as t:
        k = os.path.join(t, "kernels")
        os.makedirs(os.path.join(k, "1024x3072x16x8"))
        open(os.path.join(k, "1024x3072x16x8", "manifest"), "w").write("npumanifest 2\n")
        os.makedirs(os.path.join(k, "2560x9728x32x8"))  # a directory with no manifest is not a set
        sets = {"A-NPU": "1024x3072x16x8", "B-NPU": "2048x6144x16x8", "C-NPU": "2560x9728x32x8", "D-NPU": None}
        cat = {"A-NPU": npu, "B-NPU": npu, "C-NPU": npu, "D-NPU": npu, "E-NPU": npu, "H": hrx, "L": other}
        kept, dropped = plan(cat, k, sets)
        names = dict(dropped)
        check("A-NPU" in kept, "an NPU entry whose set ships (with a manifest) is kept")
        check("B-NPU" in names and "no kernel set" in names["B-NPU"], "an NPU entry with no set shipped is dropped")
        check("C-NPU" in names, "a set directory without a manifest does not count as shipped")
        check("D-NPU" in names and "null" in names["D-NPU"], "an entry mapped to null (a route not shipped) is dropped")
        check("E-NPU" in names and "not in" in names["E-NPU"], "an NPU entry the map does not know is dropped")
        check(kept.get("H") is hrx and kept.get("L") is other, "HRX and non-onebit entries are untouched")
        check(list(kept) == ["A-NPU", "H", "L"], "the kept catalogue keeps its order")
        os.makedirs(os.path.join(k, "legacy"))
        open(os.path.join(k, "legacy", "manifest.json"), "w").write("{}")
        check(has_set(k, "legacy"), "a format-1 set (manifest.json) counts too")
        p = os.path.join(t, "server_models.json")
        json.dump(cat, open(p, "w"))
        m = os.path.join(t, "map.json")
        json.dump({"about": "x", "sets": sets}, open(m, "w"))
        run(p, k, m)
        check(sorted(json.load(open(p))) == ["A-NPU", "H", "L"], "run rewrites the catalogue without the dropped rows")
        before = open(p).read()
        run(p, k, m)
        check(open(p).read() == before, "a second run changes nothing")
    print("npu_catalogue_filter self-test:", "FAIL" if bad else "ok")
    return 1 if bad else 0
✅ Resolved findings

tools/npu_catalogue_filter.py:41-43

Incorrect handling of manifest files

The has_set function checks for both manifest and manifest.json files, but it does not validate the content of these files to ensure they are valid manifests. This could lead to false positives if a file named manifest or manifest.json exists but is not a valid manifest. This is a potential issue for correctness, especially in a release context where manifest validation is critical.

@bong-water-water-bong
bong-water-water-bong enabled auto-merge (squash) November 22, 2026 14:36
…ips (engine#3287)

The Lemonade fork's catalogue lists four onebit NPU models; v2026.47 shipped kernel sets for two. Choosing
Qwen3-1.7B-NPU-1bit in the Lemonade page ended in a 500 that blamed the NPU array ('another client may still be
releasing the array, or the driver needs a reload') rather than the missing set.

tools/npu_catalogue_filter.py, run by weekly.sh where the payload is assembled, keeps an onebit NPU entry only
when config/npu-catalogue-sets.json maps it to a set (by geometry) that is in 1bit/npu/kernels with a manifest;
an unmapped NPU entry, or one mapped to null (a route this payload does not ship), is dropped and printed. HRX and
non-onebit entries are untouched. On the c35 payload: 0.6B and 4B kept, 1.7B (no 2048x6144x16x8 set) and
Qwen3.6-35B-A3B (private add-on route) dropped, 23 HRX entries unchanged. Self-test registered with ctest.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@github-actions

Copy link
Copy Markdown

Persistent review updated to latest commit a4ffbf2

@bong-water-water-bong
bong-water-water-bong merged commit ae804e6 into main Nov 22, 2026
11 of 12 checks passed
@bong-water-water-bong
bong-water-water-bong deleted the catalogue/npu-needs-its-set branch November 22, 2026 14:57
bong-water-water-bong added a commit that referenced this pull request Nov 23, 2026
…e now check what ships (engine#3287) (#3338)

Found by the v2026.48 cut: package_checks failed the v2026.48 engine tarball and the board-tested c35 payload with
the same 22 FAIL lines, so neither could be packaged without waiving the check.
- NPU set count: demanded "the 0.6B, 1.7B and 4B sets", stale since 1.7B stopped shipping (#3300's catalogue filter
  decides what is offered). Now: at least one signed set, and every set is a geometry config/npu-catalogue-sets.json names.
- Host-ELF row: rejected the signed-manifest sets' AIE kernels at <set>/<id>/layer1.elf, which the allowlist above admits
  by design (#3278). Those are skipped when the set carries its manifest; an AIE ELF anywhere else still fails.
- Private names in the packed 1bit: matched as substrings, so one private basename matched inside a longer PUBLIC
  path ending with it, in a message the engine prints. Now whole names (grep -w); real private names still match
  (13 hits in an unstripped build binary, 0 in the stripped package).

Measured: the v2026.48 engine tarball now passes all 13 rows (rc 0). tests/weekly_package_checks_test.sh: 7 rows on
miniature tarballs with invented names, 7/7 with this change and 6 FAIL against main's weekly.sh; in the CI image as a
non-root user 7/7.

Co-authored-by: bong-water-water-bong <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
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