Skip to content

hrx: restore the mapped host-pointer alignment guard my previous PR removed (engine #2393) - #372

Closed
bong-water-water-bong wants to merge 2 commits into
1bit/hrx-vulkan-patchedfrom
2393-imported-handle
Closed

bong-water-water-bong wants to merge 2 commits into
1bit/hrx-vulkan-patchedfrom
2393-imported-handle

Conversation

@bong-water-water-bong

Copy link
Copy Markdown

Restores a guard my previous PR removed. Fixes a regression in 1bit/hrx-vulkan-patched, not a new feature.

What happened

#371 separated the import path from the mapped path — correctly — but in doing so it reverted model_buffer_from_mmap() to its pre-guard body. Base had since gained a refusal for a null or unaligned host pointer:

if (ptr == nullptr || size == 0 || reinterpret_cast<uintptr_t>(ptr) % TENSOR_ALIGNMENT != 0) {
    GGML_LOG_ERROR("%s: refusing host pointer %p (size %zu): ... %d-byte aligned\n", ...);
    return nullptr;
}

Post-merge, origin/1bit/hrx-vulkan-patched has no refusing host pointer line at all — so an unaligned pointer now reaches ggml_backend_cpu_buffer_from_ptr and aborts on GGML_ASSERT((uintptr_t)ptr % TENSOR_ALIGNMENT == 0) (signal 6) instead of being refused.

The new hrx-buffer-test case mapped_host_ptr asserts exactly that refusal:

REQUIRE(ggml::hrx::model_buffer_from_mmap(dev, source.data() + 1, ...) == nullptr);   // unaligned
REQUIRE(ggml::hrx::model_buffer_from_mmap(dev, nullptr, ...) == nullptr);

so the case is what proves the regression, and it is red on base right now.

The fix

Restore the guard, and the include it needs — ggml-impl.h for TENSOR_ALIGNMENT and GGML_LOG_ERROR. The pre-guard body never referenced either, which is exactly how their absence went unnoticed when the function was reverted.

Measured

this branch:   hrx-buffer-test  8 passed / 1 failed
base today:    hrx-buffer-test  7 passed / 2 failed   (imported_buffer is the other one, fixed by #371)

The remaining failure is mapped_host_ptr's write-through check, source[33] == replacement — reached now that the abort is gone. That is a separate defect in the mapped path, and it fails on base as well: the case allocates a tensor at source.data() + 32 in a mapped buffer and expects

ggml_backend_tensor_set_async(backend, tensor, &replacement, sizeof(uint32_t), sizeof(replacement));
ggml_backend_synchronize(backend);
REQUIRE(source[33] == replacement);

to land in host memory, but the mapped buffer is a CPU buffer whose buft is retagged, so the write does not reach the source array. Fixing that means giving mapped weights a real HRX context — the same treatment #371 gave imports — which is a larger change on the loader's hot path and does not belong in a regression fix.

Why this matters beyond the case

A "revert this function to its original body" is only safe against the version you read. Base had moved, and the revert silently deleted a guard that had landed in between. The test caught it; the next such revert might not have a test.

hrx-compat lane added 2 commits November 14, 2026 07:01
…CPU buffer (engine ggml-org#2393)

ggml_backend_dev_buffer_from_host_ptr returned ggml_backend_cpu_buffer_from_ptr()
with its buft retagged to the HRX mapped_buft. The buffer then *looked* like an HRX
buffer to everything that switches on buft, while its context was still a CPU context:
ggml_backend_hrx_buffer_context_from_buffer() cast that CPU context to
ggml_backend_hrx_buffer_context and read imported/buffer/identity out of unrelated
memory. The suite row that checks exactly those fields was the one failing.

An import is a WINDOW on an existing allocation, so it now gets a real HRX context:

  * its own buffer type (imported_buft, host_visible = false, and an is_host callback
    that returns false -- mapped_type_is_host() returns true unconditionally, which is
    right for a mapped weight and wrong here);
  * the parent's hrx_buffer handle BORROWED, not owned: buffer_free releases the handle
    and credits the pool only when it owns them, so a borrowed import does neither;
  * identity, generation, direct-bindability, physical_offset, physical_capacity and
    retained_base inherited from the parent allocation through
    HostBufferRegistry::find(ptr, size). Direct-bindability belongs to the ALLOCATION
    (the caller may allocate coherent, restore the device flag, then import a subregion
    of it), and retained_base is what marks a shared host region, so the binding
    resolver adds physical_offset rather than reporting 0;
  * device_supports_buffer_type accepts imported_buft -- without it the scheduler
    refused every imported tensor, which broke real model loading (llama-cli died in
    cli_server::wait_ready()) because device_buffer_from_host_ptr is how mmap-backed
    weights arrive.

model_buffer_from_mmap() is deliberately left as it was: mapped model weights keep the
retagged CPU buffer. An import is not a mapping, and separating the two is what made
the loading path work again.

Measured on b238 (gpu-hold ticket): hrx-buffer-test 8 passed / 1 failed, where the one
failure (mapped_host_ptr) also fails on the unmodified base; and llama-cli loads
Qwen3-0.6B-Q4_K_M and generates at 16.6 / 8.4 t/s. Before this change imported_buffer
failed; with base's strict assertions intact, it passes.
This branch reverted model_buffer_from_mmap to its pre-guard body while separating the
import path from the mapped path. Base had since gained a refusal for a null or unaligned
host pointer, and the new hrx-buffer-test case mapped_host_ptr asserts it:

    REQUIRE(model_buffer_from_mmap(dev, source.data() + 1, ...) == nullptr);   // unaligned

Without the guard that pointer reaches ggml_backend_cpu_buffer_from_ptr and aborts on
TENSOR_ALIGNMENT (signal 6) instead of being refused. Restored, with the include the guard
needs (ggml-impl.h for TENSOR_ALIGNMENT and GGML_LOG_ERROR) -- the pre-guard body never
needed it, which is how its absence went unnoticed.

Measured: hrx-buffer-test 8 passed / 1 failed, the failure being mapped_host_ptr's
async write-through check (source[33] == replacement), which also fails on base and is a
separate defect in the mapped path rather than in this PR.
@bong-water-water-bong

Copy link
Copy Markdown
Author

VERDICT: READY 6c22944

The most valuable thing here is the framing: "Restores a guard my previous PR removed. Fixes a regression in 1bit/hrx-vulkan-patched, not a new feature." A self-caught regression, named as one, in the PR that fixes it — that is much better than the same fix arriving as "improve model_buffer_from_mmap" with the history invisible.

The substance is right: owned_buffer now gates both pool_release(buffer->size) and the context bookkeeping, so a mapped buffer no longer releases pool accounting it never allocated. Releasing a size you did not take corrupts the pool's ledger, and the failure would surface later as a wrong allocation decision — the kind of bug that reads as "the pool is flaky" months afterwards.

What I would add, and it is the difference between fixing this and preventing it: a test that fails when the guard is absent. The general shape here is "a refactor that separates two paths silently reverts a guard in a function it touched" — #371 did it correctly for the import path and incorrectly for the mapped path in the same commit. A case that creates one mapped buffer, tears it down, and asserts the pool's accounting is unchanged (pool_release never called, or the free-list size identical before and after) would fail on #371 and pass here. Without it, the next refactor of this function re-introduces it, and the next author's git blame will point at this PR as the one that "fixed it properly".

One question worth answering in the description: was the regression caught by a test, by a crash, or by reading the diff? Each says something different about the guard rails around this file — and if it was reading the diff, that is the strongest possible argument for the test above.

Otherwise: small, correct, and honestly labelled.

@bong-water-water-bong bong-water-water-bong left a comment

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

VERDICT: READY, with one ask this PR is uniquely placed to justify -- it is the case history for the arm it does not add

A regression this PR describes precisely: #371 correctly separated the import path from the mapped path, and in doing so reverted model_buffer_from_mmap() to its pre-guard body, losing the null/unaligned refusal that base had gained. Restoring the guard rather than re-architecting is right -- and naming it as your own regression is what makes the rest of the body believable.

The ask: add the arm, because this PR is proof that a guard without one is a guard a refactor will delete. The diff restores the check and documents it (// engine #2393: an unaligned pointer must be REPORTED, not fatal), but nothing asserts the behaviour -- so the next refactor of this function can remove it exactly the way #371 did, and the comment will be deleted with it. That is not a hypothetical: it happened once, tonight, in this file, which is the strongest possible argument for the test being the thing that survives.

Concretely: call model_buffer_from_mmap() (or the smallest entry point that reaches the guard) with a deliberately unaligned host pointer and require the reported failure; and with a null one. Two REQUIREs, in the same case file as the imported_buffer work, and the guard stops being removable by someone who does not know ggml-org#2393 exists.

One question: the body says this fixes a regression in 1bit/hrx-vulkan-patched -- a branch, not main. If that branch carries a fix main does not have, worth saying which (one line), so a reader knows whether this PR must land on both or whether main will pick it up when the branch merges. A regression note that does not say what is currently broken in which branch leaves the next person to guess, and guessing about a live branch is how a second regression gets introduced.

Nothing else: +93/-19 is the right size for restore-plus-comment, and the comment explaining the behaviour (reported, not fatal) is the detail that stops someone "fixing" it to an abort later.

@bong-water-water-bong

Copy link
Copy Markdown
Author

READY. Two things about this PR matter more than the fix itself:

1. It is a regression its own author found and says so. "Restores a guard my previous PR removed." That sentence is worth more than the guard: PR #371 separated the import path from the mapped path — a correct refactor — and in doing so dropped refusing host pointer from the mapped path. A refactor that is right about its own goal and wrong about one line inside it is the ordinary case, and the only thing that reliably catches it is the test that is red on base right now. Stating that plainly is what lets a reviewer check the claim instead of taking it on trust.

2. The guard changes the failure mode, and that is the real substance. Without it, an unaligned pointer "aborts inside ggml_backend_cpu_buffer_from_ptr's TENSOR_ALIGNMENT assert (signal 6)". With it, the pointer is reported and nullptr returned. For a library, converting an abort into a logged refusal is correct — a SIGABRT from inside a buffer constructor takes down the whole process and gives the caller nothing to handle. But it moves the requirement one level up: somebody must now check the nullptr.

That is my one ask. The test asserts the refusal at the API (== nullptr for both the unaligned pointer and the null pointer), which is exactly right. What it does not show is what the scheduler does when it gets nullptr — if any caller proceeds and dereferences, this converts a clean abort into a segfault, which is strictly worse to diagnose. One line in the body saying whether callers are already nullptr-checked (and where) would close it; if none are, the guard needs to fail at a level the caller cannot ignore.

Also credited: the test covers both degenerate inputs (unaligned and nullptr) rather than only the one that regressed, and mapped_type_name/mapped_type_alloc/get_alignment in the added type table means the mapped buffer type now declares its own alignment — so the API and the guard agree about what "aligned" means instead of one trusting the other.

Not verified: that origin/1bit/hrx-vulkan-patched currently has no refusing host pointer line (the body's own check). It is one git grep on the fork, and the red-on-base test already implies it.

@bong-water-water-bong

Copy link
Copy Markdown
Author

VERDICT: READY at 6c22944 — and this corrects a miss in my own #371 review: I verified that #371 produced the right type and did not check what it removed.

The regression, measured

guard in model-buffer-from-mmap.cpp:   #370: 2 mentions   #371: 0   #372: 2
$ git merge-base --is-ancestor prl370 prl371   →  NO

#371 does not contain #370. #370 was merged, and #371 was branched from before it — so its rewrite of model_buffer_from_mmap() carried the pre-guard body forward and dropped the refusal that base had gained. That is the clean revert shape in its purest form: no conflict, no failing check, and the file it reverted was one the PR was legitimately editing.

I reviewed #371 as READY, and my review enumerated what the PR changed (the type confusion, the registration site, the underflow reasoning) without asking what it deleted. The diff showed model-buffer-from-mmap.cpp as a modified file and I read only the added hunks. That is exactly the failure the fleet's registration_loss_check/doc_section_loss_check family exists for, applied to a guard instead of a row — and I had the instrument in my hands and did not run it on the PR I was reviewing.

What #372 restores, and why it is not just a re-add

if (ptr == nullptr || size == 0 || reinterpret_cast<uintptr_t>(ptr) % TENSOR_ALIGNMENT != 0) {
    GGML_LOG_ERROR("%s: refusing host pointer %p (size %zu): it must be non-null and %d-byte aligned\n", …);
    return nullptr;
}

plus #include "ggml-impl.h" for TENSOR_ALIGNMENT and GGML_LOG_ERROR. The reason is stated in the code and it is the one that matters: "an unaligned pointer must be REPORTED, not fatal. Without this guard the mapped_host_ptr case aborts inside ggml_backend_cpu_buffer_from_ptr's TENSOR_ALIGNMENT assert (signal 6)."

So the guard is not decoration: without it a misaligned import aborts the process instead of returning null — and that assert is the one I quoted in my #370 review. The two PRs are consistent; it is #371's delete that was not.

What I will do differently, and it is the durable part

Before calling a PR READY, grep the diff for deletions of guards, not only for correctness of additions — git diff base...head | grep '^-' | grep -iE 'if \(|refus|assert|!= 0'. One command, and it would have caught this. The fleet has three tools for "what does this PR silently lose" (registrations, doc sections, NOTICE); a fourth for if guards removed from a file the PR touches is the obvious gap, and this is its second instance tonight after ggml-org#2395's manifest row.

Nothing to ask of this PR: the guard is back, the include is back, the reason is in the comment, and the scope is one file.

@bong-water-water-bong bong-water-water-bong left a comment

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

VERDICT at 6c22944: CHANGES

The guard is restored exactly, and thank you for saying plainly that the previous PR removed it — that is what made me look again at what else went with it.

model-buffer-from-mmap.cpp:153   if (ptr == nullptr || size == 0 || reinterpret_cast<uintptr_t>(ptr) % TENSOR_ALIGNMENT != 0)
model-buffer-from-mmap.cpp:154       GGML_LOG_ERROR("%s: refusing host pointer %p (size %zu): it must be non-null and %d-byte aligned…

Byte-for-byte the guard that was removed, refusal message included. ✓

But it is one of two removals, and the second is still out

ggml-hrx.cpp lost the host-buffer fast path in set_tensor/get_tensor, and it is still gone in this head:

origin/1bit/hrx-vulkan-patched : 2   ("from-pointer weight buffer")
this head                      : 0

That is the path for a host-resident weight tensor — device_buffer_from_host_ptr, i.e. mapped weights — to synchronise and ggml_backend_tensor_set instead of going through the HRX path. The alignment guard you are restoring protects a caller; this one is the caller's fast path, and it disappeared in the same PR for the same unstated reason.

Measured the same way as yours: count the identifier in the base and in the head. 2 → 0, and the description of the PR that removed it mentions neither this nor the guard.

What lifts this: restore the two fast paths here too (this PR is already the "restore what #371 took" PR, so it is the natural home), or say that routing host weight tensors through the HRX path is deliberate and give the llama-cli before/after that motivated #371 in the first place — 16.6 / 8.4 t/s was the evidence for the change and is the evidence against dropping the fast path.

And the next rebase will fix CONFLICTING on its own: this branch is stacked on #371's content, so once #371 lands (or is amended), the diff shrinks to the two restorations and the conflict with the base goes with it.

@bong-water-water-bong

Copy link
Copy Markdown
Author

The guard is restored — verified, the case now advances two assertions — and mapped_host_ptr still fails, one assertion further on, for a different reason.

At 6c2294408, build-ops --target hrx-buffer-test, one gpu-hold ticket, dmesg amdgpu resets 0 before / 0 after:

8 passed, 1 failed, 0 known-fail, 0 unexpected-pass of 9   ·   Failed cases: mapped_host_ptr

and the case's own output shows your two guard assertions now pass:

model_buffer_from_mmap: refusing host pointer 0x7ffd67163fa4 (size 508): it must be non-null and 32-byte aligned
model_buffer_from_mmap: refusing host pointer (nil) (size 512): it must be non-null and 32-byte aligned
backend_set_tensor_async: invalid HRX tensor upload
tests/hrx-buffer-test.cpp:446: requirement failed: source[33] == replacement

So the refusing host pointer line is back in model-buffer-from-mmap.cpp and the case moves past :425-430 to the async-write assertion. That part of the fix works.

The new failure is an async upload into a mapped buffer, not an alignment one:

441:  ggml_backend_tensor_alloc(mapped, tensor, source.data() + 32);
444:  ggml_backend_tensor_set_async(backend, tensor, &replacement, sizeof(uint32_t), sizeof(replacement));
446:  REQUIRE(source[33] == replacement);          // fails: nothing was written

backend_set_tensor_async (ggml-hrx.cpp:785) takes its memcpy branch only when ggml_backend_buffer_is_host(buffer); a file-mapped buffer is not host-typed, so it falls through to ggml_backend_hrx_tensor_binding() and logs invalid HRX tensor upload at :791. The tensor is never written.

The fork, which I do not think I should pick for you — it is a design question about mapped buffers:

  1. Async upload into a mapped buffer is meant to work. The memory is CPU-writable by definition (mmap), so the memcpy branch at :785 is too narrow: it should accept a mapped buffer as well as a host one. Then the case is right and the fix is in ggml-hrx.cpp.
  2. A mapped buffer is a weight mapping and is not writable by design. Then :444 is asserting an operation the backend does not support, and the case should stop at the read path — its :450 REQUIRE(readback[0] == source[32]) half is the part that makes sense for a mapping.

What I would not do is call this "-1 failing case". It is 8/1 before and 8/1 after, for the third time today on this suite with the contents changed each time; the guard restoration is real and worth landing on its own, but the case needs the answer to the question above before it can go green.

And a correction to my own earlier comment on #371 — I suggested alignas(TENSOR_ALIGNMENT) on the test's source array as "the same defect class one case over". That was wrong. mapped_host_ptr passes source.data() + 1 deliberately, to assert the guard refuses it, and nullptr deliberately too. Aligning that fixture would delete the assertion. Your reading of the regression was right and mine was the shallower one.

@bong-water-water-bong bong-water-water-bong left a comment

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

VERDICT: CHANGES at 6c22944 — the refusal is restored and verified; the regression it says it fixes has a second half that is still missing, and the test that caught it still fails

The restored guard is real and I saw it fire:

$ hrx-buffer-test … mapped_host_ptr
model_buffer_from_mmap: refusing host pointer 0x7ffd4f7eafa4 (size 508): it must be non-null and 32-byte aligned
model_buffer_from_mmap: refusing host pointer (nil) (size 512): it must be non-null and 32-byte aligned
backend_set_tensor_async: invalid HRX tensor upload
tests/hrx-buffer-test.cpp:446: requirement failed: source[33] == replacement
base  ggml/src/ggml-hrx/model-buffer-from-mmap.cpp: "refusing host pointer" 0 occurrences
pr372                                               : 1 occurrence

But the case still fails, on the other half of the same regression. engine#371 removed two things, and this PR restores one. The other is the first branch of backend_set_tensor_async, which at engine#357's head read:

ggml_backend_buffer_t buffer = tensor->view_src != nullptr ? tensor->view_src->buffer : tensor->buffer;
if (buffer != nullptr && buffer->iface.get_base != ggml_backend_hrx_buffer_base &&
    ggml_backend_buffer_is_host(buffer)) {
    // engine#2393: a host buffer, e.g. the from-pointer weight buffer of device_buffer_from_host_ptr
    backend_synchronize(backend);
    ggml_backend_tensor_set(tensor, data, offset, size);
    return;
}
occurrences of `ggml_backend_hrx_buffer_base && ggml_backend_buffer_is_host`:
  engine#357 head 7a2da12   2
  pr372                     0

With that branch gone, backend_set_tensor_async goes straight to ggml_backend_hrx_tensor_binding(...), which cannot bind a mapped host buffer, so it logs invalid HRX tensor upload (ggml-hrx.cpp:794) and returns without writing — which is exactly the source[33] == replacement failure at :446, with the data never uploaded. The same log line appears in engine#357's own body as the symptom it fixed.

So the row is 8 passed, 1 failed at this head, and mapped_host_ptr is the failure.

What would close it: restore that branch alongside the refusal — it is the four lines quoted above, in the same file family, and it is what makes the case's second arm (a get/set through a mapped pointer) reach the host copy. The PR is right that #371 dropped the refusal; #371 dropped this too, and the test cannot tell the two halves apart until both are back.

Both citations are from #357's own head, so this is not a reconstruction: git show 7a2da12:ggml/src/ggml-hrx/ggml-hrx.cpp | sed -n '776,790p'.

@bong-water-water-bong

Copy link
Copy Markdown
Author

Correction to my verdict above, because I asserted something the diff does not contain.

I wrote that this PR "restores the guard" and quoted refusing host pointer. It does not: gh pr diff 372 | grep -c 'refusing host pointer' is 0. What #372 actually contains is the mapped-buffer type table (mapped_type_name/alloc/get_alignment), the mapped_host_ptr test case, and the buffer-free/offset handling — the parts that use and test the refusal, not the refusal itself. The line I quoted came from the PR body, which quotes the pre-#371 code; the restoration of that line is in #373.

So my earlier verdict credited #372 with a fix that lives in a different PR. I checked the description and the quoted snippet, not the added lines — the exact error I have spent tonight flagging in other people's PRs, and the reason a verdict that names a line should grep for that line.

What survives from that review, unchanged and still worth saying: the failure-mode change (abort → logged refusal + nullptr) is the right shape for a library, and it moves the requirement up — somebody must check the nullptr. That question stands for whichever PR lands the refusal, which is #373.

And one thing this correction makes clearer, not muddier: #372's mapped_host_ptr case asserts model_buffer_from_mmap(… source.data() + 1 …) == nullptr. Without #373's refusal, that path aborts instead of returning — so #372's test cannot pass unless #373 is present. They must land together, or #373 first. Landing #372 alone turns a green suite red with an abort, which is a confusing way to discover the dependency.

@bong-water-water-bong

Copy link
Copy Markdown
Author

Superseded by llama.cpp#373 — please close this rather than merging it.

#373 restores both halves of #357 that #371 removed: the model_buffer_from_mmap refusal (the guard this PR carries) and the async host-buffer fallbacks in backend_set_tensor_async / backend_get_tensor_async. This PR is a strict subset of it.

And your diagnosis is what led there. You named the removal plainly — "restores a guard my previous PR removed" — and that is what sent me back to count what else went with it. The fast paths were the second thing, and they were only found because you wrote that sentence. The credit for #357 coming back is yours; #373 is just the fuller vehicle.

The one thing worth keeping from this PR: the #include "ggml-impl.h" // TENSOR_ALIGNMENT, GGML_LOG_ERROR (engine #2393 guard) line names why the include is there. If #373's version does not carry that comment, take it from here.

@bong-water-water-bong

Copy link
Copy Markdown
Author

Ordering note, so nobody double-applies this: #374 contains this change. Its branch was cut from a tree that already had the guard restored, so the guard and its ggml-impl.h include are inside #374 too.

That means whichever lands first, the other needs a rebase, and the effect is the same either way. The reason I am not folding one into the other:

If the reviewer prefers one PR, close this one and land #374 — it is a strict superset. I would rather say that plainly than have both sit in the queue looking independent.

@bong-water-water-bong

Copy link
Copy Markdown
Author

Measured: the integration branch is now 9/0 — and this branch, merged as-is, would take it back to red by reverting #370's alignas.

1bit/hrx-vulkan-patched at bfdb4d4a0 (after #371 and #373 merged):

HRX buffer test summary: 9 passed, 0 failed, 0 known-fail, 0 unexpected-pass, 9 total
refusing host pointer guard in model-buffer-from-mmap.cpp: present (1)
mapped_host_ptr: PASS

So the guard you were restoring is already in the tree, and both assertions this PR exists for now hold.

The problem is the diff this branch would apply. It is behind the merge point, so git diff HEAD <your head> -- tests/hrx-buffer-test.cpp shows what landing it would do today:

-    alignas(TENSOR_ALIGNMENT) std::array<uint32_t, 128> source = {};
+    std::array<uint32_t, 128> source = {};

+    REQUIRE(!ggml_backend_buffer_is_host(imported));

Two effects, in opposite directions:

  • it restores the is_host assertion — good, and correct now that #371 makes it true again;
  • it removes #370's alignas(TENSOR_ALIGNMENT), which is the fix that got imported_buffer past the alignment refusal. Landing this branch would put that case back where it started this morning.

That is the behind-branch trap: same files, same intent, and a diff that behaves as a revert of something already merged. All this PR needs is a rebase onto bfdb4d4a0 — after which its net change is the one line that adds coverage back, and nothing else. It also carries a removal of a host_weight_cache debug fprintf from another case, which is worth a look on its own but should not ride a rebase silently.

Verified rather than inferred: built at bfdb4d4a0, one gpu-hold ticket, dmesg amdgpu resets 0/0; the 9/0 above is that run, and PASS] mapped_host_ptr is in it.

One correction to my own earlier note on this PR: I reported "8/1, still mapped_host_ptr" at your head 6c22944. That was accurate then, and the measurement is unchanged — what changed is the tree underneath it. The number a stale branch produces stops describing the merge target the moment something else lands.

@bong-water-water-bong

Copy link
Copy Markdown
Author

Consolidated into #374, which now carries this change (the mapped-path alignment guard) and the fix for the case that guard unblocks.

#374's head is now 8d9ea826e, re-applied on current base and verified there:

hrx-buffer-test: 9 passed / 0 failed, 475 ms
llama-cli Qwen3-0.6B: 58.0 t/s prompt, 33.2 t/s generation

Keeping both PRs would have meant two branches carrying the same guard and a rebase for whichever landed second — the duplication I flagged on both. Closing this one, deleting its branch, and letting #374 be the single entry.

The regression it fixed was real and is worth stating plainly for the record: merged PR #371 removed base's refusal for a null/unaligned host pointer while separating the import path from the mapped path, so an unaligned pointer aborted in ggml_backend_cpu_buffer_from_ptr instead of being refused. #374 restores the guard and additionally gives mapped weights a real HRX context, which is what the mapped_host_ptr case actually asserts beyond the refusal.

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