Repository navigation
Conversation
`0xShug0#970` shipped the aperture accounting with RK3588's measured per-process ceiling, 3900 MiB, as a constant in the CosyVoice3 flow sidecar. The accounting is shared (`rknn::ApertureBudget`) and the number is not, so the number needs a dial: `AUDIOCPP_RKNN_APERTURE_MIB` overrides it in the spirit of the `AUDIOCPP_RKNN_CORE_MASK` read beside it, and zero (the reading of a malformed value too, so a typo cannot silently mean one megabyte) turns the accounting off and pins every rung the deployment declares. The default is the measured 3900 MiB, so an RK3588 deployment that sets nothing is unchanged; a board that has not been measured opts out without a code edit, at the price of a failed `rknn_init` if its declared set is wider than its aperture. Effective budget is traced once per process (`cosyvoice3.flow.dit.rknn.aperture_budget_mib`) so a deployment can be audited from its log.
|
The board-configurable ceiling is useful, but:
|
|
Both review points from here are folded into #975, which now carries the same knob under one name: The RKNN-enabled compilation concern is verified on hardware: the reworked #975 tree builds clean natively on the RK3588 board with Resolving this in favor of #975 to keep the residency work one reviewable stack; the code lands through that PR either way. |
Why
#970moved the aperture accounting into the shared RKNN layer and left the ceiling, 3900 MiB, as a constant in the CosyVoice3 flow sidecar, where it is honest: it is a measurement of one board. That leaves every other board inheriting a number measured on RK3588, and the only way to change it is to edit a model file.This adds the dial the same layer already has for the other board-specific request (
AUDIOCPP_RKNN_CORE_MASKinframework/rknn/engine.cpp):AUDIOCPP_RKNN_APERTURE_MIB.What
#970.cosyvoice3.flow.dit.rknn.aperture_budget_mib) so a deployment can be audited from its log file.No new option surface: this is board bring-up, not a per-request knob, and the session options are spec-validated, so a guard/bring-up dial does not belong in a family's schema.
Validation
PC (x86_64,
-DENGINE_BUILD_TESTS=ON -DENGINE_BUILD_EXTENDED_TESTS=ON):engine_model_cosyvoice3builds (the whole block is inside#if defined(ENGINE_HAVE_RKNN), so a PC build is unchanged),python3 tools/check_loader_catalog_sync.pypasses.Board (Orange Pi 5 Plus, RK3588, 31 GiB, native aarch64 build with
-DENGINE_ENABLE_RKNN=ON -DENGINE_RKNN_INCLUDE_DIR=/usr/local/include -DENGINE_RKNN_LIBRARY=/usr/lib/librknnrt.so), one cold server per row,cosyvoice3-q8_0.ggufplus the six-rungflow_estimator_seq{110,200,250,400,500,900}.rknnladder, requests alternating rung 200 (n=4/10) and rung 400 (n=50):loads(count offlow.dit.rknn.load_ms)=3900=2555=0, series4 50 72Unset and
=3900agree to within 0.2% of wall on all six requests, which is the default-preserving claim.=2555shows the dial acting: 200+400 (3744 MiB) no longer fits, so every length change evicts and re-inits (loads2 -> 6), costing +8.3% wall and returning 1.13 GiB of RSS.=0pins 200+400, which this board does admit at 3744 MiB, and the next longer rung dies at init with the driver's own answer:CosyVoice3 flow estimator RKNN: rknn_init failed with code -6, surfaced asrc=500with the server surviving - that is the documented price of declaring a set wider than the aperture, and the reason the default stays the measured number.Audio is unaffected by the dial: rung 200 and rung 400 renders are
f2864dfeb0f5...andb127028a9ee3...in all three accounting rows.Limits
The dial is model-local, like the measurement it dials. When a second family grows a ladder it should read the same env var, at which point the reading belongs in
framework/rknnnext to the core mask; one consumer is not worth moving it.