Repository navigation
RCDL 0.3.0
RCDL 0.3.0:自研 NPU 栈,全部开源
请直接安装 0.3.1:它修复了自研运行时下
Engine.label_map()找不到标签文件的问题。
这一版起,RCDL 的 NPU 这一层是自己的:编译器、量化工具、运行时和内核驱动全部开源,跑模型不再需要瑞芯微的任何用户态软件——不用 librknnrt,不用 rknn-toolkit2,编译 RCDL 也不需要瑞芯微的头文件。官方的 .rknn 照样能加载。
自研 NPU 栈
| 部分 | 源码 | 文档 |
|---|---|---|
编译器与量化工具(ONNX → .rnpu) |
scripts/rnpu |
NPU_COMPILER.zh.md |
运行时(执行 .rnpu) |
src/npu、include/rcdl/npu |
NPU_RUNTIME.zh.md |
| 内核驱动 rknpu-rcdl(GPL-2.0) | kernel/rknpu-rcdl |
NPU_DRIVER.zh.md |
- 注册表里的每个模型都有自研栈的
.rnpu构建;整套板上测试(866 个)在自研栈和官方运行时上结果相同,另有 490 个编译器与运行时测试。 - 量化用自己的工具:minmax / percentile / mse 三种范围、跨层均衡、偏置校正、敏感度分析与按层混合精度(
--fp16-ops)。 - 内核驱动 rknpu-rcdl:瑞芯微 rknpu 0.9.8 加上我们的修复,可加载模块,从开机时的驱动接管 NPU、用完交还;不依赖厂商调频也能在每次上电时恢复 SRAM 读裕量和时钟,空闲自动下电。已在 RK3588S(6.1.118,驱动编进内核)和 RK3588(6.1.141,驱动为模块)两块板上验证,所有构建输出与厂商驱动逐位相同。
- 只用
.rnpu时,只需要板子镜像自带的 rknpu 内核驱动;.rknn模型仍需要 librknnrt(≥ 2.3.2)。
新增任务与模型(自 0.2.1)
语音合成 KokoroTts(Kokoro-82M v1.1-zh,中英文)· 多语种语音识别 SenseVoiceAsr · 英文语音识别 MoonshineAsr · 说话人识别 SpeakerEmbedder(CAM++)· 声音事件识别 AudioTagger(EfficientAT)· 视频目标跟踪 VideoObjectTracker(EdgeTAM)· 双目深度 StereoMatcher(Lite Any Stereo V2)· 度量深度(Depth Anything V2 Metric)· DETR 检测 DetrDetector(RF-DETR、D-FINE、PP-DocLayout_plus-L 版面分析)· DETR 实例分割 DetrSegmenter(RF-DETR-Seg)· 快速版面分析 BoxScoreDetector(PP-DocLayout-S)· 文档方向(PP-LCNet)· 一阶段多人姿态 RtmoPoseEstimator(RTMO-s)· 人脸识别 LVFace-T(MIT 权重)· 人脸活体 FaceLiveness(MiniFASNet)· 图文向量 PE-Core-S16。
不兼容变更(C++)
公开头文件不再包含瑞芯微的 rknn_api.h:模型张量改用 RCDL 自己的 rcdl::TensorInfo / TensorType / TensorFormat / QuantType(字段名和数值与 librknnrt 相同)。迁移说明见 CHANGELOG。Python API 不变。
安装
conda create -n rcdl -c https://mirrors.ruis.ai/conda -c conda-forge rcdl完整变更见 CHANGELOG.md。从这一版起,版本记录默认中文,英文版在 CHANGELOG.en.md。
RCDL 0.3.0: an NPU stack of its own, all open source
Install 0.3.1 instead: it fixes
Engine.label_map()not finding the labels file on the own runtime.
From this release, RCDL's NPU layer is its own: the compiler, the quantizer, the runtime and the kernel driver are all open source, and running models needs no Rockchip user-space software — no librknnrt, no rknn-toolkit2, and no Rockchip header to build RCDL. Rockchip's .rknn models still load.
The NPU stack
| Part | Source | Guide |
|---|---|---|
Compiler and quantizer (ONNX → .rnpu) |
scripts/rnpu |
NPU_COMPILER.md |
Runtime (runs .rnpu) |
src/npu, include/rcdl/npu |
NPU_RUNTIME.md |
| Kernel driver rknpu-rcdl (GPL-2.0) | kernel/rknpu-rcdl |
NPU_DRIVER.md |
- Every model in the registry has an
.rnpubuild, and the whole board test suite (866 tests) gives the same results on it as on Rockchip's runtime; 490 more test the compiler and runtime. - Quantization with our own tool: minmax / percentile / mse ranges, cross-layer equalization, bias correction, sensitivity analysis and per-layer mixed precision (
--fp16-ops). - The rknpu-rcdl kernel driver: Rockchip's rknpu 0.9.8 with our fixes, a loadable module that takes the NPU over from the driver the board booted with and gives it back; without the vendor's DVFS it restores the SRAM read margin and the clock at every power-up, and powers the NPU off when idle. Verified on an RK3588S board (6.1.118, driver built in) and an RK3588 board (6.1.141, driver as a module), every build's outputs bit-identical to the vendor driver's.
- With
.rnpumodels only, the board image's rknpu kernel driver is all RCDL needs;.rknnmodels still need librknnrt (2.3.2 or newer).
New tasks and models (since 0.2.1)
Speech synthesis KokoroTts (Kokoro-82M v1.1-zh, Mandarin and English) · multilingual speech recognition SenseVoiceAsr · English speech recognition MoonshineAsr · speaker recognition SpeakerEmbedder (CAM++) · audio event tagging AudioTagger (EfficientAT) · video object tracking VideoObjectTracker (EdgeTAM) · stereo depth StereoMatcher (Lite Any Stereo V2) · metric depth (Depth Anything V2 Metric) · DETR detection DetrDetector (RF-DETR, D-FINE, PP-DocLayout_plus-L document layout) · DETR instance segmentation DetrSegmenter (RF-DETR-Seg) · fast document layout BoxScoreDetector (PP-DocLayout-S) · document orientation (PP-LCNet) · one-stage multi-person pose RtmoPoseEstimator (RTMO-s) · face recognition LVFace-T (MIT weights) · face liveness FaceLiveness (MiniFASNet) · image-text embeddings PE-Core-S16.
Breaking changes (C++)
RCDL's headers no longer include Rockchip's rknn_api.h: model tensors are described by RCDL's own rcdl::TensorInfo / TensorType / TensorFormat / QuantType (librknnrt's field names and numbers). Migration notes are in CHANGELOG.en.md. The Python API is unchanged.
Install
conda create -n rcdl -c https://mirrors.ruis.ai/conda -c conda-forge rcdlAll changes: CHANGELOG.en.md (Chinese, now the default: CHANGELOG.md).