Skip to content
Merged
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
8 changes: 6 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,14 @@ This repository exists to be reviewable. Five rules keep it that way.
xclbins and the repository vendors none.
A private add-on (docs/npu.md, "Private routes") builds its kernels from
source in its own repository.
5. **Every file carries the copyright and Apache-2.0 notice.** Run
5. **Every file carries the copyright and Apache-2.0 notice, once.** Run
`python3 tools/copyright.py --fix` before committing; CI runs `--check`.
Files that cannot hold a comment (binaries, JSON, test data) are exempt,
listed in the tool.
listed in the tool. `--check` also fails a notice **duplicated inside the
first 20 lines** — the accidental shape that shipped 20 times before
engine#1547. A second occurrence further down is data (a heredoc or a
template that emits the notice into a generated file) and is left alone;
the three such files say so in a comment.

## RFCs: design before code

Expand Down
2 changes: 0 additions & 2 deletions onnx/build_ort.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Copyright 2026 bong-water-water-bong
# SPDX-License-Identifier: Apache-2.0
#
# Build ONNX Runtime from source and install it to a prefix we own, so onnx/ links against our
# libonnxruntime instead of the distro's. ORT is MIT: patching it and shipping the result closed
Expand Down
2 changes: 0 additions & 2 deletions onnx/tests/ort_run_generic.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Copyright 2026 bong-water-water-bong
# SPDX-License-Identifier: Apache-2.0
#
# ort_run_generic.sh BINARY PYTHON — `ort-run --input/--output/--dump-all` on a graph it has never
# seen (docs/onnx.md, "Any graph"). The model is a two-node MatMul+Relu written here with python
Expand Down
2 changes: 0 additions & 2 deletions os/v3/puppy/catalogue-manifest.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Copyright 2026 bong-water-water-bong
# SPDX-License-Identifier: Apache-2.0
#
# catalogue-manifest.py <server_models.json> <out.txt>
#
Expand Down
2 changes: 0 additions & 2 deletions os/v3/puppy/embed/etc/sysctl.d/60-1bit-console.conf
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Copyright 2026 bong-water-water-bong
# SPDX-License-Identifier: Apache-2.0
#
# Cycle 26, item 1: the console belongs to the console. Nothing may print onto tty1 while the console TUI is on it.
#
Expand Down
2 changes: 0 additions & 2 deletions os/v3/puppy/shell-login.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Copyright 2026 bong-water-water-bong
# SPDX-License-Identifier: Apache-2.0
#
# shell-login.sh <rootfs>
#
Expand Down
2 changes: 0 additions & 2 deletions scripts/check_repack_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Copyright 2026 bong-water-water-bong
# SPDX-License-Identifier: Apache-2.0
#
# check_repack_config.py -- oracle-free repack validation.
#
Expand Down
3 changes: 3 additions & 0 deletions scripts/mk-kernel-packages.sh
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,9 @@ chmod 0644 "$cfg"/etc/security/limits.d/*.conf "$cfg"/etc/udev/rules.d/*.rules \
"$cfg"/etc/modules-load.d/*.conf
install -m 0644 "$work/MOK-Kernel.der" "$cfg/usr/share/1bit/mok/MOK-Kernel.der"
cp "$repo/LICENSE" "$cfg/usr/share/licenses/1bit-npu-config/LICENSE"
# The <!-- ... --> block below is EMITTED into the package's README, not this script's own header (which is
# at the top). Deleting it as a duplicate ships a package whose documentation carries no licence
# (engine#1547, one of the three exemptions there).
cat > "$cfg/usr/share/doc/1bit-npu-config/README.md" <<'EOF'
<!--
Copyright 2026 bong-water-water-bong
Expand Down
25 changes: 25 additions & 0 deletions tests/copyright_check_untracked_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@

HERE = os.path.dirname(os.path.abspath(__file__))
TOOL = os.path.join(HERE, os.pardir, "tools", "copyright.py")
# Data, not this file's header: NOTICE is the string the cases below assert the tool against, which is why
# the second Copyright+SPDX pair here is legitimate (engine#1547).
NOTICE = ("# Copyright 2026 bong-water-water-bong\n"
"# SPDX-License-Identifier: Apache-2.0\n"
"#\n"
Expand Down Expand Up @@ -105,5 +107,28 @@ def git(repo, *args):
rc = run(repo, "--check")
check(rc.returncode == 0, "an ignored file is left out", rc.stdout + rc.stderr)

# A notice pasted twice in the header. This shape shipped in #1535 and #1544 because has_notice() only
# asked whether the notice was PRESENT; #1547 lists the 20 files it left behind.
with open(os.path.join(repo, "twice.py"), "w") as f:
f.write(NOTICE + "\n# Copyright 2026 bong-water-water-bong\n# SPDX-License-Identifier: Apache-2.0\nprint(2)\n")
rc = run(repo, "--check")
check(rc.returncode != 0, "a notice duplicated inside the header window FAILS the check",
f"rc {rc.returncode}: {rc.stdout.strip()}")
check("twice.py" in (rc.stdout + rc.stderr), "and the failure names the file", rc.stdout + rc.stderr)

# resolve it the way the tool's message says (delete the second copy) so the next case starts clean
with open(os.path.join(repo, "twice.py"), "w") as f:
f.write(NOTICE + "print(2)\n")

# ... but a second occurrence that is DATA, further down, is legitimate: a heredoc or template that emits
# the notice into a generated file. Three files in the tree are exactly this, and they must stay green.
with open(os.path.join(repo, "emits.sh"), "w") as f:
f.write(NOTICE + "".join(f"# line {i}\n" for i in range(20))
+ "cat > out.h <<'EOF'\n# Copyright 2026 bong-water-water-bong\n"
"# SPDX-License-Identifier: Apache-2.0\nEOF\n")
rc = run(repo, "--check")
check(rc.returncode == 0, "a second occurrence past the window (emitted notice) stays green",
rc.stdout + rc.stderr)

print(f"copyright_check_untracked_test: {len(FAIL)} failure(s)")
sys.exit(1 if FAIL else 0)
2 changes: 0 additions & 2 deletions tests/fconst19_measure_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Copyright 2026 bong-water-water-bong
# SPDX-License-Identifier: Apache-2.0
"""The 1.9 measurement tool's own paths, on synthetic packs.

`tools/fconst19_measure.py` shipped a crash on its refusal path because the only pair it was ever run on
Expand Down
2 changes: 0 additions & 2 deletions tools/amd-rai-sweep/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ See the License for the specific language governing permissions and
limitations under the License.
-->
<!--
Copyright 2026 bong-water-water-bong
SPDX-License-Identifier: Apache-2.0
-->
# AMD Ryzen AI ONNX packs — image + Whisper sweep

Expand Down
29 changes: 26 additions & 3 deletions tools/copyright.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,29 @@ def exempt(path):
return _match(path, EXEMPT) or _match(path.rsplit("/", 1)[-1], EXEMPT)


NOTICE_WINDOW = 20 # the lines has_notice() looks at; duplicated_notice() uses the same window


def has_notice(text):
head = "\n".join(text.splitlines()[:20])
head = "\n".join(text.splitlines()[:NOTICE_WINDOW])
return NOTICE[0] in head and NOTICE[1] in head and "Licensed under the Apache License, Version 2.0" in head


def duplicated_notice(text):
"""True when the Copyright + SPDX pair appears twice inside the header window.

Present-in-the-head was all this gate ever asked, so a file whose header block was pasted twice passed —
which is how #1535 and #1544 shipped one, and why #1547 lists 20 files. The window is deliberate: the
three legitimate second occurrences in the tree (a heredoc emitting a licence header in
scripts/mk-kernel-packages.sh, the NOTICE string a test asserts on in
tests/copyright_check_untracked_test.py, and the NOTICE template in tools/npu_leaderboard.py) all sit
past line 20, because they are *data*, not the file's own header. A duplicate inside the window is the
accidental shape; anything further down is somebody's deliberate string.
"""
head = "\n".join(text.splitlines()[:NOTICE_WINDOW])
return head.count(NOTICE[0]) > 1 and head.count(NOTICE[1]) > 1


def add_notice(text, block):
lines = text.splitlines(keepends=True)
insert_at = 1 if lines and lines[0].startswith("#!") else 0
Expand All @@ -148,7 +166,7 @@ def listing(*args):
return subprocess.run(["git", "ls-files", *args], capture_output=True, text=True,
check=True).stdout.split("\n")
files = sorted(set(filter(None, listing())) | set(filter(None, listing("--others", "--exclude-standard"))))
missing, unknown = [], []
missing, unknown, duplicated = [], [], []
for path in filter(None, files):
if exempt(path):
continue
Expand All @@ -158,6 +176,9 @@ def listing(*args):
continue
with open(path, encoding="utf-8") as f:
text = f.read()
if duplicated_notice(text):
duplicated.append(path)
continue
if has_notice(text):
continue
if args.fix:
Expand All @@ -167,11 +188,13 @@ def listing(*args):
else:
missing.append(path)

for path in duplicated:
print("copyright notice duplicated inside the header window (delete the second copy):", path)
for path in unknown:
print("no comment style known (add one to LINE_STYLES/BLOCK_STYLES or EXEMPT):", path)
for path in missing:
print("missing copyright notice:", path)
if missing or unknown:
if missing or unknown or duplicated:
print("run: python3 tools/copyright.py --fix", file=sys.stderr)
return 1
return 0
Expand Down
2 changes: 0 additions & 2 deletions tools/fconst19_measure.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Copyright 2026 bong-water-water-bong
# SPDX-License-Identifier: Apache-2.0
"""Measure a Ryzen AI 1.9 Token .fconst against its 1.8 twin, and print the table line to add.

An importer cannot derive a 1.9 pack's layout from the pack: the q/k/v bundle's tile shape is not a
Expand Down
2 changes: 0 additions & 2 deletions tools/flm_head_pb16i.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Copyright 2026 bong-water-water-bong
# SPDX-License-Identifier: Apache-2.0
#
# The MTP head in our "pb16i" form: codes x per-(32 K, column) magnitudes, no per-group bias.
#
Expand Down
2 changes: 0 additions & 2 deletions tools/npu-arena/TOOLCHAIN.lock.example
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Copyright 2026 bong-water-water-bong
# SPDX-License-Identifier: Apache-2.0
#
# TOOLCHAIN.lock.example -- copy to TOOLCHAIN.lock (git-ignored) and fill in for
# your box. The arena resolves every path from the environment first, then from
Expand Down
2 changes: 0 additions & 2 deletions tools/npu-arena/ceiling.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Copyright 2026 bong-water-water-bong
# SPDX-License-Identifier: Apache-2.0
#
# ceiling.sh -- phase 1 of the 2026-10-30 14:58 addendum: measure the attainable
# weight-stream bandwidth for EACH phase's tap/tile geometry with the matrix unit
Expand Down
2 changes: 0 additions & 2 deletions tools/npu-arena/lib/env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Copyright 2026 bong-water-water-bong
# SPDX-License-Identifier: Apache-2.0
#
# lib/env.sh -- sourced by every arena build/run. Resolves the toolchain from the
# environment (or from a local TOOLCHAIN.lock, which is deliberately NOT in the
Expand Down
2 changes: 0 additions & 2 deletions tools/npu-arena/make_probe.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Copyright 2026 bong-water-water-bong
# SPDX-License-Identifier: Apache-2.0
#
# make_probe.sh <PHASE> [<PHASE> ...] -- build the DMA-ceiling probe submissions for
# a phase: the phase's own tap/tile geometry with the matrix unit replaced by
Expand Down
2 changes: 0 additions & 2 deletions tools/npu-arena/make_task.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Copyright 2026 bong-water-water-bong
# SPDX-License-Identifier: Apache-2.0
#
# make_task.sh -- create or refresh a task bundle for one phase.
# make_task.sh GU|D|QKV|O|Z
Expand Down
2 changes: 0 additions & 2 deletions tools/npu-arena/oracle.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Copyright 2026 bong-water-water-bong
# SPDX-License-Identifier: Apache-2.0
#
# oracle.sh -- score ONE submission for ONE phase.
#
Expand Down
2 changes: 0 additions & 2 deletions tools/npu-arena/runner/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Copyright 2026 bong-water-water-bong
# SPDX-License-Identifier: Apache-2.0
#
# runner/build.sh -- build the arena's host-side on-device scorer.
# Links the engine's own NPU runtime (pinned in TOOLCHAIN.lock); no XRT.
Expand Down
2 changes: 2 additions & 0 deletions tools/npu_leaderboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
import sys
from pathlib import Path

# Data, not this file's header: NOTICE is the HTML block written into a generated leaderboard, which is
# why the second Copyright+SPDX pair here is legitimate (engine#1547).
NOTICE = """<!--
Copyright 2026 bong-water-water-bong
SPDX-License-Identifier: Apache-2.0
Expand Down
Loading