Skip to content

docs: record engine#315 as a documented limitation - #352

Merged
bong-water-water-bong merged 2 commits into
mainfrom
1bit/known-issues-315
Oct 7, 2026
Merged

bong-water-water-bong merged 2 commits into
mainfrom
1bit/known-issues-315

Conversation

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator

Adds KNOWN-ISSUES.md, recording engine#315 — intermittent all-NaN logits / format-500 on GLM-4.7-Flash
Q4_K_M on HRX0 under GTT pressure — as a documented limitation.

Why now. The issue's resolution criterion has two branches: a forward fix demonstrated by an instrumented
clean arm, or the owner's written acceptance as a documented limitation. The first is unavailable:

  • Every runtime-side candidate on the device-to-host path is falsified with code evidence. The staged
    writeback path is inert (no host-staged downloads exist, so PendingHostWriteback is never queued — 11 valid
    arms, 0 HRX host writeback lines, with the probe proven to fire under =poison). The direct copy is
    covered by the wait: stream_synchronize_sleeping (runtime/hrx-sleeping-wait.cpp:127) flushes before it
    waits. Placement advice cannot be a fix — iree_hal_buffer_params_t has no placement member and
    iree_hal_allocator_virtual_memory_advise is advisory by contract (iree/hal/allocator.h:495). The sleeping
    wait already falls through to hrx_stream_wait.
  • The only pin candidate proposed, f2099e9b7 (1bit/amd-core-our-hrx), is a strict ancestor of the pin
    this repo already ships (third_party/llama.cpp @ 26330cc20490a547f94c9e5c960bf93063453151). Adopting it
    would be a revert, excluded by the constraint that pins only move forward. Its 322/322 MUL_MAT result is
    therefore not a working configuration the shipped pin lost; f2099e9b7 is a known-clean lower bound to
    bisect from instead.

What the entry records: the reproduction (count=154880 of 154880, contiguous=yes); both failure faces
(all-NaN logits, and the Content-only format 500 — and why a NaN-only count records the second face as clean);
the tested-and-excluded levers (TRANSIENT_REUSE: 0 NaN in 7 arms and 0-in-15 vs 1-in-14; the placement-advice
branch; the staged writeback family; the wait-coverage question); the traps this issue has already sprung (wrong
device, vacuous pass, stale incremental builds, silent arm loss from the runner's inherited lock fd); the
instrumentation available for a future bisect; and what remains unknown.

The issue stays OPEN — this only records the limitation, per the criterion.

Acceptance. The owner authorised landing this entry in writing on 2026-10-07 ("you have gh authorization and
do what needs to be done") on the basis that no forward fix is available. The text was drafted by the assistant
and has not been edited by the owner; it is open to amendment or withdrawal.

@bong-water-water-bong
bong-water-water-bong merged commit 20be8fb into main Oct 7, 2026
6 of 10 checks passed
@bong-water-water-bong
bong-water-water-bong deleted the 1bit/known-issues-315 branch October 7, 2026 20:16
@github-actions

github-actions Bot commented Oct 8, 2026

Copy link
Copy Markdown

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

🎫 Ticket compliance analysis 🔶

315 - Partially compliant

Compliant requirements:

  • Document the intermittent all-NaN logits and format-500 issue on GLM-4.7-Flash under GTT pressure
  • Record the issue as a documented limitation with reproduction steps and failure modes
  • Include analysis of levers tested and excluded
  • Note the known unknowns and instrumentation available for bisecting

Non-compliant requirements:

  • None

Requires further human verification:

  • None
⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
🧪 No relevant tests
🔒 No security concerns identified
⚡ Recommended focus areas for review

Documentation completeness

The documentation covers the issue well, but it's important to ensure that all aspects of the problem, including the specific conditions under which it occurs and the detailed analysis of why certain fixes were ruled out, are clearly communicated. The PR does a good job of documenting the issue, but a review of the documentation for clarity and completeness is recommended.

<!--
Copyright 2026 bong-water-water-bong
SPDX-License-Identifier: Apache-2.0

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->

# Known issues

## engine#315 — intermittent all-NaN logits and format-500 on GLM-4.7-Flash under GTT pressure

**Status: OPEN, accepted as a documented limitation.** The issue stays open until this criterion is met.

Owner acceptance, recorded 2026-10-07: the owner authorised landing this entry in writing — *"you have gh
authorization and do what needs to be done"* — on the basis that no forward fix is available. The limitation text
below was drafted by the assistant; the owner has not edited it and may amend or withdraw it at any time.

**Affected:** `GLM-4.7-Flash-Q4_K_M` on `HRX0`, `llama-server`, at high GTT occupancy (measured from
`gtt_start` ~83 GB up to ~110 GB). Raises at roughly 10-20 % per run; not deterministic and not reproducible on
demand, which is why it is recorded as a limitation rather than fixed.

### Reproduction

3 detached neighbour `llama-server` processes at default context drive GTT into the ~100 GB band, then one
detector server is exercised with 8 identical greedy requests separated by different-length distractors,
followed by 50 mixed-length requests. Under pressure the logits buffer is never written, and the sampler guard
reports:

count=154880 of 154880, contiguous=yes


`154880` is the model's vocabulary width — the whole LM-head output. The guard fires on the consumer side,
which is why it reports the shape and not the producer.

### Both failure faces

The same underlying defect — output data that is wrong or unwritten under memory pressure — surfaces in two
places depending on where it lands:

1. **All-NaN logits.** The logits buffer is never written; the sampler guard fires with
   `count=154880 of 154880, contiguous=yes`. Example: `v315g-c3` (control arm).
2. **Format-500.** The model emits text the server rejects:
   `{"error":{"code":500,"message":"The model produced output that does not match the expected Content-only
   format"}}`. Example: `v315k-l1` (legacy arm), `identical: 1 distinct of 8` then mixed `10 of 50`, `nan=0`.

A NaN-only count records the second face as a clean run, which is what makes it dangerous as a metric. Scoring
must be: an arm is **valid only if it completes `mixed: 50 of 50 ok`**; an arm that aborts early has reduced
exposure and is excluded, not counted as clean.

### Levers tested and excluded

- **`GGML_HRX_TRANSIENT_REUSE=legacy`** — no effect. 15-arm matched study, alternating control and legacy
  inside one box state: **0 NaN in 15 control vs 1 in 14 legacy.** A 7-arm paired confirmation scored by
  completion rather than NaN: **0 NaN in 7 arms**, control 3 clean / 1 truncated, legacy 2 clean / 1 truncated.
  Truncation is not one-sided, and the unpaired aggregates on both sides are noise.
- **Placement advice on the transient arena's committed backing** — cannot be a fix. `iree_hal_buffer_params_t`
  has no placement member (`usage`, `access`, `type`, `queue_family_affinity`, `min_alignment`;
  `runtime/src/iree/hal/buffer.h:646`), and the only advice API is advisory by contract: *"incorrect hints may
  reduce performance but will not cause incorrect behavior"* (`iree/hal/allocator.h:495`). The HRX transient
  path never calls it, but a hint that cannot cause incorrect behaviour cannot resolve one either.
- **The staged host writeback path** — excluded. `download_prepared_host_staging` gates on `has_download`,
  which needs `staging.download = access.write && !binding.graph_input` **and** a binding with non-null
  `host_data` — set only for non-directly-bindable *host* allocations. No graph node writes into a host tensor
  on this path, so `PendingHostWriteback` is inert: 11 valid arms, 0 `HRX host writeback` lines, with the
  reporting path proven to fire under `=poison`.
- **The direct device-to-host copy not being covered by the wait** — falsified.
  `stream_synchronize_sleeping` (`runtime/hrx-sleeping-wait.cpp:127`) flushes **before** it waits, so the copy
  recorded by `backend_get_tensor_async` is submitted and then awaited.
- **Pinning `f2099e9b7` (the `1bit/amd-core-our-hrx` cell)** — not available as a fix.
  `git merge-base --is-ancestor f2099e9b7 26330cc20` is **true**: it is a strict ancestor of the pin
  `engine@main` already ships (`third_party/llama.cpp @ 26330cc20490a547f94c9e5c960bf93063453151`), so adopting
  it would be a revert, which this issue's constraint excludes. Its `322/322 MUL_MAT` result is therefore **not**
  a working configuration that the shipped pin lost — whatever makes that cell clean is already in `26330cc20`,
  which faults. The regression is in what the `1bit/hrx-vulkan-patched` merge added on top, and `f2099e9b7` is a
  known-clean lower bound to bisect from.
- **The `TRANSIENT_REUSE` knob is not a lever for this fault** beyond the arms above: truncation is not one-sided,
  and the unpaired aggregates on both sides are noise.
- **The sleeping wait returning before completion** — cleared: it falls through to `hrx_stream_wait` and returns
  that status.

### Traps this issue has already sprung

- **Wrong device.** Results are only meaningful with an explicit provider/device; a run against the wrong backend
  produces plausible-looking numbers that answer a different question.
- **Vacuous pass.** Zero NaN can be achieved by failing differently — an arm that aborts early logs no NaN. Both
  faces above must be counted, plus complete-arm counts.
- **Stale incremental builds.** Several earlier measurements on this issue were retracted as build artifacts: a
  nested build directory that had previously compiled a *different* `ggml-hrx` carried ~1.3 MB of stale objects.
  Fresh build directories with the engine's own `ExternalProject` arguments are required.
- **Silent arm loss.** `rt-det-direct.sh` takes the box lock on fd 9 and passes it to the `nohup`'d server, so an
  abnormal arm death leaves an orphan holding the flock and every later arm wedges without running. One-word fix
  at the launch site: `... 2>&1 9>&- &`.

### What remains unknown

The fault reproduces on the shipped pin — `pair 2 arm c: FAULT-NaN nan=1 req=34 gtt_start=102G`, build
`10604 = 3971f49bf`, `parse=0` ruling out the format-500 mode — so the shared-memory tile-visibility change does
not eliminate it. The rate study (40 arms on the shipped fix vs 30 on always-stage) was still running when this
entry was written; its per-arm regime gate and truncation accounting must be reported before any rate is quoted
here. No runtime-side ordering gap on the device-to-host path could be named, and no forward-pin fix candidate
survives (the only one proposed is an ancestor of the shipped pin, i.e. a revert). The open candidates are in the
kernel/binding family: GLM is the only model whose decode splits into two 128 KB AQL command blocks (919 + 760
dispatches) with 1,399 barriers per token.

### Instrumentation available for the bisect (implemented, not yet built)

On `f2099e9b7`: a probe on the route the logits actually take (`backend_get_tensor_async` →
`hrx_stream_copy_buffer`) that names the producing graph `value`. It recovers the `ValueId` by searching the
retained `GraphProgram` value maps for the downloaded tensor pointer (`GraphProgram::graph()` exposes the
`ValueMap`; each `Value` holds `const ggml_tensor * tensor`), records at copy time, and scans after the
flush-and-wait that publishes the data, with a `=poison` mode so the reporting path can be proven to fire. It
compiles (single TU). It is deliberately unbuilt and unrun: relinking rebuilds every TU that includes
`backend-context.h`, and that CPU inside a GTT-bound measurement is the confound that already invalidated one run
of this experiment.

bong-water-water-bong pushed a commit that referenced this pull request Nov 14, 2026
…ixes and the #2392 labels)

15 fork commits past 6485e5d69. They include the four host-tier checks the
#327 merge left asserting retired forms (#352, engine#2388, now closed: loom
host tier 87/0), HostWeightCache's gauges and the misaligned-pointer refusal
(#356/#357/#358, engine#2393), and the add-on case labels (#355/#359/#362,
engine#2392). Registry regenerated. hrx_f16_narrowing --write records one
guard GAINED (flash_attention/online_softmax: #347 floors the max before the
scale); none lost.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
bong-water-water-bong added a commit that referenced this pull request Nov 14, 2026
…337/#339), and the engine builds and tests against it (refs #2138) (#2357)

* third_party/llama.cpp: pin to llama.cpp #327's head 2c178f44 (engine#2138)

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

* chat template: build against #327's common_json (engine#2138)

At llama.cpp #327, common/jinja/value.cpp works through common_json (common/json.cpp)
and global_from_json takes one. At that pin 1bit and npu_template_test failed to link
(undefined common_json::is_null() and the rest, then global_from_json<ordered_json>).

- onebit_jinja compiles common/json.cpp. Its JSON_ASSERT is GGML_ASSERT, and the binary
  does not link ggml, so app/jinja_ggml_abort.cpp defines ggml_abort(): the same
  file:line message on stderr, then abort(). ggml.h is read for the declaration only.
- render_chat_template hands the renderer common_json::parse(in.dump()). common_json is
  an ordered_json underneath, so the request's key order survives the round trip.

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

* registry: regenerate at 2c178f44, six reviewed classes are now real architectures (engine#2138)

registry_pins failed after the pin move (recorded e6c80014e, pinned 2c178f44b);
tools/registry_build.py regenerates it (hrx 350, npu 9). Then registry_gaps failed:
six classes docs/arch-gaps.md had declined are mapped at the new pin. Each has its own
converter class, LLM_ARCH_ entry and src/models/*.cpp graph at 2c178f44, so each gets a
mapped_ok reason and a dated note: HrmTextForCausalLM, MuseSparkForConditionalGeneration,
Glm5NextForConditionalGeneration, GraniteSwitchForCausalLM, Lfm3ForCausalLM, and
DFlash2DraftModel. For DFlash2 this is the condition the page set: the converter writes the
conv and selector keys and codebooks, and dflash.cpp builds both heads.

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

* census_watch_test: the classes pin 2c178f44 implements are covered, not declined (engine#2138)

After the registry regenerated at 2c178f44, 22 checks failed. Each one used DFlash2,
Muse Spark, Granite Switch, LFM3, MiniCPM-V 4.7 or MiniCPM-OCR as its example of a
declined or unmapped class, and the live registry now maps all six for hrx.

- Section 15b asserts the four reviewed classes as covered and silent, each with a
  mapped_ok reason and a dated docs/arch-gaps.md note, the way DeepseekV41 moved at 5e6388a5a.
- The FLM pack rows for MiniCPM-V 4.7, MiniCPM-OCR, DFlash2 and LFM3 take the
  hrx-only NPU-gap branch Hy-Memory already used.
- The unmapped FLM example is the same recorded listing against a registry without
  MiniCPM-V 4.7 (the one before this pin), so the listing payload is not edited. The live
  registry's `!! NPU FLM` line for it is checked too.
- The declined-pack example is an inline NeedleForToolCalling entry; LFM3 is no longer declined.

A mutant that drops Lfm3ForCausalLM's mapped_ok fails 15b.

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

* third_party/llama.cpp: pin to #327's merge commit 2f7f04f0 (engine#2138)

#327 squash-merged into 1bit/hrx-vulkan-patched as 2f7f04f0d, which is that branch's head.
It contains the old pin e6c80014 and fork #335 (039edcc55), the commit #327's head lacked.
Regenerated at that tree, the registry changes only the recorded pin: the same 350 mappings
and the same six mapped_ok classes as at 2c178f44.

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

* third_party/llama.cpp: pin to the fork head 912c079d8 (engine#2138)

912c079d8 is 2f7f04f plus llama.cpp#337 (b1fd5e8eb: the parser tools, HRX ctest rows and
working files the #327 squash missed) and #339 (13 HRX tests return 77 without an HRX0
device). Both are tests and tools only, with no src/ggml/include/common change. Regenerated,
the registry changes only the recorded pin.

Full build + ctest at this pin: the same 2 non-linking NPU targets; the only steady failure is
hrx_f16_narrowing_check. Four tests failed under a load average of ~58
(spec_decode_acceptance, tool_help_check_tests, npu_pack_import, npu_serve_smoke_self) and
passed rerun on their own.

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

* engine#2138: pin llama.cpp to 6485e5d69 (the fork head: #345's dequant definitions + #341)

912c079d8 could not link its routed MoE kernels (unresolved exact declaration
'@ggml_codebook_f16_vector4', measured by pi-os3 serving flint). llama.cpp#345
defines the motifs the #327 merge left declared; #341 aligns the HRX suites'
kernel-name checks with the merged tree. Registry regenerated for the pin.

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

* engine#2138: record the 34 narrowing bodies and 11 f16 accumulators the AMD merge brings, by what feeds them

hrx_f16_narrowing.py --write at the #2357 pin (6485e5d69). It refuses to write a
smaller guard set, and none was lost: the 10 guarded bodies are unchanged. The
narrowing baseline header groups the new bodies by the producer of the narrowed
operand: unguarded f32 activations into f16 WMMA tiles (engine#1962's open
question), AMD's routed f16_projection_q{4,5,6}k without this line's guard marker
(engine#2127), dequantized weights, attention probabilities/scales, published
f16 outputs, q8_1 d/s, gated-delta-net state, and one test kernel.
dequant.loom 20 -> 21 is #345's ggml_codebook_f16_vector4. The stale
attention_postprocess_f32_f16 line is dropped (3 -> 0).

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

* engine#2138: pin llama.cpp to ca5aac715 (fork head: the #2388/#2393 fixes and the #2392 labels)

15 fork commits past 6485e5d69. They include the four host-tier checks the
#327 merge left asserting retired forms (#352, engine#2388, now closed: loom
host tier 87/0), HostWeightCache's gauges and the misaligned-pointer refusal
(#356/#357/#358, engine#2393), and the add-on case labels (#355/#359/#362,
engine#2392). Registry regenerated. hrx_f16_narrowing --write records one
guard GAINED (flash_attention/online_softmax: #347 floors the max before the
scale); none lost.

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

* engine#2138: pin llama.cpp to e1be68de6 (fork head: #364, test-hrx-buffer agrees with #356)

The 04:10Z CHANGES at f7d3265 named a regression the #2393 fixes introduced:
after #356 HostWeightCache::clear() keeps the lifetime counts, as AMD's does,
but our test-hrx-buffer still asserted hits == 0 after a clear. #364 makes
that test expect the lifetime counts, so both suites assert one contract.
The fork diff ca5aac715..e1be68de6 is that one test file. Registry regenerated;
the narrowing baselines are unchanged.

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

* engine#2138: pin llama.cpp to a21b25099 (fork head: #365 and two test-only commits)

#365 makes AMD's hrx-loom-jit-test pass the compile configs this line's kernels
require (value_stride, ssm_conv n_t/n_s, copy_transpose_f16 shape), the
remaining unexplained suite in the 05:42Z CHANGES at 1afedb3. The other two
commits (#1c436c2ee, 8ce550f08) are also tests only: e1be68de6..a21b25099
touches no ggml/, src/ or common/ file. Registry regenerated; the narrowing
baselines are unchanged.

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

* engine#2138: pin llama.cpp to ea2d2eb07 (fork head: #2404's hrx-loom-jit-test fixes)

a21b25099..ea2d2eb07 is one test file (tests/hrx-loom-jit-test.cpp, ed1e594f7
and ea2d2eb07): the Dynamic-workload gap is labelled known-fail instead of
failing, so AMD's hrx-loom-jit-test is 6/0/1 known-fail (pi-os3, 07:35Z) and
engine#2404 is closed. No ggml/, src/ or common/ change. Registry regenerated;
narrowing baselines unchanged.

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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant