Skip to content

Tokenizer: byte-level BPE from GGUF, exact against HF tokenizers - #2

Merged
bong-water-water-bong merged 1 commit into
mainfrom
tokenizer
Sep 22, 2026
Merged

bong-water-water-bong merged 1 commit into
mainfrom
tokenizer

Conversation

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator

Text in, token ids out, with no Python and no ICU. It reads the vocabulary from GGUF metadata.

What

  • engine/core/tokenizer.*: the same steps as HF tokenizers, in order:
    • added-token split (leftmost-longest)
    • NFC normalization
    • the Qwen2 split regex, ported by hand one branch at a time
    • GPT-2 byte-level mapping, then BPE merges
    • decode
  • It refuses tokenizer.ggml.pre values it has no golden for.
  • engine/core/unicode.*: UTF-8 codec, character classes and NFC. The tables come from Python unicodedata 16.0.0 via tools/gen_unicode_tables.py.
  • docs/tokenizer.md explains the design, the verification and the known limits.

Verification

golden_tokenizer checks three things per case, all exact against HF tokenizers 0.22.2:

  • pre-token pieces, checked separately because BPE can hide a wrong split
  • ids
  • decoded bytes
case set cases mismatches
committed, runs in CI (vocab-only GGUF 5.9 MB + cases) 481 0
random, seed 7 20,081 0 (0.9 s)

Mutation sweep: ten single-rule deletions, nine caught (for example, dropping NFC gives 187 mismatches). The tenth, the \p{N} branch, is an equivalent mutant. An earlier version of the cases missed contraction rules, because " 'd" is split by the punctuation branch before the contraction branch runs. The cases now put contractions after letters.

Test plan

  • ctest on strixhalo: 5/5 (incl. golden_cpu)
  • ctest locally: 4/4 (no model needed)
  • zero warnings at -Wall -Wextra -Wpedantic

🤖 Generated with Claude Code

…zers

- engine/core/tokenizer: added-token split, NFC, hand-ported Qwen2 split
  regex, GPT-2 byte mapping, BPE merges, decode. Unverified
  tokenizer.ggml.pre values are refused.
- engine/core/unicode: UTF-8 codec, letter/number/whitespace classes, NFC.
  Tables generated from Python unicodedata 16.0.0 by
  tools/gen_unicode_tables.py (no ICU).
- tests: test_unicode (CI), golden_tokenizer checking pre-token pieces,
  ids and decoded bytes. The Qwen3 vocab-only GGUF (5.9 MB) and 481 cases
  are committed so it runs in CI.

481 committed cases and 20,081 random cases: 0 mismatches on split,
encode and decode. Nine of ten single-rule mutations fail the test; the
tenth is equivalent.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@bong-water-water-bong
bong-water-water-bong merged commit 8331046 into main Sep 22, 2026
1 check passed
@bong-water-water-bong
bong-water-water-bong deleted the tokenizer branch September 22, 2026 19:14
bong-water-water-bong pushed a commit that referenced this pull request Sep 26, 2026
…ama.cpp #2, #5)

The pin adds the zaya architecture and its converter on top of 96f6b89 (#104's #95 fixes).
registry/architectures.json, regenerated: ZayaForCausalLM maps to hrx and vulkan
(266 architectures, all mapped).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
bong-water-water-bong pushed a commit that referenced this pull request Sep 26, 2026
…ama.cpp #2, #5, #6)

The pin adds the zaya architecture and its converter (#2, #5) on top of #104's #95 fixes, and
carries #106's scalar-scatter SET_ROWS onto the tracked branch (#6): #106 pinned c358334,
which is on no branch of the fork. registry/architectures.json, regenerated:
ZayaForCausalLM maps to hrx and vulkan (266 architectures, all mapped).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
bong-water-water-bong added a commit that referenced this pull request Sep 26, 2026
…nly architectures (#107)

* ZAYA1 (Zyphra) on Vulkan: serve routes fork-only architectures to our llama.cpp

`1bit serve --device vulkan` reads the GGUF's general.architecture (app/gguf_meta.h) and
runs an architecture only our llama.cpp implements (zaya) on the HRX build's Vulkan0, even
when the upstream Vulkan build is present. registry_build counts such architectures for
vulkan the same way, and check_models.tsv checks ZAYA1-8B Q4_K_M on vulkan.

docs/vulkan.md: converting and serving ZAYA1, with the checks against transformers and
the measured speeds on Strix Halo.

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

* ZAYA1 on HRX and ROCm: docs, and serve_e2e on vulkan and hrx in the registry

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

* Pin llama.cpp 5556bf2: ZAYA1 on Vulkan, HRX and ROCm (1bit-MONSTER/llama.cpp #2, #5, #6)

The pin adds the zaya architecture and its converter (#2, #5) on top of #104's #95 fixes, and
carries #106's scalar-scatter SET_ROWS onto the tracked branch (#6): #106 pinned c358334,
which is on no branch of the fork. registry/architectures.json, regenerated:
ZayaForCausalLM maps to hrx and vulkan (266 architectures, all mapped).

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

* registry: vulkan and hrx rows re-checked at b9812e0 (16/16 pass, ZAYA1-8B included)

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

* ci: build gguf_meta_test

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

---------

Co-authored-by: bong-water-water-bong <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
bong-water-water-bong pushed a commit that referenced this pull request Oct 12, 2026
…ontains

Read-only; no arms, no box.

The sentinel instrument cannot support the inference drawn from it. GGML_HRX_SENTINEL fills the
619520-byte host-visible region inside hrx_buffer_init, i.e. once per allocation at load: the
faulting arm has exactly one fill line at 0.44s and faults at 2.02s after ~1087 tokens wrote that
region, so sentinel=0 only says an earlier token overwrote the pattern. Section 22 finding #2's
'not one is our payload, so the write is present' over-reads it.

The conclusion survives on sounder grounds: call 1086 was finite with hash f38cc8b5b54dbb8f, call
1087 is nan=154880, and no constant NaN payload reproduces 91a04b03818e7083 - so the faulting
graph did write all 154880 elements as NaN. Face A stands, for a different reason.

Fork research (1bit-MONSTER/llama.cpp and AMD-Ecosystem/llama.cpp):
- e6187096b (Oct 2) fixed exactly this class: 'masked KV rows reach flash-attention P*V as V = +0',
  with tests/test-hrx-fa-masked-v (27 cases).
- That fix is ALREADY IN THE PIN: e6187096b is an ancestor of e44c9d01a, as are both 314 commits,
  and the zeroing comment plus the test are in the tree.
- 314's predicate rewrite is semantically equivalent on the source (same >-1e30 test, same LDS
  array, published by subgroup 0 before a workgroup barrier), so it is not a regression.
- fb4dff7bb (engine-315/host-visible-coherence, Oct 9) is forward-only but section 13 already
  falsified coherence as a sufficient mechanism.
- Nothing post-pin on either remote fixes an FA/visibility/NaN defect.

Surviving hypothesis: the zeroing predicate is one mask value per key while the accumulation covers
several query rows, so a tile masked for the accumulating row can be judged all-visible and read
directly - finite stale V gives Face B, non-finite gives tiny_P * NaN = Face A. Cheapest
discriminator is the existing 27-case test extended with non-finite masked V and multi-row
differing-key masks: seconds, not 60 in-regime arms.
bong-water-water-bong pushed a commit that referenced this pull request Oct 15, 2026
…SISTENT mapping

ggml-hrx.cpp:320-338 maps a host-visible buffer ONCE at allocation (hrx_buffer_map READ|WRITE over the
whole buffer) and buffer_get then does a plain memcpy out of that mapping; nothing re-maps or invalidates
it. So every engine read of a host-visible buffer is a CPU read of a mapping established at allocation.

That gives memcpy_stable=0 a third explanation the read-twice control does not separate: read #1 == read #2
!= sync means a stale cache line, read #1 != read #2 means the buffer moved - but with a persistent mapping
of NON-COHERENT memory, the CPU's own cached view changing between the reads (lines evicted and re-fetched)
also yields memcpy_stable=0 with nothing device-side moving. The arm that produced 75/75 was running with
the eviction forcer in the same cell, and eviction pressure is exactly what changes which lines are held.
The stronger reading in 315-read-twice-result-buffer-moves-under-the-reader.md is corrected.

Re-opened narrowly: coherence, as a property of the MAPPING rather than of the allocation flags section 13
tested (hv56=1 still faulted, so a coherent allocation does not remove the fault; whether it removes the
mapping's read-to-read divergence is a different, measurable question). Not re-opened: the falsified
writeback candidate, whose measurement was a counter rather than a hash comparison.

Hands forward: run the twin with GGML_HRX_BUFFER_TRACE=1 in both memory-type cells, which is what
315-two-cell-memory-type-preregistration.md pre-registered.
bong-water-water-bong pushed a commit that referenced this pull request Oct 15, 2026
… box run is authorised)

Targets the one measured, unexplained fact left: result_norm changes between two consecutive identical plain
reads in a faulting arm (75/75 and 128/128 memcpy_stable=0, three reads three hashes), with the deferred
writeback and the persistent-mapping cache explanation both already removed by measurement.

Instrument: one edit to the existing twin - a backend_synchronize between read #1 and read #2, reporting
hash_after_sync. Configuration: result_norm + BUFFER_TRACE, ub=512, in-regime, eviction forcer, stop at the
first fault; diagnostic cell, no arm counts toward a campaign.

Readings pre-declared: read#1 != read#2 and hash_after_sync == read#2 -> the writer IS ordered by the stream,
so the reads raced work a sync would have covered, which makes GraphExecutor::execute returning without a
wait the live candidate. read#1 != read#2 and hash_after_sync != read#2 -> the writer is not ordered by
context->stream at all, which kills that candidate and points at a second writer of the arena slot. No
divergence -> uninformative, itself new.

Falsifier stated. Cost: one instrument edit, one rebuild, one faulting arm (the forcer produced a fault in 1
arm for both previous probes).
bong-water-water-bong pushed a commit that referenced this pull request Oct 15, 2026
Adds a fresh ggml_backend_synchronize(backend) and then a FOURTH plain read of the same tensor at the same
call, reported as hash_after_sync with after_sync_stable = (hash_after_sync == memcpy2_hash) on a new
[hrx-f32-sync-after] line.

Tests whether the writer that moves result_norm between two adjacent plain reads is ordered by the stream
the harness already synchronises. Pre-registered reading: #1 != #2 and after_sync == #2 means the writer IS
ordered by the stream (a fresh sync stops the movement, so the reads were racing work the sync covers,
making GraphExecutor::execute returning without a wait the live candidate); #1 != #2 and after_sync != #2
means the writer is not ordered by context->stream at all, which kills that candidate and points at a second
writer of the reused arena slot; #1 == #2 is uninformative.

Gated on the same GGML_HRX_TENSOR_FP path as the twin, inert when unset. Refuses to apply unless the
read-twice control is present, and the build asserts the markers in source and binary rather than trusting
an exit status.
bong-water-water-bong added a commit that referenced this pull request Oct 30, 2026
…for the layout contract (#668)

* tools/npu-arena: the kernel arena, its DMA-ceiling probe, and a test for the layout contract

The arena that produced the last two PRs was a private directory.  It belongs in
the repo: it is the harness every future kernel change is scored with, and the
numbers it produces only mean something if anyone can rebuild it.

tools/npu-arena/ is that harness, self-contained and box-agnostic (paths resolve
from the environment, or from a git-ignored TOOLCHAIN.lock; TOOLCHAIN.lock.example
documents the pins):

* `harness/gen.py` freezes a per-phase harness: A (activations) int8, B int8 in the
  engine's packed layout, the expected int32 = the exact integer matmul, per-column
  scales for provenance, and SHA256SUMS.  Three seeds, ternary with the container's
  real per-32-row-group magnitude structure, so a lossless 2-bit packing stays a
  legitimate entry.
* `runner/runner.cpp` is the on-device scorer: one full ELF, the frozen harness, a
  byte-exact int32 check (two consecutive clean reads, because the runtime's
  readback is occasionally short -- engine issue #666), median of N launches.  It
  can also score a submission's own weight layout (`--w`) and skip the check for a
  probe (`--no-check`).
* `make_task.sh` + `oracle.sh` are the competition: a task bundle per phase, and an
  oracle that rebuilds a submission from source with the pinned toolchain, refuses
  a shared device, replays the leader, and prints the leaderboard row on ACCEPT.
* `make_probe.sh` + `probe/mm_dmabw.cc` + `ceiling.sh` are phase 1 of the
  2026-10-30 14:58 plan: the phase's own objectfifos, taps, blocked layout, tile
  geometry and column-group loop with the matrix unit replaced by a pass-through
  microkernel, so a launch measures the data path alone.  Two variants per phase
  (8-core M=16 / 32-core M=64 with 4 core rows) and a CEILING.md report, so every
  entry can be judged as a percentage of what this box can actually stream.
* `LEADERBOARD.md` and `HARVEST.md` carry the records: the blocked-B layout is
  entry #2 on every phase (2.4-2.6x, since merged as #667), and what the numbers
  still owe (the 32-core N-partition, the 2-bit ternary stream).

Also moves the blocked layout's index math out of the runtime header into
npu/forward/include/q4nx_weight_layout.h, and tests it:
tests/npu_blocked_layout_test.cpp proves the mapping is a bijection over six
geometries (including the 27B's 5120x17408 and 17408x5120), that each 64x128 tile
occupies one contiguous 8192-byte window with the tiles k-fastest, that element
(i,j) inside a tile lands where the int8 microkernel reads it
(b_in[((kb*16+nb)*8+r)*8+c], an independent restatement of its "B LAYOUT
silicon-verified" note), that a geometry which is not a whole number of tiles is
refused, and that the row-major layout every earlier container uses has not moved.
Pure index math, no device and no runtime, so it runs in CI.

No kernel binaries: the ELFs stay private and are emitted from source with the
pinned toolchain (the same rule as the rest of the NPU artifacts).

* tools/npu-arena: split the kernel material out to the private kernel tree

Owner decision on this PR: the probe microkernel and the perf records are kernel
material, so they live with the rest of the ELF tree (npu-kernels) rather than in
the public engine.

Moved to npu-kernels (PR #19, branch arena/leaderboard-and-probe):
* `npu/probe/mm_dmabw.cc` -- the pass-through AIE microkernel the ceiling probe links.
* `docs/arena/LEADERBOARD.md`, `docs/arena/HARVEST.md` -- the per-phase records and the
  techniques/findings behind them.

What stays here is host tooling and documentation only:
* the arena's harness generator, runner, oracle, task/probe builders and ceiling driver,
  which reference the private tree by path (`NPU_KERNELS`/`PROBE_SRC`/`GENERATORS`) and
  carry no kernel source;
* the README, now describing the method instead of our measured tables;
* `q4nx_weight_layout.h` (the layout contract, mechanism only -- the numbers moved to the
  records) and its CI test.

Also applies tools/copyright.py --fix to the new files (the build's copyright check was
failing on them).

* npu: make the layout test compile itself, so CI actually runs it

CI builds an explicit target list and then runs `ctest`, so a registered test whose
binary is not on that list reports "Not Run" and never executes -- which is exactly
what happened to the layout test (test 41, 46 tests, 1 failed, exit 8).  Editing
that workflow list needs a token scope this lane does not have, and a test of pure
index math does not need a build target at all: `tests/npu_blocked_layout_test.sh`
compiles tests/npu_blocked_layout_test.cpp with the build's own compiler at test
time and runs it.

add_test() therefore passes the compiler, the include dir and the source.  It uses
nothing else: no runtime, no device, no NPU toolchain, so it passes on the hosted
runner.

Verified with the runner's own configure (cmake -G Ninja, gcc-16/g++-16, no NPU
options): `ctest -R npu_blocked_layout` -> Passed 0.21s.

---------

Co-authored-by: bong-water-water-bong <[email protected]>
bong-water-water-bong pushed a commit that referenced this pull request Nov 5, 2026
…didate, #1084)

Every amdxdna partition node is created with `exclusive = false` ("always
set exclusive to false for now"), so when no free column range is left
allocate_partition() hands a second client the *same* columns as a live one.
Each design's CDO asks for all 8 columns, so two clients that have each
dispatched once always share one partition - and configuring the second stops
the array for every client (614, DPU PC 0xffffffff).

Measured on strixhalo 2026-11-05, shipped c24 payload under npu-hold: two
clients that each dispatched once sat in "Partition Index 0, Columns [0..7]"
and the next dispatch wedged 3/3 sequential and 3/3 concurrent, while one
context was clean in every row (1000-3408 positions) and a second serve that
never dispatched was clean too. Full chain in #1084.

The first version of this patch made the *context* exclusive, and pi-onebp
measured it refusing the second context of a single client's multi-context
route (ZR1 per-op forward: 4 designs = 4 contexts, "code 102" on ctx #2, 3/3)
- a route that ran 67 200 submits with 0 TDR on the shared partitions. So the
unit is the client: alloc_requests.owner carries the owner (hwctx->client, one
per open file), partition_node.owner records it, and allocate_partition() only
shares within one owner. A distinct column range is still handed out whenever
one is free, so designs using fewer columns than the array keep running
concurrently; only the case that wedges the array becomes a clean -ENODEV at
context creation.

Verified `git apply --check` clean on the pin alone and after 0001+0002; a
build of pin + 0001 + 0002 + 0003 is rc 0 with no warnings and srcversion
FA680E5F8334570CA318449 (recorded in the README's fingerprint table), and the
patched sources are byte-identical to the tree that was built.

It is a candidate: no module carrying it has run on hardware in this shape
(the per-context version was the one installed at 05:49 and rolled back from),
and the README says so together with the rows that would prove it. Also state
what this directory still does not carry - the newer TDR series (0008/0009)
the box and the c25 candidate run - so nobody reads "pin + the series" as the
module the fleet is running.

closes #1084
bong-water-water-bong pushed a commit that referenced this pull request Nov 5, 2026
…didate, #1084)

Every amdxdna partition node is created with `exclusive = false` ("always
set exclusive to false for now"), so when no free column range is left
allocate_partition() hands a second client the *same* columns as a live one.
Each design's CDO asks for all 8 columns, so two clients that have each
dispatched once always share one partition - and configuring the second stops
the array for every client (614, DPU PC 0xffffffff).

Measured on strixhalo 2026-11-05, shipped c24 payload under npu-hold: two
clients that each dispatched once sat in "Partition Index 0, Columns [0..7]"
and the next dispatch wedged 3/3 sequential and 3/3 concurrent, while one
context was clean in every row (1000-3408 positions) and a second serve that
never dispatched was clean too. Full chain in #1084.

The first version of this patch made the *context* exclusive, and pi-onebp
measured it refusing the second context of a single client's multi-context
route (ZR1 per-op forward: 4 designs = 4 contexts, "code 102" on ctx #2, 3/3)
- a route that ran 67 200 submits with 0 TDR on the shared partitions. So the
unit is the client: alloc_requests.owner carries the owner (hwctx->client, one
per open file), partition_node.owner records it, and allocate_partition() only
shares within one owner. A distinct column range is still handed out whenever
one is free, so designs using fewer columns than the array keep running
concurrently; only the case that wedges the array becomes a clean -ENODEV at
context creation.

Verified `git apply --check` clean on the pin alone and after 0001+0002; a
build of pin + 0001 + 0002 + 0003 is rc 0 with no warnings and srcversion
FA680E5F8334570CA318449 (recorded in the README's fingerprint table), and the
patched sources are byte-identical to the tree that was built.

It is a candidate: no module carrying it has run on hardware in this shape
(the per-context version was the one installed at 05:49 and rolled back from),
and the README says so together with the rows that would prove it. Also state
what this directory still does not carry - the newer TDR series (0008/0009)
the box and the c25 candidate run - so nobody reads "pin + the series" as the
module the fleet is running.

closes #1084
bong-water-water-bong pushed a commit that referenced this pull request Nov 16, 2026
…map-side result

#2625 merged with its own conflict markers still in docs/nvme-iommu-fault-triage.md
(line 137 <<<<<<< HEAD, line 157 >>>>>>>), and they were INSIDE a bash code
block: the numbered recipe was split by several paragraphs of prose and the
page no longer rendered. The prose moves after the fence, the marker lines go,
and the recipe reads #1/#2/#3 again.

Everything else here is the map side of #2478, measured 06:42Z with the same
page: a filtered capture on five addresses chosen from the fault census recorded
ZERO events in 30 s and aborted on its own positive control, because the fault
target moves -- the last three faults were on an address the list did not have.
Unfiltered for 13 min (252,704 map/unmap events, 795 s covered):

  0xebf50000  x4 faults  NO map or unmap of this iova anywhere in the window
  0x6925f000  x1         nearest map +230 ms AFTER the fault
  0xe407f000  x2         nearest -58 s
  0xe1d00000  x1         nearest -347 s

Four of eight faults hit an IOVA never mapped and never unmapped in 795 s, so
the translation is absent and nothing re-creates it: a descriptor carrying an
address the driver has finished with, not a stale TLB entry.

Two of my own instrument errors, corrected in the page: iommu_map's size is %cx
(%dx is paddr, and the probe printed size=0x138ec90000 for an 84 GB 'size'), and
a regex anchored on the task name dropped 2,176 of 115,941 map lines because
'next-server (v1-8386' contains a space.
bong-water-water-bong added a commit that referenced this pull request Nov 16, 2026
…res nothing (#2641)

* diag: a pairing whose window held many unmaps is not discriminating, and says so

A positive needs the same treatment the negative just got. Measured at
05:40Z (150 s, three probes filtered to one IOVA): the NVMe paths map and
unmap ONE pool page ~470 times a second --

  27644  iommu_map  <- __iommu_dma_map <- dma_map_phys <- nvme_prep_rq
  35907  iommu_unmap_fast <- __iommu_dma_unmap <- dma_unmap_phys <- nvme_pci_complete_batch
  33141  iommu_unmap_fast <- dma_iova_unlink <- dma_iova_destroy <- nvme_unmap_data

so a +/-30 s window holds thousands of unmaps of the same IOVA and "the
nearest one" proves nothing. correlate() now counts the unmaps inside the
window and render() flags any pairing with more than three:

  [1 of 7 unmaps of this iova in the window -- NOT discriminating, narrow --window]

which fires on the burst capture's own -5.65 s pairing (1 of 7). Two arms,
including one asserting a lone in-window unmap is NOT flagged.

(cherry picked from commit 20a882a)

* diag: the churn rate, and three ways a filtered kprobe silently measures nothing

Follow-up to #2625, whose last commit (20a882a) was pushed after the merge
and is not in main -- the exact loss llama.cpp#406 describes. Cherry-picked
with -x, and the detector it proposes confirms it:

  git diff origin/main 20a882a -- tools/diag/unmap_fault_order.py   (non-empty)

The '5-25 s' in the negative and in --help was the rate of THAT capture, not
of this stream. Measured again on a busier boot, one NVMe pool page is mapped
and unmapped ~470 times a second (nvme_prep_rq -> dma_map_phys -> iommu_map;
nvme_pci_complete_batch -> dma_unmap_phys and dma_iova_unlink), so a +/-30 s
window holds ~14,000 unmaps of it. Both messages now say 'seconds on a sparse
stream, sub-millisecond where the page is recycled' instead of a constant.

Plus the three instrument traps that cost runs while taking those counts:
tracing_on=0 under enable=1; a stacktrace trigger hiding the event line (and
blocking event deletion until !stacktrace:0); and tracefs rejecting range
filters in a way that leaves the probe unfiltered.

* docs: repair the conflict markers #2625 left on main, and record the map-side result

#2625 merged with its own conflict markers still in docs/nvme-iommu-fault-triage.md
(line 137 <<<<<<< HEAD, line 157 >>>>>>>), and they were INSIDE a bash code
block: the numbered recipe was split by several paragraphs of prose and the
page no longer rendered. The prose moves after the fence, the marker lines go,
and the recipe reads #1/#2/#3 again.

Everything else here is the map side of #2478, measured 06:42Z with the same
page: a filtered capture on five addresses chosen from the fault census recorded
ZERO events in 30 s and aborted on its own positive control, because the fault
target moves -- the last three faults were on an address the list did not have.
Unfiltered for 13 min (252,704 map/unmap events, 795 s covered):

  0xebf50000  x4 faults  NO map or unmap of this iova anywhere in the window
  0x6925f000  x1         nearest map +230 ms AFTER the fault
  0xe407f000  x2         nearest -58 s
  0xe1d00000  x1         nearest -347 s

Four of eight faults hit an IOVA never mapped and never unmapped in 795 s, so
the translation is absent and nothing re-creates it: a descriptor carrying an
address the driver has finished with, not a stale TLB entry.

Two of my own instrument errors, corrected in the page: iommu_map's size is %cx
(%dx is paddr, and the probe printed size=0x138ec90000 for an 84 GB 'size'), and
a regex anchored on the task name dropped 2,176 of 115,941 map lines because
'next-server (v1-8386' contains a space.

* ci: a conflict marker committed at the start of a line fails the pre-PR checks

#2625 merged with its own markers still in docs/nvme-iommu-fault-triage.md --
'<<<<<<< HEAD' at 137 and '>>>>>>> 2b1faf1' at 157, both INSIDE a bash block,
so the numbered recipe was split by prose, the fence closed in the wrong place
and the page other lanes reason from did not render. Nothing read the file back:
the merge kept what a hand-resolved conflict should have removed.

tools/ci/conflict_marker_check.py, stateful on purpose: '<<<<<<<', '|||||||'
and '>>>>>>>' are git's own, and '=======' counts ONLY inside an unterminated
block -- the first version treated a bare '=======' as a separator and flagged
10 Markdown underlines and shell rules across 4 files on a clean tree, which is
the shape of check nobody keeps. The real tree now reports 0.

Registered where the tree needs it: a ctest --check row and its --self-test
(tests_referenced_check requires the invocation, not the mention: 72 tool
self-tests, 52 python tests), the pre-pr-checks runner, and its page -- the
runner refuses to run when the page and the array disagree, which is how the
missing page row surfaced rather than silently.

Self-test: 7 arms (mid-line quotes and setext underlines are not conflicts; the
#2625 shape yields start+separator+end; build/ and .bin skipped; rc 0/1/2).
pre-pr-checks: all 11 green, 3 skipped.

---------

Co-authored-by: bong-water-water-bong <[email protected]>
bong-water-water-bong added a commit that referenced this pull request Nov 17, 2026
…nary at a time (#2826)

* ci: run ctest with -j 4, so the 14.5 min Test step stops being one binary at a time

Measured on main run 43998969466 (job build, 23m total): Build 7.28m, Test 14.55m.
The Test step ran ctest serially on a 4-vCPU runner. One flag; the log redirect,
the set +e / exit $rc handling and the build/ctest.log the next step reads are
untouched.

What in the suite cannot run concurrently, and why -j 4 is safe anyway:

  * FIXED PORTS. Every configured test that starts a server already holds
    RESOURCE_LOCK route_ports (CMakeLists.txt: the engine#1070 list below the
    registration glob, plus http_guard, hw_gate_npuserve and the conditional
    serve_client_hangup_cpu/serve_context_limit_cpu rows). The census row
    route_port_lock fails when a new server test is added without the lock, so
    this cannot drift. ctest honours RESOURCE_LOCK under -j: those tests
    serialise against each other and nothing else does.
  * SHARED FILESYSTEM PATHS. Nothing in tests/ writes a fixed path: every test
    that writes uses mktemp -d (checked hw_gate_mem, hw_gate_zero_cases,
    hybrid_route, npu_import_contract, hrx_cpu_weight_parity, registration_glob,
    copyright_gate, gpu_hold_*). The 45 fixed /tmp sites in
    tools/ci/tmp_paths.txt are product code under app/ and npu/, reached only by
    device rows that skip in this configuration (tmp_path_check: 44 baselined,
    none new).
  * NPU/GPU DEVICE. No row in this CI build binds the device: npu_device_lock is
    device-free by design (a forked flock on a temp file), and the device/model
    rows need a model and return 77 here.

Proof that the log stays readable: a 4-test probe project under -j 4 prints the
same two shapes ctest_skips.py parses ('2/4 Test #2: t_skip ...***Skipped' and
'100% tests passed, 0 tests failed out of 4'), and running ctest_skips.py on the
-j 4 log and on the serial log of the same project yields the identical set of
findings (including the unbaselined-skip failure, rc 1).

The engine to measure it is this PR's own build.

Refs ORCH 2026-11-17 (CI-time lever).

* ci: the three tree-asserting rows and the cwd-writing smoke row run alone under -j 4

The first -j 4 build (run 44003534895) failed exactly two of 382 rows, and both are
properties of the tests rather than of parallelism:

  * tool_help_check_tests -- tree_state() is sampled before and after each tool's
    --help and ANY difference is reported as 'wrote into the tree while answering
    --help'. It named pin_holdings_test.py and python_test_order_check.py because
    another row was writing into the checkout at that moment. RUN_SERIAL TRUE on
    tool_help_check, tool_help_check_tests and tool_help_check_onnx: they run by
    themselves and the assertion keeps its full strength.
  * npu_serve_smoke_self -- its self-test creates npu_serve_smoke_selftest.* in
    os.getcwd() (tools/npu_serve_smoke.py:338), i.e. in the checkout root, which is
    what the row above saw. RUN_SERIAL TRUE, with the root cause named in the comment
    so a follow-up can give it a WORKING_DIRECTORY and then drop the property.

Verified that the property lands where ctest reads it: configure the tree, then
ctest -N --show-only=json-v1 reports RUN_SERIAL True for all four rows. Everything
else keeps its four workers -- the port tests already serialise on RESOURCE_LOCK
route_ports, which ctest honours under -j.

Refs ORCH 2026-11-17 (CI-time lever).

* ci: the three holes the -j 4 review found -- embed_serve's fixed port, the census blind spot, its /tmp files

Review at bd7ca3e asked for the claims to be as strong as the change. All three were
real, and none of them was caused by -j 4: they are what -j 4 makes matter.

  1. embed_serve starts `1bit serve` on a FIXED port -- PORT=${EMBED_SERVE_PORT:-8247}
     in tests/embed_serve.sh -- and held no RESOURCE_LOCK, while every other server row
     does. Now `set_tests_properties(embed_serve PROPERTIES RESOURCE_LOCK route_ports)`.
  2. tests/route_port_lock_test.py could not see it: BIND_RE knew freeport, the `:0`
     bind and `--port 43xxx`, and a shell default matched none of them, so the census
     reported OK with a fixed-port server test unlocked. BIND_RE now also matches
     PORT=${VAR:-<4-5 digits>}, and test_the_census_finds_the_route_tests names
     embed_serve so the pattern cannot quietly stop matching it again.
  3. tests/embed_serve.sh wrote its two curl bodies to fixed /tmp/embed_serve_er{1,2},
     so two runs at once judged each other's reply. Both are mktemp files now and are
     removed by the existing cleanup trap.

Verified against a configured probe build rather than by reading: the census now finds
embed_serve (it did not before), and test_every_route_test_holds_the_route_port_lock
passes with it included -- "every route test holds the lock (embed_serve included)".
The one arm still red in that probe is `http_guard`, which is red on main's own
configure too (its C++ source is only found when the row is configured in), so it is a
probe artifact and not this change; the CI row passes on main and on this head.

Refs #2826.

---------

Co-authored-by: bong-water-water-bong <[email protected]>
bong-water-water-bong added a commit that referenced this pull request Nov 24, 2026
…te stops saying PENDING (engine#3158) (#3501)

The Inkling entry shipped with "Accuracy gate row on this fork is PENDING ... the route must not ship before it is
posted". The row is now posted: .../3158#issuecomment-7140433770, measured on the re-card itself
(1bit-MONSTER/Inkling-2-Mini-loom @ afcb64b0) with the same CPU arbiter the r8 row used (llama.cpp 0.8.0-dev,
commit d4a2741, on the box CPU in the same box-hold ticket): thinking-on tokens 29 = 29; 50.0 % greedy agreement
over 8 prompts; all four splits are near-ties (CPU top-1 to the route's token 0.031, 0.263, 0.037, 0.057 nats,
Loom on the arbiter's #2 each time), score 8/8; the texts are byte-identical to the r8 row.

The lane's pinned scorer (logprob_agree-3386.py, 23 Nov 18:29) read those same four splits as counted because it
misaligns the reference token stream on Inkling's <|message_model|>/<|end_message|> markers; main's
tools/logprob_agree.py carries the alignment fix and scores the captured runs 8/8. No route semantics change here,
only the gate note.

Co-authored-by: bong-water-water-bong <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant