Repository navigation
docs(rockchip-npu): price the vendor zero-op matmul path, record the QuaRot int8 negative - #1266
Merged
Merged
Conversation
added 2 commits
November 12, 2026 21:31
…0 POC One full OmniVoice layer on rknn_matmul_api (fp16->fp32 GEMMs, fp32 CPU RoPE/softmax/SiLU) runs 137 ms NPU/layer, stage outputs at fp16-GEMM noise, x28 = 3.9 s/step before host packing. Documents the NATIVE tiled layout contract.
Residual-stream Hadamard folded into the front-28 export (graph neutral at 116 dB, fp16 control 57-60 dB): w8a8 rebuild measures 2.1/-0.6 dB, the same death as unrotated. Scales bind on unrotated MLP-mid/attention activations; full QuaRot needs per-op fp16 attention the converter cannot express.
Owner
|
@wOvAN Thanks! PR merged. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #1264, which merged with the two commits I pushed after the merge left out.
Vendor zero-op path, priced. The single-core ceiling from #1264 was then measured end to end with a one-layer port on the board: the OmniVoice layer-0 QKV/O/MLP GEMMs and the 32+32 attention tiles on
rknn_matmul_apiat fp16-to-fp32, with RoPE, softmax, SiLU and the residual adds on the CPU in fp32 (M=1536, CFG-packed). The NPU side runs 137 ms per layer and the stage outputs match the fp32 torch reference at fp16-GEMM noise (q_rope 36 dB, layer output 21 dB), so x28 is a 3.9 s/step NPU-only floor, before host cost. Host cost is real: the NATIVE layout is tiled, not row-major (A[K1,M,subK], B[N1,K1,subN,subK], C perf, the official demo packers), and naive scalar packing plus C unpacking triples the layer wall. A tuned port (prepacked weights, vectorized packing, fp16 C for the big-N GEMMs) lands near 5-6 s/step, about 1.5x over the compiled 8.4 s engine, with the O and down projections (0.32/0.22 TFLOP/s single-core at K>=2048) eating 1.8 s of the floor by themselves. The 2.5x stays locked to the AGPL library: the vendor zero-op path is a real but modest lever.QuaRot/FWHT int8 probe (negative). The int8 probe bullet said the literature remedy is a randomized Hadamard transform exported into the ONNX graph. That experiment ran: a randomized 1024-dim Hadamard folded into the front-28 export (embeddings, QKV, gate/up by
H, o and down byH^T, norm weights absorbed, a final de-rotation matmul that keeps the shard contract; the graph is neutral, 116 dB against the fp32 reference, and an fp16 control build of the rotated graph measures 57-60 dB at argmax 1.0). The w8a8 rebuild of the rotated graph measures 2.1/-0.6 dB, bit for bit the unrotated death. The residual stream was not the binding outlier: the per-tensor scales are set by the unrotated MLP mid (silu(g)*u, 3072-wide SwiGLU tails) and by QK^T/P inside attention, and full QuaRot additionally keeps attention in fp16, which is a per-op dtype the converter cannot express. int8 is closed for this family on the converter path.Docs-only, no code touched. Board: RK3588, librknnrt 2.3.2, engines built in the 2.3.2 converter venv.