chipwright 0.2.2__tar.gz → 0.2.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {chipwright-0.2.2 → chipwright-0.2.3}/PKG-INFO +1 -1
- {chipwright-0.2.2 → chipwright-0.2.3}/chipwright/__init__.py +1 -1
- {chipwright-0.2.2 → chipwright-0.2.3}/chipwright/device.py +9 -2
- {chipwright-0.2.2 → chipwright-0.2.3}/chipwright/run.py +1 -1
- chipwright-0.2.3/chipwright/tests/test_device_ctx.py +81 -0
- {chipwright-0.2.2 → chipwright-0.2.3}/chipwright/tests/test_packaging.py +1 -1
- {chipwright-0.2.2 → chipwright-0.2.3}/chipwright.egg-info/PKG-INFO +1 -1
- {chipwright-0.2.2 → chipwright-0.2.3}/chipwright.egg-info/SOURCES.txt +1 -0
- {chipwright-0.2.2 → chipwright-0.2.3}/pyproject.toml +1 -1
- {chipwright-0.2.2 → chipwright-0.2.3}/LICENSE +0 -0
- {chipwright-0.2.2 → chipwright-0.2.3}/README.md +0 -0
- {chipwright-0.2.2 → chipwright-0.2.3}/chipwright/adapt.py +0 -0
- {chipwright-0.2.2 → chipwright-0.2.3}/chipwright/build.py +0 -0
- {chipwright-0.2.2 → chipwright-0.2.3}/chipwright/cache.py +0 -0
- {chipwright-0.2.2 → chipwright-0.2.3}/chipwright/cli.py +0 -0
- {chipwright-0.2.2 → chipwright-0.2.3}/chipwright/config.py +0 -0
- {chipwright-0.2.2 → chipwright-0.2.3}/chipwright/data/behavior_prompts.yaml +0 -0
- {chipwright-0.2.2 → chipwright-0.2.3}/chipwright/data/index.yaml +0 -0
- {chipwright-0.2.2 → chipwright-0.2.3}/chipwright/device_adb.py +0 -0
- {chipwright-0.2.2 → chipwright-0.2.3}/chipwright/env.py +0 -0
- {chipwright-0.2.2 → chipwright-0.2.3}/chipwright/errors.py +0 -0
- {chipwright-0.2.2 → chipwright-0.2.3}/chipwright/llm_reference.py +0 -0
- {chipwright-0.2.2 → chipwright-0.2.3}/chipwright/modalities/__init__.py +0 -0
- {chipwright-0.2.2 → chipwright-0.2.3}/chipwright/modalities/asr_encoder.py +0 -0
- {chipwright-0.2.2 → chipwright-0.2.3}/chipwright/modalities/cv.py +0 -0
- {chipwright-0.2.2 → chipwright-0.2.3}/chipwright/modalities/llm.py +0 -0
- {chipwright-0.2.2 → chipwright-0.2.3}/chipwright/recipe.py +0 -0
- {chipwright-0.2.2 → chipwright-0.2.3}/chipwright/registry.py +0 -0
- {chipwright-0.2.2 → chipwright-0.2.3}/chipwright/resolver.py +0 -0
- {chipwright-0.2.2 → chipwright-0.2.3}/chipwright/sdk.py +0 -0
- {chipwright-0.2.2 → chipwright-0.2.3}/chipwright/tags.py +0 -0
- {chipwright-0.2.2 → chipwright-0.2.3}/chipwright/task_eval.py +0 -0
- {chipwright-0.2.2 → chipwright-0.2.3}/chipwright/tests/conftest.py +0 -0
- {chipwright-0.2.2 → chipwright-0.2.3}/chipwright/tests/test_adapt.py +0 -0
- {chipwright-0.2.2 → chipwright-0.2.3}/chipwright/tests/test_build.py +0 -0
- {chipwright-0.2.2 → chipwright-0.2.3}/chipwright/tests/test_cache.py +0 -0
- {chipwright-0.2.2 → chipwright-0.2.3}/chipwright/tests/test_cli_ux.py +0 -0
- {chipwright-0.2.2 → chipwright-0.2.3}/chipwright/tests/test_device_adb.py +0 -0
- {chipwright-0.2.2 → chipwright-0.2.3}/chipwright/tests/test_env.py +0 -0
- {chipwright-0.2.2 → chipwright-0.2.3}/chipwright/tests/test_env_adb.py +0 -0
- {chipwright-0.2.2 → chipwright-0.2.3}/chipwright/tests/test_llm_modality.py +0 -0
- {chipwright-0.2.2 → chipwright-0.2.3}/chipwright/tests/test_precision_support.py +0 -0
- {chipwright-0.2.2 → chipwright-0.2.3}/chipwright/tests/test_registry.py +0 -0
- {chipwright-0.2.2 → chipwright-0.2.3}/chipwright/tests/test_resolver.py +0 -0
- {chipwright-0.2.2 → chipwright-0.2.3}/chipwright/tests/test_run_llm.py +0 -0
- {chipwright-0.2.2 → chipwright-0.2.3}/chipwright/tests/test_security.py +0 -0
- {chipwright-0.2.2 → chipwright-0.2.3}/chipwright/tests/test_tags.py +0 -0
- {chipwright-0.2.2 → chipwright-0.2.3}/chipwright/tests/test_task_eval.py +0 -0
- {chipwright-0.2.2 → chipwright-0.2.3}/chipwright/tests/test_verify.py +0 -0
- {chipwright-0.2.2 → chipwright-0.2.3}/chipwright/tests/test_verify_llm.py +0 -0
- {chipwright-0.2.2 → chipwright-0.2.3}/chipwright/verify.py +0 -0
- {chipwright-0.2.2 → chipwright-0.2.3}/chipwright/verify_llm.py +0 -0
- {chipwright-0.2.2 → chipwright-0.2.3}/chipwright.egg-info/dependency_links.txt +0 -0
- {chipwright-0.2.2 → chipwright-0.2.3}/chipwright.egg-info/entry_points.txt +0 -0
- {chipwright-0.2.2 → chipwright-0.2.3}/chipwright.egg-info/requires.txt +0 -0
- {chipwright-0.2.2 → chipwright-0.2.3}/chipwright.egg-info/top_level.txt +0 -0
- {chipwright-0.2.2 → chipwright-0.2.3}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: chipwright
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.3
|
|
4
4
|
Summary: A verified package manager for Qualcomm NPUs — resolve the artifact that loads on your exact chip, run it, and prove it against a CPU reference.
|
|
5
5
|
License-Expression: MIT
|
|
6
6
|
Project-URL: Homepage, https://github.com/nameissakthi25/chipwright
|
|
@@ -82,16 +82,23 @@ class RemoteQNN:
|
|
|
82
82
|
time.sleep(wait)
|
|
83
83
|
return last
|
|
84
84
|
|
|
85
|
-
def ensure_ctx(self, local_path, name):
|
|
85
|
+
def ensure_ctx(self, local_path, name, ext=None):
|
|
86
86
|
"""Push an artifact to the board and return a runnable context-binary path (cached).
|
|
87
87
|
|
|
88
88
|
A DLC is the durable artifact; the HTP context binary is per-target, so a `.dlc` is compiled
|
|
89
89
|
into a context binary ON the board (2 MB VTCM) — regenerate, don't ship brittle. A prebuilt
|
|
90
90
|
context binary (`.bin`/`.qnnctx`) is pushed as-is.
|
|
91
|
+
|
|
92
|
+
`ext` is the registry-declared artifact kind ("dlc"/"bin"/…). It is authoritative: a hosted
|
|
93
|
+
artifact is fetched into the content-addressed cache under a HASHED filename with no extension,
|
|
94
|
+
so inferring "is this a DLC?" from `local_path` wrongly treats a fetched DLC as a prebuilt
|
|
95
|
+
context binary (skips context-gen → "Could not create context from binary" on-device). When
|
|
96
|
+
`ext` is given we trust it; only when it is absent do we fall back to the filename suffix.
|
|
91
97
|
"""
|
|
92
98
|
name = _safe_board_name(name) # registry-sourced; confine before it reaches any shell string
|
|
93
99
|
self._retry(lambda: _ssh(self.pw, self.port, self.dest, f"mkdir -p {self.board_dir}", timeout=40))
|
|
94
|
-
if local_path.endswith(".dlc")
|
|
100
|
+
is_dlc = (ext == "dlc") if ext is not None else local_path.endswith(".dlc")
|
|
101
|
+
if is_dlc:
|
|
95
102
|
dlc_board = f"{self.board_dir}/{name}"
|
|
96
103
|
ctx_board = f"{self.board_dir}/ctx_{name}/{name}_ctx.bin"
|
|
97
104
|
present = _ssh(self.pw, self.port, self.dest, f"test -f {ctx_board} && echo OK", timeout=40)
|
|
@@ -81,7 +81,7 @@ def run_variant(variant, input_path=None):
|
|
|
81
81
|
|
|
82
82
|
board_name = r.get("board_name", os.path.basename(art))
|
|
83
83
|
print(f" pushing artifact to board ({board_name}) …", flush=True)
|
|
84
|
-
ctx_board = dev.ensure_ctx(art, board_name)
|
|
84
|
+
ctx_board = dev.ensure_ctx(art, board_name, ext=variant.ext)
|
|
85
85
|
|
|
86
86
|
mod = importlib.import_module(f".modalities.{r['modality']}", __package__)
|
|
87
87
|
if not r.get("cpu_onnx") or not (input_path or r.get("input")):
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"""ensure_ctx must decide DLC-vs-prebuilt by the registry-declared `ext`, not the filename.
|
|
2
|
+
|
|
3
|
+
Regression for a real-silicon bug: a HOSTED artifact is fetched into the content-addressed cache under
|
|
4
|
+
a hashed filename with NO extension, so `local_path.endswith('.dlc')` was False for a fetched DLC →
|
|
5
|
+
ensure_ctx pushed it as a prebuilt context binary and skipped context-gen → the board reported
|
|
6
|
+
"Could not create context from binary". Passing `ext` from the variant fixes it. No real SSH: _ssh/_scp
|
|
7
|
+
are monkeypatched to record the commands issued.
|
|
8
|
+
"""
|
|
9
|
+
import os
|
|
10
|
+
import sys
|
|
11
|
+
|
|
12
|
+
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))
|
|
13
|
+
|
|
14
|
+
from chipwright import device
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class _R:
|
|
18
|
+
def __init__(self, rc=0, out="", err=""):
|
|
19
|
+
self.returncode, self.stdout, self.stderr = rc, out, err
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def _fakes():
|
|
23
|
+
"""Return (calls, ssh, scp) — ssh returns 'OK' to a `test -f` only AFTER a context-gen ran, so the
|
|
24
|
+
pre-gen presence check misses and the post-gen check passes (mirrors a fresh board)."""
|
|
25
|
+
calls, gen = [], {"done": False}
|
|
26
|
+
|
|
27
|
+
def ssh(pw, port, dest, *cmd, timeout=600, capture=True):
|
|
28
|
+
c = cmd[0] if cmd else ""
|
|
29
|
+
calls.append(c)
|
|
30
|
+
if "qnn-context-binary-generator" in c:
|
|
31
|
+
gen["done"] = True
|
|
32
|
+
return _R(out="OK" if ("test -f" in c and gen["done"]) else "")
|
|
33
|
+
|
|
34
|
+
def scp(pw, port, *args, timeout=1800):
|
|
35
|
+
return _R()
|
|
36
|
+
|
|
37
|
+
return calls, ssh, scp
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
def _dev(monkeypatch):
|
|
41
|
+
monkeypatch.setattr(device.shutil, "which", lambda _: "/usr/bin/sshpass")
|
|
42
|
+
return device.RemoteQNN("1.2.3.4", "root", "pw", 22)
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
def test_hosted_dlc_hashed_name_still_context_gens_with_ext(monkeypatch):
|
|
46
|
+
"""The bug: a fetched DLC has a hashed, extension-less path. With ext='dlc' it MUST context-gen."""
|
|
47
|
+
calls, ssh, scp = _fakes()
|
|
48
|
+
monkeypatch.setattr(device, "_ssh", ssh)
|
|
49
|
+
monkeypatch.setattr(device, "_scp", scp)
|
|
50
|
+
dev = _dev(monkeypatch)
|
|
51
|
+
hashed = "/home/u/.cache/chipwright/blobs/ab/" + "a" * 64 # no .dlc suffix
|
|
52
|
+
ctx = dev.ensure_ctx(hashed, "mobilenet", ext="dlc")
|
|
53
|
+
assert any("qnn-context-binary-generator" in c for c in calls), "ext='dlc' must trigger context-gen"
|
|
54
|
+
assert ctx.endswith("ctx_mobilenet/mobilenet_ctx.bin")
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
def test_without_ext_falls_back_to_suffix(monkeypatch):
|
|
58
|
+
"""Back-compat: no ext → infer from the filename. A .dlc path context-gens; a .bin is pushed as-is."""
|
|
59
|
+
calls, ssh, scp = _fakes()
|
|
60
|
+
monkeypatch.setattr(device, "_ssh", ssh)
|
|
61
|
+
monkeypatch.setattr(device, "_scp", scp)
|
|
62
|
+
dev = _dev(monkeypatch)
|
|
63
|
+
dev.ensure_ctx("/x/model.dlc", "m", ext=None)
|
|
64
|
+
assert any("qnn-context-binary-generator" in c for c in calls)
|
|
65
|
+
|
|
66
|
+
calls2, ssh2, scp2 = _fakes()
|
|
67
|
+
monkeypatch.setattr(device, "_ssh", ssh2)
|
|
68
|
+
monkeypatch.setattr(device, "_scp", scp2)
|
|
69
|
+
ctx = dev.ensure_ctx("/x/prebuilt.bin", "m", ext=None)
|
|
70
|
+
assert not any("qnn-context-binary-generator" in c for c in calls2), "a .bin is pushed as-is"
|
|
71
|
+
assert ctx.endswith("/m")
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
def test_ext_bin_is_pushed_as_is_even_if_path_says_dlc(monkeypatch):
|
|
75
|
+
"""ext is authoritative: ext='bin' must NOT context-gen even if the path happens to end .dlc."""
|
|
76
|
+
calls, ssh, scp = _fakes()
|
|
77
|
+
monkeypatch.setattr(device, "_ssh", ssh)
|
|
78
|
+
monkeypatch.setattr(device, "_scp", scp)
|
|
79
|
+
dev = _dev(monkeypatch)
|
|
80
|
+
dev.ensure_ctx("/x/weird.dlc", "m", ext="bin")
|
|
81
|
+
assert not any("qnn-context-binary-generator" in c for c in calls)
|
|
@@ -137,7 +137,7 @@ def test_run_refuses_when_no_cpu_reference(monkeypatch, tmp_path):
|
|
|
137
137
|
def __init__(self, *a, **k):
|
|
138
138
|
pass
|
|
139
139
|
|
|
140
|
-
def ensure_ctx(self, _art, _name):
|
|
140
|
+
def ensure_ctx(self, _art, _name, ext=None):
|
|
141
141
|
return "/board/ctx"
|
|
142
142
|
|
|
143
143
|
monkeypatch.setattr(runmod, "_board_env",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: chipwright
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.3
|
|
4
4
|
Summary: A verified package manager for Qualcomm NPUs — resolve the artifact that loads on your exact chip, run it, and prove it against a CPU reference.
|
|
5
5
|
License-Expression: MIT
|
|
6
6
|
Project-URL: Homepage, https://github.com/nameissakthi25/chipwright
|
|
@@ -39,6 +39,7 @@ chipwright/tests/test_build.py
|
|
|
39
39
|
chipwright/tests/test_cache.py
|
|
40
40
|
chipwright/tests/test_cli_ux.py
|
|
41
41
|
chipwright/tests/test_device_adb.py
|
|
42
|
+
chipwright/tests/test_device_ctx.py
|
|
42
43
|
chipwright/tests/test_env.py
|
|
43
44
|
chipwright/tests/test_env_adb.py
|
|
44
45
|
chipwright/tests/test_llm_modality.py
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "chipwright"
|
|
7
|
-
version = "0.2.
|
|
7
|
+
version = "0.2.3"
|
|
8
8
|
description = "A verified package manager for Qualcomm NPUs — resolve the artifact that loads on your exact chip, run it, and prove it against a CPU reference."
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
license = "MIT"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|