Repository navigation
feat: 重新支持 Intel Mac,纯 Rust VM 替代 ort/ONNX Runtime——PureVox6/AEC7 权重编译期内嵌 - #366
Merged
OrientCOMPASS merged 4 commits intoOct 9, 2026
Merged
Conversation
…el blobs Mechanical Rust transcription of the numpy reference kernels from the libmicyou experimental backend: broadcasting elementwise ops, batched MatMul, NCHW Conv (pointwise-GEMM / depthwise / im2col paths), scatter ConvTranspose, GRU (fwd/bwd/bidi, linear_before_reset), BatchNorm, LayerNorm, Resize (linear+half_pixel), structural ops (transpose/concat/ slice/pad/expand/gather/reduce/copy) over a pre-packed f32 arena — no allocations per frame, no graph parsing at runtime, no C dependencies. Performance (measured in the libmicyou port CI, ubuntu-22.04 single thread, vs ort 2.0.0-rc.13 + onnxruntime 1.19.2 with intra/inter=1): AVX2+FMA runtime dispatch, branchless exp/tanh, GRU weight pre-transpose and L1 reuse bring the combined aec7+purevox6 chain to 1.04x of ort (RTF 0.384, ~2.6x real-time headroom); purevox6 alone beats MLAS (0.98x). Soundness invariant (per-op output/input arena regions disjoint) is enforced by the compiler's live-range packing and re-validated in debug builds. The model-generation toolchain, ONNX sources, golden fixtures and the full verification matrix (numpy<->onnxruntime parity, blob freshness, per-op / streaming / time-domain goldens, native-vs-ort bench) live in the libmicyou repository; docs/pure-rust-inference.md records the design and the results. This repository ships the runtime artifacts only.
BREAKING CHANGE: micyou_audio::init_ort_runtime is removed; AI noise suppression and AEC no longer load libonnxruntime or discover .onnx files. The compiled MCYI models are embedded in the binary (include_bytes!) and always available — the model-missing degradation path is gone. - dsp.rs: PureVoxProcessor/AecProcessor now drive micyou_infer::Session over the embedded blobs; STFT/iSTFT/OLA framing and cache feedback order are unchanged; fixture-free property tests pin the integration (PureVox attenuates stationary noise, AEC7 crushes aligned noise echo, full-chain smoke) — golden/parity verification of the blobs themselves lives in the libmicyou repository - micyou-core: server startup no longer probes/loads the ORT shared library; resources.rs markers reduce to the ALSA/PipeWire config (legacy trees with .onnx files still resolve) - protocol surface: AecFailure::ModelMissing is removed — the backend can no longer report a missing model — together with its frontend notification mapping and the aecDisabledModelMissing key in all seven locales; the failure-code stability test keeps pinning the rest - bundling: the committed onnxruntime shared libraries (src-tauri/libs/, 78 MB) and the .onnx models (src-tauri/resources/, 7 MB) are removed along with the prepare-sidecars/installer.iss steps that copied them; the LICENSE-PureVox/LICENSE-AEC7 attribution files stay bundled; settings UI renames the PureVox entry from "(ONNX)" to "(AI)" - workspace: ort and ndarray dependencies removed; micyou-audio's noise-suppression feature now pulls micyou-infer Size: each desktop binary (GUI/CLI/TUI) grows ~6.9 MB (embedded weights; installers net +3–5 MB after compression) while the payload drops the per-platform onnxruntime library and the models; installed footprint is roughly unchanged and the entire ONNX Runtime distribution/discovery failure class is gone.
…cord docs/pure-rust-inference.md records why the two models compile to a static instruction stream (op census, per-frame MAC budget, folded node counts), the MCYI blob format, the seven-layer verification matrix run in the libmicyou CI, the measured native-vs-ort performance (1.04x combined, RTF 0.384), the two-repo split (generation toolchain there, runtime artifacts here) and the known VM boundaries. AGENTS.md gains the micyou-infer crate row and the embedded-model wording.
The previously bundled libonnxruntime.dylib was an arm64-only thin binary — the reason the desktop only shipped macOS arm64 installers and Intel Macs had no working AI noise suppression/AEC. The pure-Rust VM removes that constraint: the x86_64 path has AVX2+FMA runtime dispatch with a baseline scalar fallback, and the zero-C-dependency tree cross-compiles from the arm64 runners (verified locally: cargo check -p micyou-infer --target x86_64-apple-darwin). - development/release/pre-release: macOS matrix gains the x86_64 entry (artifacts named MicYou-macOS-<ver>-x86_64.dmg; the release publish job picks them up automatically via download-all-artifacts) - mirrorchyan_release.yml: macos/x64 upload entry for the new dmg - about.toml: resolve licenses for x86_64-apple-darwin as well - docs: Intel Mac rationale in docs/pure-rust-inference.md; AGENTS.md CI description
OrientCOMPASS
force-pushed
the
feat/pure-rust-inference
branch
from
October 9, 2026 09:10
acdcd2b to
38a9280
Compare
Contributor
Author
|
ModelMissing 枚举已删除。 |
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.
摘要
移除后端的
ort/ ONNX Runtime 依赖:PureVox6 降噪与 AEC7 消回声改为零依赖纯 Rust 推理 VM(新 cratemicyou-infer)执行编译期内嵌的静态编译权重(MCYI blob,include_bytes!),并借此解锁 Intel Mac 完整 AI 音频功能(CI 新增 x86_64 macOS 安装包)。该移植已在实验性后端 libmicyou 完成完整的开发—对拍—性能验证闭环(七层验证矩阵 + 与 ort 的同机基准对比),本 PR 只包含运行时整合与权重产物;模型生产工具链与 golden 测试设施留在实验仓库(见「两仓库分工」)。
BREAKING CHANGE:
micyou_audio::init_ort_runtime移除;后端不再加载libonnxruntime、不再发现.onnx文件。模型编译进二进制、永远可用,「模型缺失」降级路径随之消失。动机与依据
.onnx模型并随包分发,运行时要走「探测 dylib → 动态加载 → 发现模型文件 → 建 Session」链路,任何一环缺失都会让 AI 降噪/AEC 静默降级。内嵌编译期权重后,这一整类故障不存在。libonnxruntime.dylib是 arm64-only thin binary(Mach-O cputype0x100000c,非 universal)——这是桌面端此前只发布 macOS arm64 安装包、Intel Mac 无法使用 AI 降噪/AEC 的直接原因。纯 Rust VM 无此约束:x86_64 路径带 AVX2+FMA 运行时派发(is_x86_feature_detected!,不满足时回落 baseline 标量路径),零 C 依赖可在 arm64 runner 直接交叉编译。本 PR 同步为 development/release/pre-release 三条流水线增加x86_64-apple-darwin构建,MirrorChyan 上传清单增加 macos/x64 条目。变更清单
新增
tauri-app/crates/micyou-infer/:零运行时依赖推理 VM(std only)。~26 个定形算子内核,预打包 f32 arena,每帧零分配、零图解析;AVX2+FMA 运行时派发 + 通用回落;唯一 unsafe 不变量(同 op 输出/输入 arena 区间不重叠)由编译器活跃区间打包保证、debug 构建逐 op 复验tauri-app/crates/micyou-audio/src/assets/{purevox6,aec7}.mcy:静态编译权重(2.09MB + 4.78MB;purevox6 1105 ONNX 节点→440 指令,aec7 1581→616)docs/pure-rust-inference.md:设计文档(可行性评估、MCYI 格式、验证矩阵、性能实测、边界与模型更新流程)改造
micyou-audio/dsp.rs:PureVoxProcessor/AecProcessor由 ort Session 改驱动micyou_infer::Session;STFT/iSTFT/OLA 布线与 cache 反馈顺序不变;新增 3 个零夹具行为测试(PureVox 衰减稳态噪声、AEC7 压制对齐噪声回声、全链 smoke),cargo test -p micyou-audio --features noise-suppression即可运行micyou-core:服务启动不再探测/加载 ORT 动态库(service.rs);resources.rs资源目录 marker 改为 ALSA/PipeWire 配置(向后兼容:含.onnx的旧安装树仍可解析,覆盖升级无感)ort、ndarray依赖移除;noise-suppressionfeature 改拉micyou-infer;Cargo.lock同步(−231 行)src-tauri/libs/(78MB onnxruntime ×3)与src-tauri/resources/*.onnx(7MB,LICENSE-PureVox/LICENSE-AEC7 署名文件保留随包);prepare-sidecars.js/installer.iss的 ort 拷贝步骤移除PureVox (ONNX)→PureVox (AI)about.tomltargets 补x86_64-apple-darwin;AGENTS.md crate 表与 CI 描述更新正确性验证
完整七层验证矩阵在 libmicyou 的 CI 执行并通过(工具链所在仓库);本 PR 的运行时逻辑与验证版本逐行一致、权重 blob 逐字节一致(fork 上保留的对拍存档分支
feat/pure-rust-inference-full与本分支的全部源码差异仅为文档注释指向与移除的 golden 测试文件;存档分支携带完整工具链与 golden,合并后可删):存档分支 CI:Native Inference run 37889534944(①–⑥ 全部门禁 + ubuntu/windows/macos 三 OS VM 测试矩阵,全绿)。
本 PR 分支 CI:Development Build run 37895348875(Windows 安装器 / Linux deb+rpm+AppImage / macOS arm64 / macOS x86_64 / Android 五任务全绿,artifact 可下载)。本地另有
cargo test -p micyou-audio --features noise-suppression27/27、cargo check --locked -p micyou-core -p micyou-cli -p micyou-tui零告警。流式反馈稳定性:f32 求和序与 ORT 存在 ~1e-6 级差异(与 silero 移植同量级),16 帧自反馈漂移实测 ≤1.4e-5,系统收缩性良好、不发散,听感无影响。
性能(与 ort 版同机对比)
libmicyou 移植 CI 在同一 GitHub runner(ubuntu-22.04,单线程)对 ort 2.0.0-rc.13 + onnxruntime 1.19.2(
intra/inter_threads=1,官方 Microsoft 构建)与纯 Rust VM 运行同一 harness(相同确定性信号、300 warmup + 3000 计量帧、480 样本/帧 = 10ms 实时预算):组合链与 ort 基本打平,RTF 0.384 → 实时余量 ~2.6×。x86_64 上 AVX2+FMA 运行时派发对标 MLAS 的做法;非 x86(含 Apple Silicon)走自动向量化通用路径(macOS arm64 CI 构建与测试通过)。
体积影响
兼容性与升级
AecFailure事件协议、settings.json字段、降噪类型 id(PureVox/RNNoise/Speexdsp)全部不变;ModelMissing枚举保留(不再可达).onnx/onnxruntime 文件不影响新版(资源目录 marker 向后兼容),装完即用两仓库分工与模型更新流程
本仓库只含运行时产物(VM +
.mcy权重);模型生产与验证设施(numpy 参照解释器、ONNX→MCYI 编译器、对拍/golden 生成器、ONNX 源模型、验证 CI、bench harness)在 libmicyou。更换/升级模型时:在 libmicyou 重跑compile_models.py与 golden 生成、通过其 CI 全链验证后,把新.mcy提交回本仓库即可(流程已写入docs/pure-rust-inference.md§7;不支持的算子会在编译期显式报错而非静默降级)。参考
docs/pure-rust-inference.mdfinetune/silero_v4_port.md)