Repository navigation
(Do not merge)Minicpm v4.7 q80 - #1259
michyu-amd wants to merge 33 commits into
Conversation
Copy of MiniCPM_V_BF16/decoding with a new model type QWEN3_5_08B_Q80[_SL]: Q8_0 projections and lm_head, bf16 ssm alpha/beta. Every other type builds the same MLIR and kernel code as before. - models/qwen3.5-08b-q80.h, iron ModelArch/config for the new type; KERNEL_RNE_MASK defaults to 1512 for it. - proj_main.cc: the Q8_0 lm_head runs through mvm() on whole q80 blocks (the weight buffer now holds one); mvm_q80_half is left out of that build. - iron/proj_tile.py: for Q8_0 the proj-mode RTP is pinned at 33280 and made 64 bytes long, so the weight buffer after it stays 64-byte aligned. - host: Q8_0 package path (detection, layout, CPU dequant, whole-block lm_head in 8 streams), the CPU lm_head now covers a last partial row block, and --stateless drives _SL xclbins like the engine does. Co-Authored-By: Claude <noreply@anthropic.com>
Add a converter path for MiniCPM-V-4.7-1B with Q8_0 language weights, from llama.cpp's BF16 GGUF (no llama-quantize): - configs/minicpm_v_1b_q80.json: the bf16 name map with every language Linear and lm_head marked Q8_0; embedding, norms, ssm_a/dt/conv1d and ssm_alpha/beta (+ .bf16 twins) stay BF16. - q4nx/constants.py: ModelArch.MINICPM_V_1B_Q80, selected only with -f minicpm-v-4.7-1b-q80 (listed before the 1B entry because -f matching is by prefix). Auto-detection is unchanged. - q4nx/models/minicpm_v_q80.py: MiniCPM_V_1B_Q80 reuses the bf16 converter, then quantizes the Q8_0 tensors with its own code: bf16 scale first (amax / 127), round half to even against that scale, clamp +-127, zero group d = 0 / q = 0. Blocks are written in the kernel layout, I8 [rows/32, cols/256, 8704] (bf16 scales group major, int8 column major); lm_head is zero-padded to 248,320 rows. - README.md: short notes on the path, the maths and the layout. The bf16 and Q4 converters give byte-identical model.q4nx before and after this change. Co-Authored-By: Claude <noreply@anthropic.com>
… engine First step of the Q8_0 MiniCPM-V-4.7-1B engine: a pure copy of detail/minicpm_v_4_7_bf16_npu (and its public header) under new names, still running the bf16 logic. The Q8_0 weight path comes in later commits. - detail/minicpm_v_4_7_q80_npu/, include/models/minicpm_v_4_7_q80/: class, library, file names, namespaces (mcv_q80, mcv_q80_npu, mcv_q80_cpu_func, mcv_q80_mm, mcv_q80_nan, minicpm_v_q80_cpu, minicpm_q80_reconfig, minicpm_q80_wait), every global minicpm_v_bf16_* type, the C state API and the include guards renamed, so the two engines share no symbol when one process loads both. Environment variable names stay shared with the other MiniCPM-V engines. Undoing the renames gives the bf16 files byte for byte. - engines.json: the engine with family minicpm-v-4.7-q80 and no model yet (the tag, its kernel assignment and RTP lock stanza come with the catalog entry). - build_units.json: the MiniCPM_V_Q80/decoding unit (QWEN3_5_08B_Q80_SL). This also fixes devkit_check, which was red since the kernel commit added that Makefile without a unit. - build_minicpm_v_4_7_q80.sh: builds the engine. Checked: both engines build (XRT, g++-13) with the same warnings; no engine-own symbol is exported by both libraries; with both libraries in one process and the bf16 package and xclbins, the copy gives the same prompt ids, answer ids and text as the bf16 engine (two pictures and a text prompt, either engine first), and the host_ref gate dumps are equal byte for byte. devkit_check --pending-ok: ok. Co-Authored-By: Claude <noreply@anthropic.com>
Decode streams the stored Q8_0 blocks (8,704 B, 32 x 256) to the MiniCPM_V_Q80 layer design: projections in row-block pairs, the lm_head as the 25th run in the Q8_0 stream layout (270,172,160 B). alpha/beta stay bf16. Every Q8_0 weight offset is checked to be 64-byte aligned. Prefill packs bfp16 from the same weights: at load each Q8_0 tensor is turned into row-major bf16(q * d), round to nearest even, in integer math so bf16 denormal scales do not depend on the FPU's flush-to-zero mode. bfp16_mm is unchanged. The host paths (CPU builds, fallbacks, the DECODE=cpu lm_head) read the Q8_0 blocks through the existing q8_0 block decoder. The embedding stays the package's bf16 table. Co-Authored-By: Claude <noreply@anthropic.com>
Conflict resolution (16 files): - Main's side (bf16 PR #1220 shipped files): src/lib/{xrt,hrx}/minicpm_v_4_7_bf16_npu.dll, src/xclbins/MiniCPM-V-4.7-1B-BF16-NPU2/*.xclbin (8), src/model_info.json, src/wix/flm.wxs, flm-dev-kit/FLM_Xclbin/rtp_addresses.lock.txt (main's is ours plus the MiniCPM5 stanza). - Both sides: q4nx/constants.py (MINICPM5_MOE, MINICPM_V_1B_BF16, MINICPM_V_1B_Q80 in that order; Q80 names and config entries kept), q4nx/models/__init__.py (minicpm_v_q80 and minicpm5 imports, __all__ has both), FLM_Xclbin/build_units.json (MiniCPM_V_Q80/decoding kept). src/lib and src/xclbins now equal origin/main. The q80 converter output is unchanged (model.q4nx sha256 d2cba34e...4964d9). Co-Authored-By: Claude <noreply@anthropic.com>
…e weights)
Wire the Q8_0 engine (minicpm_v_4_7_q80_npu) into the app as family
minicpm-v-4.7-q80, tag minicpm-v-4.7-q80:1b, weights folder
MiniCPM-V-4.7-1B-Q80-NPU2. Mirrors the minicpm-v-4.7-bf16:1b app side.
- modeling_minicpm_v_q80.{hpp,cpp}, modeling_minicpm_v_q80_image.cpp: the
bf16 wrapper under q80 names, for the q80 engine class, its image types
and its state API.
- The engine's app header, the frontend / backend registration, the
builtin-engine family list, the engine link list, the server's raw-RGB8
image check and the CI engine table (changes.py).
- engines.json: the engine's model tag; kernel_assignment.json / .md: the
model's kernels (layer.xclbin from MiniCPM_V_Q80/decoding
QWEN3_5_08B_Q80_SL, every other slot the bf16 model's artifact); the
RTP lock stanza of the Q80_SL decode artifact.
- model_list.json: the catalog entry (upload fields are placeholders).
- src/test/minicpm_v_4_7_q80_npu: the test harness (prompt, cached
follow-up, clear_context, picture).
The Windows installer entries follow after the dev-kit swap.
Co-Authored-By: Claude <noreply@anthropic.com>
Brings in #1257 (MiniCPM sampling defaults = the model card). Conflict resolution: - flm-dev-kit/FLM_Q4NX_Converter/q4nx/models/__init__.py: one conflict on the __all__ line (the merge had two merge bases; the virtual base had two __all__ lines). Kept both sides: main's list plus our 'MiniCPM_V_1B_Q80' after 'MiniCPM_V_1B_BF16'. The result equals this branch's file. Auto-merged with no net change here: q4nx/constants.py, FLM_Xclbin/rtp_addresses.lock.txt. Co-Authored-By: Claude <noreply@anthropic.com>
Same change #1257 made for minicpm-v-4.7-bf16: top_k 20 -> 100, top_p 0.8 -> 0.95, rep_penalty 1.0 -> 1.03 (temperature 0.7, min_p 0, no presence penalty unchanged), with the same comment. Co-Authored-By: Claude <noreply@anthropic.com>
FastFlowLM/MiniCPM-V-4.7-1B-Q80-NPU2 is on Hugging Face (commit e518368b). model_info.json gets its file list (git oids, sizes, lfs sha256) from the repo's tree API, unchanged; model_list.json sets flm_min_version 1.0.15 (the uploaded config.json's flm_version) and modified_at 2026-12-04. Co-Authored-By: Claude <noreply@anthropic.com>
Security scan found no critical or high findings on lines changed by this pull request49 medium, low, or unrated finding(s) are not listed; the scan run has them. View the security scan run for complete reports. “New” means the finding is located in a changed file on an added or modified line; it is not a base-versus-head findings delta. |
The Windows engine build (devkit-engines / win-xrt) stopped with C3861 '__builtin_clz': identifier not found in q80_value_bf16. std::bit_width (C++20 <bit>, the engines already build as C++20) gives the same top bit on every compiler. Checked against the old code on all 255 x 65536 (q, scale) inputs: identical bf16 bits. Co-Authored-By: Claude <noreply@anthropic.com>
Dev-kit benchResults of the dev-kit benches in Build and Test run 47690429638 for SummaryDev-kit bench (pr) on
|
| Model | Machine | Context | Decode base → dev-kit | Δ | Prefill base → dev-kit | Δ | Decode Δ vs nightly (same kind) |
|---|---|---|---|---|---|---|---|
| minicpm-v-4.7-q80:1b | strix-halo | 1k | — → 52.8 | — | — → 5014.9 | — | no baseline for this kind |
| minicpm-v-4.7-q80:1b | strix-halo | 2k | — → 51.3 | — | — → 5883.8 | — | no baseline for this kind |
| minicpm-v-4.7-q80:1b | strix-halo | 4k | — → 48.9 | — | — → 6197.1 | — | no baseline for this kind |
| minicpm-v-4.7-q80:1b | strix-halo | 8k | — → 44.5 | — | — → 6854.1 | — | no baseline for this kind |
GSM8K accuracy (%)
| Model | Nightly baseline | This run | Δ (points) | Notes |
|---|---|---|---|---|
| minicpm-v-4.7-q80:1b | — | 84.0 | — |
Linux HRX
Perf (tok/s; dev-kit against the base package on the same runner)
| Model | Machine | Context | Decode base → dev-kit | Δ | Prefill base → dev-kit | Δ | Decode Δ vs nightly (same kind) |
|---|---|---|---|---|---|---|---|
| minicpm-v-4.7-q80:1b | strix | 1k | — → 47.2 | — | — → 3713.8 | — | no baseline for this kind |
| minicpm-v-4.7-q80:1b | strix | 2k | — → 45.8 | — | — → 3928.8 | — | no baseline for this kind |
| minicpm-v-4.7-q80:1b | strix | 4k | — → 44.2 | — | — → 3966.1 | — | no baseline for this kind |
| minicpm-v-4.7-q80:1b | strix | 8k | — → 40.1 | — | — → 3694.8 | — | no baseline for this kind |
GSM8K accuracy (%)
| Model | Nightly baseline | This run | Δ (points) | Notes |
|---|---|---|---|---|
| minicpm-v-4.7-q80:1b | — | 84.0 | — |
Perf: flm bench, decode and prefill average tok/s per context. A/B is the one perf signal that judges a change; the runners differ by machine kind, so the nightly comparison is informational and only made for the same kind. Accuracy: GSM8K (first 50 questions) and DocVQA (when enabled), greedy; unanswered questions count as wrong. Per-question reports, server logs and CSVs: the devkit-bench-result-* artifacts.
The dev-kit engine libraries and kernels that run 47428636190 built from 55106b6, staged into its product builds and tested on the NPU (devkit_swap.py fetch): 6 engine file(s), 8 kernel(s). CI checks these bytes against the run's staging manifests. src/lib/hrx/libminicpm_v_4_7_q80_npu.so src/lib/hrx/minicpm_v_4_7_q80_npu.dll src/lib/hrx/minicpm_v_4_7_q80_npu.lib src/lib/xrt/libminicpm_v_4_7_q80_npu.so src/lib/xrt/minicpm_v_4_7_q80_npu.dll src/lib/xrt/minicpm_v_4_7_q80_npu.lib src/xclbins/MiniCPM-V-4.7-1B-Q80-NPU2/attn_bfp16c.xclbin src/xclbins/MiniCPM-V-4.7-1B-Q80-NPU2/layer.xclbin src/xclbins/MiniCPM-V-4.7-1B-Q80-NPU2/mm_bfp16.xclbin src/xclbins/MiniCPM-V-4.7-1B-Q80-NPU2/vision_attn.xclbin src/xclbins/MiniCPM-V-4.7-1B-Q80-NPU2/vision_attn_kv.xclbin src/xclbins/MiniCPM-V-4.7-1B-Q80-NPU2/vision_mm_a.xclbin src/xclbins/MiniCPM-V-4.7-1B-Q80-NPU2/vision_mm_b.xclbin src/xclbins/MiniCPM-V-4.7-1B-Q80-NPU2/vision_mm_p.xclbin Devkit-Swap-Run: 47428636190 Devkit-Swap-Tested: 55106b6
…nno setup Adds the q80 engine next to minicpm_v_4_7_bf16_npu.dll in src/wix/flm.wxs and src/inno/flm.iss, now that the swap commit brought the CI-built libraries. Co-Authored-By: Claude <noreply@anthropic.com>
…r, app, engine; off by default)
One stderr line per stage ("[MCVPROF] <steady us> <name> <ms> <extra>") for the
HTTP/JSON path, frame prep, template/tokenize, prefix cache, vision tower split,
language prefill (GDN vs attention layers), and each decode token (layers,
lm_head, set_context_length, sampler, detokenize). Off: one cached env check per
timer, no clock reads, no output, no extra NPU syncs; bench answers identical.
Co-Authored-By: Claude <noreply@anthropic.com>
…default off) - FLM_MINICPM_V_HWCTX_FIX: npu_exclusive() / foreign_sig() count the hw-context list correctly under both driver conventions (bytes written or bytes left), require our own pid in the list, and cross-check the device-wide context count (other Linux users are hidden from the list); unsure = not exclusive / not ok. Enables single-context vision on Linux and fixes the decode guard, which aborted the first token even when alone. Linux only. - FLM_MINICPM_V_SKIP_IMAGE_SNAPSHOT: no end snapshot for single-turn image requests (it can only serve a later turn of the same chat). - FLM_MINICPM_V_PARSE_ONCE: the chat body is parsed once; the log line is made from that parse (same text). - FLM_MINICPM_V_PARALLEL_FRAME_PREP: the frames of one message are prepared on several threads, then appended in message order (same bytes). Bench answers identical to the baseline with every flag off, alone and all on; all on: about -100 ms per shot on Krackan. Co-Authored-By: Claude <noreply@anthropic.com>
Conflicts, all "both sides added next to each other": - converter: keep MINICPM_V_1B_Q80 and main's QWEN4_A3B (enum values are only used for in-process lookups), and both names in models/__all__; - model_info.json: main's file plus the minicpm-v-4.7-q80:1b entry (rebuilt with a JSON tool; main's formatting reproduced byte for byte); - server.cpp / rest_handler.cpp: main's route-preview flag and new run_chat_turn arguments, with the S1 timer line and the S2 parse-once path. Co-Authored-By: Claude <noreply@anthropic.com>
The dev-kit engine libraries and kernels that run 47608341446 built from fd6e0d5, staged into its product builds and tested on the NPU (devkit_swap.py fetch): 6 engine file(s), 8 kernel(s). CI checks these bytes against the run's staging manifests. src/lib/hrx/libminicpm_v_4_7_q80_npu.so src/lib/hrx/minicpm_v_4_7_q80_npu.dll src/lib/hrx/minicpm_v_4_7_q80_npu.lib src/lib/xrt/libminicpm_v_4_7_q80_npu.so src/lib/xrt/minicpm_v_4_7_q80_npu.dll src/lib/xrt/minicpm_v_4_7_q80_npu.lib src/xclbins/MiniCPM-V-4.7-1B-Q80-NPU2/attn_bfp16c.xclbin src/xclbins/MiniCPM-V-4.7-1B-Q80-NPU2/layer.xclbin src/xclbins/MiniCPM-V-4.7-1B-Q80-NPU2/mm_bfp16.xclbin src/xclbins/MiniCPM-V-4.7-1B-Q80-NPU2/vision_attn.xclbin src/xclbins/MiniCPM-V-4.7-1B-Q80-NPU2/vision_attn_kv.xclbin src/xclbins/MiniCPM-V-4.7-1B-Q80-NPU2/vision_mm_a.xclbin src/xclbins/MiniCPM-V-4.7-1B-Q80-NPU2/vision_mm_b.xclbin src/xclbins/MiniCPM-V-4.7-1B-Q80-NPU2/vision_mm_p.xclbin Devkit-Swap-Run: 47608341446 Devkit-Swap-Tested: fd6e0d5
…N_V2 Level 1 (exact, same image_embeds bits): - chunk size follows the shot size (rows/4, 512..4096, step 256) - residual add + LayerNorm + bfp16 pack of the next input in one pass - q/k/v written straight into the attention buffers - GELU + pack between fc1 and fc2 row-buffered - device sequences cached per chunk size Level 2: level 1 plus two matmul dispatches in flight (dispatch_lane::submit_split, a waiter thread waits in issue order). Default 0 runs the old code. On Krackan, vision per shot -21% (E01) and -24% (Teacher); answers and image_embeds hashes equal on all bench shots. Co-Authored-By: Claude <noreply@anthropic.com>
flm_batch_api.h is the C table an engine library can export to decode
several contexts ("slots") at once: select_slot + its own prefill per
slot, decode_step over the active slots, slot_length / slot_clear.
No virtual is added to causal_lm.
The fake engine stands in for minicpm_v_4_7_q80_npu in test builds
(-DFLM_MINICPM_V_FAKE_ENGINE, then FLM_MINICPM_V_FAKE=1 at run time):
deterministic answers per prompt, sleeps with the model's measured
times, fault injection, and no NPU device is opened. Release builds
do not compile it.
Co-Authored-By: Claude <noreply@anthropic.com>
With FLM_MINICPM_V_BATCH=B >= 2, several requests decode together, one engine slot each, driven by one NPU thread that admits a waiting request's vision + prefill first and otherwise runs one decode step for every active slot. Request threads keep the host work: settings, template, tokenizer and frames before (batch_prepare, under one host lock), token text, streaming and parsing after. Each request has its own sampler copy and the serial decode order (prefill sample, held-back think tokens, stop checks), so a slot gives the answer the serial path gives. insert() is split into prepare_prompt() and the engine part without changing it. An engine without the batch table is driven as one slot through forward(), which is today's engine. Co-Authored-By: Claude <noreply@anthropic.com>
AcceleratorRequestCoordinator gets shared leases: batched chats join the NPU while one is held (up to a limit, never past an older waiter), and exclusive turns such as model loads wait until the last one ends. Shared grants run on their own worker pool. run_chat_turn gets a batched branch that hands the turn to the model's batch session and never touches the engine itself. Only installed when FLM_MINICPM_V_BATCH >= 2; requests the batch path does not serve (tools, response_format, logprobs, other models, ...) keep their exclusive turn. Co-Authored-By: Claude <noreply@anthropic.com>
An earlier merge on this branch wrote both files with LF endings, so every line differed from main. Content is unchanged (git diff --ignore-cr-at-eol is empty). Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
The dev-kit engine libraries and kernels that run 47623563019 built from 3647225, staged into its product builds and tested on the NPU (devkit_swap.py fetch): 6 engine file(s), 8 kernel(s). CI checks these bytes against the run's staging manifests. src/lib/hrx/libminicpm_v_4_7_q80_npu.so src/lib/hrx/minicpm_v_4_7_q80_npu.dll src/lib/hrx/minicpm_v_4_7_q80_npu.lib src/lib/xrt/libminicpm_v_4_7_q80_npu.so src/lib/xrt/minicpm_v_4_7_q80_npu.dll src/lib/xrt/minicpm_v_4_7_q80_npu.lib src/xclbins/MiniCPM-V-4.7-1B-Q80-NPU2/attn_bfp16c.xclbin src/xclbins/MiniCPM-V-4.7-1B-Q80-NPU2/layer.xclbin src/xclbins/MiniCPM-V-4.7-1B-Q80-NPU2/mm_bfp16.xclbin src/xclbins/MiniCPM-V-4.7-1B-Q80-NPU2/vision_attn.xclbin src/xclbins/MiniCPM-V-4.7-1B-Q80-NPU2/vision_attn_kv.xclbin src/xclbins/MiniCPM-V-4.7-1B-Q80-NPU2/vision_mm_a.xclbin src/xclbins/MiniCPM-V-4.7-1B-Q80-NPU2/vision_mm_b.xclbin src/xclbins/MiniCPM-V-4.7-1B-Q80-NPU2/vision_mm_p.xclbin Devkit-Swap-Run: 47623563019 Devkit-Swap-Tested: 3647225
…w attention FLM_MINICPM_V_VISION_V2=3: design P (vision matmul) and the kv_once attention live in one xclbin (MiniCPM_V_Q80/vision_overlay) and are switched by register writes instead of a reconfiguration, 27 times per shot. Any other xclbin run or a failed run marks the state unknown and the next run switches fully. If vision_overlay.xclbin is missing or does not load, the engine warns and uses the separate xclbins. FLM_MINICPM_V_VISION_V2=4: level 3 plus a 48-row q-tile attention op in the same overlay, chosen per view length where it pads less (1008-row views keep 64-row tiles). Inputs copied into the model's own folder (MiniCPM_V_Q80/vision_mm_p, MiniCPM_V_Q80/vision_attn_kv; attention rebuilt with a 3 KB stack); shared folders unchanged. Core program 13,232 of 16,384 bytes. Listed in build_units.json and kernel_assignment.json/.md so CI builds and ships it. Krackan, vs level 2: NPU-busy per shot -89 ms (E01) / -60 ms (Teacher), wall -112 / -61 ms. image_embeds hashes and answers equal on every bench shot; soaks 2 h (level 3) and 1 h (level 4), 0 mismatches. Co-Authored-By: Claude <noreply@anthropic.com>
Its make bitstream recipe writes and compares host/op_configs.hpp and host/overlay_layout.hpp, so its host/ files are bitstream inputs: leave the unit out of XCLBIN_NO_BITSTREAM and list it in the known host/ readers. Co-Authored-By: Claude <noreply@anthropic.com>
Plain copy of flm-dev-kit/FLM_Xclbin/MiniCPM_V_Q80/decoding (tracked files at 2a7a383). The shipping decoding/ folder stays as it is; batched decode work goes into the copy. Co-Authored-By: Claude <noreply@anthropic.com>
- proj_main / q8_core: M-row Q8_0 mvm(). Each 32-column group is converted int8 -> bf16 once into a stack buffer, then up to 5 rows run their MAC chains on it per pass. Every row keeps the one-row operation order, so a row of an M-row run is bit-identical to that row run alone. mvm() is noinline (proj core program 13,424 -> 7,312 bytes). - send_y_paired(): the main core of a combo pair takes both buffer tokens and grants the neighbour its half (new lock), so a run of several y packets cannot overwrite a buffer before its DMA sent it. - rms_residual: lm_head mode with rows > 1 norms each row into a staging buffer and sends rows interleaved per 256-column chunk. The packet fill is a noinline function: Peano moved the header store past the lock calls, and after a layer run the lm_head packets went to the wrong place. - host: rows RTP, logits laid out [round][row][512]; x86 bit-exact model of the per-row op order (host/q80_rows_model.*); run.exe --model-check, --raw-check N, --batch B --steps S --prompts ... (batched vs alone, bit for bit), --solo-only / --hash-log (compare two xclbins). - Layer modes still run one row; decoding/ is unchanged. Tests (Krackan): --model-check (rows 1..8 == one row, all layer weights); --batch 1..8 x 64 steps, every slot's logits bit-identical batched vs alone; M = 1 decode 4 prompts x 96 steps identical to the shipping layer.xclbin. Co-Authored-By: Claude <noreply@anthropic.com>
devkit_check.py wants every FLM_Xclbin folder with a Makefile in build_units.json. One MODEL_TYPE, QWEN3_5_08B_Q80_SL (the engine variant); no model uses its artifact yet. Co-Authored-By: Claude <noreply@anthropic.com>
With FLM_MINICPM_V_BATCH=B >= 2 and layer_batch.xclbin present, the engine keeps up to min(B, 8) slots, each with its own KV cache, RoPE buffers, length and checkpoint, and exports flm_batch_api.h (minicpm_v_4_7_q80_batch_api). decode_step runs the decoder layers once per slot (one row each, all slots in one runlist), then the lm_head once with one row per slot on the decoding_batch kernels. Every slot gives the logits the serial engine gives, bit for bit. The decode kernels are stateless (x is read from and written back to DDR on every run), so slots can share one runlist and other xclbins may run between steps. Two runlists are used in turn: one is reset while the other runs. select_slot swaps the slot's state into the serial fields, so prefill and forward() work on the selected slot unchanged. layer_batch.xclbin is the decoding_batch artifact; its RTP map is the decoding one plus a rows word in the proj/rms mode RTPs. When the flag is off (unset, 0 or 1), or the file is missing, the engine loads layer.xclbin and runs today's code: no stream or buffer changes. Co-Authored-By: Claude <noreply@anthropic.com>
find_batch_api asks the engine for minicpm_v_4_7_q80_batch_api. When the engine runs with two or more slots it returns the table and the batch session decodes all active requests in one step; otherwise the session keeps the serial one-slot adapter over forward(). Co-Authored-By: Claude <noreply@anthropic.com>
run_batch prefills prompts into slots and decodes them through the batch table (--slots B), or serially with the flag off, and logs one hash of the logits per slot per step. Equal hash logs prove every slot equals the serial engine. Options cover different lengths per slot, slot reuse after clear, forward() on a slot between steps (--tail-forward), fewer active slots (--max-active) and foreign xclbin runs between steps (--foreign, --every). Co-Authored-By: Claude <noreply@anthropic.com>
Adds
minicpm-v-4.7-q80:1b: MiniCPM-V-4.7-1B with the language weights (every language Linear and the lm_head) in Q8_0 (int8, one bf16 scale per 32 weights). The network and the vision tower are the same asminicpm-v-4.7-bf16:1b; only the language weights change. Decode reads about half the bytes per token, so it is about 1.5x faster than bf16.Needs #1258 merged first (adds the family to the pr tier, like #1219 before #1220). Weights: https://huggingface.co/FastFlowLM/MiniCPM-V-4.7-1B-Q80-NPU2
What it adds
flm-dev-kit/FLM_Xclbin/MiniCPM_V_Q80/decoding/(copy ofMiniCPM_V_BF16/decoding), model typeQWEN3_5_08B_Q80_SL: Q8_0 projections and lm_head, alpha/beta stay bf16. Onlylayer.xclbinis new; the other 7 slots reuse theMiniCPM_V_BF16artifacts.kernel_assignment.json:minicpm-v-4.7-q80:1b->MiniCPM-V-4.7-1B-Q80-NPU2.flm-dev-kit/FLM_DLL/detail/minicpm_v_4_7_q80_npu/(copy of the bf16 engine with every name changed, so both can load in one process). Decode reads the stored Q8_0 blocks; prefill dequantizes Q8_0 to bf16 at load time (integer math, exact for denormal scales) and keeps the bfp16 prefill path.MiniCPM_V_1B_Q80(-f minicpm-v-4.7-1b-q80, configminicpm_v_1b_q80.json): Q8_0 from the BF16 GGUF with its own quantizer (bf16 scale rounded first, round half to even).takes_rawfor raw RGB8 frames, catalog entry, harnesssrc/test/minicpm_v_4_7_q80_npu.Libraries and xclbins come in the swap commit after CI. Installer entries (
flm.wxs,flm.iss) follow in a separate commit after the swap.Shared files changed (additive):
.github/script/ci/changes.py,flm-dev-kit/FLM_DLL/engines.json,flm-dev-kit/FLM_Xclbin/{build_units.json,kernel_assignment.json,kernel_assignment.md,rtp_addresses.lock.txt},flm-dev-kit/FLM_Q4NX_Converter/{README.md,q4nx/constants.py,q4nx/models/__init__.py},src/CMakeLists.txt,src/common/AutoModel/{builtin_backends.cpp,builtin_frontends.cpp,model_frontend.cpp},src/server/rest_handler.cpp,src/model_list.json. Other models' conversions and kernel MLIR were checked unchanged.Checked on a Krackan NPU, local builds