diff --git a/.github/actions/devkit-bench-acc/action.yml b/.github/actions/devkit-bench-acc/action.yml index 99bfcc3c6..8104df217 100644 --- a/.github/actions/devkit-bench-acc/action.yml +++ b/.github/actions/devkit-bench-acc/action.yml @@ -12,8 +12,7 @@ description: > output is non-zero when the gate fails, for the job's final gate, so the other benches and the upload still run. Runs the scripts of scripts-dir (the pull request's base) under clean_run.py: no token or GitHub variable - reaches flm. Ported from FastFlowLM_IRON's bench-acc and bench-vlm-acc - actions. + reaches flm. inputs: bench: diff --git a/.github/actions/devkit-bench-perf/action.yml b/.github/actions/devkit-bench-perf/action.yml index 3b2425568..5734a07b7 100644 --- a/.github/actions/devkit-bench-perf/action.yml +++ b/.github/actions/devkit-bench-perf/action.yml @@ -15,7 +15,7 @@ description: > CSV, for the job's final gate. Runs the scripts of scripts-dir (a checkout of .github/script at the pull request's base, so the pull request's own edits do not measure it) under clean_run.py: no token or GitHub variable - reaches flm. Ported from FastFlowLM_IRON's bench-perf action. + reaches flm. inputs: flm-bin: diff --git a/.github/script/ci/changes.py b/.github/script/ci/changes.py index f33935758..2489cafa2 100644 --- a/.github/script/ci/changes.py +++ b/.github/script/ci/changes.py @@ -148,8 +148,8 @@ r"|.*~$)", # editor backups such as src/home_install.sh~ re.IGNORECASE) -# The FLM dev kit: kernel, engine, converter and pybind sources imported from -# FastFlowLM_IRON, built and tested by dev-kit jobs of their own. No product +# The FLM dev kit: kernel, engine, converter and pybind sources, built and +# tested by dev-kit jobs of their own. No product # build reads them yet, so they select no product build or suite (a product # change that starts consuming one must add it to the product rules here). # Area -> the prefix that selects it, in output order. diff --git a/.github/script/ci/check_internal_refs.py b/.github/script/ci/check_internal_refs.py new file mode 100644 index 000000000..3ddf02ab0 --- /dev/null +++ b/.github/script/ci/check_internal_refs.py @@ -0,0 +1,111 @@ +#!/usr/bin/env python3 +# Copyright © Advanced Micro Devices, Inc., or its affiliates. All rights reserved. +# Portions of this file consist of AI-generated content. +"""Fail when a tracked file names internal repositories or process details. + + check_internal_refs.py [--repo ] + +The dev kit (flm-dev-kit/) came from a private development tree. Tracked files +must not name that tree, its pull requests, commits, branches or CI, internal +ticket IDs, personal paths, or NPU crash details (keep the engineering warning, +phrased generically). Every text file git tracks is scanned against PATTERNS; +binary files (a NUL byte in the first 8 KB) are skipped, as are the paths in +ALLOWED (each with its reason). "IRON" alone is not matched: it is also the +public mlir-aie Python API ("IRON Python", "IRON's object FIFOs"), so only the +forms that mean the repository are. Prints "check_internal_refs: error: +:: : " per hit and exits 1 when there is one. + +Standard library and git only. Run by build-and-test.yml's changes job on +every event; its tests are test_check_internal_refs.py. +""" + +from __future__ import annotations + +import argparse +import re +import subprocess +import sys +from pathlib import Path +from typing import Optional + +REPO_ROOT = Path(__file__).resolve().parents[3] + +# name -> pattern. Narrow on purpose: a hit should always be worth fixing. +PATTERNS = { + "internal repository": re.compile(r"FastFlowLM_IRON|\bFLM_IRON\b|AMD-ROCm-Internal", re.IGNORECASE), + "internal ticket": re.compile(r"\bSCL-\d+"), + "internal PR or issue": re.compile(r"\bIRON\s*#\d+|\bIRON PR\b"), + "internal commit or branch": re.compile(r"\bIRON\s+`?[0-9a-f]{7,40}\b|\bIRON (?:HEAD|CI)\b|\bIRON tree\b"), + "internal CI or tooling": re.compile(r"\bIRON's (?:CI|local|wheel-aie-env|ironenv|bench-models|walk-up)\b"), + "internal process": re.compile(r"\bPhase 2b exclusion\b|\b(?:pending|for an?) Legal (?:review|decision)\b"), + "crash details": re.compile(r"\bbugcheck\b|VIDEO_SCHEDULER_INTERNAL_ERROR", re.IGNORECASE), + # /scratch/$USER, $(USER) and ${USER} are generic; a literal name is not. + "personal path": re.compile(r"/scratch/(?!\$\(USER\)|\$\{?USER\b)[A-Za-z0-9_.-]+"), +} + +# path -> why it may contain the patterns. +ALLOWED = { + ".github/script/ci/check_internal_refs.py": "defines the patterns", +} + +BINARY_PROBE = 8192 + + +def scan_text(text: str) -> list[tuple[int, str, str]]: + """(line number, pattern name, matched text) for every hit in text.""" + hits = [] + for number, line in enumerate(text.splitlines(), 1): + for name, pattern in PATTERNS.items(): + match = pattern.search(line) + if match: + hits.append((number, name, match.group(0))) + return hits + + +def tracked_files(repo: Path) -> Optional[list[str]]: + try: + out = subprocess.run(["git", "-C", str(repo), "ls-files", "-z"], check=True, + capture_output=True).stdout + except (OSError, subprocess.CalledProcessError): + return None + return [p for p in out.decode("utf-8", "surrogateescape").split("\0") if p] + + +def scan_repo(repo: Path) -> tuple[list[str], int]: + """(errors, files scanned) for the files git tracks in repo.""" + files = tracked_files(repo) + if files is None: + return [f"{repo}: git ls-files failed"], 0 + errors = [] + scanned = 0 + for rel in files: + if rel in ALLOWED: + continue + try: + data = (repo / rel).read_bytes() + except OSError: + continue # deleted in the work tree, or a submodule + if b"\0" in data[:BINARY_PROBE]: + continue + scanned += 1 + for number, name, found in scan_text(data.decode("utf-8", "replace")): + errors.append(f"{rel}:{number}: {name}: {found}") + return errors, scanned + + +def main(argv: Optional[list[str]] = None) -> int: + parser = argparse.ArgumentParser(description=__doc__.splitlines()[0]) + parser.add_argument("--repo", type=Path, default=REPO_ROOT) + args = parser.parse_args(argv) + errors, scanned = scan_repo(args.repo) + for err in errors: + print(f"check_internal_refs: error: {err}") + if errors: + print(f"check_internal_refs: {len(errors)} hit(s); reword them (see the docstring)", file=sys.stderr) + return 1 + print(f"check_internal_refs: ok ({scanned} text files)") + return 0 + + +if __name__ == "__main__": + sys.exit(main()) diff --git a/.github/script/ci/devkit_assemble_xclbins.py b/.github/script/ci/devkit_assemble_xclbins.py index 7949a3f84..ff4c6fe31 100644 --- a/.github/script/ci/devkit_assemble_xclbins.py +++ b/.github/script/ci/devkit_assemble_xclbins.py @@ -13,7 +13,7 @@ merged. For every model of flm-dev-kit/FLM_Xclbin/kernel_assignment.json, each {.xclbin: artifact} whose artifact was built is copied to //.xclbin, as FastFlowLM's xclbins/ tree lays them -out. Ported from FastFlowLM_IRON's assemble-xclbins action: of an +out. Of an artifact's .xclbin files, the one named .xclbin is taken (a unit that builds several designs names each after the slot it fills); otherwise the only one, and an artifact with several and none of that name is ambiguous diff --git a/.github/script/ci/devkit_check.py b/.github/script/ci/devkit_check.py index 3ee1374a2..765d11bd0 100644 --- a/.github/script/ci/devkit_check.py +++ b/.github/script/ci/devkit_check.py @@ -72,8 +72,8 @@ third-party notice ("Copyright (c)", "Copyright ©", "Copyright " or an SPDX line) or a "Generated by ... Do not edit" first line passes, as AGENTS.md's notice rules give - those no AMD notice. NOTICE_HELD lists the files SCL-5105 - holds without any notice, each with its reason + those no AMD notice. NOTICE_HELD lists the files held + without any notice pending review, each with its reason Standard library only. """ @@ -121,12 +121,12 @@ THIRD_PARTY_NOTICE = re.compile(r"Copyright\s*(?:\(c\)|©|\d{4})|SPDX-(?:License-Identifier|FileCopyrightText):", re.IGNORECASE) GENERATED = re.compile(r"\bGenerated by\b.*\bDo not edit\b", re.IGNORECASE) -# Files SCL-5105 holds without any notice (path -> reason). A held file is +# Files held without any notice pending review (path -> reason). A held file is # reported as a note, not an error; drop it here once its notice lands. NOTICE_HELD = { f"{DEVKIT}/FLM_Xclbin/Gemma4/test_top.py": - "the Gemma 4 model-card example (Hugging Face transformers usage); SCL-5105 holds it " - "without a notice (Phase 2b exclusion candidate, kept held in IRON 867542752)", + "the Gemma 4 model-card example (Hugging Face transformers usage); kept without a " + "notice pending review", } VENDORED = (f"{DEVKIT}/FLM_DLL/include/nlohmann/", f"{DEVKIT}/FLM_DLL/include/aiebu/", f"{DEVKIT}/FLM_DLL/external_libs/", f"{DEVKIT}/FLM_Xclbin/host_common/aiebu/") diff --git a/.github/script/ci/devkit_symbol_clash.py b/.github/script/ci/devkit_symbol_clash.py index e71710b81..27b932323 100755 --- a/.github/script/ci/devkit_symbol_clash.py +++ b/.github/script/ci/devkit_symbol_clash.py @@ -22,7 +22,7 @@ after checking that it is the same in every library. Run by devkit-engines.yml on flm-dev-kit/FLM_DLL/build/lib (Linux XRT and -HRX). Ported from the internal FLM_IRON CI. Standard library and binutils' nm. +HRX). Standard library and binutils' nm. """ import argparse import collections diff --git a/.github/script/ci/devkit_xclbin_plan.py b/.github/script/ci/devkit_xclbin_plan.py index 12ba66f06..c4f07a17d 100644 --- a/.github/script/ci/devkit_xclbin_plan.py +++ b/.github/script/ci/devkit_xclbin_plan.py @@ -17,7 +17,7 @@ "touched_models": [], "bench_models": []} -bench_models, as FastFlowLM_IRON's bench-models: in mode changed, the models +bench_models: in mode changed, the models using a build selected because its source (or its build_units.json entry) changed, plus the models whose kernel_assignment.json entry was added or changed. A canary build, or one rebuilt only because a changed model uses @@ -250,8 +250,8 @@ def builds(self) -> list[dict]: def changed_plan(plan: Plan, files: list[str], base_units: dict[str, list], base_assignment: Optional[dict], canary: list, base_lock: Optional[str] = None, head_lock: Optional[str] = None) -> None: - # Units removed or renamed: their old paths select nothing (as IRON's - # walk-up, which found no Makefile there at head). + # Units removed or renamed: their old paths select nothing (a walk-up + # from them finds no Makefile at head). gone = set(base_units) - set(plan.units) for path in files: if TOOLCHAIN.match(path) or DEVKIT_CI.match(path): diff --git a/.github/script/ci/test_check_internal_refs.py b/.github/script/ci/test_check_internal_refs.py new file mode 100644 index 000000000..c1dff0fd5 --- /dev/null +++ b/.github/script/ci/test_check_internal_refs.py @@ -0,0 +1,123 @@ +# Copyright © Advanced Micro Devices, Inc., or its affiliates. All rights reserved. +# Portions of this file consist of AI-generated content. +"""Tests for check_internal_refs.py: python3 -m unittest discover -s ci -p 'test_*.py' -t ci""" + +from __future__ import annotations + +import io +import subprocess +import sys +import tempfile +import unittest +from contextlib import redirect_stdout +from pathlib import Path + +HERE = Path(__file__).resolve().parent +sys.path.insert(0, str(HERE)) +import check_internal_refs as cir # noqa: E402 + +# Built from parts so that a grep of this file finds no whole example. +REPO = "FastFlowLM" + "_IRON" + + +def names(text: str) -> list[str]: + return [name for _, name, _ in cir.scan_text(text)] + + +class ScanTextTest(unittest.TestCase): + def test_internal_forms_hit(self): + cases = { + f"imported from {REPO}": "internal repository", + "Ported from the internal FLM" + "_IRON CI.": "internal repository", + "github.com/AMD-ROCm-" + "Internal/x": "internal repository", + "SCL-" + "5105 holds it": "internal ticket", + "(As IRON" + "#148.)": "internal PR or issue", + "IRON" + " PR #137": "internal PR or issue", + "kept held in IRON" + " 0123abcd9": "internal commit or branch", + "it is in git at IRON" + " `2261dffc2`.": "internal commit or branch", + "rebuilt from IRON" + " HEAD": "internal commit or branch", + "built by IRON" + " CI": "internal commit or branch", + "the IRON" + " tree's quant_size.hpp": "internal commit or branch", + "the version IRON's" + " wheel-aie-env action pinned": "internal CI or tooling", + "(Phase 2b" + " exclusion candidate)": "internal process", + "is pending Legal" + " review": "internal process", + "ended in bug" + "check 0x0": "crash details", + "(VIDEO_SCHEDULER_" + "INTERNAL_ERROR)": "crash details", + "cp /scratch/" + "someone/models .": "personal path", + } + for text, name in cases.items(): + with self.subTest(text=text): + self.assertIn(name, names(text)) + + def test_public_iron_and_generic_paths_pass(self): + for text in ( + "the IRON Python design in iron/attn_aie.py", + "IRON's task API and IRON's allocator", + "IRON's object FIFOs; the IRON `runtime_sequence`; the IRON `init=` value", + "IRON → MLIR → aiecc.py", + "IRON CT[r][c] = (col c, row r+2)", + "built on [IRON](https://github.com/amd/iron)", + "export FLM_MODEL_PATH=\"/scratch/$USER\"", + "REFERENCE ?= /scratch/$(USER)/ref.safetensors", + "prefix ${USER}: /scratch/${USER}/flm_exe_core", + "Legal notices are in THIRD_PARTY_NOTICES.txt", + ): + with self.subTest(text=text): + self.assertEqual(names(text), []) + + def test_line_numbers(self): + hits = cir.scan_text("ok\nfrom " + REPO + "\nok\n") + self.assertEqual([(n, name) for n, name, _ in hits], [(2, "internal repository")]) + + def test_allowed_paths_exist(self): + root = HERE.parents[2] + for rel, reason in cir.ALLOWED.items(): + with self.subTest(path=rel): + self.assertTrue((root / rel).is_file()) + self.assertTrue(reason) + + +class ScanRepoTest(unittest.TestCase): + def setUp(self): + self._tmp = tempfile.TemporaryDirectory() + self.repo = Path(self._tmp.name) + subprocess.run(["git", "init", "-q", str(self.repo)], check=True) + + def tearDown(self): + self._tmp.cleanup() + + def add(self, rel: str, data: bytes): + path = self.repo / rel + path.parent.mkdir(parents=True, exist_ok=True) + path.write_bytes(data) + subprocess.run(["git", "-C", str(self.repo), "add", rel], check=True) + + def test_hits_binary_allowed_and_untracked(self): + self.add("docs/a.md", f"line\nsee {REPO}\n".encode()) + self.add("img.bin", b"\0\1" + REPO.encode()) + self.add(".github/script/ci/check_internal_refs.py", REPO.encode()) + (self.repo / "untracked.md").write_text(REPO) + errors, scanned = cir.scan_repo(self.repo) + self.assertEqual(errors, [f"docs/a.md:2: internal repository: {REPO}"]) + self.assertEqual(scanned, 1) + out = io.StringIO() + with redirect_stdout(out): + self.assertEqual(cir.main(["--repo", str(self.repo)]), 1) + self.assertIn("check_internal_refs: error: docs/a.md:2:", out.getvalue()) + + def test_clean_repo_passes(self): + self.add("README.md", b"IRON Python kernels, /scratch/$USER/x\n") + out = io.StringIO() + with redirect_stdout(out): + self.assertEqual(cir.main(["--repo", str(self.repo)]), 0) + self.assertIn("ok (1 text files)", out.getvalue()) + + def test_not_a_repo(self): + with tempfile.TemporaryDirectory() as plain: + errors, scanned = cir.scan_repo(Path(plain) / "missing") + self.assertEqual(scanned, 0) + self.assertEqual(len(errors), 1) + + +if __name__ == "__main__": + unittest.main() diff --git a/.github/script/devkit-bench/acc_common.py b/.github/script/devkit-bench/acc_common.py index 5a56bb14d..5df6918ac 100644 --- a/.github/script/devkit-bench/acc_common.py +++ b/.github/script/devkit-bench/acc_common.py @@ -2,8 +2,6 @@ # Portions of this file consist of AI-generated content. """Shared plumbing for the two dev-kit accuracy benches. -Ported from FastFlowLM_IRON's .github/scripts/acc-bench-common. - gsm8k_run.py (GSM8K) and run_vqa.py (DocVQA) both stream questions through an already-running `flm serve` over /v1/chat/completions. They used to handle a bad question differently -- GSM8K counted a request failure, DocVQA silently diff --git a/.github/script/devkit-bench/compare.py b/.github/script/devkit-bench/compare.py index aaf82b640..0e9543bff 100644 --- a/.github/script/devkit-bench/compare.py +++ b/.github/script/devkit-bench/compare.py @@ -3,8 +3,6 @@ # Portions of this file consist of AI-generated content. """Comparisons and soft gates of the dev-kit benches (pure functions). -Adapted from FastFlowLM_IRON's .github/scripts/comparer-perf/compare.py and -comparer-acc/compare.py (which drew matplotlib plots and set no threshold); report.py renders what these return. Perf (flm bench CSVs: context_length_k, prefill/decoding avg tok/s, TTFT): diff --git a/.github/script/devkit-bench/docvqa_fetch.py b/.github/script/devkit-bench/docvqa_fetch.py index f483514b9..5b7cad2a0 100644 --- a/.github/script/devkit-bench/docvqa_fetch.py +++ b/.github/script/devkit-bench/docvqa_fetch.py @@ -3,8 +3,6 @@ # Portions of this file consist of AI-generated content. """Build the DocVQA evaluation subset from a pinned public source. -Adapted from FastFlowLM_IRON's .github/scripts/vlm-acc-bench/build_dataset.py. - Runs on a GitHub-hosted runner (devkit-bench.yml's docvqa job), never on an NPU runner: it downloads one validation shard of the Hugging Face dataset lmms-lab/DocVQA at a pinned commit (REVISION), checks its SHA-256 and size diff --git a/.github/script/devkit-bench/gsm8k_run.py b/.github/script/devkit-bench/gsm8k_run.py index df0e4b182..224b82132 100644 --- a/.github/script/devkit-bench/gsm8k_run.py +++ b/.github/script/devkit-bench/gsm8k_run.py @@ -3,8 +3,6 @@ # Portions of this file consist of AI-generated content. """Run the GSM8K accuracy bench against an already-running `flm serve` model. -Ported from FastFlowLM_IRON's .github/scripts/llm-acc-bench. - Streams the vendored GSM8K test questions (data/gsm8k_100.jsonl, the first 100 of the GSM8K test set; see THIRD_PARTY_NOTICES.txt) through /v1/chat/completions, asks for step-by-step work ending in a fixed diff --git a/.github/script/devkit-bench/gsm8k_score.py b/.github/script/devkit-bench/gsm8k_score.py index 2f5bff656..29da38c7b 100644 --- a/.github/script/devkit-bench/gsm8k_score.py +++ b/.github/script/devkit-bench/gsm8k_score.py @@ -3,8 +3,6 @@ # Portions of this file consist of AI-generated content. """Accuracy for GSM8K predictions written by gsm8k_run.py. -Ported from FastFlowLM_IRON's .github/scripts/llm-acc-bench. - Accuracy = 100 * (# correct) / (# total). A question counts as correct when the parsed final numeric answer exactly matches the reference answer. diff --git a/.github/script/devkit-bench/perf.py b/.github/script/devkit-bench/perf.py index 2ff7a758e..1cbdbb5a6 100644 --- a/.github/script/devkit-bench/perf.py +++ b/.github/script/devkit-bench/perf.py @@ -4,8 +4,6 @@ """Runs `flm bench` for one model, on the dev-kit build and optionally on the package it was overlaid on, back to back on the same runner. -Adapted from FastFlowLM_IRON's .github/scripts/bench-perf/bench-perf.sh. - perf.py --flm-bin [--base-flm-bin ] --model --out-dir [--ctx-len 8192] [--timeout 3600] [--pull] diff --git a/.github/script/devkit-bench/run_acc.py b/.github/script/devkit-bench/run_acc.py index 170d21faf..d7cd1df81 100644 --- a/.github/script/devkit-bench/run_acc.py +++ b/.github/script/devkit-bench/run_acc.py @@ -4,9 +4,6 @@ """Runs one accuracy bench (GSM8K or DocVQA) for one model against its own `flm serve`. -Adapted from the serve/poll/run/score/stop steps of FastFlowLM_IRON's -.github/actions/bench-acc and bench-vlm-acc. - run_acc.py --bench gsm8k|docvqa --flm-bin --model --out-dir [--n 50] [--data eval.jsonl] [--max-unanswered 5] [--time-budget-s 0] diff --git a/.github/script/devkit-bench/run_vqa.py b/.github/script/devkit-bench/run_vqa.py index d7e0877a3..257b6c706 100644 --- a/.github/script/devkit-bench/run_vqa.py +++ b/.github/script/devkit-bench/run_vqa.py @@ -3,8 +3,6 @@ # Portions of this file consist of AI-generated content. """Run the DocVQA accuracy bench against an already-running `flm serve` model. -Ported from FastFlowLM_IRON's .github/scripts/vlm-acc-bench. - Streams the eval set built by docvqa_fetch.py through /v1/chat/completions (image + question), asks for a single word or phrase, and writes one prediction record per question. Greedy decoding, so results are deterministic diff --git a/.github/script/devkit-bench/score_anls.py b/.github/script/devkit-bench/score_anls.py index 8e6955174..079b8719d 100644 --- a/.github/script/devkit-bench/score_anls.py +++ b/.github/script/devkit-bench/score_anls.py @@ -3,8 +3,6 @@ # Portions of this file consist of AI-generated content. """Official DocVQA metric: ANLS (Average Normalized Levenshtein Similarity). -Ported from FastFlowLM_IRON's .github/scripts/vlm-acc-bench. - For each question, score = max over ground-truth answers of (1 - NL(pred, gt)) if that value >= 0.5 else 0 where NL is the Levenshtein distance normalized by the longer string length. diff --git a/.github/script/devkit-bench/select_models.py b/.github/script/devkit-bench/select_models.py index 5a5c67216..5cb2894dd 100644 --- a/.github/script/devkit-bench/select_models.py +++ b/.github/script/devkit-bench/select_models.py @@ -3,9 +3,7 @@ # Portions of this file consist of AI-generated content. """Which models the dev-kit benches run. -Adapted from FastFlowLM_IRON's .github/actions/select-bench-models and -.github/scripts/dll-bench-models/resolve.py; the inputs are FastFlowLM's -equivalents, read from Build and Test's devkit-bench-plan artifact and this +The inputs are read from Build and Test's devkit-bench-plan artifact and this checkout: pull request the models of the dev-kit engines serving the touched diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index da17bef99..e18dd13e8 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -187,6 +187,11 @@ jobs: working-directory: .github/script run: python3 -m unittest discover -s ci -p 'test_*.py' -t ci + # Every event, whatever it touches: no tracked file may name internal + # repositories, tickets, personal paths or NPU crash details. + - name: Check for internal references + run: python3 .github/script/ci/check_internal_refs.py + # Static checks of the dev kit's CI data (flm-dev-kit/FLM_Xclbin/ # kernel_assignment.json and build_units.json, flm-dev-kit/FLM_DLL/ # engines.json, the -Bsymbolic-functions link flag, and on a pull request diff --git a/.github/workflows/devkit-aie-image.yml b/.github/workflows/devkit-aie-image.yml index 0e0be3ba3..59ae3fc05 100644 --- a/.github/workflows/devkit-aie-image.yml +++ b/.github/workflows/devkit-aie-image.yml @@ -11,7 +11,7 @@ name: Dev-kit AIE build image # build every event: builds the image without pushing it, then builds # the kernels docker/aie-build.pdi.sha256 lists in it # (docker/aie-build-check.sh) and requires each one's PDI to be the -# one IRON's toolchain made, byte for byte. A pull request that +# one the original toolchain made, byte for byte. A pull request that # changes the toolchain shows whether it still makes the shipped # kernels # publish main only (push, or workflow_dispatch run on main): builds again diff --git a/.github/workflows/devkit-bench.yml b/.github/workflows/devkit-bench.yml index 80f3bd6af..5691d44e5 100644 --- a/.github/workflows/devkit-bench.yml +++ b/.github/workflows/devkit-bench.yml @@ -5,8 +5,7 @@ name: Dev-kit Bench # Perf (flm bench) and accuracy (GSM8K; DocVQA when enabled) benches of the # dev kit's engines (flm-dev-kit/FLM_DLL) and kernels (flm-dev-kit/FLM_Xclbin) -# on the NPU runners, ported from FastFlowLM_IRON's PR Check benches -# (scripts in .github/script/devkit-bench, actions devkit-bench-perf and +# on the NPU runners (scripts in .github/script/devkit-bench, actions devkit-bench-perf and # devkit-bench-acc). They run only when dev-kit engine or kernel source # changed (code or build inputs; not docs, CI, the converter, pybind or # launchlib; changes.py devkit_bench). Nothing is rebuilt here: the bench diff --git a/THIRD_PARTY_NOTICES.txt b/THIRD_PARTY_NOTICES.txt index 1586168f9..1912beb99 100644 --- a/THIRD_PARTY_NOTICES.txt +++ b/THIRD_PARTY_NOTICES.txt @@ -1516,8 +1516,7 @@ Used in: flm-dev-kit/FLM_DLL/detail/minicpm_v_4_7_npu/image/ Published by OpenBMB as remote code with the MiniCPM-V 4.7 model; no copyright line was published with that file, and it is no longer present at -the head revision of the model repositories. Listed for attribution; whether -this reimplementation needs attribution is pending Legal review. +the head revision of the model repositories. Listed for attribution. Licensed under the Apache License, Version 2.0. The license text is reproduced at the end of this file. diff --git a/docker/aie-build.pdi.sha256 b/docker/aie-build.pdi.sha256 index 6b1563bf7..5c03c4bfb 100644 --- a/docker/aie-build.pdi.sha256 +++ b/docker/aie-build.pdi.sha256 @@ -4,8 +4,8 @@ # What docker/aie-build-check.sh requires of a kernel built in the aie-build # image: the PDI inside the xclbin (the AIE_PARTITION section, dumped with # xclbinutil --dump-section AIE_PARTITION:JSON), byte for byte. The PDI is -# deterministic: these are the hashes of IRON's local, IRON CI and shipped -# (src/xclbins) builds of the same unit, all three identical. The xclbin +# deterministic: these are the hashes of a local build, a CI build and the +# shipped (src/xclbins) build of the same unit, all three identical. The xclbin # around it is not (timestamp, UniqueID, XclBinUUID, PDI UUID, xclbinutil # version string), so its hash says nothing and is not compared. # diff --git a/docs/core-setup-linux.md b/docs/core-setup-linux.md index 7bf6d2ac8..86340dce3 100644 --- a/docs/core-setup-linux.md +++ b/docs/core-setup-linux.md @@ -188,7 +188,7 @@ source /scratch/$USER/flm_exe_core/flm_env.sh ``` `flm_env.sh` sets `FLM_CONFIG_PATH`, `FLM_XCLBIN_PATH`, `FLM_MODEL_PATH` -(`/scratch/alfxu`) and pins `XILINX_XRT`. It does **not** set `ulimit` — step 4 +(the value it had when `home_install.sh` ran; left unset otherwise) and pins `XILINX_XRT`. It does **not** set `ulimit` — step 4 is on you. Models live under `$FLM_MODEL_PATH/models/`. The shipped diff --git a/flm-dev-kit/FLM_DLL/detail/minicpm_ocr_npu/image/README.md b/flm-dev-kit/FLM_DLL/detail/minicpm_ocr_npu/image/README.md index 29072f351..2263353c4 100644 --- a/flm-dev-kit/FLM_DLL/detail/minicpm_ocr_npu/image/README.md +++ b/flm-dev-kit/FLM_DLL/detail/minicpm_ocr_npu/image/README.md @@ -145,7 +145,7 @@ run already works. A new `xrt::kernel` on the same context does not help. So: | 3 | 1 s | try 2 failed fast | A second **timeout** stops it: the op throws as before. A context that keeps timing out is truly -stuck; sending it more work is what came before the 0x139 bugcheck in the Windows test. One failure +stuck; sending it more work can make the machine unresponsive (reboot to recover). One failure costs the driver's timeout once; the tries themselves take milliseconds. Off the overlay (the three-xclbin path, design B) nothing changes: a separate xclbin has no host-written diff --git a/flm-dev-kit/FLM_DLL/detail/minicpm_v_4_7_npu/minicpm_v_reconfig.hpp b/flm-dev-kit/FLM_DLL/detail/minicpm_v_4_7_npu/minicpm_v_reconfig.hpp index bd137d911..fd6692e9f 100644 --- a/flm-dev-kit/FLM_DLL/detail/minicpm_v_4_7_npu/minicpm_v_reconfig.hpp +++ b/flm-dev-kit/FLM_DLL/detail/minicpm_v_4_7_npu/minicpm_v_reconfig.hpp @@ -3,7 +3,7 @@ #pragma once // Reconfigure the NPU array from inside an instruction stream, instead of switching hardware contexts. -// (Adapted from the Gemma4e vision single-context reconfiguration, IRON PR #137 / feat/vision-single-ctx.) +// (Adapted from the Gemma4e vision single-context reconfiguration.) // // The MiniCPM-V language prefill alternates between two overlays: mm.xclbin (projections) and attn.xclbin (full attention, 6 layers). // Each overlay is its own xclbin = its own hw_context, and every switch between contexts costs about 2.4 ms (the firmware reloads the PDI); diff --git a/flm-dev-kit/FLM_DLL/detail/qwen3_8mtp_npu/verify/npu/q4nx.hpp b/flm-dev-kit/FLM_DLL/detail/qwen3_8mtp_npu/verify/npu/q4nx.hpp index e5cd4c291..32b954c8b 100644 --- a/flm-dev-kit/FLM_DLL/detail/qwen3_8mtp_npu/verify/npu/q4nx.hpp +++ b/flm-dev-kit/FLM_DLL/detail/qwen3_8mtp_npu/verify/npu/q4nx.hpp @@ -4,7 +4,7 @@ /// \brief q4nx arithmetic shared by every NPU layer here: the two block-size /// formulae and the row-block interleave. /// -/// Duplicated from the IRON tree's quant_size.hpp and +/// Duplicated from FLM_Xclbin's quant_size.hpp and /// decoding_layer::reorder_cpy rather than included, since the DLL does not /// otherwise reach under FLM_Xclbin. A divergence dequantises garbage rather /// than failing to compile -- hence the static assertions below. diff --git a/flm-dev-kit/FLM_DLL/engines.json b/flm-dev-kit/FLM_DLL/engines.json index 67e60fd11..1ccc5b251 100644 --- a/flm-dev-kit/FLM_DLL/engines.json +++ b/flm-dev-kit/FLM_DLL/engines.json @@ -1,5 +1,5 @@ { - "_doc": "FLM_DLL engines. engines: every detail/ directory with a Makefile that builds a model library (lib.so / .dll) -> families: the FastFlowLM catalog families (details.family in src/model_list.json) to test when the engine changes, the same as the engine's row in ENGINES in .github/script/ci/changes.py; models: the kernel_assignment.json models it serves (from FastFlowLM_IRON .github/scripts/dll_assignment.json, plus hy_mem_npu -> hy-memory:30b-a3b, which that file omits; [] = none yet); uses: the other engines whose sources or include/models// headers it compiles, so a change to one of those also tests this engine's families. shared: detail/ directories every engine builds against, which serve no model on their own; a change to one tests every engine's families. served_elsewhere: kernel_assignment.json models no engine here serves -> what runs them. Read by changes.py (devkit-families), checked by devkit_check.py.", + "_doc": "FLM_DLL engines. engines: every detail/ directory with a Makefile that builds a model library (lib.so / .dll) -> families: the FastFlowLM catalog families (details.family in src/model_list.json) to test when the engine changes, the same as the engine's row in ENGINES in .github/script/ci/changes.py; models: the kernel_assignment.json models it serves ([] = none yet); uses: the other engines whose sources or include/models// headers it compiles, so a change to one of those also tests this engine's families. shared: detail/ directories every engine builds against, which serve no model on their own; a change to one tests every engine's families. served_elsewhere: kernel_assignment.json models no engine here serves -> what runs them. Read by changes.py (devkit-families), checked by devkit_check.py.", "shared": [ "q4nx", "mha", diff --git a/flm-dev-kit/FLM_Xclbin/Gemma4/verify_decoding/notes/al_and_host.md b/flm-dev-kit/FLM_Xclbin/Gemma4/verify_decoding/notes/al_and_host.md index b6ef9250b..d8bd67e28 100644 --- a/flm-dev-kit/FLM_Xclbin/Gemma4/verify_decoding/notes/al_and_host.md +++ b/flm-dev-kit/FLM_Xclbin/Gemma4/verify_decoding/notes/al_and_host.md @@ -5,8 +5,8 @@ # Stream D: acceptance length and host-side cycle time (2026-10-29) -Code: IRON `FLM_DLL/detail/gemma4e_dflash` commits `536b0e0f2` (drafter GEMM), `5566e669e` (async inject, draft-head re-scoring, -measured guard, tf_replay rig), `e0f68c28b` (verify preparation overlaps the draft head, dynamic GEMM schedule). Rigs: `tools/tf_replay.cpp` (teacher-forced / free AL), `work/scripts/run_d_seqs.py` (one sequence +Code: `FLM_DLL/detail/gemma4e_dflash`: drafter GEMM; async inject, draft-head re-scoring, +measured guard, tf_replay rig; verify preparation overlaps the draft head, dynamic GEMM schedule. Rigs: `tools/tf_replay.cpp` (teacher-forced / free AL), `work/scripts/run_d_seqs.py` (one sequence per process, retries after a device reset), `work/scripts/eval_d.sh`, offline analysis `work/ref/al_analysis.py`, `al_subvocab.py`, `al_rescore.py`, `al_rescore_q8.py`, `vocab_select.py`. Private builds: `work/dfork/build` (D), `work/dfork/build_head` (HEAD before D, for A/B). @@ -53,15 +53,15 @@ generations 90% at 32k ids; TF AL static 32k 3.156, static 64k 3.458, static 64k (TF AL is deterministic to ~0.3% run to run; per sequence the cycle boundaries shift when a draft changes, so per-sequence numbers move both ways while the mean improves.) -**Package proposal**: `configs/dflash.json` `"bf16_tensors": ["model.fc.weight"]` (converter commit 6f0f77b9e supports it; the host +**Package proposal**: `configs/dflash.json` `"bf16_tensors": ["model.fc.weight"]` (the converter supports it; the host drafter already reads BF16 blocks; checked: C++ vs fp32 reference on the same weights cos >= 0.999998, tokens 7/7 on the S5.2 cases). Package grows 225 MB -> 270 MB. The package is not published yet, so this is the moment (D13). ## 3. Host side -- Drafter GEMM (`536b0e0f2`): bf16 scale/min pairs (-17% weight bytes), weight tile reused across 8-token tiles (prompt priming in +- Drafter GEMM: bf16 scale/min pairs (-17% weight bytes), weight tile reused across 8-token tiles (prompt priming in 64-row chunks), q|k|v and gate|up in one parallel region, 16 threads by default. Bit-identical outputs. -- Speculative injection (`5566e669e`): the verify rows' taps are injected on a background thread during the verify's `lm_head_8` and +- Speculative injection: the verify rows' taps are injected on a background thread during the verify's `lm_head_8` and the caller's sampling; commit truncates (`truncate()`) to the kept rows. Inject wait at commit: ~0.05 ms (was ~1.4 ms on the path). - Draft head re-scoring costs ~0.3 ms (56 Q8 rows dequantised + dotted) on top of the NPU dispatch. - Guard: measured cycle and plain-step costs of the session replace the fitted constants once available. @@ -79,8 +79,8 @@ thinking on, free-running greedy speculation, 256 tokens; `tf_replay free`, logs | engine | cycles | AL | tok/s | ms/cycle | host draft | draft head | verify | accept | commit | |---|--:|--:|--:|--:|--:|--:|--:|--:|--:| -| HEAD (`7f689ba6a`+H fix) | 2750 | 3.613 | 21.52 | 167.9 | 12.07 | 11.57 | 141.87 | 1.77 | 0.02 | -| D (`e0f68c28b`) | 2686 | **3.708** | **23.05** | **160.9** | **6.66** | 11.66 | 141.49 | 0.51 | 0.02 | +| HEAD (+H fix) | 2750 | 3.613 | 21.52 | 167.9 | 12.07 | 11.57 | 141.87 | 1.77 | 0.02 | +| D | 2686 | **3.708** | **23.05** | **160.9** | **6.66** | 11.66 | 141.49 | 0.51 | 0.02 | | change | | +2.6% | **+7.1%** | -7.0 ms | -5.4 | +0.1 | (same) | -1.3 | | (verify includes the 42 layers and lm_head_8; at these contexts the NPU part is unchanged by D. llama.cpp reference on the same diff --git a/flm-dev-kit/FLM_Xclbin/Gemma4/verify_decoding/notes/attn8_L8_results.md b/flm-dev-kit/FLM_Xclbin/Gemma4/verify_decoding/notes/attn8_L8_results.md index acc6f7b89..741a0d7a9 100644 --- a/flm-dev-kit/FLM_Xclbin/Gemma4/verify_decoding/notes/attn8_L8_results.md +++ b/flm-dev-kit/FLM_Xclbin/Gemma4/verify_decoding/notes/attn8_L8_results.md @@ -5,7 +5,7 @@ # attention path of the 8-token verify layer: RoPE, q park, global + SWA attention (plan S6.5 second half, S6.9, S6.10), 2026-10-29 -IRON `FLM_Xclbin/Gemma4/verify_decoding`, branch feat/bolt-dflash, commits 022d7c637 (RoPE), c84ebd8ce (q park + global), aca5666cb (SWA). +Design: `FLM_Xclbin/Gemma4/verify_decoding`, built in three steps: RoPE, q park + global, SWA. Stage designs (stand-alone, shim-fed): `DESIGN=attn8rope` (RoPE tiles only), `DESIGN=attn8attn` (RoPE + q park + global and SWA attention columns). ## Build / run diff --git a/flm-dev-kit/FLM_Xclbin/Gemma4/verify_decoding/notes/attn_longctx.md b/flm-dev-kit/FLM_Xclbin/Gemma4/verify_decoding/notes/attn_longctx.md index 9c9de75df..9b11f57fb 100644 --- a/flm-dev-kit/FLM_Xclbin/Gemma4/verify_decoding/notes/attn_longctx.md +++ b/flm-dev-kit/FLM_Xclbin/Gemma4/verify_decoding/notes/attn_longctx.md @@ -8,7 +8,7 @@ Goal: the 8 verify tokens read K/V ONCE per verify (attn8 replayed K/V once per token: 8x the single-token traffic). Target: global and SWA 8-token attention <= ~2x the single-token (decode) attention at 4k. Status: **met** (stage design and fused8). -## Design (committed: 3f6f16708, 07b552da1, b2d10ea22) +## Design Files: `kernels/attnx_common.h`, `kernels/attnx_score.cc`, `kernels/attnx_pv.cc`, `iron/attnx.py` (tiles, q park, o assembly), `iron/attnx_aie.py` (stand-alone stage design, DESIGN=attnx), `host_attn8/attnx_host.hpp` (stage host, `attn8.exe --stage attnx`), `iron/fused8_aie.py` (`FUSED8_ATTN=x` selects attnx, default `8` = old attention), `host/test_fused8.hpp` (attnx RTPs + K/V replay). @@ -71,7 +71,7 @@ fused8x (`build/fused8x_full_L8`): Fixed by the o assembly memtile with circuits. - ~11:08: an ATTNX_DBG=1 debug build (debug branches broken; DBG builds must not be used again). -## Read-before-write bug (coordinator item 3): ROOT CAUSE = test harness, fixed in b2d10ea22 +## Read-before-write bug (coordinator item 3): ROOT CAUSE = test harness, fixed Repro: `-t verify8 --mode verify --layers 5 --cursors 0,9 --poison` (cos 0.83 at c=9 when c=0 runs first). Cause: `kv_cache` is `buffer`, and `size()` returns ELEMENTS. @@ -141,7 +141,7 @@ fused pass then start from the same snapshot; logs work/attnx/chain_*.log) - Stream acceptance on real text (AL in the engine) is the right judge. - Open question for the coordinator: whether the rows with large fused margins (e.g. 102 vs oracle 1.9) are random-token artefacts (huge hidden norms) or an accumulated bf16 bias of the fused projections. -- Rig speed: seeding costs ~1.8 s per 8-position fused pass on the host (pli_row made ~10x faster in 5dd31ecb0; the rest is per-call host +- Rig speed: seeding costs ~1.8 s per 8-position fused pass on the host (pli_row since made ~10x faster; the rest is per-call host BO setup), so a 16k chain takes ~75 min. ## Summary diff --git a/flm-dev-kit/FLM_Xclbin/Gemma4/verify_decoding/notes/e2e_results.md b/flm-dev-kit/FLM_Xclbin/Gemma4/verify_decoding/notes/e2e_results.md index d6e328f72..565c3663c 100644 --- a/flm-dev-kit/FLM_Xclbin/Gemma4/verify_decoding/notes/e2e_results.md +++ b/flm-dev-kit/FLM_Xclbin/Gemma4/verify_decoding/notes/e2e_results.md @@ -5,10 +5,10 @@ # End-to-end results: DFlash speculative decoding with the attnx verify xclbin (2026-10-29) -Engine IRON `1a6fc4cd7` (attnx host contract in gemma4e_dflash_verify.cpp; FLM_DFLASH_ATTN=8 selects verify_attn8.xclbin for A/B). -Verify xclbins rebuilt from IRON HEAD (all stream P kernels): `verify.xclbin` = build/fused8x_full_L8 (attnx), `verify_attn8.xclbin` = build/fused88_full_L8; +Engine: `gemma4e_dflash` as of the original development tree (attnx host contract in gemma4e_dflash_verify.cpp; FLM_DFLASH_ATTN=8 selects verify_attn8.xclbin for A/B). +Verify xclbins rebuilt from the same tree (all stream P kernels): `verify.xclbin` = build/fused8x_full_L8 (attnx), `verify_attn8.xclbin` = build/fused88_full_L8; both passed the whole-layer oracle (layers 0/5/40/35 x cursors 0/9/505/1000/2000, poison, repeat 2: 20/20 each) before deployment -into work/local-xclbins/xclbins/Nemotron-3.5-Bolt-E4B-DFlash-NPU2/. DFlash package: fc BF16 (IRON 3e458215b), 270 MB. +into work/local-xclbins/xclbins/Nemotron-3.5-Bolt-E4B-DFlash-NPU2/. DFlash package: fc BF16, 270 MB. Box: quiet (load < 0.5), only one NPU job at a time. All runs greedy unless stated. ## 1. Accuracy on real text diff --git a/flm-dev-kit/FLM_Xclbin/Gemma4/verify_decoding/notes/fused8_results.md b/flm-dev-kit/FLM_Xclbin/Gemma4/verify_decoding/notes/fused8_results.md index 96aec0369..491d8448b 100644 --- a/flm-dev-kit/FLM_Xclbin/Gemma4/verify_decoding/notes/fused8_results.md +++ b/flm-dev-kit/FLM_Xclbin/Gemma4/verify_decoding/notes/fused8_results.md @@ -5,7 +5,7 @@ # fused8: the whole 8-row verify layer on hardware (plan S6.11 / S6.12), 2026-10-29 -IRON `FLM_Xclbin/Gemma4/verify_decoding`, branch feat/bolt-dflash: commit 3d1a586a3 (design + host driver) and the chain8 test commit after it. +Design: `FLM_Xclbin/Gemma4/verify_decoding` (design + host driver, and the chain8 test). Design `DESIGN=fused8` (`iron/fused8_aie.py`, `iron/fused8_mt.py`), build `work/scripts/build_fused8.sh ` (kernels: proj_main rms_residual_l8 glu_l8 rope swa_rope attn_qk_e4b attn_kv_e4b swa_attn_qk swa_attn_kv ple8_gate ple8_up ple8_norm; Peano; the three xclbins build and route in 2-6 s, `full` = 211,980 B). Allocation table: `fused8_allocation.md` (this folder). Test: `run.exe -t chain8` (42 layers). diff --git a/flm-dev-kit/FLM_Xclbin/Gemma4/verify_decoding/notes/hang_rootcause.md b/flm-dev-kit/FLM_Xclbin/Gemma4/verify_decoding/notes/hang_rootcause.md index 5fa2bcdf6..0e5d56983 100644 --- a/flm-dev-kit/FLM_Xclbin/Gemma4/verify_decoding/notes/hang_rootcause.md +++ b/flm-dev-kit/FLM_Xclbin/Gemma4/verify_decoding/notes/hang_rootcause.md @@ -37,8 +37,8 @@ Evidence - lm_head_8 (`gen_seq_l8`) was checked by inspection: its only token BDs are the per-round S2MM y BDs, each waited. ## Fix -- `FLM_Xclbin/Gemma4/verify_decoding/host/test_fused8.hpp` (`f8::run`, commit 98f02c173) and the engine generator - `FLM_DLL/detail/gemma4e_dflash/gemma4e_dflash_verify.cpp` (`verify_gen_seq`, commit 33a9c40ed) keep a **token +- `FLM_Xclbin/Gemma4/verify_decoding/host/test_fused8.hpp` (`f8::run`) and the engine generator + `FLM_DLL/detail/gemma4e_dflash/gemma4e_dflash_verify.cpp` (`verify_gen_seq`) keep a **token ledger**: every token-issuing memcpy increments a counter per (tile, direction, channel), every wait decrements it; the final waits are emitted from the ledger (one per outstanding token) and the generator throws if any counter is nonzero when the stream is closed. So an unbalanced stream cannot be generated any more. @@ -64,7 +64,7 @@ engine (rounding level), but it breaks strict reproducibility of the first verif | A/B, same binary (`hammer8`, layer 5, cursor 64): old stream (`FUSED8_OLD_WAITS=1`) | **fails at dispatch #254** (earlier also #254 on layer 0 / cursor 64 with the pre-fix build): deterministic | | fused8, balanced stream: `hammer8` 21,000 consecutive dispatches in ONE hardware context, round robin over layers 0/5/40/35 x cursors 0/505/1000/4000 (16 pairs), KV state restored before every dispatch | **21000/21000 complete, 0 diffs** vs each pair's reference (2nd dispatch); 3 first-after-load diffs (SWA L0 at 505/1000/4000, see above); 252 s | | lm_head_8: 5000 dispatches alternating two inputs (`lm_head_8/run.exe --repeat 5000`) | 5000/5000 bit-exact vs the first results, PASS | -| engine (`test_spec_engine`, clean build of HEAD 80d3b38ea in a separate worktree), `FLM_DFLASH_VERIFY_RELOAD=0`, 15 prompts (12 chat + 3 long, up to 1024 tokens each) in ONE process | **7783 tokens generated speculatively, 1982 cycles = 83,244 verify layer dispatches** (+ ~4000 lm_head_8 dispatches) in one verify context, no timeout; mean AL 3.26, 0 stream mismatches | +| engine (`test_spec_engine`, clean build with the fix in a separate worktree), `FLM_DFLASH_VERIFY_RELOAD=0`, 15 prompts (12 chat + 3 long, up to 1024 tokens each) in ONE process | **7783 tokens generated speculatively, 1982 cycles = 83,244 verify layer dispatches** (+ ~4000 lm_head_8 dispatches) in one verify context, no timeout; mean AL 3.26, 0 stream mismatches | | whole layer vs the oracle (8 sequential decode dispatches), layers 0/5/40/35 x cursors 0,1,9,16,505,511,512,520,1000,4000, repeat 3, MAX_L 4608 | all 40 cases within tolerance (min cos 0.99916, typ 0.9995-0.9998; K/V min cos 0.99934); the only "FAIL" flags are the repeat-identity check of SWA L0 at cursor >= 505 = the first-after-load anomaly | Two earlier attempts of the engine run died with `ERT_CMD_STATE_TIMEOUT` / context-creation errors that were NOT this design: @@ -74,13 +74,13 @@ killed by the driver reset 60 s later. A hung design on the NPU stalls every har 16-context limit (another fork's engine held 12 contexts, mine needs 12). ## Other findings -- **Harness poison bug class (pre-existing, also at 23ea54996):** `verify8 --poison` with several cursors in one process fails +- **Harness poison bug class (pre-existing, also before the fix):** `verify8 --poison` with several cursors in one process fails (e.g. layer 5: cursor 0 then 9 -> cos 0.83; cursor 9 alone with poison passes, cursor 0 then 9 without poison passes and is bit-identical to cursor 9 alone). So a dispatch can be influenced by ON-CHIP data left by the previous dispatch when that data is extreme (the poisoned V rows of the previous dispatch); with sane data the effect is invisible. Same family as the first-after-load anomaly: some attention-path buffer is read before it is rewritten in the current dispatch. Owner: stream A (attention rewrite); repro: `run.exe -t verify8 --mode verify --fused-xclbin ... --layers 5 --cursors 0,9 --repeat 1 --poison`. - **My own harness bug, fixed:** the pli memo was keyed by object address; the harness re-creates decoding_layer objects at the same - address, so layer 40 got layer 5's pli rows (cos 0.89). Keyed by layer index now (80d3b38ea). + address, so layer 40 got layer 5's pli rows (cos 0.89). Keyed by layer index now. - **Partial-stage debug xclbins (`fused8_attn_L8` etc.) hang by design** on repeated dispatch (partial phase sets desync the cores): never run them in a loop. diff --git a/flm-dev-kit/FLM_Xclbin/Gemma4/verify_decoding/notes/phase8_results.md b/flm-dev-kit/FLM_Xclbin/Gemma4/verify_decoding/notes/phase8_results.md index d874c9a9f..b74dcf0c2 100644 --- a/flm-dev-kit/FLM_Xclbin/Gemma4/verify_decoding/notes/phase8_results.md +++ b/flm-dev-kit/FLM_Xclbin/Gemma4/verify_decoding/notes/phase8_results.md @@ -5,7 +5,7 @@ # Phase 8: the fused 8-row verify in the gemma4e_dflash engine (2026-10-29) -IRON `FLM_DLL/detail/gemma4e_dflash`, branch feat/bolt-dflash: commits `b4068405d` (fused verify + lm_head_8), `d28e86fcd` (overlap/lazy commit/ranged flush), `a300556bd` (HRX stubs), `7f689ba6a` (adaptive guard). +Engine: `FLM_DLL/detail/gemma4e_dflash`: fused verify + lm_head_8, overlap/lazy commit/ranged flush, HRX stubs, adaptive guard. Files: `gemma4e_dflash_verify.cpp` (new), `gemma4e_dflash_spec_state.hpp` (new, shared Spec state), `gemma4e_dflash_spec.cpp`, `gemma4e_dflash_detail.hpp`, `gemma4e_dflash.cpp` (lazy decode streams), `tools/test_spec_engine.cpp`. diff --git a/flm-dev-kit/FLM_Xclbin/Gemma4/verify_decoding/notes/proj_engine_L8_results.md b/flm-dev-kit/FLM_Xclbin/Gemma4/verify_decoding/notes/proj_engine_L8_results.md index f1bf3a048..9a1fcc16f 100644 --- a/flm-dev-kit/FLM_Xclbin/Gemma4/verify_decoding/notes/proj_engine_L8_results.md +++ b/flm-dev-kit/FLM_Xclbin/Gemma4/verify_decoding/notes/proj_engine_L8_results.md @@ -5,7 +5,7 @@ # 8-token projection engine on hardware (plan S6.3 / S6.4 / S6.5a), 2026-10-29 -Designs (IRON `FLM_Xclbin/Gemma4/verify_decoding`, branch feat/bolt-dflash, commits 5a32344f6, dc32e4f9c, 3a0e5815f): +Designs (`FLM_Xclbin/Gemma4/verify_decoding`): - `DESIGN=projonly`: 16 Q4 projection cores + assembly memtiles + MT3 x landing/replay + shim feed/capture (y packets de-permuted by a shim BD). - `DESIGN=projstage`: same, y goes through the MT4 token-major stage (`y_depermute_mt`) and IT4. - `make bitstream MODEL_TYPE=GEMMA4_E4B L_TOKENS=8 DESIGN=projonly` (build/GEMMA4_E4B_L8/xclbins/projonly.xclbin); `L_TOKENS=1` runs the shipping core through the same replay machinery. diff --git a/flm-dev-kit/FLM_Xclbin/Gemma4/verify_decoding/notes/proj_speedup.md b/flm-dev-kit/FLM_Xclbin/Gemma4/verify_decoding/notes/proj_speedup.md index 8679cc2f8..c0b684357 100644 --- a/flm-dev-kit/FLM_Xclbin/Gemma4/verify_decoding/notes/proj_speedup.md +++ b/flm-dev-kit/FLM_Xclbin/Gemma4/verify_decoding/notes/proj_speedup.md @@ -10,10 +10,10 @@ committed kernels are copied back to verify_decoding). Scripts: work/scripts/pw_ shared, medians are often contention-inflated; quiet-box min == median). ## Committed -| commit | change | before | after | accuracy | +| # | change | before | after | accuracy | |---|---|---|---|---| -| 4af6f3f92 | q4_l8: mmul pair scoped to one row half (all four 8x8 accumulators live -> compiler spilled them every k-tile) | toy 1.92 us/block (Peano slope), projonly L5 min 1724-1732 us | toy 1.62 us/block, projonly L5 min 1510-1549 us (L0 1346-1388) | bit-identical (proj8 relL2 0.0143-0.0202 unchanged; fused8 oracle unchanged) | -| 8a10e416a | PLE MVM: two tokens per 64-lane accumulator, all 8 tokens one pass, column loop unrolled | toy 1.10 us per [128k x 32] x 8 tok | 0.91 us | bit-identical (ple8 stage relL2 0.0063-0.0091 unchanged, 4 layers) | +| 1 | q4_l8: mmul pair scoped to one row half (all four 8x8 accumulators live -> compiler spilled them every k-tile) | toy 1.92 us/block (Peano slope), projonly L5 min 1724-1732 us | toy 1.62 us/block, projonly L5 min 1510-1549 us (L0 1346-1388) | bit-identical (proj8 relL2 0.0143-0.0202 unchanged; fused8 oracle unchanged) | +| 2 | PLE MVM: two tokens per 64-lane accumulator, all 8 tokens one pass, column loop unrolled | toy 1.10 us per [128k x 32] x 8 tok | 0.91 us | bit-identical (ple8 stage relL2 0.0063-0.0091 unchanged, 4 layers) | Reference points (same session): projonly L=1 decode core L5 min 1271-1289 us; projonly 8-token with compute removed (stream floor) min 1427-1453 us. -> the 8-token projection is now within ~5-8 % of its weight-stream floor (was ~20 %). diff --git a/flm-dev-kit/FLM_Xclbin/Gemma4/verify_decoding/notes/rmsglu_L8_results.md b/flm-dev-kit/FLM_Xclbin/Gemma4/verify_decoding/notes/rmsglu_L8_results.md index 11ae56f7f..972d8b66b 100644 --- a/flm-dev-kit/FLM_Xclbin/Gemma4/verify_decoding/notes/rmsglu_L8_results.md +++ b/flm-dev-kit/FLM_Xclbin/Gemma4/verify_decoding/notes/rmsglu_L8_results.md @@ -5,7 +5,7 @@ # 8-row rms_residual + GLU stage design (plan S6.6 / S6.7), 2026-10-29 -IRON `FLM_Xclbin/Gemma4/verify_decoding`, branch feat/bolt-dflash, commit `5f1c36d3c`. Design `DESIGN=rmsglu`: +Design `DESIGN=rmsglu` in `FLM_Xclbin/Gemma4/verify_decoding`: `make bitstream MODEL_TYPE=GEMMA4_E4B L_TOKENS=8 DESIGN=rmsglu BUILD_ROOT=build/rmsglu_L8 KERNEL_SRCS=""` (`RMSGLU_TAPS=1` + another BUILD_ROOT builds the debug-tap variant). Test: `work/scripts/run_rmsglu.sh [repeat]` (`XB=rmsglu_taps_L8 TAPFLAG=--taps` for the taps), host `host/test_rmsglu.hpp` (`run_rmsglu.exe -t rmsglu`), reference `tools/rmsglu_ref.py`. diff --git a/flm-dev-kit/FLM_Xclbin/Gemma4/verify_decoding/notes/swa_linear_buffer.md b/flm-dev-kit/FLM_Xclbin/Gemma4/verify_decoding/notes/swa_linear_buffer.md index 1d33f2ea7..cb79b2ae2 100644 --- a/flm-dev-kit/FLM_Xclbin/Gemma4/verify_decoding/notes/swa_linear_buffer.md +++ b/flm-dev-kit/FLM_Xclbin/Gemma4/verify_decoding/notes/swa_linear_buffer.md @@ -5,7 +5,7 @@ # SWA linear window buffer (plan S4.1 re-scoped by the D6 change), engine side -Code: IRON `FLM_DLL/detail/gemma4e_dflash/` commits `5f8ad8268`, `e8f49e122` (header `gemma4e_dflash_swa.hpp`). +Code: `FLM_DLL/detail/gemma4e_dflash/` (header `gemma4e_dflash_swa.hpp`). ## Contract (what the 8-row verify host path uses) - Each non-skip SWA layer buffer holds `kSwaBufferRows = 2048` rows per plane (K plane then V plane, plane stride `2048 * SWA_DK`); skip layers use the owner's buffer. @@ -21,7 +21,7 @@ Code: IRON `FLM_DLL/detail/gemma4e_dflash/` commits `5f8ad8268`, `e8f49e122` (he - Prefill: `gemma4e_prefill_shape` carries `swa_base_old/new/zero_hi`; the decode buffer gets the rows with position >= new base (old window rows are relocated when the base moves); the prefill scratch cache stays absolute-position. - Stress build: `-DFLM_SWA_BUFFER_ROWS=640` (via `FLM_OVERRIDE_FLAGS`) compacts every ~81 tokens; `static_assert(kSwaBufferRows >= 576)`. -## Bugs found by the rigs (both fixed in e8f49e122) +## Bugs found by the rigs (both fixed) 1. Compaction inside a verify batch + commit rollback: `first_row < 0` assertion in `_move_kv_cache` (window needed positions already dropped). 2. After a pre-verify compaction the instruction sequences generated for the previous `set_context_length` still had the old base baked in: the first verify row was appended at the old row and the replay used the old base (found by `FLM_DFLASH_CHECK_SWA`: a stale non-zero row behind the context; streams diverged 15-35 tokens later). diff --git a/flm-dev-kit/FLM_Xclbin/Hy_MT2_1.8B/README.md b/flm-dev-kit/FLM_Xclbin/Hy_MT2_1.8B/README.md index 58a55aad1..6c06a67a5 100644 --- a/flm-dev-kit/FLM_Xclbin/Hy_MT2_1.8B/README.md +++ b/flm-dev-kit/FLM_Xclbin/Hy_MT2_1.8B/README.md @@ -397,7 +397,7 @@ prompts are nearly all fixed cost, and in the translation benchmark prefill is ~ ## Krackan baseline (WP0, 2026-11-05) Measured on a Krackan test machine on -`hy_mt2` = IRON `5682aa708`, FastFlowLM `d5e186cb`. Every later WP compares against these numbers. +FastFlowLM `d5e186cb`. Every later WP compares against these numbers. All speed numbers are medians of 3 separate runs with nobody else on the NPU. ### Translations and prefill sweep (G2, G3) diff --git a/flm-dev-kit/FLM_Xclbin/MiniCPM_V/decoding/ANALYSIS.md b/flm-dev-kit/FLM_Xclbin/MiniCPM_V/decoding/ANALYSIS.md index 30cd34476..27b373133 100644 --- a/flm-dev-kit/FLM_Xclbin/MiniCPM_V/decoding/ANALYSIS.md +++ b/flm-dev-kit/FLM_Xclbin/MiniCPM_V/decoding/ANALYSIS.md @@ -248,7 +248,7 @@ another NPU2 design), or lm_head computed by the layer design's projection engin ## 16. Feasibility: one xclbin for layers + lm_head (overlay), 2026-11-02 `../lm_head_npu_bin/` was an unchanged copy of `Qwen3_5/lm_head_npu_bin`, built for QWEN3_5_2B (Peano, 4 s). It was -removed on 2026-11-03 (lm_head now runs inside layer.xclbin, so nothing used it); it is in git at IRON `2261dffc2`. +removed on 2026-11-03 (lm_head now runs inside layer.xclbin, so nothing used it). - **Program memory (16 KB per core on NPU2, aie-rt `xaie2pgbl_reginit.c`):** fits. lm_head = 4.8 KB on all 32 cores; decode = 6.96 KB (projection), 4.5-5.4 KB (attention), 2.8 KB (GDN), max 10.5 KB (conv core (5,2)). diff --git a/flm-dev-kit/FLM_Xclbin/Whisper/decoder_mv_dequant_mv/kernel/common.h b/flm-dev-kit/FLM_Xclbin/Whisper/decoder_mv_dequant_mv/kernel/common.h index 7c22ad83d..b64023d41 100644 --- a/flm-dev-kit/FLM_Xclbin/Whisper/decoder_mv_dequant_mv/kernel/common.h +++ b/flm-dev-kit/FLM_Xclbin/Whisper/decoder_mv_dequant_mv/kernel/common.h @@ -9,7 +9,7 @@ typedef bfloat16 bf16; // .bss is not zeroed when a Peano-built core is loaded. AIE_PERSIST_ZERO puts a // zero-initialized static that must keep its value across calls in .data, and // AIE_PING_FLAG makes a ping/pong selector volatile there too: under Peano a lock -// acquire is not a memory barrier. Both do nothing under chess. (As IRON#148.) +// acquire is not a memory barrier. Both do nothing under chess. #if defined(__chess__) #define AIE_PERSIST_ZERO #define AIE_PING_FLAG bool diff --git a/flm-dev-kit/FLM_Xclbin/Whisper/encoder_MM/kernel/common.h b/flm-dev-kit/FLM_Xclbin/Whisper/encoder_MM/kernel/common.h index ab3ee50d2..3103e74ab 100644 --- a/flm-dev-kit/FLM_Xclbin/Whisper/encoder_MM/kernel/common.h +++ b/flm-dev-kit/FLM_Xclbin/Whisper/encoder_MM/kernel/common.h @@ -10,7 +10,7 @@ typedef bfloat16 bf16; // .bss is not zeroed when a Peano-built core is loaded. AIE_PERSIST_ZERO puts a // zero-initialized static that must keep its value across calls in .data, and // AIE_PING_FLAG makes a ping/pong selector volatile there too: under Peano a lock -// acquire is not a memory barrier. Both do nothing under chess. (As IRON#148.) +// acquire is not a memory barrier. Both do nothing under chess. #if defined(__chess__) #define AIE_PERSIST_ZERO #define AIE_PING_FLAG bool diff --git a/flm-dev-kit/FLM_Xclbin/Whisper/encoder_attention_884/kernel/common.h b/flm-dev-kit/FLM_Xclbin/Whisper/encoder_attention_884/kernel/common.h index e420a0786..5fe329071 100644 --- a/flm-dev-kit/FLM_Xclbin/Whisper/encoder_attention_884/kernel/common.h +++ b/flm-dev-kit/FLM_Xclbin/Whisper/encoder_attention_884/kernel/common.h @@ -10,7 +10,7 @@ typedef bfloat16 bf16; // .bss is not zeroed when a Peano-built core is loaded. AIE_PERSIST_ZERO puts a // zero-initialized static that must keep its value across calls in .data, and // AIE_PING_FLAG makes a ping/pong selector volatile there too: under Peano a lock -// acquire is not a memory barrier. Both do nothing under chess. (As IRON#148.) +// acquire is not a memory barrier. Both do nothing under chess. #if defined(__chess__) #define AIE_PERSIST_ZERO #define AIE_PING_FLAG bool diff --git a/flm-dev-kit/FLM_Xclbin/Whisper/encoder_attention_888/kernel/common.h b/flm-dev-kit/FLM_Xclbin/Whisper/encoder_attention_888/kernel/common.h index 3bc4aa696..3269787b5 100644 --- a/flm-dev-kit/FLM_Xclbin/Whisper/encoder_attention_888/kernel/common.h +++ b/flm-dev-kit/FLM_Xclbin/Whisper/encoder_attention_888/kernel/common.h @@ -10,7 +10,7 @@ typedef bfloat16 bf16; // .bss is not zeroed when a Peano-built core is loaded. AIE_PERSIST_ZERO puts a // zero-initialized static that must keep its value across calls in .data, and // AIE_PING_FLAG makes a ping/pong selector volatile there too: under Peano a lock -// acquire is not a memory barrier. Both do nothing under chess. (As IRON#148.) +// acquire is not a memory barrier. Both do nothing under chess. #if defined(__chess__) #define AIE_PERSIST_ZERO #define AIE_PING_FLAG bool diff --git a/flm-dev-kit/FLM_Xclbin/Whisper/encoder_dequant/kernel/common.h b/flm-dev-kit/FLM_Xclbin/Whisper/encoder_dequant/kernel/common.h index 548448eb5..d8391173c 100644 --- a/flm-dev-kit/FLM_Xclbin/Whisper/encoder_dequant/kernel/common.h +++ b/flm-dev-kit/FLM_Xclbin/Whisper/encoder_dequant/kernel/common.h @@ -10,7 +10,7 @@ typedef bfloat16 bf16; // .bss is not zeroed when a Peano-built core is loaded. AIE_PERSIST_ZERO puts a // zero-initialized static that must keep its value across calls in .data, and // AIE_PING_FLAG makes a ping/pong selector volatile there too: under Peano a lock -// acquire is not a memory barrier. Both do nothing under chess. (As IRON#148.) +// acquire is not a memory barrier. Both do nothing under chess. #if defined(__chess__) #define AIE_PERSIST_ZERO #define AIE_PING_FLAG bool diff --git a/flm-dev-kit/FLM_Xclbin/Whisper/whisper_lm_head_npu_bin/kernel/common.h b/flm-dev-kit/FLM_Xclbin/Whisper/whisper_lm_head_npu_bin/kernel/common.h index 1341459a2..3efd63253 100644 --- a/flm-dev-kit/FLM_Xclbin/Whisper/whisper_lm_head_npu_bin/kernel/common.h +++ b/flm-dev-kit/FLM_Xclbin/Whisper/whisper_lm_head_npu_bin/kernel/common.h @@ -11,7 +11,7 @@ typedef bfloat16 bf16; // .bss is not zeroed when a Peano-built core is loaded. AIE_PERSIST_ZERO puts a // zero-initialized static that must keep its value across calls in .data, and // AIE_PING_FLAG makes a ping/pong selector volatile there too: under Peano a lock -// acquire is not a memory barrier. Both do nothing under chess. (As IRON#148.) +// acquire is not a memory barrier. Both do nothing under chess. #if defined(__chess__) #define AIE_PERSIST_ZERO #define AIE_PING_FLAG bool diff --git a/flm-dev-kit/FLM_Xclbin/build_units.json b/flm-dev-kit/FLM_Xclbin/build_units.json index ba4c41269..a028e9fac 100644 --- a/flm-dev-kit/FLM_Xclbin/build_units.json +++ b/flm-dev-kit/FLM_Xclbin/build_units.json @@ -1,5 +1,5 @@ { - "_doc": "Every FLM_Xclbin build unit (a directory owning a Makefile, path relative to FLM_Xclbin/) -> model_types: the MODEL_TYPE values it is built for, one build each (make bitstream MODEL_TYPE=; [] = built once, no MODEL_TYPE); artifacts: the CI artifact names those builds produce, xclbins-[_], the names kernel_assignment.json refers to. Ported from the MULTI_MODEL table of FastFlowLM_IRON .github/actions/xclbin-build-matrix/action.yml. Checked by .github/script/ci/devkit_check.py.", + "_doc": "Every FLM_Xclbin build unit (a directory owning a Makefile, path relative to FLM_Xclbin/) -> model_types: the MODEL_TYPE values it is built for, one build each (make bitstream MODEL_TYPE=; [] = built once, no MODEL_TYPE); artifacts: the CI artifact names those builds produce, xclbins-[_], the names kernel_assignment.json refers to. Checked by .github/script/ci/devkit_check.py.", "units": { "Dequant_Q4_0_w128x512": { "model_types": [], diff --git a/flm-dev-kit/FLM_Xclbin/minicpm_ocr/decoding/ANALYSIS.md b/flm-dev-kit/FLM_Xclbin/minicpm_ocr/decoding/ANALYSIS.md index d2e24d9e0..e2b7bd7f9 100644 --- a/flm-dev-kit/FLM_Xclbin/minicpm_ocr/decoding/ANALYSIS.md +++ b/flm-dev-kit/FLM_Xclbin/minicpm_ocr/decoding/ANALYSIS.md @@ -249,7 +249,7 @@ another NPU2 design), or lm_head computed by the layer design's projection engin ## 16. Feasibility: one xclbin for layers + lm_head (overlay), 2026-11-02 `../lm_head_npu_bin/` was an unchanged copy of `Qwen3_5/lm_head_npu_bin`, built for QWEN3_5_2B (Peano, 4 s). It was -removed on 2026-11-03 (lm_head now runs inside layer.xclbin, so nothing used it); it is in git at IRON `2261dffc2`. +removed on 2026-11-03 (lm_head now runs inside layer.xclbin, so nothing used it). - **Program memory (16 KB per core on NPU2, aie-rt `xaie2pgbl_reginit.c`):** fits. lm_head = 4.8 KB on all 32 cores; decode = 6.96 KB (projection), 4.5-5.4 KB (attention), 2.8 KB (GDN), max 10.5 KB (conv core (5,2)). diff --git a/flm-dev-kit/FLM_Xclbin/toolchain.lock b/flm-dev-kit/FLM_Xclbin/toolchain.lock index bbfa8d82b..cd75e77ed 100644 --- a/flm-dev-kit/FLM_Xclbin/toolchain.lock +++ b/flm-dev-kit/FLM_Xclbin/toolchain.lock @@ -63,11 +63,11 @@ MLIR_AIE_WHEEL_VERSION=0.0.1.2025101504+ae29ec5 MLIR_AIE_WHEEL_URL=https://github.com/Xilinx/mlir-aie/releases/download/latest-wheels-2/mlir_aie-0.0.1.2025101504+ae29ec5-cp312-cp312-manylinux_2_35_x86_64.whl MLIR_AIE_WHEEL_SHA256=54fb1bf62451290f402c96b86d23a01cca09fa5f6ebc402606ed917717baabdd -# The pip ironenv installs everything with (the one IRON's ironenv has). +# The pip ironenv installs everything with. PIP_VERSION=26.2.1 # Peano (llvm-aie), the AIE core compiler of every ENABLE_CHESSCC=0 build: the -# version IRON's wheel-aie-env action pinned, from the llvm-aie nightly index +# version the kernels were developed with, from the llvm-aie nightly index # (LLVM_AIE_INDEX, which pip -f would read; the image downloads the wheel by # URL and checks its digest). The image installs it outside the venv and also # passes it to the mlir-aie build, so ironenv has no second (older) Peano. diff --git a/flm-dev-kit/aie2p-launchlib/launchlib/README.md b/flm-dev-kit/aie2p-launchlib/launchlib/README.md index 6f90e375b..c6c42e3eb 100644 --- a/flm-dev-kit/aie2p-launchlib/launchlib/README.md +++ b/flm-dev-kit/aie2p-launchlib/launchlib/README.md @@ -57,7 +57,7 @@ runlists fail; on Windows it made launches much slower. Do not share the NPU wit Without a context list (Windows without `LAUNCH_NPU_WATCH_XRT`, or on an XRT whose list it does not recognize, or `accel` empty; `Session::watch_why()` says which) the Session cannot see other contexts, so it takes the NPU as shared: by the policy, every warm and rerun launch runs as cold (`cold_only`), unless `SessionOptions::exclusive` says no other process uses the NPU. On Windows a warm or rerun launch after another app's context hangs the NPU, and -repeated hangs ended in bugcheck 0x119 on a shared machine. The order check and the recovery still work. +repeated hangs can make the machine unresponsive (reboot to recover). The order check and the recovery still work. What it costs: one driver query per run, ~1 µs with no context on the NPU but 35–55 µs once any context exists (ours too: the driver asks the firmware). Within `max_gap` of its last query the Session asks only after the run (a diff --git a/flm-dev-kit/aie2p-launchlib/launchlib/include/launch/xrt/session.hpp b/flm-dev-kit/aie2p-launchlib/launchlib/include/launch/xrt/session.hpp index 6e3280747..f3c92589f 100644 --- a/flm-dev-kit/aie2p-launchlib/launchlib/include/launch/xrt/session.hpp +++ b/flm-dev-kit/aie2p-launchlib/launchlib/include/launch/xrt/session.hpp @@ -68,7 +68,8 @@ // launch runs as cold), unless `exclusive` says no other process // uses the NPU. On Windows a warm or rerun launch after another // app's context hangs the NPU; repeated, Windows resets it again -// and again, then stops with bugcheck 0x119. +// and again, and the machine can become unresponsive (reboot +// to recover). // recovery A runlist that throws or does not finish in `timeout`: status // failed, and the Session opens a new hw_context (~40 ms). That is // the only way back from a hang or from shim DMA tasks that never diff --git a/flm-dev-kit/aie2p-launchlib/pm_runtime_load_singletile/README.md b/flm-dev-kit/aie2p-launchlib/pm_runtime_load_singletile/README.md index 6d2ad2151..6d68e1d4d 100644 --- a/flm-dev-kit/aie2p-launchlib/pm_runtime_load_singletile/README.md +++ b/flm-dev-kit/aie2p-launchlib/pm_runtime_load_singletile/README.md @@ -101,7 +101,7 @@ powershell -File tools/pressure.ps1 -Bin C:\b\pm\Release -Package precompiled/c8 Ryzen AI 7 350 (Krackan, 8 columns), XRT 2.21.0, 32 cores: the table above and the walks in `results/pressure_32core.md` pass. Not run on Windows: P5b, P8, P9, P10 (`-Group hang`). They hang the NPU on -purpose, and on two machines that ended with the machine offline (one in bugcheck 0x119). +purpose, and repeated hangs can make the machine unresponsive (reboot to recover). The builds above are blind (no context list). With `-DNPU_WATCH=ON` (public XRT headers only), `test` and `stress` see other contexts through XRT's list, and warm and rerun launches run as asked while the NPU is theirs; they print diff --git a/flm-dev-kit/aie2p-launchlib/vadd_vmul_bf16/WINDOWS.md b/flm-dev-kit/aie2p-launchlib/vadd_vmul_bf16/WINDOWS.md index 5ba51335f..4073026d7 100644 --- a/flm-dev-kit/aie2p-launchlib/vadd_vmul_bf16/WINDOWS.md +++ b/flm-dev-kit/aie2p-launchlib/vadd_vmul_bf16/WINDOWS.md @@ -97,7 +97,7 @@ Windows with one other context. pm `stress --mode watch` (S7) checks the guard: next to a process that runs cold(vmul), every warm and rerun launch of the walk runs as cold, 0 wrong, on Linux and on Windows. Not tested on Windows: a context that runs a launch inside one of our runlists (on a shared -machine a hang there can end in bugcheck 0x119). +machine a hang there can make the machine unresponsive; reboot to recover). ## Port notes @@ -108,8 +108,8 @@ machine a hang there can end in bugcheck 0x119). every warm and rerun launch runs as its cold kernel. `SessionOptions::exclusive = true` (the caller vouches that no other process uses the NPU) runs them as asked. A warm or rerun launch after another app's - context hangs the NPU, and on Windows repeated hangs end in bugcheck 0x119 - (VIDEO_SCHEDULER_INTERNAL_ERROR; seen on a shared machine). So a + context hangs the NPU, and on Windows repeated hangs can make the machine + unresponsive (reboot to recover). So a Windows Session also stops after `max_failures` (2) failed runlists in a row instead of opening a new hw_context each time (status `stopped`, `reopen()` to go on). Pressure results of the Session on Windows: diff --git a/flm-dev-kit/aie2p-launchlib/whisper_encoder/README.md b/flm-dev-kit/aie2p-launchlib/whisper_encoder/README.md index 533d20a57..4be11b944 100644 --- a/flm-dev-kit/aie2p-launchlib/whisper_encoder/README.md +++ b/flm-dev-kit/aie2p-launchlib/whisper_encoder/README.md @@ -137,7 +137,7 @@ So the encoder in one context gives the same K/V. The other examples' stress and ## Step 3: the whole engine in FastFlowLM The engine of this tree inside a shipped FastFlowLM: `build/rt/stock` is a copy of a v1.0.12 portable build (XRT, -with the Whisper speed-up of IRON#155), `build/rt/tree` the same with this tree's `libwhisper_npu.so` and Whisper +with an earlier Whisper speed-up), `build/rt/tree` the same with this tree's `libwhisper_npu.so` and Whisper xclbins (`build/xroot`). Three variants: **stock** (as shipped), **tree** (this tree, the switch off) and **switch** (`FLM_WHISPER_SWITCH_DIR=build/switch`). The transcripts come from FastFlowLM's own ASR test (`npu_test --suites asr`, `flm serve -a 1`): the FLEURS set of 84 clips in 7 languages, 4 of them longer than one diff --git a/src/common/AutoModel/modeling_gemma4_12b_image.cpp b/src/common/AutoModel/modeling_gemma4_12b_image.cpp index 011b7244a..94db0e422 100644 --- a/src/common/AutoModel/modeling_gemma4_12b_image.cpp +++ b/src/common/AutoModel/modeling_gemma4_12b_image.cpp @@ -347,7 +347,7 @@ void Gemma4_12B::preprocess_image( // // debug, compare with reference tensor to see the error - // SafeTensors referencetensor("/scratch/shdu/transformerExplorer/gemma4_unified_image_debug.safetensors"); + // SafeTensors referencetensor("/path/to/gemma4_unified_image_debug.safetensors"); diff --git a/src/create_new_model.md b/src/create_new_model.md index 4e8f6b216..4451a3a23 100644 --- a/src/create_new_model.md +++ b/src/create_new_model.md @@ -23,7 +23,7 @@ Every model has two layers: 1. **The engine** — `class _npu : public causal_lm`. This is the NPU kernel graph (PIMPL-hidden) and is shipped as a *prebuilt* shared library (`lib_npu.so` / `_npu.dll`). You normally do **not** write this; it - comes from the kernel/IRON project. + comes from the developer kit (`flm-dev-kit/FLM_DLL`). 2. **The AutoModel wrapper** — `class : public AutoModel`. This is what you write. It owns the tokenizer, sampler, chat template and prompt cache, and drives the engine through `prefill()` / `forward()` / `checkpoint()` / `restore()`. @@ -438,7 +438,7 @@ void register_builtin_backends(BackendRegistry& registry) { ```bash #!/usr/bin/bash -export FLM_MODEL_PATH="/scratch/michyu" +export FLM_MODEL_PATH="/path/to/models" cp /path/to/kernels/build/lib/libgemma4_12b_npu.so ../../lib/xrt # cp -r /path/to/xclbins/Gemma4-12B-IT-NPU2 ../../xclbins/ ``` diff --git a/src/home_install.sh b/src/home_install.sh index 1e6198c57..7998ff755 100755 --- a/src/home_install.sh +++ b/src/home_install.sh @@ -343,6 +343,14 @@ STOCK_ENV )" fi +# The model directory: the FLM_MODEL_PATH this installer ran with, if any; +# otherwise flm's own default (~/.config/flm on Linux). +if [[ -n "${FLM_MODEL_PATH:-}" ]]; then + MODEL_PATH_LINE="export FLM_MODEL_PATH=\"$FLM_MODEL_PATH\"" +else + MODEL_PATH_LINE="# FLM_MODEL_PATH is not set: flm uses its default model directory." +fi + ENV_SCRIPT="$FLM_PREFIX/flm_env.sh" echo "[home_install] writing env script: $ENV_SCRIPT" cat > "$ENV_SCRIPT" <