Skip to content

MoE streaming: prefetch off the decode path, time split measured (pin llama.cpp-vulkan a29be7f) - #154

Merged
bong-water-water-bong merged 2 commits into
mainfrom
moe/prefetch-worker
Sep 26, 2026
Merged

bong-water-water-bong merged 2 commits into
mainfrom
moe/prefetch-worker

Conversation

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator
  • Pins third_party/llama.cpp-vulkan to a29be7f (fork PR README thank-you and a complete third-party NOTICE, ahead of going public #20). The gate-ahead prefetch is now scored on a worker thread, ONEBIT_MOE_PREFETCH=N sets how many layers ahead it looks (default 1), and ONEBIT_MOE_STATS=1 prints where decode time goes. The fork PR also fixes its CI Test step (Zamba/Zamba2/BlackMamba in test-llama-archs, and the saver for Zamba v1).
  • docs/moe-streaming.md gets a new section, "Where streamed decode spends its time":
    • Coder-30B at 4608 slots: prefetch went from 28 tok/s (the old inline scoring) to 43.5-44.8 tok/s, against 42 with prefetch off.
    • The host round trip per layer caps streamed decode at about 57 tok/s.
    • At 1536 slots the drive is the limit.
    • Next item 1 is rewritten.
  • Perplexity with prefetch 1 and 2: 21.1029, identical to all-Vulkan.

🤖 Generated with Claude Code

… llama.cpp-vulkan a29be7f)

Fork PR #20: the gate-ahead prefetch is scored on a worker thread, ONEBIT_MOE_PREFETCH sets how
many layers ahead, and ONEBIT_MOE_STATS prints where decode time goes. The PR also fixes the
fork's test-llama-archs/save-load tests for Zamba, Zamba2 and BlackMamba.

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

context7 Bot commented Sep 26, 2026 •

Copy link
Copy Markdown

Docs7 for 1bit-monster/engine

Result Status Action
Deployment ➖ Not used —
Content review ➖ Did not run. This site has no agent runs available this month. Wait for the monthly reset or check your Docs7 plan. —

Commit 4441a6b

@github-actions

github-actions Bot commented Sep 26, 2026 •

Copy link
Copy Markdown

PR Reviewer Guide 🔍

(Review updated until commit 4441a6b)

Here are some key observations to aid the review process:

🎫 Ticket compliance analysis 🔶

20 - Partially compliant

Compliant requirements:

  • README thank you section added
  • NOTICE file updated with complete third-party attribution
  • All copyright lines in NOTICE come from project's own LICENSE or source headers
  • Vendored Lemonade attributed to AMD with changes noted
  • Every pinned submodule attributed
  • Every library fetched by CMake attributed at pinned version
  • Compound licenses stated exactly
  • AMD's NPU firmware noted as not redistributed

Non-compliant requirements:

  • None

Requires further human verification:

  • Verification that all attribution details in NOTICE match the actual source code and licenses
  • Confirmation that the README thank you section accurately reflects the contributions
⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
🧪 No relevant tests
🔒 No security concerns identified
⚡ Recommended focus areas for review

Performance Claim Verification

The PR claims that prefetch moved off the decode path improved performance from 28 tok/s to 43.5-44.8 tok/s at 4,608 slots. This performance improvement must be verified with actual measurements on the target hardware (AMD Strix Halo's XDNA 2 NPU) to ensure the claim is accurate and not overstated.

| streamed, 1,536 slots (25%) | 8-10 |

Through `1bit serve` (a 128-token chat answer, three requests): 18.9, then 28.3 and 27.1 tok/s
at 4,608 slots; 7.1, 6.6 and 6.0 at 1,536. The answers match the resident model's. With the
prefetch moved off the decode path (below), 4,608 slots gives 17.1, then 38.9 and 39.0.
Hardware Limitation Clarification

The PR states that "The host round trip caps streamed decode at about 57 tok/s" and that "At 1,536 slots the drive is the limit." These claims need to be validated with actual hardware measurements to confirm they accurately reflect the performance characteristics of the system.

- **The round trip caps streamed decode.** 0.37 ms between remaps x 48 layers is 17.6 ms per
  token, about 57 tok/s, against 12.5 ms (80 tok/s) resident. Each layer's routed ids go to the
  host and its slot indices come back before the expert matmuls can run.
- **Prefetch now pays a little.** Its router scoring first ran inside the remap op, scalar, at
  about 0.15 ms per layer: prefetch cost 4,608 slots a third of its speed (28 against 42
  tok/s). A worker thread now scores the next `ONEBIT_MOE_PREFETCH` layers (default 1) off the
  decode path.
- **At 1,536 slots the drive is the limit.** About 88 misses x 2.1 MB per token is 185 MB, and
  at 10 tok/s that is about 2 GB/s through `O_DIRECT` on a drive shared with other tenants. More
  reads in flight (`ONEBIT_MOE_IO` 4 to 32) didn't help, and prefetch trades demand misses for
  wasted reads (80 against 61 GiB over the run). What helps here is reading fewer bytes: a
  better hit rate (item 2 below) or smaller experts.

@github-actions

Copy link
Copy Markdown

Persistent review updated to latest commit 4441a6b

@bong-water-water-bong
bong-water-water-bong merged commit f964645 into main Sep 26, 2026
11 checks passed
@bong-water-water-bong
bong-water-water-bong deleted the moe/prefetch-worker branch September 26, 2026 17:43
bong-water-water-bong pushed a commit that referenced this pull request Sep 26, 2026
…59f6d37a by accident)

# Conflicts:
#	third_party/llama.cpp
bong-water-water-bong added a commit that referenced this pull request Sep 26, 2026
…159)

tools/check_pins.py fails a pull request whose submodule pin is behind or
diverged from main's (#154 dropped ZAYA1-VL that way); the "pin rollback"
label skips it. tools/issue_agent.py + issue-agent.yml: a first pass on
issues from outside authors with the local PR-Agent model, which only picks
a label; comments are templates (form fields, registry lookup, Q&A pointer).
RFCs: discussions #157 and #158.

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 30, 2026
…epSeek-V4.1-Flash, GET_ROWS bound)

third_party/llama.cpp: `d8d2f5b39f22` -> `5e6388a5a852` (1bit-MONSTER/llama.cpp 1bit/hrx-vulkan-patched).
third_party/hrx-system stays at `82804197bcbe` (the commit config/hrx-long-prompt-validated-pin.config names).

Fork commits new to the engine:

- `fe04824` ggml-hrx: an env-gated host-gap profiler (engine #572) (#154)
- `b8861a9` kv: verify the zero padding of the KV cache, and repair it (engine #528) (#155)
- `9e8453a` model: DeepSeek-V4.1-Flash (deepseek41) port of upstream #31086 + #31300 (#156)
- `f61f290` dsv41: drop the dead llm_arch_supports_mixed_batch definition (#157)
- `01d7df4` dsv41: the deepseek41 and DSpark graphs never expanded their output (#158)
- `5e6388a` ggml-hrx: GET_ROWS for a table over 262208 rows (engine #572) (#159)

44 files, +4,289/-209: a new model architecture (deepseek41), the KV zero-padding repair, the
GET_ROWS row/byte bound with its matcher, the host-gap profiler, and their tests
(test-backend-ops cases, test-kv-zero, test-llama-archs).
bong-water-water-bong added a commit that referenced this pull request Oct 31, 2026
* Bump HRX: llama.cpp 5e6388a5a (host-gap profiler, KV zero padding, DeepSeek-V4.1-Flash, GET_ROWS bound)

third_party/llama.cpp: `d8d2f5b39f22` -> `5e6388a5a852` (1bit-MONSTER/llama.cpp 1bit/hrx-vulkan-patched).
third_party/hrx-system stays at `82804197bcbe` (the commit config/hrx-long-prompt-validated-pin.config names).

Fork commits new to the engine:

- `fe04824` ggml-hrx: an env-gated host-gap profiler (engine #572) (#154)
- `b8861a9` kv: verify the zero padding of the KV cache, and repair it (engine #528) (#155)
- `9e8453a` model: DeepSeek-V4.1-Flash (deepseek41) port of upstream #31086 + #31300 (#156)
- `f61f290` dsv41: drop the dead llm_arch_supports_mixed_batch definition (#157)
- `01d7df4` dsv41: the deepseek41 and DSpark graphs never expanded their output (#158)
- `5e6388a` ggml-hrx: GET_ROWS for a table over 262208 rows (engine #572) (#159)

44 files, +4,289/-209: a new model architecture (deepseek41), the KV zero-padding repair, the
GET_ROWS row/byte bound with its matcher, the host-gap profiler, and their tests
(test-backend-ops cases, test-kv-zero, test-llama-archs).

* registry+census: derive the new pin's data (DeepSeek-V4.1-Flash now maps)

Two generated/reviewed data sets derive from the pinned backends, and the pin move has to carry
both or the tree's own checks go red at the new pin. Reported by CI on the bump head; both
reproduced locally first.

**registry (ctest registry_pins):**
"llama.cpp (hrx) recorded at d8d2f5b39, pinned at 5e6388a5a" - `tools/registry_build.py`
regenerated `registry/architectures.json` at the new pin: source string, plus
`DeepseekV41ForCausalLM -> deepseek41, hrx`, counts hrx 293 -> 294. That map is legitimate at
`5e6388a5a`: `conversion/__init__.py` maps the class, `src/llama-arch.cpp` registers
`LLM_ARCH_DEEPSEEK41`, and `src/models/deepseek41.cpp` implements hparams/tensors/graph/engram
(fork #156 = upstream #31086 + #31300). The class had been reviewed as *not an alias* of
`deepseek4`, so `--check-gaps` correctly refused a silent map: `registry/significant.json` now
carries a `mapped_ok` reason naming the commit and the port, its `family` text no longer claims
the pinned path runs "neither", and `docs/arch-gaps.md` gets the dated note (the "not mapped"
recheck it quotes was against `6b397ee9`, before the port). `tests/registry_gaps_test.py`'s
committed-state invariant changes from "no reviewed class is a key in the registry" to "every
reviewed class the registry maps carries a non-vacuous `mapped_ok`", with the CLI case driven by
a class that genuinely has no reason.

**census (ctest census_watch):** the watcher's test listed `DeepseekV41ForCausalLM` among the
classes reviewed *report-only* (#522: "needs real support: engram + candidate blocks"), which is
exactly what the new pin changes. The entry moves out of that table and becomes an assertion of
the opposite: the same model is now COVERED, exit 0, with no `significant` alert and no
`reviewed_report` line - alerting on a class the engine supports is the false alarm this watcher
exists to avoid.

`registry/census.json` itself needs no regeneration: it is the Hugging Face snapshot
(`date`/`coverage`/`raw`, written by `tools/census.py`), not pin-derived.

Green locally at this pin: `registry_build.py --check-pins`, `--check-gaps`,
`tests/registry_gaps_test.py`, `tests/census_watch_test.py`.

---------

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant