Repository navigation
engine#315: coherence for host-visible HRX buffers (llama.cpp pin move) - #366
bong-water-water-bong wants to merge 2 commits into
Conversation
…engine#315) third_party/llama.cpp e44c9d01a4d5 -> fb4dff7bbb7a, a descendant: the pin is an ancestor of the new revision, so this is a forward move and not a revert. The single change on the fork side makes coherence unconditional for host-visible buffers. Such a buffer is read directly by the CPU - the generic ggml_backend_tensor_get_async short-circuits for host buffers, so no backend copy runs and nothing in the transfer path orders the device's write against that read. Coherence was gated on direct_host_binding (GGML_HRX_USE_UNIFIED_MEMORY, default off), so the default configuration could read unwritten bytes from the output region. Measured on strixhalo, GLM-4.7-Flash, in-regime at gtt_start 98 GiB: the discriminating run put a fault on the non-coherent side only (default FAULT with the coherent arm clean); every default arm allocates the logits buffer as host-visible non-coherent (0x52) and every coherent arm as HOST_COHERENT (0x56).
PR Reviewer Guide 🔍(Review updated until commit 154fbc3)Here are some key observations to aid the review process:
|
Moving a submodule pin requires regenerating registry/architectures.json, which the ctest case registry_pins (tools/registry_build.py --check-pins) enforces. The architecture data is unchanged - the fork-side change touches ggml-hrx.cpp's buffer allocator, not architecture definitions - so only the recorded pin moves.
|
Persistent review updated to latest commit 154fbc3 |
|
Closing: the candidate did not survive its own pre-registered acceptance campaign, so it must not land. Fix cell: 9 clean / 1 fault in-regime (10.0%, 95% CI 1.8-40.4); control: 3 clean / 1 fault (25%); Fisher p = 0.505 -> acceptance NOT MET (>=60 clean, zero faults required). The stopping rule ended the run at the first fix-cell fault, and the decisive line is that arm itself: hv56=1 means the output region was HOST_COHERENT when it faulted (the same per-arm trace that proved the fix live in the smoke), so a visibility gap in the output region is not a sufficient cause. The fork branch engine-315/host-visible-coherence is left in place as the tested candidate; the full record is in the engine issue #315 and in docs/315-mechanism.md of the evidence branch. The one part of this PR that is independent of the fix is the CI lesson: moving a submodule pin requires regenerating registry/architectures.json (ctest registry_pins), which is why the first run of this PR failed and the second passed. |
Draft. The pin move and the fork-side change are final; the acceptance campaign is running on
strixhalo and
KNOWN-ISSUES.mdwill be updated in this branch with its evidence and the met criterionbefore this is marked ready for review. Opened as a draft now so the CI checks (including
tools/check_pins.py) run while the campaign finishes.What moves
third_party/llama.cpp:e44c9d01a4d5->fb4dff7bbb7a(branchengine-315/host-visible-coherencein 1bit-MONSTER/llama.cpp). The old pin is an ancestor of the new one, so this is forward, not a revert.
The change (fork side, one function)
ggml/src/ggml-hrx/ggml-hrx.cpp, 7 insertions / 3 deletions inbuffer_alloc: coherence becomesunconditional for host-visible buffers.
A host-visible buffer is read directly by the CPU — the generic
ggml_backend_tensor_get_asyncshort-circuits for host buffers, so no backend copy runs and nothing in the transfer path orders the
device's write against that read. Coherence was gated on
direct_host_binding(
GGML_HRX_USE_UNIFIED_MEMORY, default off), so in the default configuration the reader couldobserve unwritten bytes from the output region. That is the whole defect shape: whole-vocabulary NaNs
on one face (Face A,
common/sampling.cpp:587guard thenGGML_ABORT), and output bytes that are notvalid UTF-8 surfacing as an HTTP 500 parse failure on the other (Face B) — the same unwritten/wrong
output landing in two places. Same memory class, one bit, no new allocation path, no configuration
change, and it fixes the default rather than requiring a toggle.
Evidence so far (details and paths to follow in KNOWN-ISSUES.md)
per-layer weight leases are the only downloads, all
hashes_equal=1), and the deferred-writebackpath is a measured hard negative (0
[hrx-wb-fp]records over a complete arm).HRX0_HOST host_visible=1 direct_host_binding=0 memory_type=0x52 size=619520(
619520 = 154880 x 4, matching the Face-A guard'scount=154880) — host-visible, notHOST_COHERENT.gtt_start 98 GiB, alternating default vscoherent): 3 pairs clean/clean, pair 4 default FAULT (Face B: 500 after
unparsed Content-only output) with the coherent arm clean.memory_type=0x52, fix cellmemory_type=0x56(HOST_COHERENT).faces; results, CI and the power statement to be posted here when it completes.