Repository navigation
Description
Scope
Track correctness and backend coverage for the existing draft-mtp implementation on SpacemiT, starting with Qwen3.5-0.8B Q8_0. The speculative decoding framework already exists; this work concerns CPY layouts and Q8_0 IME2 execution/readback used by the target and MTP graphs.
Problems covered by the candidate
- CPY transpose wrapper extents and overly broad supported-layout claims.
- CPY batch-stride validation against the dense plane size, including singleton dimensions.
- Q8 IME2 four-row accumulation/scaling order.
- Q8 IME2 four-row tail stores.
- Canonical Q8_0 readback/copy behavior for repacked tensors.
- Keeping scalar Q8_0 inputs in canonical layout and rejecting unsafe packed views.
A six-commit candidate is available on Gingkoleaves/llama.cpp:ospp/mtp-after-scale. These are backend correctness changes, with a host CPY regression test; no new public API or replacement MTP framework is proposed.
Dependencies and related work
- Eval bug: draft-MTP crashes on SpacemiT K3 with a SET_ROWS index assertion #73 / ggml-spacemit: apply bias in the RVV F32 scale kernel #74: missing F32 SCALE bias can feed invalid reverse indices to SET_ROWS. That fix is maintained separately. The MTP candidate is stacked on ggml-spacemit: apply bias in the RVV F32 scale kernel #74 until it is merged; the final MTP diff should exclude the prerequisite.
- Compile bug: K1 IME1-only build still compiles IME2 SPE kernels #75 / ggml-spacemit: gate IME kernels on compiler support #76: K1 compiler gating is a separate build fix and is not included in this branch. K3 validation does not depend on that PR; a K1 integration may need both.
- ggml spacemit prefill opt #49: existing prefill/MTP verification optimization is related work already in the target baseline, not an additional patch in this submission.
Evidence and current limits
- Public base:
e50504b54a4fe5d4b2314ffaf57583ffc4cf9a6b; combined SCALE + six-fix tree:e1cea1c337ea66462cc1a2c0c9e460c7a4b9e9b2. The uploaded trees match the prepared local commits exactly. - Fresh host regression:
python3 tests/spacemit-review/test_cpy_transpose_bounds.pypasses 1,872 shape configurations and 4,096 paired batch-stride configurations; dimension-swap and prior singleton-stride mutations are rejected. This checks production guard/wrapper addresses and bytes, not RVV assembly or full graph execution. - Saved K3 short-run evidence for the recomposed e50504b candidate records 6/6 checks and 4/4 synthetic MoE operator checks. The earlier full K1/K3 30/30 evidence belongs to the e0804fe combined candidate, not this newly published commit chain.
- Full-model 35B testing, full CI, and fresh per-change performance attribution are not complete. Synthetic MoE fixtures do not substitute for a full-model run.
Validation to complete
Use identical model bytes, prompt tokens, sampling settings and generation limits for MTP off, draft maximum 2 and 3; retain token IDs, text, stop conditions, proposals and accepted prefixes. Save exact source trees, toolchains, runtime libraries and backend placement evidence.
The Chinese/English acceptance-rate gap remains under investigation. Compare generic CPU (x86 or RISC-V without the SpacemiT backend) and K3 on multiple frozen prompt sequences and the same prefixes, logging draft/target top-1 and prefix acceptance at each step. A backend precision defect is not established merely by different aggregate acceptance rates.
The candidate will remain a draft pending review and remaining native validation.
AI assistance was used for implementation, test preparation, evidence review, and this report.
Activity