a8nova commited on
Commit
e76f48b
·
verified ·
1 Parent(s): 13d5526

nnopt port: Audio8-TTS-Realistic-0.6b-LiteRT

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. .gitattributes +18 -32
  2. LICENSE +201 -0
  3. NOTICE +11 -0
  4. README.md +77 -0
  5. config.json +34 -0
  6. sm8850-npu-a16w8/README.md +147 -0
  7. sm8850-npu-a16w8/REPRO.md +168 -0
  8. sm8850-npu-a16w8/assets/default_voice.txt +1 -0
  9. sm8850-npu-a16w8/assets/default_voice.wav +3 -0
  10. sm8850-npu-a16w8/build.sh +91 -0
  11. sm8850-npu-a16w8/build/stage/arktts_runner +3 -0
  12. sm8850-npu-a16w8/build/stage/assets/default_voice.txt +1 -0
  13. sm8850-npu-a16w8/build/stage/assets/default_voice.wav +3 -0
  14. sm8850-npu-a16w8/build/stage/cbemb.bf16 +3 -0
  15. sm8850-npu-a16w8/build/stage/emb.bf16 +3 -0
  16. sm8850-npu-a16w8/build/stage/fastemb.bf16 +3 -0
  17. sm8850-npu-a16w8/build/stage/libLiteRt.so +3 -0
  18. sm8850-npu-a16w8/build/stage/libLiteRtDispatch_Qualcomm.so +3 -0
  19. sm8850-npu-a16w8/build/stage/port.json +10 -0
  20. sm8850-npu-a16w8/build/stage/run.sh +6 -0
  21. sm8850-npu-a16w8/build/stage/tok_added.txt +0 -0
  22. sm8850-npu-a16w8/build/stage/tok_merges.txt +0 -0
  23. sm8850-npu-a16w8/build/stage/tok_vocab.txt +0 -0
  24. sm8850-npu-a16w8/demo/demo.json +41 -0
  25. sm8850-npu-a16w8/demo/input.txt +1 -0
  26. sm8850-npu-a16w8/demo/output.wav +3 -0
  27. sm8850-npu-a16w8/demo/stream_metrics.json +1 -0
  28. sm8850-npu-a16w8/demo/stream_output.wav +3 -0
  29. sm8850-npu-a16w8/demo/tts_metrics.json +1 -0
  30. sm8850-npu-a16w8/deploy.sh +27 -0
  31. sm8850-npu-a16w8/fetch.sh +41 -0
  32. sm8850-npu-a16w8/models/cdecs.tflite +3 -0
  33. sm8850-npu-a16w8/models/cenc.tflite +3 -0
  34. sm8850-npu-a16w8/models/cpost.tflite +3 -0
  35. sm8850-npu-a16w8/models/cpost256.tflite +3 -0
  36. sm8850-npu-a16w8/models/fast.tflite +3 -0
  37. sm8850-npu-a16w8/models/head.tflite +3 -0
  38. sm8850-npu-a16w8/models/rope_fast.f32 +0 -0
  39. sm8850-npu-a16w8/models/rope_slow.f32 +3 -0
  40. sm8850-npu-a16w8/models/rvq_t0.f16 +3 -0
  41. sm8850-npu-a16w8/models/rvq_tr.f16 +3 -0
  42. sm8850-npu-a16w8/models/slow.tflite +3 -0
  43. sm8850-npu-a16w8/models/slow1.tflite +3 -0
  44. sm8850-npu-a16w8/models/slow1s.tflite +3 -0
  45. sm8850-npu-a16w8/report.html +613 -0
  46. sm8850-npu-a16w8/report/reproduce.sh +11 -0
  47. sm8850-npu-a16w8/report/results.csv +73 -0
  48. sm8850-npu-a16w8/report/results.json +0 -0
  49. sm8850-npu-a16w8/repro/Dockerfile +8 -0
  50. sm8850-npu-a16w8/repro/bench.py +729 -0
.gitattributes CHANGED
@@ -1,35 +1,21 @@
1
- *.7z filter=lfs diff=lfs merge=lfs -text
2
- *.arrow filter=lfs diff=lfs merge=lfs -text
3
  *.bin filter=lfs diff=lfs merge=lfs -text
4
- *.bz2 filter=lfs diff=lfs merge=lfs -text
5
- *.ckpt filter=lfs diff=lfs merge=lfs -text
6
- *.ftz filter=lfs diff=lfs merge=lfs -text
7
- *.gz filter=lfs diff=lfs merge=lfs -text
8
- *.h5 filter=lfs diff=lfs merge=lfs -text
9
- *.joblib filter=lfs diff=lfs merge=lfs -text
10
- *.lfs.* filter=lfs diff=lfs merge=lfs -text
11
- *.mlmodel filter=lfs diff=lfs merge=lfs -text
12
- *.model filter=lfs diff=lfs merge=lfs -text
13
- *.msgpack filter=lfs diff=lfs merge=lfs -text
14
- *.npy filter=lfs diff=lfs merge=lfs -text
15
- *.npz filter=lfs diff=lfs merge=lfs -text
16
- *.onnx filter=lfs diff=lfs merge=lfs -text
17
- *.ot filter=lfs diff=lfs merge=lfs -text
18
- *.parquet filter=lfs diff=lfs merge=lfs -text
19
- *.pb filter=lfs diff=lfs merge=lfs -text
20
- *.pickle filter=lfs diff=lfs merge=lfs -text
21
- *.pkl filter=lfs diff=lfs merge=lfs -text
22
- *.pt filter=lfs diff=lfs merge=lfs -text
23
- *.pth filter=lfs diff=lfs merge=lfs -text
24
- *.rar filter=lfs diff=lfs merge=lfs -text
25
- *.safetensors filter=lfs diff=lfs merge=lfs -text
26
- saved_model/**/* filter=lfs diff=lfs merge=lfs -text
27
- *.tar.* filter=lfs diff=lfs merge=lfs -text
28
- *.tar filter=lfs diff=lfs merge=lfs -text
29
  *.tflite filter=lfs diff=lfs merge=lfs -text
30
- *.tgz filter=lfs diff=lfs merge=lfs -text
31
- *.wasm filter=lfs diff=lfs merge=lfs -text
32
- *.xz filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
 
 
 
 
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
- *.zst filter=lfs diff=lfs merge=lfs -text
35
- *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
1
  *.bin filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  *.tflite filter=lfs diff=lfs merge=lfs -text
3
+ *.gguf filter=lfs diff=lfs merge=lfs -text
4
+ *.onnx filter=lfs diff=lfs merge=lfs -text
5
+ *.npz filter=lfs diff=lfs merge=lfs -text
6
+ *.wav filter=lfs diff=lfs merge=lfs -text
7
+ *.so filter=lfs diff=lfs merge=lfs -text
8
+ *.bf16 filter=lfs diff=lfs merge=lfs -text
9
+ *.f16 filter=lfs diff=lfs merge=lfs -text
10
+ *.f32 filter=lfs diff=lfs merge=lfs -text
11
+ *.npy filter=lfs diff=lfs merge=lfs -text
12
+ *.tkb filter=lfs diff=lfs merge=lfs -text
13
+ *.png filter=lfs diff=lfs merge=lfs -text
14
+ *.jpg filter=lfs diff=lfs merge=lfs -text
15
+ *.jpeg filter=lfs diff=lfs merge=lfs -text
16
+ *.pdf filter=lfs diff=lfs merge=lfs -text
17
  *.zip filter=lfs diff=lfs merge=lfs -text
18
+ *.gz filter=lfs diff=lfs merge=lfs -text
19
+ *.safetensors filter=lfs diff=lfs merge=lfs -text
20
+ *.pt filter=lfs diff=lfs merge=lfs -text
21
+ sm8850-npu-a16w8/build/stage/arktts_runner filter=lfs diff=lfs merge=lfs -text
LICENSE ADDED
@@ -0,0 +1,201 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
NOTICE ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ audio8_tts
2
+
3
+ The model architecture is inspired by the DualAR design used in Fish Audio
4
+ S2 Pro.
5
+
6
+ ---
7
+
8
+ This repository is a modified version of Edge0/Audio8-TTS-Realistic-Air by Edge0 (published as Edge0/Audio8-TTS-Realistic-0.6b, which now redirects to Edge0/Audio8-TTS-Realistic-Air), revision 23c305cc013fde378edb459f538317043c993a74.
9
+
10
+ Changes, made by nnopt (https://nnopt.dev):
11
+ - `sm8850-npu-a16w8/` (nnopt job NN-983499): included: models/*.tflite (18 graphs AOT-compiled for SM8850 by nnopt; a16w8 decode graphs, fp16 rest), the CPU-side tables in build/stage/; Qualcomm's QNN runtime is fetched. The runtime code (src/, build.sh, deploy.sh, run.sh) is new, written by nnopt's agents for this device.
README.md ADDED
@@ -0,0 +1,77 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ base_model: Edge0/Audio8-TTS-Realistic-Air
4
+ pipeline_tag: text-to-speech
5
+ tags:
6
+ - on-device
7
+ - nnopt
8
+ - litert
9
+ - tflite
10
+ - android
11
+ - npu
12
+ - hexagon
13
+ - qualcomm
14
+ - tts
15
+ - galaxy-s26-plus
16
+ ---
17
+
18
+ # Audio8-TTS-Realistic-0.6b on Samsung Galaxy S26+ (LiteRT)
19
+
20
+ Ported and verified on a real Samsung Galaxy S26+ by [nnopt.dev](https://nnopt.dev) — AI agents that port and optimize models for the hardware you ship.
21
+
22
+ The model is [Edge0/Audio8-TTS-Realistic-Air](https://huggingface.co/Edge0/Audio8-TTS-Realistic-Air) by Edge0, and it is theirs (published as Edge0/Audio8-TTS-Realistic-0.6b, which now redirects to Edge0/Audio8-TTS-Realistic-Air). The LiteRT port in this repository is nnopt's work: nnopt job NN-983499.
23
+
24
+ | | |
25
+ |---|---|
26
+ | Device | Samsung Galaxy S26+, Android 16 |
27
+ | Chip | Snapdragon 8 Elite Gen 5 (SM8850) |
28
+ | Processor | NPU (Hexagon HTP v81) for every model graph; CPU for tokenizer, sampling and glue |
29
+ | Runtime | LiteRT 2.3.1 (Qualcomm dispatch), QNN 2.50.0 |
30
+ | Precision | a16w8 decode graphs (int8 weights, int16 activations); fp16 prefill, LM head and codec (encoder, post-module, streaming decoder) |
31
+ | Modality | text -> speech |
32
+ | Weights | included: models/*.tflite (18 graphs AOT-compiled for SM8850 by nnopt; a16w8 decode graphs, fp16 rest), the CPU-side tables in build/stage/; Qualcomm's QNN runtime is fetched |
33
+ | nnopt job | NN-983499 (port) |
34
+ | Folder | [`sm8850-npu-a16w8/`](https://huggingface.co/nnopt-dev/Audio8-TTS-Realistic-0.6b-LiteRT/tree/main/sm8850-npu-a16w8) |
35
+
36
+ ## Verified results
37
+
38
+ nnopt built the folder from a clean copy, deployed it to the device and checked it against the model's reference code on hidden inputs. The full report is `report.html` in the folder.
39
+
40
+ - Passed. Intelligibility (ASR word error rate change) +0.4 points (bar at most +5.0 points)
41
+ - WER 4.67% vs 4.28% ref
42
+ - full check passed
43
+ - no speculative decoding
44
+ - Time to first audio 2.42 s
45
+ - Real-time factor 0.449
46
+ - Latency 2.42 s
47
+ - Load time 2.23 s
48
+ - Peak memory 2,519 MB
49
+ - 18 graphs, NPU 100%
50
+
51
+ ## Use it
52
+
53
+ ```
54
+ mkdir Audio8-TTS-Realistic-0.6b-LiteRT && cd Audio8-TTS-Realistic-0.6b-LiteRT
55
+ curl -fsSL https://huggingface.co/nnopt-dev/Audio8-TTS-Realistic-0.6b-LiteRT/resolve/main/config.json -o config.json
56
+ hf download nnopt-dev/Audio8-TTS-Realistic-0.6b-LiteRT --include "sm8850-npu-a16w8/*" --local-dir .
57
+ cd sm8850-npu-a16w8
58
+ bash fetch.sh
59
+ bash deploy.sh /data/local/tmp/audio8 # adb: pushes build/stage (runner, LiteRT, QNN libs, graphs, tables)
60
+ adb push demo/input.txt /data/local/tmp/audio8/in.txt
61
+ adb shell 'cd /data/local/tmp/audio8 && sh ./run.sh --text-file in.txt --seed 1234 --out out.wav --metrics m.json'
62
+ adb pull /data/local/tmp/audio8/out.wav
63
+ ```
64
+
65
+ Needs: A Snapdragon SM8850 phone (Galaxy S26+), adb, ~3 GB free storage; curl and unzip on the host. Rebuilding (`bash build.sh`) fetches the NDK and the original weights itself.
66
+
67
+ `README.md` in the folder has every flag, the requirements and the known limits; `REPRO.md` (where present) reproduces the measurements.
68
+
69
+ ## License
70
+
71
+ Apache 2.0, like Edge0/Audio8-TTS-Realistic-Air: see LICENSE and NOTICE. LiteRT in `vendor/litert/` is Apache 2.0. Qualcomm's QNN runtime is not here: `fetch.sh` gets it from Maven Central, under Qualcomm's license.
72
+
73
+ ## Made with nnopt
74
+
75
+ [nnopt](https://nnopt.dev) is a platform where AI agents port, optimize and benchmark a model for a specific device. They write the runtime code on the real device, and a locked verification kit then checks the result against the model's own reference code before anything ships. Every number on this page comes from that check.
76
+
77
+ Want your model on your device? Start a job at [nnopt.dev](https://nnopt.dev).
config.json ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "nnopt_manifest": 1,
3
+ "repo": "nnopt-dev/Audio8-TTS-Realistic-0.6b-LiteRT",
4
+ "model": {
5
+ "name": "Audio8-TTS-Realistic-0.6b",
6
+ "source_repo": "Edge0/Audio8-TTS-Realistic-Air",
7
+ "source_revision": "23c305cc013fde378edb459f538317043c993a74",
8
+ "source_note": "published as Edge0/Audio8-TTS-Realistic-0.6b, which now redirects to Edge0/Audio8-TTS-Realistic-Air",
9
+ "authors": "Edge0",
10
+ "license": "apache-2.0"
11
+ },
12
+ "variants": [
13
+ {
14
+ "id": "sm8850-npu-a16w8",
15
+ "device": "Samsung Galaxy S26+",
16
+ "chip": "Snapdragon 8 Elite Gen 5 (SM8850)",
17
+ "os": "Android 16",
18
+ "processor": "NPU (Hexagon HTP v81) for every model graph; CPU for tokenizer, sampling and glue",
19
+ "runtime": "LiteRT 2.3.1 (Qualcomm dispatch), QNN 2.50.0",
20
+ "runtime_version": "LiteRT 2.3.1 + QNN 2.50.0",
21
+ "precision": "a16w8 decode graphs (int8 weights, int16 activations); fp16 prefill, LM head and codec (encoder, post-module, streaming decoder)",
22
+ "weights": "included: models/*.tflite (18 graphs AOT-compiled for SM8850 by nnopt; a16w8 decode graphs, fp16 rest), the CPU-side tables in build/stage/; Qualcomm's QNN runtime is fetched",
23
+ "nnopt_job": "NN-983499",
24
+ "job_kind": "port",
25
+ "verified": {
26
+ "verdict": "Passed. Intelligibility (ASR word error rate change) +0.4 points (bar at most +5.0 points); WER 4.67% vs 4.28% ref; full check passed; no speculative decoding",
27
+ "speed": "Time to first audio 2.42 s; Real-time factor 0.449; Latency 2.42 s; Load time 2.23 s; Peak memory 2,519 MB; 18 graphs, NPU 100%"
28
+ },
29
+ "fetch": "sm8850-npu-a16w8/fetch.sh"
30
+ }
31
+ ],
32
+ "license": "apache-2.0",
33
+ "made_by": "nnopt (https://nnopt.dev)"
34
+ }
sm8850-npu-a16w8/README.md ADDED
@@ -0,0 +1,147 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Audio8-TTS-Realistic-0.6b on the Galaxy S26+ (LiteRT 2.3.1, every model graph on the Hexagon NPU)
2
+
3
+ Text to speech with zero-shot voice cloning (Edge0/Audio8-TTS-Realistic-0.6b, revision 23c305cc), ported to a
4
+ Samsung Galaxy S26+ (Snapdragon 8 Elite Gen 5, SM8850: Hexagon HTP v81, Adreno 840) on Google's LiteRT 2.3.1.
5
+
6
+ | part | graph | processor | precision |
7
+ |---|---|---|---|
8
+ | slow AR transformer (24 layers): 16-row prefill | slow | NPU (HTP, Qualcomm dispatch, QNN 2.50.0) | fp16 |
9
+ | slow AR transformer, 1-row decode over 512 and 2048 KV positions | slow1s, slow1 | NPU | a16w8 (int8 weights, int16 activations) |
10
+ | LM head of the decode step (896 x 4097 tied embedding rows, from the decode graph's hidden output) | head | NPU | fp16 |
11
+ | fast AR transformer (4 layers, 9 codebooks per frame) | fast | NPU | a16w8 (int8 weights, int16 activations) |
12
+ | codec post-module (8 windowed layers + upsampling), 256- and 1024-frame buckets | cpost256, cpost | NPU | fp16 |
13
+ | codec decoder (conv / Snake / conv-transpose, 2048 samples per frame), streaming: 8 frames per call, conv tails as state | cdecs | NPU | fp16 |
14
+ | codec encoder (voice clip -> 10 x RVQ codes, up to 127 frames = 5.9 s) | cenc | NPU | fp16 |
15
+ | tokenizer, WAV I/O + resampling, embedding sums, sampling (top-k 50, top-p 0.95, T 0.8, RAS) | runner | CPU | fp32 |
16
+
17
+ The codec decoder and encoder are written in a "rows" layout (a sequence [C, L] held as [C, rows, 64], causal convs
18
+ taking their left context from the previous row), which the HTP runs 3-10x faster than 1-D convs; the decoder is a
19
+ stateful streaming graph (8 frames per call, its 20 conv tails fed back), exact against the window decoder. The decode
20
+ step's LM head is a separate fp16 graph (the quantized decode graphs' int16 logits saturate the end-of-speech logit).
21
+ The codec runs in a second thread on the frames generated so far while the LM generates; with `--stream` the WAV is
22
+ written chunk by chunk as each block of frames is decoded.
23
+
24
+ ## Requirements
25
+ - An SM8850 phone (Galaxy S26+ US/China/Japan model) with adb. The models are compiled for SM8850 only.
26
+ - Build host: Linux x86-64 or macOS arm64 with git, curl, python3 (venv), unzip and a C compiler. build.sh fetches the
27
+ Android NDK r27d and the qnn-runtime 2.50.0 AAR (Maven Central) itself, pinned by sha256, into `.deps/`.
28
+ - The customer's files: `INPUTS_DIR` laid out as `weights/model.safetensors` and `reference_code/tokenizer.json` (+ the
29
+ repo's other files) of Edge0/Audio8-TTS-Realistic-0.6b at revision 23c305cc013fde378edb459f538317043c993a74.
30
+ Optional: with `INPUTS_DIR` unset, build.sh downloads model.safetensors and tokenizer.json from Hugging Face at that
31
+ revision into `.deps/` (sha256-checked).
32
+
33
+ ## Build, deploy, run
34
+ ```
35
+ bash build.sh # or INPUTS_DIR=/path/to/inputs; runner + tables + QNN libs into build/stage
36
+ bash deploy.sh /data/local/tmp/arktts # adb push (only changed files)
37
+ adb shell "cd /data/local/tmp/arktts && sh ./run.sh --text-file /data/local/tmp/in.txt --seed 1234 \
38
+ --out /data/local/tmp/out.wav --metrics /data/local/tmp/m.json"
39
+ ```
40
+ run.sh flags: `--text-file IN.txt --seed S [--repeat R] [--stream] --out OUT.wav --metrics M.json`;
41
+ `--stream` writes OUT.wav while frames are generated (float WAV, header patched at the end) and adds `chunks`,
42
+ `min_slack_ms`, `gaps` and `chunk_frames_ms` ([frames so far, ms]) to the metrics, `ttfa_ms` being the first chunk;
43
+ `--clone-audio WAV --clone-text-file TXT` (line 1: the clip's transcript, the rest: the text; the "clone" mode) or
44
+ `--ref-audio WAV --ref-text-file TXT` to clone another voice (at most 5.9 s; default: the bundled LibriSpeech clip
45
+ `assets/default_voice.*`, CC BY 4.0), `--no-ref` for no reference voice. Output: 44.1 kHz mono float WAV.
46
+ Sampling is seeded (`--seed`) with the runner's own RNG, so audio differs from PyTorch sample by sample but says the
47
+ same words.
48
+
49
+ Check (nnopt's kit): `nnopt-verify check --split public --bundle <reference bundle> --port /data/local/tmp/arktts`.
50
+
51
+ ## Measured (Galaxy S26+, burst)
52
+ - Public check: passed. ASR WER 5.2% for the port vs 5.7% for the reference (bar: +5 points); duration ratio per
53
+ case 0.85-1.10 (mean 0.996: the model samples, seeded, so one case's length varies like the reference's own across
54
+ seeds).
55
+ - Real-time factor 0.46-0.50 per request: the README sentence, 5.06 s of audio in 2.32 s (2.50 s streamed);
56
+ 14.02 s of audio in 7.01 s streamed.
57
+ - Streaming (`--stream`): first audio chunk at 280-311 ms, chunks of 8 frames (0.37 s of audio), no gaps (each chunk
58
+ written >= 200 ms before the audio before it has played).
59
+ - Per frame (46.4 ms of audio): slow ~6.4 ms (slow1s 6.05 ms per call), fast 9 x ~1.3 ms, head 0.6-1 ms, codec
60
+ 2.8 ms (cdecs 22 ms per 8 frames) + cpost, overlapped with the LM, other CPU ~1.5 ms.
61
+ - Load: 2.5-3.6 s (9 NPU graphs; voice clip encoded, 392 ms, and its prompt prefix prefilled once).
62
+
63
+ ## Known limits
64
+ - Requests longer than 2048 positions (prompt + frames) stop with an error; the reference's limit is the same
65
+ (max_seq_len 2048). A reference clip longer than 5.9 s is rejected (encoder graph of 127 frames).
66
+ - The voice clip is encoded at load, not per request. The encoder runs at fp16 on the NPU: its semantic codes match
67
+ the fp32 encoder at 97.6%, the residual levels at 84% overall (nearest-neighbour RVQ amplifies fp16 differences).
68
+ - Sampling is seeded with the runner's own RNG: per request, the length differs from the reference's like another
69
+ seed's would (public cases 0.85-1.10x, mean 0.996x), with the same words.
70
+ - Streaming over 256 frames (~12 s of audio) decodes the post-module per chunk of >= 48 frames: still no gaps on the
71
+ public cases nor on a 31.5 s text (678 frames: first audio 386 ms, min slack 204 ms, RTF 0.55).
72
+ - LiteRT prints one "GPU accelerator could not be loaded" warning at start: no GPU library ships, nothing uses it.
73
+ - The decode graphs (slow1s, slow1, fast) are quantized (a16w8): within the kit's intelligibility bar (WER 2.6% vs
74
+ the reference's 5.7% on the public cases; end of speech on 21 of 21 seeds of a short sentence), but not bit-equal
75
+ to an fp16 run. The fp16 decode graphs (RTF ~0.58) can be re-made with src/export/vm_export.sh.
76
+
77
+ ## Rebuilding the models (optional; build.sh never does this)
78
+ `src/export/vm_export.sh` on an x86-64 Linux machine with 64+ GB RAM (n2-highmem-16 used), litert-torch 0.10.0,
79
+ torch 2.14.1 CPU, ai-edge-litert 2.3.0 and ai-edge-litert-sdk-qualcomm 2.3.0 (QAIRT 2.50 AOT): it downloads the model
80
+ at the pinned revision, exports each graph (`export_graphs.py`, checked against PyTorch on the CPU) and AOT-compiles
81
+ the NPU graphs for SM8850 (`*_Qualcomm_SM8850_apply_plugin.tflite`, renamed to `models/<graph>.tflite`).
82
+ The shipped fast graph is the a16w8 one: `CALIB_FAST=<dir> bash vm_export.sh fast` (ARKTTS_QNORM=1 export, min/max
83
+ calibration with `lq_minmax.py` on 200 fast-step input sets dumped by the runner with ARKTTS_DUMP_FAST, NOTES.md).
84
+ The shipped slow1s / slow1 decode graphs are a16w8 too: `src/export/q_slow1s.sh` and `q_slow1.sh` (ARKTTS_QNORM=1
85
+ ARKTTS_QMASK=1 export, `lq_minmax.py` min/max calibration on 70 slow1s input sets dumped with ARKTTS_DUMP_SLOW; slow1's
86
+ set is the same inputs with the caches zero-padded to 2048 positions and masked).
87
+ `src/export/arktts_graphs.py` holds the step modules (each quotes the reference lines it implements).
88
+ The NPU codec graphs and the LM head (made on this host's CPU, 16 GB was enough; AOT with `src/export/aot_local.py`, the
89
+ same ai-edge-litert 2.3.0 + QAIRT 2.50 compiler): `cdecs_export.py K OUT` (streaming decoder, K = 8 frames per call;
90
+ checks chained calls against the whole-sequence decoder), `cenc_export.py 127 OUT` (rows-layout encoder; checks codes
91
+ against the reference encoder on the bundled voice clip), `head_export.py OUT`. They need `INPUTS_DIR` (weights +
92
+ reference_code with codec.pth) and `ARKTTS_PKG` (a folder holding the reference .py files as the package `arktts`).
93
+
94
+ ## Shipped models (models/, sha256)
95
+ ```
96
+ 5e5a6c60763020cd10a069b485748b293aaa39b04c2ae5b1bf4691bae54a7327 cdecs.tflite
97
+ c1a0704376f7b2f35656661663d658c3ea07e7a3cf205cc84d82df656e524ad4 cenc.tflite
98
+ 758e34cae97a4ccd80eeb23bc74af6c21e4fbb4134de5bf5bfbce9dd07f55c57 cpost.tflite
99
+ 32948d50a3d52217e3dd9fc18554ce7c772272d3a7cc6a917c90e9e28c2c6b0e cpost256.tflite
100
+ 19e2a955ca478fe4cb680db6d646902046aa2476cb09fe4425fbb979f08324d7 fast.tflite
101
+ 0ce6711aaed817b678974671d1ff787b166ec6982ae0b72d350efed10cf0dcca head.tflite
102
+ 42e6b27f42ac35e2c089f0d269c1f037730563d992906c7e62b150a0cd9896ab rope_fast.f32
103
+ 81648383918c4e13cf41037aef69597265d6f46bd44c3cf343451c9b0323a398 rope_slow.f32
104
+ e9f32bd8d08547ce1c0dc51f2768f40eea04a56ec57d75ce664ebd61e22c13a9 rvq_t0.f16
105
+ 3e45eb582c9f1e9fd0f508c08d48ded2862e1405c9c51f70cee230b181d6a15d rvq_tr.f16
106
+ ba0241e2dc1f8382a45b25930471f4835ceaa37bb8a4acf5d798d771ed919070 slow.tflite
107
+ d1e7ad41d7c32791e4edec27e783c892efdc5cf303e322979758b4a774be9062 slow1.tflite
108
+ 6e80c28a2e7ed0234a27c3403a575cd8d66c5a1d69afc1dd1c4debe3ef46eba2 slow1s.tflite
109
+ ```
110
+ LiteRT 2.3.1 libraries (Apache 2.0) are in vendor/litert/2.3.1 with their SHA256SUMS; the QNN libraries (Qualcomm AI
111
+ Stack License) are fetched by build.sh, never shipped.
112
+
113
+ ## Verified by nnopt
114
+
115
+ **Passed** Edge0/Audio8-TTS-Realistic-0.6b on Samsung Galaxy S26+ (2026-11-03). nnopt built this folder from a clean copy, deployed it to the device and ran it on hidden inputs; the full report is report.html.
116
+
117
+ | Check | Measured | Bar | Result |
118
+ |---|---|---|---|
119
+ | Outputs match your reference code | Intelligibility (ASR word error rate change) +0.4 points | at most +5.0 points (original precision) | pass |
120
+ | Runs on LiteRT and the Hexagon NPU | src/export/export_graphs.py:38: from ai_edge_litert.interpreter import Interpreter | the runtime you asked for | pass |
121
+ | Decodes one token per pass | one token per pass through the model: no speculative decoding in the port's code | no speculative decoding | pass |
122
+
123
+ | Speed | This port |
124
+ |---|---|
125
+ | Time to first audio | 2.42 s |
126
+ | Real-time factor | 0.449 |
127
+ | Latency | 2.42 s |
128
+ | Load time | 2.23 s |
129
+ | Peak memory | 2,519 MB |
130
+ | Text to speech: latency | 2.45 s |
131
+ | Text to speech: load time | 2.47 s |
132
+ | Text to speech: real-time factor | 0.456 |
133
+ | Text to speech: time to first audio | 2.45 s |
134
+
135
+ | Measurement | Median |
136
+ |---|---|
137
+ | Time to first audio | 2417.6 ms |
138
+ | Real-time factor | 0.448782 |
139
+ | Latency | 2417.6 ms |
140
+ | Load time | 2226.6 ms |
141
+ | Peak memory | 2519.0 MB |
142
+ | Text to speech: latency | 2454.2 ms |
143
+ | Text to speech: load time | 2465.7 ms |
144
+ | Text to speech: real-time factor | 0.455576 |
145
+ | Text to speech: time to first audio | 2454.2 ms |
146
+
147
+ To get these results on your own device, follow REPRO.md.
sm8850-npu-a16w8/REPRO.md ADDED
@@ -0,0 +1,168 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Reproduce: Edge0/Audio8-TTS-Realistic-0.6b on Samsung Galaxy S26+
2
+
3
+ nnopt ported this (NN-983499, 2026-11-03). Runtime: LiteRT 2.3.1, Qualcomm dispatch, QNN 2.50.0. Follow the steps on the same device model and OS build; the results should land within the tolerances in the last table.
4
+
5
+ ## 1. Device
6
+
7
+ | Property | nnopt ran on |
8
+ |---|---|
9
+ | Chip | Snapdragon 8 Elite Gen 5 |
10
+ | GPU | Adreno 840 |
11
+ | Memory | 12 GB |
12
+ | OS | Android 16 |
13
+
14
+ Keep the phone plugged in, screen on and awake (Developer options > Stay awake), no other apps open, and let it rest about 10 minutes before measuring (a warm phone throttles).
15
+
16
+ ## 2. Tools
17
+
18
+ **Tested:** nnopt built this folder from scratch on 2026-11-03 in the public image `ubuntu:24.04@sha256:68ee22004a9109b44973313b02ff7b1de250f1de0f5ecb628d73f579aaff33ac` with only these packages installed: git, curl, python3, python3-venv, build-essential, unzip, xz-utils. build.sh fetched everything else itself (its downloads are listed under step 3), and that build is the one nnopt deployed and measured.
19
+
20
+ Any Linux x86-64 machine with those packages builds it. build.sh is written to build on macOS arm64 as well (Xcode command line tools, git, curl, python3); nnopt did not test that for this deliverable.
21
+
22
+ | Tool | Version | Get it |
23
+ |---|---|---|
24
+ | gcc | 13.3.0 | – |
25
+ | Python | 3.12.3 | https://www.python.org/downloads/ |
26
+ | git | 2.43.0 | – |
27
+ | curl | 8.5.0 | – |
28
+
29
+ To deploy and measure you also need adb (Android platform-tools) and python3 (3.8 or newer, no packages).
30
+
31
+ build.sh and deploy.sh read these environment variables:
32
+
33
+ - `ANDROID_NDK`: the Android NDK folder (same as ANDROID_NDK_HOME)
34
+ - `BUILD`: set it before building
35
+ - `DEPS`: set it before building
36
+ - `INPUTS_DIR`: the folder step 3 fills with the model and inputs (one folder per source, as named there)
37
+ - `QNN_RUNTIME_AAR`: has a default in the script
38
+ - `STAGE`: set it before building
39
+
40
+ The same machine in Docker (`repro/Dockerfile`: the public image and packages above, nothing else):
41
+
42
+ ```
43
+ docker build --platform linux/amd64 -t build-env repro
44
+ docker run --rm --platform linux/amd64 --user "$(id -u):$(id -g)" -e HOME=/tmp -v "$PWD:/src" -w /src -v "$PWD/inputs:/inputs:ro" -e INPUTS_DIR=/inputs build-env bash build.sh
45
+ ```
46
+
47
+ ## 3. Model and inputs
48
+
49
+ **reference_code**: Hugging Face `Edge0/Audio8-TTS-Realistic-0.6b` at revision `23c305cc013fde378edb459f538317043c993a74`.
50
+
51
+ ```
52
+ huggingface-cli download Edge0/Audio8-TTS-Realistic-0.6b --revision 23c305cc013fde378edb459f538317043c993a74 --local-dir inputs/reference_code
53
+ ```
54
+
55
+ | File | Size | sha256 |
56
+ |---|---|---|
57
+ | .gitattributes | 1.5 KB | `34448b82c17d60fec9b65b1f093c115ddbaadc04beb1b0140b6bfed2e012a930` |
58
+ | LICENSE | 11.1 KB | `c71d239df91726fc519c6eb72d318ec65820627232b2f796219e87dcf35d0ab4` |
59
+ | NOTICE | 95 B | `819129644b28fb066221d782dd27a6fe1d35f33f46718d4e61570614fb38854e` |
60
+ | README.md | 15.2 KB | `cbb0adec8372b070fa9d35692ab9dc3163f3479ba827d221d3f125138a0053f3` |
61
+ | assets/badges/arxiv-badge.svg | 2.4 KB | `c9f9a2dbd4d92e35a37586909c2c41c2aa7c43ff1490852dd85ca2b500d3c7c1` |
62
+ | assets/badges/demo-badge.svg | 5.7 KB | `5f850950d7091ba4955cfa3d048b548e0297af3c6f08014eeafa9e4dd39aec14` |
63
+ | assets/badges/github-badge.svg | 2.1 KB | `aa790dc515a52cdf80903f40f94b5d1156a343d408280aa632c2403339ce5db7` |
64
+ | assets/badges/license-badge.svg | 948 B | `fa0139dca8f660be0f5eaca34886efc1e3794798e161978fde111914e06ad090` |
65
+ | assets/badges/playground-badge.svg | 562 B | `94d49131a3a38ff378e85dbf4eeb48bf8ee3a391e4cd877d23f438bac9942ade` |
66
+ | assets/realistic-hero.svg | 937 B | `b194a51201289fa1192d051bc94e9386fd965080b37707ca8b21ba63647424ba` |
67
+ | audio8-banner.jpeg | 70.9 KB | `49e684e816311da9de9c75c9ed04381d125ec4b1ec4221a9378fbf19f9c4d806` |
68
+ | codec.pth | 1.3 GB | `c310505aa11fe2f6cc63b8d3130dc7e77e73227774f5c62575769b1f47a8d048` |
69
+ | config.json | 1.7 KB | `a6a2189cb6938b117ad388bad1e4ad786df416170046a0082f07fad28438de0c` |
70
+ | configuration_arktts.py | 4.4 KB | `27fa4fd4073ef1983a48919a4562300cace84687335035a9b9a077966e1ac04e` |
71
+ | generation_config.json | 190 B | `afdc07303d332679ab9b71265c7c1b8519ace777cfa8cac057b30f01f08b5023` |
72
+ | model.safetensors | 1.1 GB | `f590053e980a45ebcbb2e787cff4f2dead932b2b61e5cf54d05664d9764e12d8` |
73
+ | modeling_arktts.py | 33.9 KB | `b320b6c875e6a57afb9745cc98fc72c116d9df6b3bf20d092a5ad3095026911f` |
74
+ | modeling_arktts_codec.py | 19.4 KB | `e1d6b0e1ef1e9ad303dc01d45d86229cf7f2e98d06a7b426234a7e4d7e3ede68` |
75
+ | preprocessor_config.json | 254 B | `e626df9aa1cbe25c4e0999a470c6598d58f172169a5488357b594795d85b5208` |
76
+ | processing_arktts.py | 10.9 KB | `eba6ecb6b7f0e221bcd19c5e3fe5978e677faf6b362912ff4febc08c3dc7f9df` |
77
+ | … 4 more | | |
78
+
79
+ **weights**: Hugging Face `Edge0/Audio8-TTS-Realistic-0.6b` at revision `23c305cc013fde378edb459f538317043c993a74`, `model.safetensors`.
80
+
81
+ ```
82
+ huggingface-cli download Edge0/Audio8-TTS-Realistic-0.6b --revision 23c305cc013fde378edb459f538317043c993a74 --include 'model.safetensors*' --local-dir inputs/weights
83
+ ```
84
+
85
+ | File | Size | sha256 |
86
+ |---|---|---|
87
+ | .gitattributes | 1.5 KB | `34448b82c17d60fec9b65b1f093c115ddbaadc04beb1b0140b6bfed2e012a930` |
88
+ | LICENSE | 11.1 KB | `c71d239df91726fc519c6eb72d318ec65820627232b2f796219e87dcf35d0ab4` |
89
+ | NOTICE | 95 B | `819129644b28fb066221d782dd27a6fe1d35f33f46718d4e61570614fb38854e` |
90
+ | README.md | 15.2 KB | `cbb0adec8372b070fa9d35692ab9dc3163f3479ba827d221d3f125138a0053f3` |
91
+ | audio8-banner.jpeg | 70.9 KB | `49e684e816311da9de9c75c9ed04381d125ec4b1ec4221a9378fbf19f9c4d806` |
92
+ | config.json | 1.7 KB | `a6a2189cb6938b117ad388bad1e4ad786df416170046a0082f07fad28438de0c` |
93
+ | configuration_arktts.py | 4.4 KB | `27fa4fd4073ef1983a48919a4562300cace84687335035a9b9a077966e1ac04e` |
94
+ | generation_config.json | 190 B | `afdc07303d332679ab9b71265c7c1b8519ace777cfa8cac057b30f01f08b5023` |
95
+ | model.safetensors | 1.1 GB | `f590053e980a45ebcbb2e787cff4f2dead932b2b61e5cf54d05664d9764e12d8` |
96
+ | modeling_arktts.py | 33.9 KB | `b320b6c875e6a57afb9745cc98fc72c116d9df6b3bf20d092a5ad3095026911f` |
97
+ | modeling_arktts_codec.py | 19.4 KB | `e1d6b0e1ef1e9ad303dc01d45d86229cf7f2e98d06a7b426234a7e4d7e3ede68` |
98
+ | preprocessor_config.json | 254 B | `e626df9aa1cbe25c4e0999a470c6598d58f172169a5488357b594795d85b5208` |
99
+ | processing_arktts.py | 10.9 KB | `eba6ecb6b7f0e221bcd19c5e3fe5978e677faf6b362912ff4febc08c3dc7f9df` |
100
+ | processor_config.json | 207 B | `4df1f6d2a8ca9d1976b75378847a9de6c3d4db6e34240788b7b9ffa053c00aa2` |
101
+ | special_tokens_map.json | 99.5 KB | `c2ff18fde6e43b7408435bc8ed079af74531befba549358a97cbc59ce606bc6b` |
102
+ | tokenizer.json | 11.7 MB | `f24e08099d45a8adf3f52f5f0b03276e433bb9d689bb15fcbcc48ce58744588b` |
103
+ | tokenizer_config.json | 840.7 KB | `b8d149343ae425b0da67e6708686aceb51be7815d9792f265fc12ff04d5e9856` |
104
+
105
+ ## 4. Build
106
+
107
+ ```
108
+ INPUTS_DIR=$PWD/inputs bash build.sh
109
+ ```
110
+
111
+ `INPUTS_DIR` is the folder step 3 filled (one folder per source, as named there).
112
+
113
+ ## 5. Connect the device
114
+
115
+ ```
116
+ adb devices
117
+ ```
118
+
119
+ One device should be listed as `device`. With several, set `export ANDROID_SERIAL=<serial>` first.
120
+
121
+ ## 6. Deploy
122
+
123
+ ```
124
+ bash deploy.sh /data/local/tmp/nnopt/port
125
+ ```
126
+
127
+ ## 7. Run one input by hand
128
+
129
+ ```
130
+ adb shell 'mkdir -p /data/local/tmp/nnopt/port-repro-io'
131
+ adb push repro/inputs/prompt.txt /data/local/tmp/nnopt/port-repro-io/
132
+ adb shell 'cd /data/local/tmp/nnopt/port && sh ./run.sh --text-file /data/local/tmp/nnopt/port-repro-io/prompt.txt --seed 1234 --out /data/local/tmp/nnopt/port-repro-io/out.wav --metrics /data/local/tmp/nnopt/port-repro-io/metrics.json'
133
+ adb pull /data/local/tmp/nnopt/port-repro-io/out.wav .
134
+ adb pull /data/local/tmp/nnopt/port-repro-io/metrics.json .
135
+ ```
136
+
137
+ `out.wav` is the output; `metrics.json` holds the program's own timings: `load_ms`, and per request `total_ms`.
138
+
139
+ ## 8. Measure
140
+
141
+ ```
142
+ python3 repro/bench.py
143
+ ```
144
+
145
+ bench.py runs nnopt's settings: 2 warm-up runs, then 5 timed runs of 3 requests each. Each run is timed on the device's own clock, and a paired shorter run checks the program's own timings, as nnopt does. `--sustained 600` adds nnopt's 10-minute sustained run.
146
+
147
+ ## 9. Check the outputs
148
+
149
+ ```
150
+ python3 repro/bench.py --check
151
+ ```
152
+
153
+ Runs the 12 public cases in `repro/expected/` and compares with the reference outputs of your reference code: the audio's length within 5% of the expected audio's.
154
+
155
+ nnopt's full check also used hidden inputs and teacher-forced comparisons; report.html has every number.
156
+
157
+ ## Expected results
158
+
159
+ | Metric | nnopt (median) | Spread (p10 to p90) | Reproduced if within |
160
+ |---|---|---|---|
161
+ | Time to first audio (ms) | 2,418 | 2,378 to 2,435 | ±10% |
162
+ | Real-time factor (x) | 0.449 | 0.442 to 0.452 | ±10% |
163
+ | Time per request (ms) | 2,418 | 2,378 to 2,435 | ±10% |
164
+ | Peak memory (MB) | 2,519 | – | ±10% (shown only) |
165
+
166
+ Each tolerance is half of nnopt's own spread between requests, at least ±10%. Numbers land outside it when the device is warm or throttling, runs another OS build or driver, has apps or battery saver running, or is not plugged in. bench.py prints the same table for your device and writes it to `repro/results/`.
167
+
168
+ `report/reproduce.sh` runs steps 8 and 9 in one go.
sm8850-npu-a16w8/assets/default_voice.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ Mister Quilter is the apostle of the middle classes, and we are glad to welcome his gospel.
sm8850-npu-a16w8/assets/default_voice.wav ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:799f78ed4beb4de7ceae3a809262d4ce242394342ccd1d58cef7d49dbc2def46
3
+ size 187404
sm8850-npu-a16w8/build.sh ADDED
@@ -0,0 +1,91 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ # Builds everything the phone needs into build/stage (see README.md):
3
+ # - the runner (C++17, LiteRT C API) with the Android NDK r27d (fetched into .deps/ unless $ANDROID_NDK is r27d)
4
+ # - the QNN 2.50.0 runtime libs from Qualcomm's qnn-runtime AAR on Maven Central (pinned sha256)
5
+ # - CPU-side tables and the tokenizer from the customer's model.safetensors + tokenizer.json ($INPUTS_DIR)
6
+ # The compiled NPU models (models/*.tflite) and the LiteRT 2.3.1 libraries (vendor/litert/2.3.1) ship in the folder.
7
+ set -euo pipefail
8
+ cd "$(dirname "$0")"
9
+ source src/paths.sh
10
+
11
+ sha256() { if command -v sha256sum >/dev/null; then sha256sum "$1" | cut -d' ' -f1; else shasum -a 256 "$1" | cut -d' ' -f1; fi; }
12
+ fetch() { # url sha256 dest
13
+ if [ -f "$3" ] && [ "$(sha256 "$3")" = "$2" ]; then return; fi
14
+ curl -fL --retry 3 -o "$3.part" "$1"
15
+ [ "$(sha256 "$3.part")" = "$2" ] || { echo "build.sh: sha256 mismatch for $1" >&2; rm -f "$3.part"; exit 1; }
16
+ mv "$3.part" "$3"
17
+ }
18
+
19
+ # ---- Android NDK r27d
20
+ NDK_REL=r27d; NDK_REV=27.3.13750724
21
+ case "$(uname -s)" in
22
+ Linux) NDK_ZIP=android-ndk-$NDK_REL-linux.zip; NDK_SHA=601246087a682d1944e1e16dd85bc6e49560fe8b6d61255be2829178c8ed15d9; HOST_TAG=linux-x86_64 ;;
23
+ Darwin) NDK_ZIP=android-ndk-$NDK_REL-darwin.zip; NDK_SHA=e69092f9d2bfa5d1199039980a14eb91c03cc971ab5c6968fc08a8e6b84e7bb7; HOST_TAG=darwin-x86_64 ;;
24
+ *) echo "build.sh: unsupported host $(uname -s)" >&2; exit 1 ;;
25
+ esac
26
+ if [ -n "${ANDROID_NDK:-}" ] && grep -q "Pkg.Revision = $NDK_REV" "$ANDROID_NDK/source.properties" 2>/dev/null; then
27
+ NDK=$ANDROID_NDK
28
+ else
29
+ NDK=$DEPS/android-ndk-$NDK_REL
30
+ if ! grep -q "Pkg.Revision = $NDK_REV" "$NDK/source.properties" 2>/dev/null; then
31
+ echo "build.sh: fetching the Android NDK $NDK_REL"
32
+ fetch "https://dl.google.com/android/repository/$NDK_ZIP" $NDK_SHA "$DEPS/$NDK_ZIP"
33
+ rm -rf "$NDK" && (cd "$DEPS" && unzip -q "$NDK_ZIP" && rm "$NDK_ZIP")
34
+ chmod -R u+w "$NDK"
35
+ fi
36
+ fi
37
+
38
+ # ---- QNN runtime 2.50.0 (Qualcomm AI Stack License: fetched, never shipped in this folder)
39
+ QNN_VER=2.50.0
40
+ QNN_SHA=b507656e4031d8aa6a7ab0fecf725b941096737ad7440ad7ea288f7c9cc9d743
41
+ QNN_AAR=$DEPS/qnn-runtime-$QNN_VER.aar
42
+ if [ -n "${QNN_RUNTIME_AAR:-}" ] && [ -f "$QNN_RUNTIME_AAR" ] && [ "$(sha256 "$QNN_RUNTIME_AAR")" = "$QNN_SHA" ]; then
43
+ QNN_AAR=$QNN_RUNTIME_AAR
44
+ else
45
+ fetch "https://storage.googleapis.com/maven-central/maven2/com/qualcomm/qti/qnn-runtime/$QNN_VER/qnn-runtime-$QNN_VER.aar" $QNN_SHA "$QNN_AAR"
46
+ fi
47
+
48
+ # ---- the customer's files: from $INPUTS_DIR when set, else fetched from Hugging Face at the pinned commit
49
+ HF_REPO=Edge0/Audio8-TTS-Realistic-0.6b
50
+ HF_REV=23c305cc013fde378edb459f538317043c993a74
51
+ ST_SHA=f590053e980a45ebcbb2e787cff4f2dead932b2b61e5cf54d05664d9764e12d8
52
+ TOKJ_SHA=f24e08099d45a8adf3f52f5f0b03276e433bb9d689bb15fcbcc48ce58744588b
53
+ find_input() { # name sha256
54
+ if [ -n "${INPUTS_DIR:-}" ]; then
55
+ for d in weights reference_code; do
56
+ if [ -f "$INPUTS_DIR/$d/$1" ]; then echo "$INPUTS_DIR/$d/$1"; return; fi
57
+ done
58
+ echo "build.sh: $1 not found under $INPUTS_DIR/weights or $INPUTS_DIR/reference_code" >&2; exit 1
59
+ fi
60
+ mkdir -p "$DEPS/hf-${HF_REV:0:8}"
61
+ echo "build.sh: INPUTS_DIR unset; fetching $1 of $HF_REPO at ${HF_REV:0:8} from Hugging Face" >&2
62
+ fetch "https://huggingface.co/$HF_REPO/resolve/$HF_REV/$1" "$2" "$DEPS/hf-${HF_REV:0:8}/$1" >&2
63
+ echo "$DEPS/hf-${HF_REV:0:8}/$1"
64
+ }
65
+ ST=$(find_input model.safetensors $ST_SHA)
66
+ TOKJ=$(find_input tokenizer.json $TOKJ_SHA)
67
+
68
+ rm -rf "$STAGE" && mkdir -p "$STAGE/dsp" "$STAGE/models" "$STAGE/assets" "$BUILD/model_src"
69
+ # prep_assets wants both files in one folder
70
+ ln -sf "$ST" "$BUILD/model_src/model.safetensors"
71
+ ln -sf "$TOKJ" "$BUILD/model_src/tokenizer.json"
72
+ python3 -I src/tools/prep_assets.py "$BUILD/model_src" "$STAGE"
73
+
74
+ # ---- the runner
75
+ LT=vendor/litert/2.3.1
76
+ CXX=$NDK/toolchains/llvm/prebuilt/$HOST_TAG/bin/aarch64-linux-android31-clang++
77
+ "$CXX" -O2 -std=c++17 -Wall -I$LT/include src/runner/arktts_runner.cpp -o "$STAGE/arktts_runner" \
78
+ -L$LT/lib -lLiteRt -static-libstdc++
79
+ cp $LT/lib/libLiteRt.so $LT/lib/libLiteRtDispatch_Qualcomm.so "$STAGE/"
80
+
81
+ # ---- QNN libs out of the AAR (unzipped into its own folder)
82
+ rm -rf "$BUILD/qnn" && mkdir -p "$BUILD/qnn" && (cd "$BUILD/qnn" && unzip -q -o "$QNN_AAR" 'jni/arm64-v8a/*')
83
+ chmod -R u+w "$BUILD/qnn"
84
+ for f in libQnnHtp.so libQnnSystem.so libQnnHtpV81Stub.so; do cp "$BUILD/qnn/jni/arm64-v8a/$f" "$STAGE/"; done
85
+ cp "$BUILD/qnn/jni/arm64-v8a/libQnnHtpV81Skel.so" "$STAGE/dsp/"
86
+
87
+ cp models/*.tflite models/*.f32 models/*.f16 "$STAGE/models/"
88
+ cp assets/default_voice.wav assets/default_voice.txt "$STAGE/assets/"
89
+ cp src/run.sh src/port.json "$STAGE/"
90
+ (cd "$STAGE" && find . -type f | sort | while read -r f; do echo "$(sha256 "$f") $f"; done > ../stage.sha256)
91
+ echo "build.sh: staged $(du -sh "$STAGE" | cut -f1) in $STAGE"
sm8850-npu-a16w8/build/stage/arktts_runner ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:bb058123b4d23d40b414b024907f209d7fe05ec2bf5e4b2f35b82314a89f318c
3
+ size 712016
sm8850-npu-a16w8/build/stage/assets/default_voice.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ Mister Quilter is the apostle of the middle classes, and we are glad to welcome his gospel.
sm8850-npu-a16w8/build/stage/assets/default_voice.wav ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:799f78ed4beb4de7ceae3a809262d4ce242394342ccd1d58cef7d49dbc2def46
3
+ size 187404
sm8850-npu-a16w8/build/stage/cbemb.bf16 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1adafc95351dab1ad730603e1b58b12ba13172b0f68c1f7db302e0dc68c9e08b
3
+ size 73400320
sm8850-npu-a16w8/build/stage/emb.bf16 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3b10642782084892d5dabfc5599b4ad97021a770728845756dc2564525b24919
3
+ size 279150592
sm8850-npu-a16w8/build/stage/fastemb.bf16 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c03d14d2074423cbe07c1e4d03a34b26849a4c238907f3e86cafaa9eb6223ccc
3
+ size 7340032
sm8850-npu-a16w8/build/stage/libLiteRt.so ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9ad1a5072b09087bddeb3d7be22854350191b21239136b78ebee2120443c7305
3
+ size 5475936
sm8850-npu-a16w8/build/stage/libLiteRtDispatch_Qualcomm.so ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ab6a581ef26d83f60d03ff4ce2436d9a75b7d0c0b276357787a865e5e9dd4b7d
3
+ size 445712
sm8850-npu-a16w8/build/stage/port.json ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ {"contract": 1, "model_type": "text_to_speech",
2
+ "runtime": "LiteRT 2.3.1, Qualcomm dispatch, QNN 2.50.0", "litert_version": "2.3.1", "backend": "litert-qnn",
3
+ "soc": "SM8850", "htp_arch": "v81", "qairt_version": "2.50.0", "precision": "a16w8 decode (slow1s, slow1, fast: int8 weights, int16 activations), fp16 prefill, LM head and codec",
4
+ "cpu_fallback": false,
5
+ "modes": [{"id": "tts", "label": "Text to speech", "inputs": {"text": "utf8"}, "outputs": ["audio"],
6
+ "args": ["--text-file", "{text}", "--seed", "{seed}", "--out", "{out_wav}", "--metrics", "{metrics}"]},
7
+ {"id": "stream", "label": "Text to speech, streamed", "inputs": {"text": "utf8"}, "outputs": ["audio"],
8
+ "args": ["--text-file", "{text}", "--seed", "{seed}", "--stream", "--out", "{out_wav}", "--metrics", "{metrics}"]},
9
+ {"id": "clone", "label": "Voice clone (line 1: clip transcript)", "inputs": {"audio": "wav", "text": "utf8"}, "outputs": ["audio"],
10
+ "args": ["--clone-audio", "{audio}", "--clone-text-file", "{text}", "--seed", "{seed}", "--out", "{out_wav}", "--metrics", "{metrics}"]}]}
sm8850-npu-a16w8/build/stage/run.sh ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ # sh ./run.sh --text-file IN.txt --seed S [--repeat R] --out OUT.wav --metrics M.json
2
+ # [--ref-audio WAV --ref-text-file TXT] clone another voice (default: assets/default_voice.*)
3
+ cd "$(dirname "$0")"
4
+ export LD_LIBRARY_PATH="$PWD:/system/lib64:/vendor/lib64"
5
+ export ADSP_LIBRARY_PATH="$PWD/dsp;$PWD;/vendor/lib/rfsa/adsp;/vendor/dsp/cdsp;/system/lib/rfsa/adsp;/vendor/dsp"
6
+ exec ./arktts_runner "$@"
sm8850-npu-a16w8/build/stage/tok_added.txt ADDED
The diff for this file is too large to render. See raw diff
 
sm8850-npu-a16w8/build/stage/tok_merges.txt ADDED
The diff for this file is too large to render. See raw diff
 
sm8850-npu-a16w8/build/stage/tok_vocab.txt ADDED
The diff for this file is too large to render. See raw diff
 
sm8850-npu-a16w8/demo/demo.json ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "input": {
3
+ "text": "Welcome to Audio8 TTS. It is wonderful to hear from you.",
4
+ "files": [
5
+ "demo/input.txt"
6
+ ]
7
+ },
8
+ "source": "README of Edge0/Audio8-TTS-Realistic-0.6b (voice cloned from the bundled default reference clip, LibriSpeech 1272-128104-0000)",
9
+ "output": {
10
+ "text": "whisper-tiny transcript of the phone's streamed audio: Welcome to Audio 8, TTS. It is wonderful to hear from you.",
11
+ "files": [
12
+ "demo/stream_output.wav"
13
+ ]
14
+ },
15
+ "seconds": 6.49,
16
+ "device": "Samsung Galaxy S26+ (SM8850, Hexagon HTP v81)",
17
+ "command": "sh ./run.sh --text-file demo_input.txt --seed 1234 --stream --out demo_stream.wav --metrics demo_stream_metrics.json",
18
+ "note": "6.49 s wall from adb shell, including 3.6 s load (9 NPU graphs, voice clip encoded, voice prefix KV); streamed: first audio chunk at 280 ms, 14 chunks, no gaps (min slack 201 ms), 5.06 s of audio in 2.50 s (RTF 0.49). Every model graph on the Hexagon NPU. The non-streamed run of the same input gives a bit-identical WAV (demo/output.wav, 2.32 s, RTF 0.46).",
19
+ "runs": [
20
+ {
21
+ "mode": "stream",
22
+ "inputs": {
23
+ "text": "Welcome to Audio8 TTS. It is wonderful to hear from you."
24
+ },
25
+ "outputs": {
26
+ "audio": "demo/stream_output.wav"
27
+ },
28
+ "metrics": "demo/stream_metrics.json"
29
+ },
30
+ {
31
+ "mode": "tts",
32
+ "inputs": {
33
+ "text": "Welcome to Audio8 TTS. It is wonderful to hear from you."
34
+ },
35
+ "outputs": {
36
+ "audio": "demo/output.wav"
37
+ },
38
+ "metrics": "demo/tts_metrics.json"
39
+ }
40
+ ]
41
+ }
sm8850-npu-a16w8/demo/input.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ Welcome to Audio8 TTS. It is wonderful to hear from you.
sm8850-npu-a16w8/demo/output.wav ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8c53abec71c923c62d05bdc0ca71bafee7b5a9253cc1c27a1c870a55b078277a
3
+ size 892972
sm8850-npu-a16w8/demo/stream_metrics.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"load_ms": 3619.5, "runs": [{"total_ms": 2500.4, "ttfa_ms": 279.7, "frames": 109, "audio_seconds": 5.0620, "generate_ms": 2465.1, "slow_ms": 773.1, "fast_ms": 1401.0, "codec_ms": 35.1, "rtf": 0.4940, "stream": true, "chunks": 14, "min_slack_ms": 200.8, "gaps": 0, "chunk_frames_ms": [[8, 279.7], [16, 450.4], [24, 627.3], [32, 805.3], [40, 985.6], [48, 1154.8], [56, 1328.0], [64, 1499.4], [72, 1670.9], [80, 1850.4], [88, 2027.2], [96, 2203.4], [104, 2379.2], [109, 2500.4]]}]}
sm8850-npu-a16w8/demo/stream_output.wav ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8c53abec71c923c62d05bdc0ca71bafee7b5a9253cc1c27a1c870a55b078277a
3
+ size 892972
sm8850-npu-a16w8/demo/tts_metrics.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"load_ms": 2327.1, "runs": [{"total_ms": 2321.7, "ttfa_ms": 2321.7, "frames": 109, "audio_seconds": 5.0620, "generate_ms": 2263.2, "slow_ms": 780.7, "fast_ms": 1367.8, "codec_ms": 58.4, "rtf": 0.4587}]}
sm8850-npu-a16w8/deploy.sh ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ # bash deploy.sh DEST: installs build/stage (built by build.sh) into DEST on the phone over adb (ANDROID_SERIAL picks
3
+ # the phone). Leaves DEST/run.sh and DEST/port.json.
4
+ set -euo pipefail
5
+ cd "$(dirname "$0")"
6
+ DEST=${1:?usage: bash deploy.sh DEST}
7
+ source src/paths.sh
8
+ [ -x "$STAGE/arktts_runner" ] || { echo "deploy.sh: run build.sh first ($STAGE/arktts_runner missing)" >&2; exit 1; }
9
+ SOC=$(adb shell getprop ro.soc.model | tr -d '\r')
10
+ [ "$SOC" = "SM8850" ] || echo "deploy.sh: warning: the models are compiled for SM8850, this phone is '$SOC'" >&2
11
+ adb shell "mkdir -p '$DEST/dsp' '$DEST/models' '$DEST/assets'"
12
+ # push only what differs (the models are ~1 GB): compare each file's sha256 with the phone's copy
13
+ adb shell "cd '$DEST' && find . -type f -exec sha256sum {} + 2>/dev/null" | tr -d '\r' | awk '{print $2" "$1}' | sort > "$BUILD/phone.sha256" || true
14
+ (cd "$STAGE" && find . -type f | sort) | while read -r f; do
15
+ want=$(awk -v f="$f" '$2==f {print $1}' "$BUILD/stage.sha256" | head -1)
16
+ have=$(awk -v f="$f" '$1==f {print $2}' "$BUILD/phone.sha256" | head -1)
17
+ if [ "$want" != "$have" ]; then
18
+ echo "push $f"
19
+ adb push "$STAGE/$f" "$DEST/$f" >/dev/null
20
+ fi
21
+ done
22
+ # remove files an earlier build left in DEST (e.g. a graph that moved to another processor)
23
+ awk '{print $1}' "$BUILD/phone.sha256" | while read -r f; do
24
+ awk -v f="$f" '$2==f {found=1} END {exit !found}' "$BUILD/stage.sha256" || { echo "remove $f"; adb shell "rm -f '$DEST/$f'" </dev/null; }
25
+ done
26
+ adb shell "chmod 755 '$DEST/arktts_runner' '$DEST/run.sh'"
27
+ echo "deploy.sh: installed into $DEST"
sm8850-npu-a16w8/fetch.sh ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ # Run once after downloading this folder: bash fetch.sh
3
+ # Gets Qualcomm's QNN runtime (not redistributable) and lays out build/stage/ the way build.sh does.
4
+ set -euo pipefail
5
+ cd "$(dirname "$0")"
6
+ REPO=nnopt-dev/Audio8-TTS-Realistic-0.6b-LiteRT
7
+
8
+ # The repository's manifest first (Hugging Face counts a download when config.json is requested).
9
+ curl -fsSL "https://huggingface.co/$REPO/resolve/main/config.json" -o ../config.json
10
+
11
+ sha256_of() { if command -v sha256sum >/dev/null 2>&1; then sha256sum "$1" | cut -d" " -f1; else shasum -a 256 "$1" | cut -d" " -f1; fi; }
12
+ get() { # get URL FILE SHA256: download once, check the sha256
13
+ if [ -f "$2" ] && [ "$(sha256_of "$2")" = "$3" ]; then return 0; fi
14
+ mkdir -p "$(dirname "$2")"
15
+ curl -fL --retry 3 -o "$2.part" "$1"
16
+ [ "$(sha256_of "$2.part")" = "$3" ] || { echo "fetch.sh: sha256 mismatch for $1" >&2; rm -f "$2.part"; exit 1; }
17
+ mv "$2.part" "$2"
18
+ }
19
+ git_at() { # git_at URL COMMIT DIR: the exact commit, shallow
20
+ if [ "$(git -C "$3" rev-parse HEAD 2>/dev/null || true)" = "$2" ]; then return 0; fi
21
+ rm -rf "$3"; mkdir -p "$3"
22
+ git -C "$3" init -q && git -C "$3" remote add origin "$1"
23
+ git -C "$3" fetch -q --depth 1 origin "$2" && git -C "$3" -c advice.detachedHead=false checkout -q FETCH_HEAD
24
+ }
25
+
26
+ # Qualcomm's QNN runtime: its license forbids redistribution, so it is not in this repository. It comes from
27
+ # Maven Central (Google's mirror), pinned by version and sha256, the same file build.sh uses.
28
+ QNN_VER=2.50.0
29
+ QNN_SHA=b507656e4031d8aa6a7ab0fecf725b941096737ad7440ad7ea288f7c9cc9d743
30
+ get "https://storage.googleapis.com/maven-central/maven2/com/qualcomm/qti/qnn-runtime/$QNN_VER/qnn-runtime-$QNN_VER.aar" \
31
+ ".deps/qnn-runtime-$QNN_VER.aar" "$QNN_SHA"
32
+
33
+ rm -rf build/qnn && mkdir -p build/qnn build/stage/dsp build/stage/models
34
+ (cd build/qnn && unzip -q -o "../../.deps/qnn-runtime-$QNN_VER.aar" "jni/arm64-v8a/*") && chmod -R u+w build/qnn
35
+ for f in libQnnHtp.so libQnnSystem.so libQnnHtpV81Stub.so; do cp "build/qnn/jni/arm64-v8a/$f" build/stage/; done
36
+ cp build/qnn/jni/arm64-v8a/libQnnHtpV81Skel.so build/stage/dsp/
37
+ # the compiled graphs and tables, once in models/, linked into the stage deploy.sh pushes
38
+ for f in models/*.tflite models/*.f32 models/*.f16; do ln -f "$f" "build/stage/models/" 2>/dev/null || cp -f "$f" "build/stage/models/"; done
39
+ chmod +x build/stage/arktts_runner
40
+ (cd build/stage && find . -type f | sort | while read -r f; do echo "$(sha256_of "$f") $f"; done > ../stage.sha256)
41
+ echo "fetch.sh: done. Next: bash deploy.sh /data/local/tmp/audio8"
sm8850-npu-a16w8/models/cdecs.tflite ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5e5a6c60763020cd10a069b485748b293aaa39b04c2ae5b1bf4691bae54a7327
3
+ size 157108800
sm8850-npu-a16w8/models/cenc.tflite ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c1a0704376f7b2f35656661663d658c3ea07e7a3cf205cc84d82df656e524ad4
3
+ size 478203024
sm8850-npu-a16w8/models/cpost.tflite ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:758e34cae97a4ccd80eeb23bc74af6c21e4fbb4134de5bf5bfbce9dd07f55c57
3
+ size 139750424
sm8850-npu-a16w8/models/cpost256.tflite ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:32948d50a3d52217e3dd9fc18554ce7c772272d3a7cc6a917c90e9e28c2c6b0e
3
+ size 113732632
sm8850-npu-a16w8/models/fast.tflite ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:19e2a955ca478fe4cb680db6d646902046aa2476cb09fe4425fbb979f08324d7
3
+ size 64556872
sm8850-npu-a16w8/models/head.tflite ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0ce6711aaed817b678974671d1ff787b166ec6982ae0b72d350efed10cf0dcca
3
+ size 7452656
sm8850-npu-a16w8/models/rope_fast.f32 ADDED
Binary file (2.56 kB). View file
 
sm8850-npu-a16w8/models/rope_slow.f32 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:81648383918c4e13cf41037aef69597265d6f46bd44c3cf343451c9b0323a398
3
+ size 524288
sm8850-npu-a16w8/models/rvq_t0.f16 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e9f32bd8d08547ce1c0dc51f2768f40eea04a56ec57d75ce664ebd61e22c13a9
3
+ size 8388608
sm8850-npu-a16w8/models/rvq_tr.f16 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3e45eb582c9f1e9fd0f508c08d48ded2862e1405c9c51f70cee230b181d6a15d
3
+ size 18874368
sm8850-npu-a16w8/models/slow.tflite ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ba0241e2dc1f8382a45b25930471f4835ceaa37bb8a4acf5d798d771ed919070
3
+ size 729524616
sm8850-npu-a16w8/models/slow1.tflite ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d1e7ad41d7c32791e4edec27e783c892efdc5cf303e322979758b4a774be9062
3
+ size 368573104
sm8850-npu-a16w8/models/slow1s.tflite ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6e80c28a2e7ed0234a27c3403a575cd8d66c5a1d69afc1dd1c4debe3ef46eba2
3
+ size 368429744
sm8850-npu-a16w8/report.html ADDED
@@ -0,0 +1,613 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!doctype html>
2
+ <html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1">
3
+ <title>nnopt report · Edge0/Audio8-TTS-Realistic-0.6b</title>
4
+ <link rel="preconnect" href="https://fonts.googleapis.com"><link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
5
+ <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500;600&family=IBM+Plex+Sans+Condensed:wght@600;700&family=IBM+Plex+Sans:wght@400;500;600&display=swap">
6
+ <style>
7
+ :root {
8
+ --bg: #f3f5f2; --panel: #ffffff; --ink: #17201d; --ink-2: #33403b; --muted: #5a6762; --line: #cfd8d3;
9
+ --accent: #0b6e79; --accent-soft: #dcefee; --keep: #1d7a3e; --keep-soft: #dcf1e2; --stop: #b3261e;
10
+ --stop-soft: #f9dedb; --warn: #9a5b00; --warn-soft: #fbecd2; --grid: #e3e9e5;
11
+ --display: "IBM Plex Sans Condensed", "Arial Narrow", system-ui, sans-serif;
12
+ --body: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
13
+ --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
14
+ color-scheme: light;
15
+ }
16
+ @media (prefers-color-scheme: dark) {
17
+ :root:not([data-theme="light"]) {
18
+ --bg: #111715; --panel: #18201d; --ink: #e4ebe7; --ink-2: #c3cec9; --muted: #9aa8a2; --line: #2c3833;
19
+ --accent: #4fc1cc; --accent-soft: #123236; --keep: #6fd394; --keep-soft: #143222; --stop: #ff8a80;
20
+ --stop-soft: #3d1715; --warn: #f0b45a; --warn-soft: #3a2a10; --grid: #222c28; color-scheme: dark;
21
+ }
22
+ }
23
+ :root[data-theme="dark"] {
24
+ --bg: #111715; --panel: #18201d; --ink: #e4ebe7; --ink-2: #c3cec9; --muted: #9aa8a2; --line: #2c3833;
25
+ --accent: #4fc1cc; --accent-soft: #123236; --keep: #6fd394; --keep-soft: #143222; --stop: #ff8a80;
26
+ --stop-soft: #3d1715; --warn: #f0b45a; --warn-soft: #3a2a10; --grid: #222c28; color-scheme: dark;
27
+ }
28
+ * { box-sizing: border-box; }
29
+ body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.55 var(--body); }
30
+ .wrap { max-width: 1040px; margin: 0 auto; padding: 28px 20px 80px; display: grid; gap: 36px; }
31
+ h1, h2, h3 { font-family: var(--display); margin: 0; line-height: 1.15; text-wrap: balance; }
32
+ h1 { font-size: clamp(28px, 4.5vw, 40px); font-weight: 700; letter-spacing: -0.01em; }
33
+ h2 { font-size: 22px; font-weight: 600; }
34
+ h3 { font-size: 16px; font-weight: 600; }
35
+ p { margin: 0; max-width: 72ch; }
36
+ code, .mono { font-family: var(--mono); font-size: 0.88em; }
37
+ .eyebrow { font: 500 12px var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
38
+ .sub { color: var(--muted); font-size: 13px; }
39
+ section { display: grid; gap: 14px; min-width: 0; }
40
+ header { display: grid; gap: 10px; }
41
+ .tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
42
+ .tile { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px; display: grid; gap: 4px; min-width: 0; }
43
+ .tile .v { font: 700 26px/1.1 var(--display); font-variant-numeric: tabular-nums; }
44
+ .tile .k { font: 500 12px var(--mono); color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
45
+ .tile.pass { border-color: var(--keep); background: var(--keep-soft); }
46
+ .tile.fail { border-color: var(--stop); background: var(--stop-soft); }
47
+ .tile.na { border-style: dashed; }
48
+ .badge { display: inline-flex; align-items: center; gap: 6px; font: 600 12px/1 var(--mono); padding: 4px 8px; border-radius: 99px; border: 1px solid currentColor; white-space: nowrap; }
49
+ .badge.pass { color: var(--keep); } .badge.fail { color: var(--stop); } .badge.skip { color: var(--muted); } .badge.warn { color: var(--warn); }
50
+ .panel { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 4px 0; overflow-x: auto; }
51
+ table { border-collapse: collapse; width: 100%; font-size: 14px; }
52
+ th, td { text-align: left; padding: 8px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
53
+ tr:last-child td { border-bottom: 0; }
54
+ th { font: 500 12px var(--mono); color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
55
+ td.num { font-family: var(--mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
56
+ .flags { display: grid; gap: 6px; }
57
+ .flag { border-left: 3px solid var(--warn); background: var(--warn-soft); padding: 8px 12px; border-radius: 4px; font-size: 14px; }
58
+ .flag.bad { border-color: var(--stop); background: var(--stop-soft); }
59
+ .charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 12px; }
60
+ .chart { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px 8px; display: grid; gap: 6px; min-width: 0; }
61
+ .chart svg { width: 100%; height: auto; display: block; overflow: visible; }
62
+ .chart .ln { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
63
+ .chart .pt { fill: var(--accent); stroke: var(--panel); stroke-width: 2; }
64
+ .chart .hit { fill: transparent; }
65
+ .chart .hit:hover + .pt, .chart .pt:hover { r: 5; }
66
+ .chart .gl { stroke: var(--grid); stroke-width: 1; }
67
+ .chart text { fill: var(--muted); font: 11px var(--mono); }
68
+ details { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px; }
69
+ summary { cursor: pointer; font-weight: 500; }
70
+ pre { font: 12px/1.5 var(--mono); white-space: pre-wrap; word-break: break-word; margin: 10px 0 0; color: var(--ink-2); }
71
+ .kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; font-size: 14px; }
72
+ .kv dt { color: var(--muted); font: 500 12px/1.9 var(--mono); text-transform: uppercase; letter-spacing: .05em; }
73
+ .kv dd { margin: 0; font-family: var(--mono); font-size: 13px; word-break: break-all; }
74
+ footer { color: var(--muted); font-size: 12px; }
75
+ .figs { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
76
+ figure { margin: 0; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 10px; display: grid; gap: 8px; min-width: 0; }
77
+ figure svg { width: 100%; height: auto; display: block; border-radius: 4px; }
78
+ figure .frame { fill: var(--grid); }
79
+ figcaption { font-size: 13px; color: var(--ink-2); display: grid; gap: 2px; }
80
+ .box { fill: none; stroke-width: 2; vector-effect: non-scaling-stroke; }
81
+ .box.ref { stroke: var(--ink); stroke-dasharray: 6 4; }
82
+ .box.ref.missed { stroke: var(--stop); stroke-width: 3; }
83
+ .box.port { stroke: var(--accent); }
84
+ .box.port.extra { stroke: var(--warn); stroke-width: 3; }
85
+ .box.borderline { stroke: var(--muted); stroke-width: 1; opacity: .7; }
86
+ .legend { display: flex; flex-wrap: wrap; gap: 6px 18px; font: 12px var(--mono); color: var(--muted); }
87
+ .legend i { display: inline-block; width: 18px; height: 0; vertical-align: middle; margin-right: 6px; border-top: 2px solid; }
88
+ .vlm { display: grid; grid-template-columns: minmax(120px, 200px) 1fr; gap: 12px; align-items: start; }
89
+ .vlm img { width: 100%; border-radius: 4px; display: block; }
90
+ .said { display: grid; gap: 6px; font-size: 14px; }
91
+ .said .who { font: 500 11px var(--mono); color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
92
+ .said p { white-space: pre-wrap; word-break: break-word; }
93
+ mark { background: var(--stop-soft); color: var(--ink); border-bottom: 2px solid var(--stop); padding: 0 1px; }
94
+ h4 { font: 600 14px/1.2 var(--display); margin: 0; }
95
+ .phone { border-top: 2px solid var(--line); padding-top: 24px; gap: 22px; }
96
+ .phone > .ph { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
97
+ @media (max-width: 560px) { .vlm { grid-template-columns: 1fr; } }
98
+ @media print { body { background: #fff; } .wrap { padding: 0; } }
99
+ </style></head><body><main class="wrap"><header><span class="eyebrow">nnopt verification report · Text to speech</span>
100
+ <h1>Edge0/Audio8-TTS-Realistic-0.6b on galaxy-s26-plus</h1>
101
+ <p class="sub">Job NN-983499 · 2026-11-03 23:36 UTC ·
102
+ nnopt-verify 0.1.0 · reference bundle <span class="mono">3852792e9d78dcc1</span></p>
103
+ </header><div class="tiles"><div class="tile pass"><span class="k">Correctness</span><span class="v">PASS</span><span class=sub>original precision policy</span></div><div class="tile na"><span class="k">Speed target</span><span class="v">no target</span></div><div class="tile pass"><span class="k">Runtime</span><span class="v">PASS</span><span class=sub>LiteRT and the Hexagon NPU, as asked</span></div><div class="tile pass"><span class="k">Decoding</span><span class="v">PASS</span><span class=sub>one token per pass, no speculative decoding</span></div><div class="tile "><span class="k">Time to first audio</span><span class="v">2418 ms</span><span class=sub>warm, median</span></div><div class="tile "><span class="k">Peak memory</span><span class="v">2519 MB</span><span class=sub>process tree</span></div><div class="tile "><span class="k">Load time</span><span class="v">2227 ms</span></div></div><section><h2>Correctness</h2>
104
+ <p>The port ran on 18 inputs (6 hidden, generated fresh for this job and never shown to the
105
+ porting agent) and was compared with the reference outputs captured from your code. Thresholds are for the
106
+ <b>original</b> precision policy.</p>
107
+ <div class="panel"><table><thead><tr><th>Check</th><th>Value</th><th>Threshold</th><th>Result</th></tr></thead><tbody><tr><td>All cases ran<div class=sub>18/18 cases produced valid output</div></td><td class=num>1.00</td><td class=num>&gt;= 1.00</td><td><span class="badge pass">&#10003; PASS</span></td></tr><tr><td>ASR WER change vs reference audio<div class=sub>ASR WER vs input text: port 0.047, reference 0.043</div></td><td class=num>0.004</td><td class=num>&lt;= 0.050</td><td><span class="badge pass">&#10003; PASS</span></td></tr><tr><td>Spectral distance (dB)<div class=sub>reference is seeded, not exact: spectral comparison is informational</div></td><td class=num>7.22</td><td class=num>&lt;= 1.50</td><td><span class="badge skip">SKIPPED</span></td></tr><tr><td>Duration error<div class=sub>reference is seeded, not exact: spectral comparison is informational</div></td><td class=num>0.176</td><td class=num>&lt;= 0.050</td><td><span class="badge skip">SKIPPED</span></td></tr></tbody></table></div><details><summary>Per-case results (18 cases)</summary><div class="panel" style="margin-top:10px"><table><thead><tr><th>Case</th><th>Split</th><th>Spectral dB</th><th>Duration ratio</th><th>ASR of port audio</th></tr></thead><tbody><tr><td class=num>p000</td><td>public · builtin</td><td class=num>6.00</td><td class=num>1.01</td><td>The Quick Brown Fox jumps over the lazy dog near the river bank.</td></tr><tr><td class=num>p001</td><td>public · builtin</td><td class=num>7.59</td><td class=num>0.864</td><td>Please call me back when you get home this evening.</td></tr><tr><td class=num>p002</td><td>public · customer</td><td class=num>6.20</td><td class=num>1.01</td><td>Welcome to Audio 8, TTS. It is wonderful to hear from you.</td></tr><tr><td class=num>p003</td><td>public · customer</td><td class=num>6.08</td><td class=num>1.00</td><td>This utterance does not use a reference voice.</td></tr><tr><td class=num>p004</td><td>public · customer</td><td class=num>9.11</td><td class=num>0.934</td><td>the birch canoe slid on the smooth planks.</td></tr><tr><td class=num>p005</td><td>public · customer</td><td class=num>6.78</td><td class=num>1.07</td><td>glue the sheet to the dark blue background. It is easy to tell the depth of a well.</td></tr><tr><td class=num>p006</td><td>public · customer</td><td class=num>6.92</td><td class=num>1.10</td><td>The juice of lemons makes fine punch and the box was thrown beside the park truck.</td></tr><tr><td class=num>p007</td><td>public · customer</td><td class=num>7.49</td><td class=num>0.847</td><td>The weather today will be mostly sunny with a high of 72 degrees and a light breeze from the west.</td></tr><tr><td class=num>p008</td><td>public · customer</td><td class=num>6.66</td><td class=num>1.01</td><td>Sure, I&#x27;ve said a reminder for your dentist appointment on Thursday at 330 in the afternoon.</td></tr><tr><td class=num>p009</td><td>public · customer</td><td class=num>7.58</td><td class=num>0.960</td><td>your order number is 4815 and it should arrive within two to three business days.</td></tr><tr><td class=num>p010</td><td>public · customer</td><td class=num>7.56</td><td class=num>1.10</td><td>Have you ever wondered why the sky looks blue during the day, but turns orange at sunset?</td></tr><tr><td class=num>p011</td><td>public · customer</td><td class=num>6.27</td><td class=num>1.03</td><td>was upon a time in a small village by the sea. They&#x27;re lived in old fishermen who told stories every evening. The children would gather around him and listen un</td></tr><tr><td class=num>h000</td><td>hidden · generated</td><td class=num>8.89</td><td class=num>1.02</td><td>Jonah said, the weather in Bergen was windy all week.</td></tr><tr><td class=num>h001</td><td>hidden · generated</td><td class=num>7.96</td><td class=num>0.902</td><td>Quentin left the latter by the door before walking to the station.</td></tr><tr><td class=num>h002</td><td>hidden · generated</td><td class=num>6.95</td><td class=num>0.884</td><td>could you bring the umbrella to the kitchen when you have a moment?</td></tr><tr><td class=num>h003</td><td>hidden · generated</td><td class=num>7.17</td><td class=num>1.10</td><td>The library will be closed on Monday for repairs.</td></tr><tr><td class=num>h004</td><td>hidden · generated</td><td class=num>8.24</td><td class=num>1.18</td><td>my brother measured the camera and gave it to Priya.</td></tr><tr><td class=num>h005</td><td>hidden · generated</td><td class=num>6.53</td><td class=num>0.932</td><td>The bright market in Bergen opens at 8 in the morning.</td></tr></tbody></table></div></details></section><section><h2>Run modes</h2>
108
+ <p>Every way this port runs was checked against the reference's run of the same mode, on its own public and hidden
109
+ inputs. A mode marked ungraded says why.</p>
110
+ <div class="panel"><table><thead><tr><th>Mode</th><th>Check</th><th>Value</th><th>Threshold</th><th>Result</th></tr>
111
+ </thead><tbody><tr><td>Text to speech <span class=sub>(tts, PASS)</span></td><td>all inputs ran<div class=sub>5/5 inputs produced valid output</div></td><td class=num>5/5</td><td class=num>all</td><td><span class="badge pass">&#10003; PASS</span></td></tr><tr><td>Text to speech <span class=sub>(tts, PASS)</span></td><td>audio format (rate, finite, not silent)<div class=sub>5 outputs at 44100 Hz, not silent</div></td><td class=num>5/5</td><td class=num>all</td><td><span class="badge pass">&#10003; PASS</span></td></tr><tr><td>Text to speech <span class=sub>(tts, PASS)</span></td><td>intelligibility (ASR word error rate change)<div class=sub>ASR (openai/whisper-tiny) word error rate against the text it should say: port 0.019, reference 0.019</div></td><td class=num>+0.0 points</td><td class=num>at most +5.0 points</td><td><span class="badge pass">&#10003; PASS</span></td></tr><tr><td>Text to speech <span class=sub>(tts, PASS)</span></td><td>spectral distance to reference audio<div class=sub>the reference samples its speech with the seed (its own random numbers), which a port cannot reproduce sample for sample: intelligibility grades it</div></td><td class=num>–</td><td class=num>at most 1.50 dB</td><td><span class="badge skip">SKIPPED</span></td></tr><tr><td>Text to speech, streamed <span class=sub>(stream, UNGRADED)</span></td><td>graded<div class=sub>ungraded: the reference bundle has no outputs for this mode (the reference runner did not list it)</div></td><td class=num>ungraded: the reference bundle has no outputs for this mode (the reference runner did not list it)</td><td class=num></td><td><span class="badge skip">SKIPPED</span></td></tr><tr><td>Voice clone (line 1: clip transcript) <span class=sub>(clone, UNGRADED)</span></td><td>clip transcript): graded<div class=sub>ungraded: modes that take audio and text together are not graded yet</div></td><td class=num>ungraded: modes that take audio and text together are not graded yet</td><td class=num></td><td><span class="badge skip">SKIPPED</span></td></tr></tbody></table></div><p class="sub">Speed per mode (median of timed runs, one process each):</p><ul><li><b>Text to speech</b>: Request time 2454 ms, Load time 2466 ms, Real-time factor 0.456 x, Time to first audio 2454 ms</li><li><b>Text to speech, streamed</b>: no reference inputs for this mode</li><li><b>Voice clone (line 1: clip transcript)</b>: no reference inputs for this mode</li></ul></section><section><h2>Runtime</h2>
112
+ <p>Asked for <b>LiteRT: NPU where it can, GPU or CPU for the rest</b>. Clean build, the port's own code and build log: uses LiteRT; runs on the Hexagon NPU: the kit&#x27;s own run on the phone loaded the HTP, every shipped NPU graph is all DISPATCH_OP, CPU fallback disabled.</p>
113
+ <ul><li class="mono">src/export/export_graphs.py:38: from ai_edge_litert.interpreter import Interpreter</li><li class="mono">src/export/aot_local.py:3: from ai_edge_litert.aot import aot_compile</li><li class="mono">src/runner/arktts_runner.cpp:274: if (LiteRtCreateModelFromFile(g_env, path.c_str(), &amp;model) != kLiteRtStatusOk) die(&quot;cannot load %s&quot;, path.c_str());</li><li class="mono">the kit&#x27;s run on the phone: Successfully opened file /data/local/tmp/nnopt-verify/check-d0c58fe3/port/dsp/./libQnnHtpV81Skel.so</li><li class="mono">the kit&#x27;s run on the phone: fully accelerated 207/207 · Skel V81 loaded · user PD ✓</li><li class="mono">npu-graphs: 18 of 18 NPU graphs all-DISPATCH · 0 CPU ops · SM8850 · QAIRT 2.50.0</li><li class="mono">NOTES.md: Successfully opened file /data/local/tmp/nnopt/port/dsp/./libQnnHtpV81Skel.so</li><li class="mono">NOTES.md: Unsigned:Y</li></ul></section><section><h2>NPU</h2><h3>NPU graphs</h3><p>18 of 18 NPU graphs all-DISPATCH · 0 CPU ops · SM8850 · QAIRT 2.50.0</p><table><tr><th>graph</th><th>runs on</th><th>DISPATCH_OP</th><th>CPU ops</th><th>SoC</th><th>QAIRT</th><th>precision</th><th>size</th></tr><tr><td>cdecs</td><td>npu</td><td>1</td><td>0</td><td>SM8850</td><td>2.50.0</td><td>fp16</td><td>150 MB</td></tr><tr><td>cenc</td><td>npu</td><td>1</td><td>0</td><td>SM8850</td><td>2.50.0</td><td>fp16</td><td>456 MB</td></tr><tr><td>cpost</td><td>npu</td><td>1</td><td>0</td><td>SM8850</td><td>2.50.0</td><td>fp16</td><td>133 MB</td></tr><tr><td>cpost256</td><td>npu</td><td>1</td><td>0</td><td>SM8850</td><td>2.50.0</td><td>fp16</td><td>108 MB</td></tr><tr><td>fast</td><td>npu</td><td>1</td><td>0</td><td>SM8850</td><td>2.50.0</td><td>int16</td><td>62 MB</td></tr><tr><td>head</td><td>npu</td><td>1</td><td>0</td><td>SM8850</td><td>2.50.0</td><td>fp16</td><td>7 MB</td></tr><tr><td>slow</td><td>npu</td><td>1</td><td>0</td><td>SM8850</td><td>2.50.0</td><td>fp16</td><td>696 MB</td></tr><tr><td>slow1</td><td>npu</td><td>1</td><td>0</td><td>SM8850</td><td>2.50.0</td><td>int16</td><td>351 MB</td></tr><tr><td>slow1s</td><td>npu</td><td>1</td><td>0</td><td>SM8850</td><td>2.50.0</td><td>int16</td><td>351 MB</td></tr><tr><td>cdecs</td><td>npu</td><td>1</td><td>0</td><td>SM8850</td><td>2.50.0</td><td>fp16</td><td>150 MB</td></tr><tr><td>cenc</td><td>npu</td><td>1</td><td>0</td><td>SM8850</td><td>2.50.0</td><td>fp16</td><td>456 MB</td></tr><tr><td>cpost</td><td>npu</td><td>1</td><td>0</td><td>SM8850</td><td>2.50.0</td><td>fp16</td><td>133 MB</td></tr><tr><td>cpost256</td><td>npu</td><td>1</td><td>0</td><td>SM8850</td><td>2.50.0</td><td>fp16</td><td>108 MB</td></tr><tr><td>fast</td><td>npu</td><td>1</td><td>0</td><td>SM8850</td><td>2.50.0</td><td>int16</td><td>62 MB</td></tr><tr><td>head</td><td>npu</td><td>1</td><td>0</td><td>SM8850</td><td>2.50.0</td><td>fp16</td><td>7 MB</td></tr><tr><td>slow</td><td>npu</td><td>1</td><td>0</td><td>SM8850</td><td>2.50.0</td><td>fp16</td><td>696 MB</td></tr><tr><td>slow1</td><td>npu</td><td>1</td><td>0</td><td>SM8850</td><td>2.50.0</td><td>int16</td><td>351 MB</td></tr><tr><td>slow1s</td><td>npu</td><td>1</td><td>0</td><td>SM8850</td><td>2.50.0</td><td>int16</td><td>351 MB</td></tr></table><details><summary>output</summary><pre class="mono">$ nnopt-verify npu-graphs port/build/stage/models port/models --soc SM8850
114
+ graph ops SoC prec size ok
115
+ cdecs 1 sig · 1 DISP SM8850 fp16 150M ✓
116
+ cenc 1 sig · 1 DISP SM8850 fp16 456M ✓
117
+ cpost 1 sig · 1 DISP SM8850 fp16 133M ✓
118
+ cpost256 1 sig · 1 DISP SM8850 fp16 108M ✓
119
+ fast 1 sig · 1 DISP SM8850 int16 62M ✓
120
+ head 1 sig · 1 DISP SM8850 fp16 7M ✓
121
+ slow 1 sig · 1 DISP SM8850 fp16 696M ✓
122
+ slow1 1 sig · 1 DISP SM8850 int16 351M ✓
123
+ slow1s 1 sig · 1 DISP SM8850 int16 351M ✓
124
+ cdecs 1 sig · 1 DISP SM8850 fp16 150M ✓
125
+ cenc 1 sig · 1 DISP SM8850 fp16 456M ✓
126
+ cpost 1 sig · 1 DISP SM8850 fp16 133M ✓
127
+ cpost256 1 sig · 1 DISP SM8850 fp16 108M ✓
128
+ fast 1 sig · 1 DISP SM8850 int16 62M ✓
129
+ head 1 sig · 1 DISP SM8850 fp16 7M ✓
130
+ slow 1 sig · 1 DISP SM8850 fp16 696M ✓
131
+ slow1 1 sig · 1 DISP SM8850 int16 351M ✓
132
+ slow1s 1 sig · 1 DISP SM8850 int16 351M ✓
133
+ 18 of 18 NPU graphs all-DISPATCH · 0 CPU ops · SM8850 · QAIRT 2.50.0</pre></details><h3>NPU on the device</h3><p>fully accelerated 207/207 · Skel V81 loaded · user PD ✓</p><details><summary>output</summary><pre class="mono">$ adb logcat -c; &lt;the kit&#x27;s runs&gt;; logcat -d -v time | grep -E &#x27;Skel\.so|user PD|fully accelerated|IsNonCpuFullyAccelerated|Replacing [0-9]+ out of|Partitioned subgraph|per graph ms|QnnDsp|LiteRt|litert|DISPATCH&#x27; | tail -n 400
134
+ artitions for subgraph 0 (main).
135
+ LiteRT fully accelerated on the NPU: yes (cpost256, LiteRtCompiledModelIsNonCpuFullyAccelerated)
136
+ VERBOSE: Replacing 1 out of 1 node(s) with delegate (DispatchDelegate) node, yielding 1 partitions for subgraph 0 (main).
137
+ LiteRT fully accelerated on the NPU: yes (cdecs, LiteRtCompiledModelIsNonCpuFullyAccelerated)
138
+ VERBOSE: Replacing 1 out of 1 node(s) with delegate (DispatchDelegate) node, yielding 1 partitions for subgraph 0 (main).
139
+ LiteRT fully accelerated on the NPU: yes (cenc, LiteRtCompiledModelIsNonCpuFullyAccelerated)
140
+ VERBOSE: Replacing 1 out of 1 node(s) with delegate (DispatchDelegate) node, yielding 1 partitions for subgraph 0 (main).
141
+ LiteRT fully accelerated on the NPU: yes (slow, LiteRtCompiledModelIsNonCpuFullyAccelerated)
142
+ VERBOSE: Replacing 1 out of 1 node(s) with delegate (DispatchDelegate) node, yielding 1 partitions for subgraph 0 (main).
143
+ LiteRT fully accelerated on the NPU: yes (slow1, LiteRtCompiledModelIsNonCpuFullyAccelerated)
144
+ VERBOSE: Replacing 1 out of 1 node(s) with delegate (DispatchDelegate) node, yielding 1 partitions for subgraph 0 (main).
145
+ LiteRT fully accelerated on the NPU: yes (slow1s, LiteRtCompiledModelIsNonCpuFullyAccelerated)
146
+ VERBOSE: Replacing 1 out of 1 node(s) with delegate (DispatchDelegate) node, yielding 1 partitions for subgraph 0 (main).
147
+ LiteRT fully accelerated on the NPU: yes (fast, LiteRtCompiledModelIsNonCpuFullyAccelerated)
148
+ VERBOSE: Replacing 1 out of 1 node(s) with delegate (DispatchDelegate) node, yielding 1 partitions for subgraph 0 (main).
149
+ LiteRT fully accelerated on the NPU: yes (head, LiteRtCompiledModelIsNonCpuFullyAccelerated)
150
+ VERBOSE: Replacing 1 out of 1 node(s) with delegate (DispatchDelegate) node, yielding 1 partitions for subgraph 0 (main).
151
+ LiteRT fully accelerated on the NPU: yes (cpost, LiteRtCompiledModelIsNonCpuFullyAccelerated)
152
+ VERBOSE: Replacing 1 out of 1 node(s) with delegate (DispatchDelegate) node, yielding 1 partitions for subgraph 0 (main).
153
+ LiteRT fully accelerated on the NPU: yes (cpost256, LiteRtCompiledModelIsNonCpuFullyAccelerated)
154
+ VERBOSE: Replacing 1 out of 1 node(s) with delegate (DispatchDelegate) node, yielding 1 partitions for subgraph 0 (main).
155
+ LiteRT fully accelerated on the NPU: yes (cdecs, LiteRtCompiledModelIsNonCpuFullyAccelerated)
156
+ VERBOSE: Replacing 1 out of 1 node(s) with delegate (DispatchDelegate) node, yielding 1 partitions for subgraph 0 (main).
157
+ LiteRT fully accelerated on the NPU: yes (cenc, LiteRtCompiledModelIsNonCpuFullyAccelerated)
158
+ VERBOSE: Replacing 1 out of 1 node(s) with delegate (DispatchDelegate) node, yielding 1 partitions for subgraph 0 (main).
159
+ LiteRT fully accelerated on the NPU: yes (slow, LiteRtCompiledModelIsNonCpuFullyAccelerated)
160
+ VERBOSE: Replacing 1 out of 1 node(s) with delegate (DispatchDelegate) node, yielding 1 partitions for subgraph 0 (main).
161
+ LiteRT fully accelerated on the NPU: yes (slow1, LiteRtCompiledModelIsNonCpuFullyAccelerated)
162
+ VERBOSE: Replacing 1 out of 1 node(s) with delegate (DispatchDelegate) node, yielding 1 partitions for subgraph 0 (main).
163
+ LiteRT fully accelerated on the NPU: yes (slow1s, LiteRtCompiledModelIsNonCpuFullyAccelerated)
164
+ VERBOSE: Replacing 1 out of 1 node(s) with delegate (DispatchDelegate) node, yielding 1 partitions for subgraph 0 (main).
165
+ LiteRT fully accelerated on the NPU: yes (fast, LiteRtCompiledModelIsNonCpuFullyAccelerated)
166
+ VERBOSE: Replacing 1 out of 1 node(s) with delegate (DispatchDelegate) node, yielding 1 partitions for subgraph 0 (main).
167
+ LiteRT fully accelerated on the NPU: yes (head, LiteRtCompiledModelIsNonCpuFullyAccelerated)
168
+ VERBOSE: Replacing 1 out of 1 node(s) with delegate (DispatchDelegate) node, yielding 1 partitions for subgraph 0 (main).
169
+ LiteRT fully accelerated on the NPU: yes (cpost, LiteRtCompiledModelIsNonCpuFullyAccelerated)
170
+ VERBOSE: Replacing 1 out of 1 node(s) with delegate (DispatchDelegate) node, yielding 1 partitions for subgraph 0 (main).
171
+ LiteRT fully accelerated on the NPU: yes (cpost256, LiteRtCompiledModelIsNonCpuFullyAccelerated)
172
+ VERBOSE: Replacing 1 out of 1 node(s) with delegate (DispatchDelegate) node, yielding 1 partitions for subgraph 0 (main).
173
+ LiteRT fully accelerated on the NPU: yes (cdecs, LiteRtCompiledModelIsNonCpuFullyAccelerated)
174
+ VERBOSE: Replacing 1 out of 1 node(s) with delegate (DispatchDelegate) node, yielding 1 partitions for subgraph 0 (main).
175
+ LiteRT fully accelerated on the NPU: yes (cenc, LiteRtCompiledModelIsNonCpuFullyAccelerated)
176
+ VERBOSE: Replacing 1 out of 1 node(s) with delegate (DispatchDelegate) node, yielding 1 partitions for subgraph 0 (main).
177
+ LiteRT fully accelerated on the NPU: yes (slow, LiteRtCompiledModelIsNonCpuFullyAccelerated)
178
+ VERBOSE: Replacing 1 out of 1 node(s) with delegate (DispatchDelegate) node, yielding 1 partitions for subgraph 0 (main).
179
+ LiteRT fully accelerated on the NPU: yes (slow1, LiteRtCompiledModelIsNonCpuFullyAccelerated)
180
+ VERBOSE: Replacing 1 out of 1 node(s) with delegate (DispatchDelegate) node, yielding 1 partitions for subgraph 0 (main).
181
+ LiteRT fully accelerated on the NPU: yes (slow1s, LiteRtCompiledModelIsNonCpuFullyAccelerated)
182
+ VERBOSE: Replacing 1 out of 1 node(s) with delegate (DispatchDelegate) node, yielding 1 partitions for subgraph 0 (main).
183
+ LiteRT fully accelerated on the NPU: yes (fast, LiteRtCompiledModelIsNonCpuFullyAccelerated)
184
+ VERBOSE: Replacing 1 out of 1 node(s) with delegate (DispatchDelegate) node, yielding 1 partitions for subgraph 0 (main).
185
+ LiteRT fully accelerated on the NPU: yes (head, LiteRtCompiledModelIsNonCpuFullyAccelerated)
186
+ VERBOSE: Replacing 1 out of 1 node(s) with delegate (DispatchDelegate) node, yielding 1 partitions for subgraph 0 (main).
187
+ LiteRT fully accelerated on the NPU: yes (cpost, LiteRtCompiledModelIsNonCpuFullyAccelerated)
188
+ VERBOSE: Replacing 1 out of 1 node(s) with delegate (DispatchDelegate) node, yielding 1 partitions for subgraph 0 (main).
189
+ LiteRT fully accelerated on the NPU: yes (cpost256, LiteRtCompiledModelIsNonCpuFullyAccelerated)
190
+ VERBOSE: Replacing 1 out of 1 node(s) with delegate (DispatchDelegate) node, yielding 1 partitions for subgraph 0 (main).
191
+ LiteRT fully accelerated on the NPU: yes (cdecs, LiteRtCompiledModelIsNonCpuFullyAccelerated)
192
+ VERBOSE: Replacing 1 out of 1 node(s) with delegate (DispatchDelegate) node, yielding 1 partitions for subgraph 0 (main).
193
+ LiteRT fully accelerated on the NPU: yes (cenc, LiteRtCompiledModelIsNonCpuFullyAccelerated)
194
+ VERBOSE: Replacing 1 out of 1 node(s) with delegate (DispatchDelegate) node, yielding 1 partitions for subgraph 0 (main).
195
+ LiteRT fully accelerated on the NPU: yes (slow, LiteRtCompiledModelIsNonCpuFullyAccelerated)
196
+ VERBOSE: Replacing 1 out of 1 node(s) with delegate (DispatchDelegate) node, yielding 1 partitions for subgraph 0 (main).
197
+ LiteRT fully accelerated on the NPU: yes (slow1, LiteRtCompiledModelIsNonCpuFullyAccelerated)
198
+ VERBOSE: Replacing 1 out of 1 node(s) with delegate (DispatchDelegate) node, yielding 1 partitions for subgraph 0 (main).
199
+ LiteRT fully accelerated on the NPU: yes (slow1s, LiteRtCompiledModelIsNonCpuFullyAccelerated)
200
+ VERBOSE: Replacing 1 out of 1 node(s) with delegate (DispatchDelegate) node, yielding 1 partitions for subgraph 0 (main).
201
+ LiteRT fully accelerated on the NPU: yes (fast, LiteRtCompiledModelIsNonCpuFullyAccelerated)
202
+ VERBOSE: Replacing 1 out of 1 node(s) with delegate (DispatchDelegate) node, yielding 1 partitions for subgraph 0 (main).
203
+ LiteRT fully accelerated on the NPU: yes (head, LiteRtCompiledModelIsNonCpuFullyAccelerated)
204
+ VERBOSE: Replacing 1 out of 1 node(s) with delegate (DispatchDelegate) node, yielding 1 partitions for subgraph 0 (main).
205
+ LiteRT fully accelerated on the NPU: yes (cpost, LiteRtCompiledModelIsNonCpuFullyAccelerated)
206
+ VERBOSE: Replacing 1 out of 1 node(s) with delegate (DispatchDelegate) node, yielding 1 partitions for subgraph 0 (main).
207
+ LiteRT fully accelerated on the NPU: yes (cpost256, LiteRtCompiledModelIsNonCpuFullyAccelerated)
208
+ VERBOSE: Replacing 1 out of 1 node(s) with delegate (DispatchDelegate) node, yielding 1 partitions for subgraph 0 (main).
209
+ LiteRT fully accelerated on the NPU: yes (cdecs, LiteRtCompiledModelIsNonCpuFullyAccelerated)
210
+ VERBOSE: Replacing 1 out of 1 node(s) with delegate (DispatchDelegate) node, yielding 1 partitions for subgraph 0 (main).
211
+ LiteRT fully accelerated on the NPU: yes (cenc, LiteRtCompiledModelIsNonCpuFullyAccelerated)
212
+ VERBOSE: Replacing 1 out of 1 node(s) with delegate (DispatchDelegate) node, yielding 1 partitions for subgraph 0 (main).
213
+ LiteRT fully accelerated on the NPU: yes (slow, LiteRtCompiledModelIsNonCpuFullyAccelerated)
214
+ VERBOSE: Replacing 1 out of 1 node(s) with delegate (DispatchDelegate) node, yielding 1 partitions for subgraph 0 (main).
215
+ LiteRT fully accelerated on the NPU: yes (slow1, LiteRtCompiledModelIsNonCpuFullyAccelerated)
216
+ VERBOSE: Replacing 1 out of 1 node(s) with delegate (DispatchDelegate) node, yielding 1 partitions for subgraph 0 (main).
217
+ LiteRT fully accelerated on the NPU: yes (slow1s, LiteRtCompiledModelIsNonCpuFullyAccelerated)
218
+ VERBOSE: Replacing 1 out of 1 node(s) with delegate (DispatchDelegate) node, yielding 1 partitions for subgraph 0 (main).
219
+ LiteRT fully accelerated on the NPU: yes (fast, LiteRtCompiledModelIsNonCpuFullyAccelerated)
220
+ VERBOSE: Replacing 1 out of 1 node(s) with delegate (DispatchDelegate) node, yielding 1 partitions for subgraph 0 (main).
221
+ LiteRT fully accelerated on the NPU: yes (head, LiteRtCompiledModelIsNonCpuFullyAccelerated)
222
+ VERBOSE: Replacing 1 out of 1 node(s) with delegate (DispatchDelegate) node, yielding 1 partitions for subgraph 0 (main).
223
+ LiteRT fully accelerated on the NPU: yes (cpost, LiteRtCompiledModelIsNonCpuFullyAccelerated)
224
+ VERBOSE: Replacing 1 out of 1 node(s) with delegate (DispatchDelegate) node, yielding 1 partitions for subgraph 0 (main).
225
+ LiteRT fully accelerated on the NPU: yes (cpost256, LiteRtCompiledModelIsNonCpuFullyAccelerated)
226
+ VERBOSE: Replacing 1 out of 1 node(s) with delegate (DispatchDelegate) node, yielding 1 partitions for subgraph 0 (main).
227
+ LiteRT fully accelerated on the NPU: yes (cdecs, LiteRtCompiledModelIsNonCpuFullyAccelerated)
228
+ VERBOSE: Replacing 1 out of 1 node(s) with delegate (DispatchDelegate) node, yielding 1 partitions for subgraph 0 (main).
229
+ LiteRT fully accelerated on the NPU: yes (cenc, LiteRtCompiledModelIsNonCpuFullyAccelerated)
230
+ VERBOSE: Replacing 1 out of 1 node(s) with delegate (DispatchDelegate) node, yielding 1 partitions for subgraph 0 (main).
231
+ LiteRT fully accelerated on the NPU: yes (slow, LiteRtCompiledModelIsNonCpuFullyAccelerated)
232
+ VERBOSE: Replacing 1 out of 1 node(s) with delegate (DispatchDelegate) node, yielding 1 partitions for subgraph 0 (main).
233
+ LiteRT fully accelerated on the NPU: yes (slow1, LiteRtCompiledModelIsNonCpuFullyAccelerated)
234
+ VERBOSE: Replacing 1 out of 1 node(s) with delegate (DispatchDelegate) node, yielding 1 partitions for subgraph 0 (main).
235
+ LiteRT fully accelerated on the NPU: yes (slow1s, LiteRtCompiledModelIsNonCpuFullyAccelerated)
236
+ VERBOSE: Replacing 1 out of 1 node(s) with delegate (DispatchDelegate) node, yielding 1 partitions for subgraph 0 (main).
237
+ LiteRT fully accelerated on the NPU: yes (fast, LiteRtCompiledModelIsNonCpuFullyAccelerated)
238
+ VERBOSE: Replacing 1 out of 1 node(s) with delegate (DispatchDelegate) node, yielding 1 partitions for subgraph 0 (main).
239
+ LiteRT fully accelerated on the NPU: yes (head, LiteRtCompiledModelIsNonCpuFullyAccelerated)
240
+ VERBOSE: Replacing 1 out of 1 node(s) with delegate (DispatchDelegate) node, yielding 1 partitions for subgraph 0 (main).
241
+ LiteRT fully accelerated on the NPU: yes (cpost, LiteRtCompiledModelIsNonCpuFullyAccelerated)
242
+ VERBOSE: Replacing 1 out of 1 node(s) with delegate (DispatchDelegate) node, yielding 1 partitions for subgraph 0 (main).
243
+ LiteRT fully accelerated on the NPU: yes (cpost256, LiteRtCompiledModelIsNonCpuFullyAccelerated)
244
+ VERBOSE: Replacing 1 out of 1 node(s) with delegate (DispatchDelegate) node, yielding 1 partitions for subgraph 0 (main).
245
+ LiteRT fully accelerated on the NPU: yes (cdecs, LiteRtCompiledModelIsNonCpuFullyAccelerated)
246
+ VERBOSE: Replacing 1 out of 1 node(s) with delegate (DispatchDelegate) node, yielding 1 partitions for subgraph 0 (main).
247
+ LiteRT fully accelerated on the NPU: yes (cenc, LiteRtCompiledModelIsNonCpuFullyAccelerated)
248
+ VERBOSE: Replacing 1 out of 1 node(s) with delegate (DispatchDelegate) node, yielding 1 partitions for subgraph 0 (main).
249
+ LiteRT fully accelerated on the NPU: yes (slow, LiteRtCompiledModelIsNonCpuFullyAccelerated)
250
+ VERBOSE: Replacing 1 out of 1 node(s) with delegate (DispatchDelegate) node, yielding 1 partitions for subgraph 0 (main).
251
+ LiteRT fully accelerated on the NPU: yes (slow1, LiteRtCompiledModelIsNonCpuFullyAccelerated)
252
+ VERBOSE: Replacing 1 out of 1 node(s) with delegate (DispatchDelegate) node, yielding 1 partitions for subgraph 0 (main).
253
+ LiteRT fully accelerated on the NPU: yes (slow1s, LiteRtCompiledModelIsNonCpuFullyAccelerated)
254
+ VERBOSE: Replacing 1 out of 1 node(s) with delegate (DispatchDelegate) node, yielding 1 partitions for subgraph 0 (main).
255
+ LiteRT fully accelerated on the NPU: yes (fast, LiteRtCompiledModelIsNonCpuFullyAccelerated)
256
+ VERBOSE: Replacing 1 out of 1 node(s) with delegate (DispatchDelegate) node, yielding 1 partitions for subgraph 0 (main).
257
+ LiteRT fully accelerated on the NPU: yes (head, LiteRtCompiledModelIsNonCpuFullyAccelerated)
258
+ VERBOSE: Replacing 1 out of 1 node(s) with delegate (DispatchDelegate) node, yielding 1 partitions for subgraph 0 (main).
259
+ LiteRT fully accelerated on the NPU: yes (cpost, LiteRtCompiledModelIsNonCpuFullyAccelerated)
260
+ VERBOSE: Replacing 1 out of 1 node(s) with delegate (DispatchDelegate) node, yielding 1 partitions for subgraph 0 (main).
261
+ LiteRT fully accelerated on the NPU: yes (cpost256, LiteRtCompiledModelIsNonCpuFullyAccelerated)
262
+ VERBOSE: Replacing 1 out of 1 node(s) with delegate (DispatchDelegate) node, yielding 1 partitions for subgraph 0 (main).
263
+ LiteRT fully accelerated on the NPU: yes (cdecs, LiteRtCompiledModelIsNonCpuFullyAccelerated)
264
+ VERBOSE: Replacing 1 out of 1 node(s) with delegate (DispatchDelegate) node, yielding 1 partitions for subgraph 0 (main).
265
+ LiteRT fully accelerated on the NPU: yes (cenc, LiteRtCompiledModelIsNonCpuFullyAccelerated)
266
+ VERBOSE: Replacing 1 out of 1 node(s) with delegate (DispatchDelegate) node, yielding 1 partitions for subgraph 0 (main).
267
+ LiteRT fully accelerated on the NPU: yes (slow, LiteRtCompiledModelIsNonCpuFullyAccelerated)
268
+ VERBOSE: Replacing 1 out of 1 node(s) with delegate (DispatchDelegate) node, yielding 1 partitions for subgraph 0 (main).
269
+ LiteRT fully accelerated on the NPU: yes (slow1, LiteRtCompiledModelIsNonCpuFullyAccelerated)
270
+ VERBOSE: Replacing 1 out of 1 node(s) with delegate (DispatchDelegate) node, yielding 1 partitions for subgraph 0 (main).
271
+ LiteRT fully accelerated on the NPU: yes (slow1s, LiteRtCompiledModelIsNonCpuFullyAccelerated)
272
+ VERBOSE: Replacing 1 out of 1 node(s) with delegate (DispatchDelegate) node, yielding 1 partitions for subgraph 0 (main).
273
+ LiteRT fully accelerated on the NPU: yes (fast, LiteRtCompiledModelIsNonCpuFullyAccelerated)
274
+ VERBOSE: Replacing 1 out of 1 node(s) with delegate (DispatchDelegate) node, yielding 1 partitions for subgraph 0 (main).
275
+ LiteRT fully accelerated on the NPU: yes (head, LiteRtCompiledModelIsNonCpuFullyAccelerated)
276
+ VERBOSE: Replacing 1 out of 1 node(s) with delegate (DispatchDelegate) node, yielding 1 partitions for subgraph 0 (main).
277
+ LiteRT fully accelerated on the NPU: yes (cpost, LiteRtCompiledModelIsNonCpuFullyAccelerated)
278
+ VERBOSE: Replacing 1 out of 1 node(s) with delegate (DispatchDelegate) node, yielding 1 partitions for subgraph 0 (main).
279
+ LiteRT fully accelerated on the NPU: yes (cpost256, LiteRtCompiledModelIsNonCpuFullyAccelerated)
280
+ VERBOSE: Replacing 1 out of 1 node(s) with delegate (DispatchDelegate) node, yielding 1 partitions for subgraph 0 (main).
281
+ LiteRT fully accelerated on the NPU: yes (cdecs, LiteRtCompiledModelIsNonCpuFullyAccelerated)
282
+ VERBOSE: Replacing 1 out of 1 node(s) with delegate (DispatchDelegate) node, yielding 1 partitions for subgraph 0 (main).
283
+ LiteRT fully accelerated on the NPU: yes (cenc, LiteRtCompiledModelIsNonCpuFullyAccelerated)
284
+ VERBOSE: Replacing 1 out of 1 node(s) with delegate (DispatchDelegate) node, yielding 1 partitions for subgraph 0 (main).
285
+ LiteRT fully accelerated on the NPU: yes (slow, LiteRtCompiledModelIsNonCpuFullyAccelerated)
286
+ VERBOSE: Replacing 1 out of 1 node(s) with delegate (DispatchDelegate) node, yielding 1 partitions for subgraph 0 (main).
287
+ LiteRT fully accelerated on the NPU: yes (slow1, LiteRtCompiledModelIsNonCpuFullyAccelerated)
288
+ VERBOSE: Replacing 1 out of 1 node(s) with delegate (DispatchDelegate) node, yielding 1 partitions for subgraph 0 (main).
289
+ LiteRT fully accelerated on the NPU: yes (slow1s, LiteRtCompiledModelIsNonCpuFullyAccelerated)
290
+ VERBOSE: Replacing 1 out of 1 node(s) with delegate (DispatchDelegate) node, yielding 1 partitions for subgraph 0 (main).
291
+ LiteRT fully accelerated on the NPU: yes (fast, LiteRtCompiledModelIsNonCpuFullyAccelerated)
292
+ VERBOSE: Replacing 1 out of 1 node(s) with delegate (DispatchDelegate) node, yielding 1 partitions for subgraph 0 (main).
293
+ LiteRT fully accelerated on the NPU: yes (head, LiteRtCompiledModelIsNonCpuFullyAccelerated)
294
+ VERBOSE: Replacing 1 out of 1 node(s) with delegate (DispatchDelegate) node, yielding 1 partitions for subgraph 0 (main).
295
+ LiteRT fully accelerated on the NPU: yes (cpost, LiteRtCompiledModelIsNonCpuFullyAccelerated)
296
+ VERBOSE: Replacing 1 out of 1 node(s) with delegate (DispatchDelegate) node, yielding 1 partitions for subgraph 0 (main).
297
+ LiteRT fully accelerated on the NPU: yes (cpost256, LiteRtCompiledModelIsNonCpuFullyAccelerated)
298
+ VERBOSE: Replacing 1 out of 1 node(s) with delegate (DispatchDelegate) node, yielding 1 partitions for subgraph 0 (main).
299
+ LiteRT fully accelerated on the NPU: yes (cdecs, LiteRtCompiledModelIsNonCpuFullyAccelerated)
300
+ VERBOSE: Replacing 1 out of 1 node(s) with delegate (DispatchDelegate) node, yielding 1 partitions for subgraph 0 (main).
301
+ LiteRT fully accelerated on the NPU: yes (cenc, LiteRtCompiledModelIsNonCpuFullyAccelerated)
302
+ VERBOSE: Replacing 1 out of 1 node(s) with delegate (DispatchDelegate) node, yielding 1 partitions for subgraph 0 (main).
303
+ LiteRT fully accelerated on the NPU: yes (slow, LiteRtCompiledModelIsNonCpuFullyAccelerated)
304
+ VERBOSE: Replacing 1 out of 1 node(s) with delegate (DispatchDelegate) node, yielding 1 partitions for subgraph 0 (main).
305
+ LiteRT fully accelerated on the NPU: yes (slow1, LiteRtCompiledModelIsNonCpuFullyAccelerated)
306
+ VERBOSE: Replacing 1 out of 1 node(s) with delegate (DispatchDelegate) node, yielding 1 partitions for subgraph 0 (main).
307
+ LiteRT fully accelerated on the NPU: yes (slow1s, LiteRtCompiledModelIsNonCpuFullyAccelerated)
308
+ VERBOSE: Replacing 1 out of 1 node(s) with delegate (DispatchDelegate) node, yielding 1 partitions for subgraph 0 (main).
309
+ LiteRT fully accelerated on the NPU: yes (fast, LiteRtCompiledModelIsNonCpuFullyAccelerated)
310
+ VERBOSE: Replacing 1 out of 1 node(s) with delegate (DispatchDelegate) node, yielding 1 partitions for subgraph 0 (main).
311
+ LiteRT fully accelerated on the NPU: yes (head, LiteRtCompiledModelIsNonCpuFullyAccelerated)
312
+ VERBOSE: Replacing 1 out of 1 node(s) with delegate (DispatchDelegate) node, yielding 1 partitions for subgraph 0 (main).
313
+ LiteRT fully accelerated on the NPU: yes (cpost, LiteRtCompiledModelIsNonCpuFullyAccelerated)
314
+ VERBOSE: Replacing 1 out of 1 node(s) with delegate (DispatchDelegate) node, yielding 1 partitions for subgraph 0 (main).
315
+ LiteRT fully accelerated on the NPU: yes (cpost256, LiteRtCompiledModelIsNonCpuFullyAccelerated)
316
+ VERBOSE: Replacing 1 out of 1 node(s) with delegate (DispatchDelegate) node, yielding 1 partitions for subgraph 0 (main).
317
+ LiteRT fully accelerated on the NPU: yes (cdecs, LiteRtCompiledModelIsNonCpuFullyAccelerated)
318
+ VERBOSE: Replacing 1 out of 1 node(s) with delegate (DispatchDelegate) node, yielding 1 partitions for subgraph 0 (main).
319
+ LiteRT fully accelerated on the NPU: yes (cenc, LiteRtCompiledModelIsNonCpuFullyAccelerated)</pre></details><h3>benchmark_model (Google LiteRT 2.3.1)</h3><p>18 of 18 timed · 18 at 100% NPU</p><table><tr><th>graph</th><th>signature</th><th>avg ms</th><th>min ms</th><th>max ms</th><th>% on the NPU</th></tr><tr><td>cdecs</td><td></td><td>21.975</td><td>21.157</td><td>22.276</td><td>100.0</td></tr><tr><td>cenc</td><td></td><td>392.531</td><td>389.687</td><td>395.629</td><td>100.0</td></tr><tr><td>cpost</td><td></td><td>235.51</td><td>233.308</td><td>237.365</td><td>100.0</td></tr><tr><td>cpost256</td><td></td><td>12.684</td><td>12.4</td><td>12.983</td><td>100.0</td></tr><tr><td>fast</td><td></td><td>1.29</td><td>1.266</td><td>1.433</td><td>100.0</td></tr><tr><td>head</td><td></td><td>0.492</td><td>0.464</td><td>0.863</td><td>100.0</td></tr><tr><td>slow</td><td></td><td>21.247</td><td>21.157</td><td>21.771</td><td>100.0</td></tr><tr><td>slow1</td><td></td><td>7.735</td><td>7.695</td><td>7.88</td><td>100.0</td></tr><tr><td>slow1s</td><td></td><td>6.056</td><td>6.017</td><td>6.325</td><td>100.0</td></tr><tr><td>cdecs</td><td></td><td>21.118</td><td>21.035</td><td>21.429</td><td>100.0</td></tr><tr><td>cenc</td><td></td><td>379.145</td><td>367.546</td><td>395.262</td><td>100.0</td></tr><tr><td>cpost</td><td></td><td>236.198</td><td>234.715</td><td>237.677</td><td>100.0</td></tr><tr><td>cpost256</td><td></td><td>12.716</td><td>12.488</td><td>13.035</td><td>100.0</td></tr><tr><td>fast</td><td></td><td>1.343</td><td>1.273</td><td>1.555</td><td>100.0</td></tr><tr><td>head</td><td></td><td>0.499</td><td>0.465</td><td>0.765</td><td>100.0</td></tr><tr><td>slow</td><td></td><td>22.753</td><td>22.591</td><td>23.674</td><td>100.0</td></tr><tr><td>slow1</td><td></td><td>7.751</td><td>7.698</td><td>7.915</td><td>100.0</td></tr><tr><td>slow1s</td><td></td><td>6.08</td><td>6.035</td><td>6.26</td><td>100.0</td></tr></table><details><summary>output</summary><pre class="mono">$ /data/local/tmp/nnopt-verify/npu-bench/benchmark_model --graph=/data/local/tmp/nnopt/port/models/cdecs.tflite --use_npu=true --use_gpu=false --qualcomm_htp_performance_mode=burst --dispatch_library_path=/data/local/tmp/nnopt-verify/npu-bench --num_runs=20 --warmup_runs=3 (+17 more)
320
+ rted. context = 0x1
321
+ 0.0ms [WARNING] QnnDsp &lt;W&gt; m_CFBCallbackInfoObj is not initialized, return emptyList
322
+ 0.0ms [ INFO ] QnnDsp &lt;I&gt; Number of existing contexts: 0, graphs: 0
323
+ 0.0ms [ INFO ] QnnDsp &lt;I&gt; QnnContext_free done successfully.
324
+ 0.0ms [ INFO ] QnnDsp &lt;I&gt; Exiting thread
325
+
326
+ $ /data/local/tmp/nnopt-verify/npu-bench/benchmark_model --graph=/data/local/tmp/nnopt/port/models/cpost256.tflite --use_npu=true --use_gpu=false --qualcomm_htp_performance_mode=burst --dispatch_library_path=/data/local/tmp/nnopt-verify/npu-bench --num_runs=20 --warmup_runs=3
327
+ exit 0
328
+ ] QnnDsp &lt;I&gt; QnnGraph_execute done. status 0x0
329
+ 0.0ms [ INFO ] QnnDsp &lt;I&gt; QnnGraph_execute started. graph = 0x1
330
+ 0.0ms [ INFO ] QnnDsp &lt;I&gt; QnnGraph_execute done. status 0x0
331
+ 0.0ms [ INFO ] QnnDsp &lt;I&gt; QnnGraph_execute started. graph = 0x1
332
+ 0.0ms [ INFO ] QnnDsp &lt;I&gt; QnnGraph_execute done. status 0x0
333
+ 0.0ms [ INFO ] QnnDsp &lt;I&gt; QnnGraph_execute started. graph = 0x1
334
+ 0.0ms [ INFO ] QnnDsp &lt;I&gt; QnnGraph_execute done. status 0x0
335
+ 0.0ms [ INFO ] QnnDsp &lt;I&gt; QnnGraph_execute started. graph = 0x1
336
+ 0.0ms [ INFO ] QnnDsp &lt;I&gt; QnnGraph_execute done. status 0x0
337
+ 0.0ms [ INFO ] QnnDsp &lt;I&gt; QnnGraph_execute started. graph = 0x1
338
+ 0.0ms [ INFO ] QnnDsp &lt;I&gt; QnnGraph_execute done. status 0x0
339
+ 0.0ms [ INFO ] QnnDsp &lt;I&gt; QnnGraph_execute started. graph = 0x1
340
+ 0.0ms [ INFO ] QnnDsp &lt;I&gt; QnnGraph_execute done. status 0x0
341
+ INFO: count=79 first=12764 curr=12618 min=12488 max=13035 avg=12716 std=118 p5=12512 median=12709 p95=12931
342
+
343
+ INFO: [benchmark_litert_model.h:89]
344
+ ========== BENCHMARK RESULTS ==========
345
+ INFO: [benchmark_litert_model.h:92] Signature name: serving_default
346
+ INFO: [benchmark_litert_model.h:94] Model initialization: 185.55 ms
347
+ INFO: [benchmark_litert_model.h:96] Warmup (first): 15.00 ms
348
+ INFO: [benchmark_litert_model.h:98] Warmup (avg): 12.82 ms (39 runs)
349
+ INFO: [benchmark_litert_model.h:100] Inference (avg): 12.72 ms (79 runs)
350
+ INFO: [benchmark_litert_model.h:104] Inference (min): 12.49 ms
351
+ INFO: [benchmark_litert_model.h:106] Inference (max): 13.04 ms
352
+ INFO: [benchmark_litert_model.h:108] Inference (std): 0.12
353
+ INFO: [benchmark_litert_model.h:115] Throughput: 78.64 MB/s
354
+ INFO: [benchmark_litert_model.h:124]
355
+ Memory Usage:
356
+ INFO: [benchmark_litert_model.h:126] Init footprint: 118.71 MB
357
+ INFO: [benchmark_litert_model.h:128] Overall footprint: 119.71 MB
358
+ INFO: [benchmark_litert_model.h:135] Peak memory usage not available. (peak_mem_mb &lt;= 0)
359
+ INFO: [benchmark_litert_model.h:138] ======================================
360
+
361
+ INFO: [accelerator_registry.cc:43] DestroyAccelerator: ptr=0xb400007928e03b60, name=CpuAccelerator
362
+ INFO: [accelerator_registry.cc:43] DestroyAccelerator: ptr=0xb400007928e039a0, name=NpuAccelerator
363
+ 0.0ms [ INFO ] QnnDsp &lt;I&gt; QnnMem_deRegister started
364
+ 0.0ms [ INFO ] QnnDsp &lt;I&gt; QnnMem_deRegister done. status 0x0
365
+ 0.0ms [ INFO ] QnnDsp &lt;I&gt; QnnMem_deRegister started
366
+ 0.0ms [ INFO ] QnnDsp &lt;I&gt; QnnMem_deRegister done. status 0x0
367
+ 1693520000.0ms [ INFO ] Free context with QnnGraphTransformerAdapter1693546000.0ms [ INFO ] QnnGraphTransformer context freed successfully 0.0ms [ INFO ] QnnDsp &lt;I&gt; QnnContext_free started. context = 0x1
368
+ 0.0ms [WARNING] QnnDsp &lt;W&gt; m_CFBCallbackInfoObj is not initialized, return emptyList
369
+ 0.0ms [ INFO ] QnnDsp &lt;I&gt; Number of existing contexts: 0, graphs: 0
370
+ 0.0ms [ INFO ] QnnDsp &lt;I&gt; QnnContext_free done successfully.
371
+ 0.0ms [ INFO ] QnnDsp &lt;I&gt; Exiting thread
372
+
373
+ $ /data/local/tmp/nnopt-verify/npu-bench/benchmark_model --graph=/data/local/tmp/nnopt/port/models/fast.tflite --use_npu=true --use_gpu=false --qualcomm_htp_performance_mode=burst --dispatch_library_path=/data/local/tmp/nnopt-verify/npu-bench --num_runs=20 --warmup_runs=3
374
+ exit 0
375
+ FO: count=745 first=1399 curr=1299 min=1273 max=1555 avg=1343.02 std=37 p5=1288 median=1347 p95=1394
376
+
377
+ INFO: [benchmark_litert_model.h:89]
378
+ ========== BENCHMARK RESULTS ==========
379
+ INFO: [benchmark_litert_model.h:92] Signature name: serving_default
380
+ INFO: [benchmark_litert_model.h:94] Model initialization: 163.09 ms
381
+ INFO: [benchmark_litert_model.h:96] Warmup (first): 5.06 ms
382
+ INFO: [benchmark_litert_model.h:98] Warmup (avg): 1.38 ms (364 runs)
383
+ INFO: [benchmark_litert_model.h:100] Inference (avg): 1.34 ms (745 runs)
384
+ INFO: [benchmark_litert_model.h:104] Inference (min): 1.27 ms
385
+ INFO: [benchmark_litert_model.h:106] Inference (max): 1.55 ms
386
+ INFO: [benchmark_litert_model.h:108] Inference (std): 0.04
387
+ INFO: [benchmark_litert_model.h:115] Throughput: 15.92 MB/s
388
+ INFO: [benchmark_litert_model.h:124]
389
+ Memory Usage:
390
+ INFO: [benchmark_litert_model.h:126] Init footprint: 71.61 MB
391
+ INFO: [benchmark_litert_model.h:128] Overall footprint: 71.61 MB
392
+ INFO: [benchmark_litert_model.h:135] Peak memory usage not available. (peak_mem_mb &lt;= 0)
393
+ INFO: [benchmark_litert_model.h:138] ======================================
394
+
395
+ INFO: [accelerator_registry.cc:43] DestroyAccelerator: ptr=0xb400007ba340d230, name=CpuAccelerator
396
+ INFO: [accelerator_registry.cc:43] DestroyAccelerator: ptr=0xb400007ba340c820, name=NpuAccelerator
397
+ 0.0ms [ INFO ] QnnDsp &lt;I&gt; QnnMem_deRegister started
398
+ 0.0ms [ INFO ] QnnDsp &lt;I&gt; QnnMem_deRegister done. status 0x0
399
+ 0.0ms [ INFO ] QnnDsp &lt;I&gt; QnnMem_deRegister started
400
+ 0.0ms [ INFO ] QnnDsp &lt;I&gt; QnnMem_deRegister done. status 0x0
401
+ 0.0ms [ INFO ] QnnDsp &lt;I&gt; QnnMem_deRegister started
402
+ 0.0ms [ INFO ] QnnDsp &lt;I&gt; QnnMem_deRegister done. status 0x0
403
+ 0.0ms [ INFO ] QnnDsp &lt;I&gt; QnnMem_deRegister started
404
+ 0.0ms [ INFO ] QnnDsp &lt;I&gt; QnnMem_deRegister done. status 0x0
405
+ 0.0ms [ INFO ] QnnDsp &lt;I&gt; QnnMem_deRegister started
406
+ 0.0ms [ INFO ] QnnDsp &lt;I&gt; QnnMem_deRegister done. status 0x0
407
+ 0.0ms [ INFO ] QnnDsp &lt;I&gt; QnnMem_deRegister started
408
+ 0.0ms [ INFO ] QnnDsp &lt;I&gt; QnnMem_deRegister done. status 0x0
409
+ 0.0ms [ INFO ] QnnDsp &lt;I&gt; QnnMem_deRegister started
410
+ 0.0ms [ INFO ] QnnDsp &lt;I&gt; QnnMem_deRegister done. status 0x0
411
+ 0.0ms [ INFO ] QnnDsp &lt;I&gt; QnnMem_deRegister started
412
+ 0.0ms [ INFO ] QnnDsp &lt;I&gt; QnnMem_deRegister done. status 0x0
413
+ 0.0ms [ INFO ] QnnDsp &lt;I&gt; QnnMem_deRegister started
414
+ 0.0ms [ INFO ] QnnDsp &lt;I&gt; QnnMem_deRegister done. status 0x0
415
+ 1662624000.0ms [ INFO ] Free context with QnnGraphTransformerAdapter1662638000.0ms [ INFO ] QnnGraphTransformer context freed successfully 0.0ms [ INFO ] QnnDsp &lt;I&gt; QnnContext_free started. context = 0x1
416
+ 0.0ms [WARNING] QnnDsp &lt;W&gt; m_CFBCallbackInfoObj is not initialized, return emptyList
417
+ 0.0ms [ INFO ] QnnDsp &lt;I&gt; Number of existing contexts: 0, graphs: 0
418
+ 0.0ms [ INFO ] QnnDsp &lt;I&gt; QnnContext_free done successfully.
419
+ 0.0ms [ INFO ] QnnDsp &lt;I&gt; Exiting thread
420
+
421
+ $ /data/local/tmp/nnopt-verify/npu-bench/benchmark_model --graph=/data/local/tmp/nnopt/port/models/head.tflite --use_npu=true --use_gpu=false --qualcomm_htp_performance_mode=burst --dispatch_library_path=/data/local/tmp/nnopt-verify/npu-bench --num_runs=20 --warmup_runs=3
422
+ exit 0
423
+ 0.0ms [ INFO ] QnnDsp &lt;I&gt; QnnGraph_execute done. status 0x0
424
+ 0.0ms [ INFO ] QnnDsp &lt;I&gt; QnnGraph_execute started. graph = 0x1
425
+ 0.0ms [ INFO ] QnnDsp &lt;I&gt; QnnGraph_execute done. status 0x0
426
+ 0.0ms [ INFO ] QnnDsp &lt;I&gt; QnnGraph_execute started. graph = 0x1
427
+ 0.0ms [ INFO ] QnnDsp &lt;I&gt; QnnGraph_execute done. status 0x0
428
+ 0.0ms [ INFO ] QnnDsp &lt;I&gt; QnnGraph_execute started. graph = 0x1
429
+ 0.0ms [ INFO ] QnnDsp &lt;I&gt; QnnGraph_execute done. status 0x0
430
+ 0.0ms [ INFO ] QnnDsp &lt;I&gt; QnnGraph_execute started. graph = 0x1
431
+ 0.0ms [ INFO ] QnnDsp &lt;I&gt; QnnGraph_execute done. status 0x0
432
+ 0.0ms [ INFO ] QnnDsp &lt;I&gt; QnnGraph_execute started. graph = 0x1
433
+ 0.0ms [ INFO ] QnnDsp &lt;I&gt; QnnGraph_execute done. status 0x0
434
+ 0.0ms [ INFO ] QnnDsp &lt;I&gt; QnnGraph_execute started. graph = 0x1
435
+ 0.0ms [ INFO ] QnnDsp &lt;I&gt; QnnGraph_execute done. status 0x0
436
+ INFO: count=2005 first=527 curr=503 min=465 max=765 avg=498.612 std=18 p5=476 median=496 p95=520
437
+
438
+ INFO: [benchmark_litert_model.h:89]
439
+ ========== BENCHMARK RESULTS ==========
440
+ INFO: [benchmark_litert_model.h:92] Signature name: serving_default
441
+ INFO: [benchmark_litert_model.h:94] Model initialization: 130.29 ms
442
+ INFO: [benchmark_litert_model.h:96] Warmup (first): 1.87 ms
443
+ INFO: [benchmark_litert_model.h:98] Warmup (avg): 0.50 ms (996 runs)
444
+ INFO: [benchmark_litert_model.h:100] Inference (avg): 0.50 ms (2005 runs)
445
+ INFO: [benchmark_litert_model.h:104] Inference (min): 0.47 ms
446
+ INFO: [benchmark_litert_model.h:106] Inference (max): 0.77 ms
447
+ INFO: [benchmark_litert_model.h:108] Inference (std): 0.02
448
+ INFO: [benchmark_litert_model.h:115] Throughput: 6.85 MB/s
449
+ INFO: [benchmark_litert_model.h:124]
450
+ Memory Usage:
451
+ INFO: [benchmark_litert_model.h:126] Init footprint: 17.14 MB
452
+ INFO: [benchmark_litert_model.h:128] Overall footprint: 17.14 MB
453
+ INFO: [benchmark_litert_model.h:135] Peak memory usage not available. (peak_mem_mb &lt;= 0)
454
+ INFO: [benchmark_litert_model.h:138] ======================================
455
+
456
+ INFO: [accelerator_registry.cc:43] DestroyAccelerator: ptr=0xb40000739d00c900, name=CpuAccelerator
457
+ INFO: [accelerator_registry.cc:43] DestroyAccelerator: ptr=0xb40000739d00cba0, name=NpuAccelerator
458
+ 0.0ms [ INFO ] QnnDsp &lt;I&gt; QnnMem_deRegister started
459
+ 0.0ms [ INFO ] QnnDsp &lt;I&gt; QnnMem_deRegister done. status 0x0
460
+ 0.0ms [ INFO ] QnnDsp &lt;I&gt; QnnMem_deRegister started
461
+ 0.0ms [ INFO ] QnnDsp &lt;I&gt; QnnMem_deRegister done. status 0x0
462
+ 1626901000.0ms [ INFO ] Free context with QnnGraphTransformerAdapter1626911000.0ms [ INFO ] QnnGraphTransformer context freed successfully 0.0ms [ INFO ] QnnDsp &lt;I&gt; QnnContext_free started. context = 0x1
463
+ 0.0ms [WARNING] QnnDsp &lt;W&gt; m_CFBCallbackInfoObj is not initialized, return emptyList
464
+ 0.0ms [ INFO ] QnnDsp &lt;I&gt; Number of existing contexts: 0, graphs: 0
465
+ 0.0ms [ INFO ] QnnDsp &lt;I&gt; QnnContext_free done successfully.
466
+ 0.0ms [ INFO ] QnnDsp &lt;I&gt; Exiting thread
467
+
468
+ $ /data/local/tmp/nnopt-verify/npu-bench/benchmark_model --graph=/data/local/tmp/nnopt/port/models/slow.tflite --use_npu=true --use_gpu=false --qualcomm_htp_performance_mode=burst --dispatch_library_path=/data/local/tmp/nnopt-verify/npu-bench --num_runs=20 --warmup_runs=3
469
+ exit 0
470
+ 89]
471
+ ========== BENCHMARK RESULTS ==========
472
+ INFO: [benchmark_litert_model.h:92] Signature name: serving_default
473
+ INFO: [benchmark_litert_model.h:94] Model initialization: 352.80 ms
474
+ INFO: [benchmark_litert_model.h:96] Warmup (first): 26.18 ms
475
+ INFO: [benchmark_litert_model.h:98] Warmup (avg): 22.84 ms (22 runs)
476
+ INFO: [benchmark_litert_model.h:100] Inference (avg): 22.75 ms (44 runs)
477
+ INFO: [benchmark_litert_model.h:104] Inference (min): 22.59 ms
478
+ INFO: [benchmark_litert_model.h:106] Inference (max): 23.67 ms
479
+ INFO: [benchmark_litert_model.h:108] Inference (std): 0.18
480
+ INFO: [benchmark_litert_model.h:115] Throughput: 2117.76 MB/s
481
+ INFO: [benchmark_litert_model.h:124]
482
+ Memory Usage:
483
+ INFO: [benchmark_litert_model.h:126] Init footprint: 706.33 MB
484
+ INFO: [benchmark_litert_model.h:128] Overall footprint: 730.50 MB
485
+ INFO: [benchmark_litert_model.h:135] Peak memory usage not available. (peak_mem_mb &lt;= 0)
486
+ INFO: [benchmark_litert_model.h:138] ======================================
487
+
488
+ INFO: [accelerator_registry.cc:43] DestroyAccelerator: ptr=0xb4000075ba40a700, name=CpuAccelerator
489
+ INFO: [accelerator_registry.cc:43] DestroyAccelerator: ptr=0xb4000075ba40ac40, name=NpuAccelerator
490
+ 0.0ms [ INFO ] QnnDsp &lt;I&gt; QnnMem_deRegister started
491
+ 0.0ms [ INFO ] QnnDsp &lt;I&gt; QnnMem_deRegister done. status 0x0
492
+ 0.0ms [ INFO ] QnnDsp &lt;I&gt; QnnMem_deRegister started
493
+ 0.0ms [ INFO ] QnnDsp &lt;I&gt; QnnMem_deRegister done. status 0x0
494
+ 0.0ms [ INFO ] QnnDsp &lt;I&gt; QnnMem_deRegister started
495
+ 0.0ms [ INFO ] QnnDsp &lt;I&gt; QnnMem_deRegister done. status 0x0
496
+ 0.0ms [ INFO ] QnnDsp &lt;I&gt; QnnMem_deRegister started
497
+ 0.0ms [ INFO ] QnnDsp &lt;I&gt; QnnMem_deRegister done. status 0x0
498
+ 0.0ms [ INFO ] QnnDsp &lt;I&gt; QnnMem_deRegister started
499
+ 0.0ms [ INFO ] QnnDsp &lt;I&gt; QnnMem_deRegister done. status 0x0
500
+ 0.0ms [ INFO ] QnnDsp &lt;I&gt; QnnMem_deRegister started
501
+ 0.0ms [ INFO ] QnnDsp &lt;I&gt; QnnMem_deRegister done. status 0x0
502
+ 0.0ms [ INFO ] QnnDsp &lt;I&gt; QnnMem_deRegister started
503
+ 0.0ms [ INFO ] QnnDsp &lt;I&gt; QnnMem_deRegister done. status 0x0
504
+ 0.0ms [ INFO ] QnnDsp &lt;I&gt; QnnMem_deRegister started
505
+ 0.0ms [ INFO ] QnnDsp &lt;I&gt; QnnMem_deRegister done. status 0x0
506
+ 0.0ms [ INFO ] QnnDsp &lt;I&gt; QnnMem_deRegister started
507
+ 0.0ms [ INFO ] QnnDsp &lt;I&gt; QnnMem_deRegister done. status 0x0
508
+ 0.0ms [ INFO ] QnnDsp &lt;I&gt; QnnMem_deRegister started
509
+ 0.0ms [ INFO ] QnnDsp &lt;I&gt; QnnMem_deRegister done. status 0x0
510
+ 2041952000.0ms [ INFO ] Free context with QnnGraphTransformerAdapter2042007000.0ms [ INFO ] QnnGraphTransformer context freed successfully 0.0ms [ INFO ] QnnDsp &lt;I&gt; QnnContext_free started. context = 0x1
511
+ 0.0ms [WARNING] QnnDsp &lt;W&gt; m_CFBCallbackInfoObj is not initialized, return emptyList
512
+ 0.0ms [ INFO ] QnnDsp &lt;I&gt; Number of existing contexts: 0, graphs: 0
513
+ 0.0ms [ INFO ] QnnDsp &lt;I&gt; QnnContext_free done successfully.
514
+ 0.0ms [ INFO ] QnnDsp &lt;I&gt; Exiting thread
515
+
516
+ $ /data/local/tmp/nnopt-verify/npu-bench/benchmark_model --graph=/data/local/tmp/nnopt/port/models/slow1.tflite --use_npu=true --use_gpu=false --qualcomm_htp_performance_mode=burst --dispatch_library_path=/data/local/tmp/nnopt-verify/npu-bench --num_runs=20 --warmup_runs=3
517
+ exit 0
518
+ .h:89]
519
+ ========== BENCHMARK RESULTS ==========
520
+ INFO: [benchmark_litert_model.h:92] Signature name: serving_default
521
+ INFO: [benchmark_litert_model.h:94] Model initialization: 244.93 ms
522
+ INFO: [benchmark_litert_model.h:96] Warmup (first): 11.87 ms
523
+ INFO: [benchmark_litert_model.h:98] Warmup (avg): 7.82 ms (64 runs)
524
+ INFO: [benchmark_litert_model.h:100] Inference (avg): 7.75 ms (130 runs)
525
+ INFO: [benchmark_litert_model.h:104] Inference (min): 7.70 ms
526
+ INFO: [benchmark_litert_model.h:106] Inference (max): 7.92 ms
527
+ INFO: [benchmark_litert_model.h:108] Inference (std): 0.03
528
+ INFO: [benchmark_litert_model.h:115] Throughput: 3097.02 MB/s
529
+ INFO: [benchmark_litert_model.h:124]
530
+ Memory Usage:
531
+ INFO: [benchmark_litert_model.h:126] Init footprint: 362.12 MB
532
+ INFO: [benchmark_litert_model.h:128] Overall footprint: 374.20 MB
533
+ INFO: [benchmark_litert_model.h:135] Peak memory usage not available. (peak_mem_mb &lt;= 0)
534
+ INFO: [benchmark_litert_model.h:138] ======================================
535
+
536
+ INFO: [accelerator_registry.cc:43] DestroyAccelerator: ptr=0xb400007988c12070, name=CpuAccelerator
537
+ INFO: [accelerator_registry.cc:43] DestroyAccelerator: ptr=0xb400007988c12bd0, name=NpuAccelerator
538
+ 0.0ms [ INFO ] QnnDsp &lt;I&gt; QnnMem_deRegister started
539
+ 0.0ms [ INFO ] QnnDsp &lt;I&gt; QnnMem_deRegister done. status 0x0
540
+ 0.0ms [ INFO ] QnnDsp &lt;I&gt; QnnMem_deRegister started
541
+ 0.0ms [ INFO ] QnnDsp &lt;I&gt; QnnMem_deRegister done. status 0x0
542
+ 0.0ms [ INFO ] QnnDsp &lt;I&gt; QnnMem_deRegister started
543
+ 0.0ms [ INFO ] QnnDsp &lt;I&gt; QnnMem_deRegister done. status 0x0
544
+ 0.0ms [ INFO ] QnnDsp &lt;I&gt; QnnMem_deRegister started
545
+ 0.0ms [ INFO ] QnnDsp &lt;I&gt; QnnMem_deRegister done. status 0x0
546
+ 0.0ms [ INFO ] QnnDsp &lt;I&gt; QnnMem_deRegister started
547
+ 0.0ms [ INFO ] QnnDsp &lt;I&gt; QnnMem_deRegister done. status 0x0
548
+ 0.0ms [ INFO ] QnnDsp &lt;I&gt; QnnMem_deRegister started
549
+ 0.0ms [ INFO ] QnnDsp &lt;I&gt; QnnMem_deRegister done. status 0x0
550
+ 0.0ms [ INFO ] QnnDsp &lt;I&gt; QnnMem_deRegister started
551
+ 0.0ms [ INFO ] QnnDsp &lt;I&gt; QnnMem_deRegister done. status 0x0
552
+ 0.0ms [ INFO ] QnnDsp &lt;I&gt; QnnMem_deRegister started
553
+ 0.0ms [ INFO ] QnnDsp &lt;I&gt; QnnMem_deRegister done. status 0x0
554
+ 0.0ms [ INFO ] QnnDsp &lt;I&gt; QnnMem_deRegister started
555
+ 0.0ms [ INFO ] QnnDsp &lt;I&gt; QnnMem_deRegister done. status 0x0
556
+ 0.0ms [ INFO ] QnnDsp &lt;I&gt; QnnMem_deRegister started
557
+ 0.0ms [ INFO ] QnnDsp &lt;I&gt; QnnMem_deRegister done. status 0x0
558
+ 1821180000.0ms [ INFO ] Free context with QnnGraphTransformerAdapter1821190000.0ms [ INFO ] QnnGraphTransformer context freed successfully 0.0ms [ INFO ] QnnDsp &lt;I&gt; QnnContext_free started. context = 0x1
559
+ 0.0ms [WARNING] QnnDsp &lt;W&gt; m_CFBCallbackInfoObj is not initialized, return emptyList
560
+ 0.0ms [ INFO ] QnnDsp &lt;I&gt; Number of existing contexts: 0, graphs: 0
561
+ 0.0ms [ INFO ] QnnDsp &lt;I&gt; QnnContext_free done successfully.
562
+ 0.0ms [ INFO ] QnnDsp &lt;I&gt; Exiting thread
563
+
564
+ $ /data/local/tmp/nnopt-verify/npu-bench/benchmark_model --graph=/data/local/tmp/nnopt/port/models/slow1s.tflite --use_npu=true --use_gpu=false --qualcomm_htp_performance_mode=burst --dispatch_library_path=/data/local/tmp/nnopt-verify/npu-bench --num_runs=20 --warmup_runs=3
565
+ exit 0
566
+ l.h:89]
567
+ ========== BENCHMARK RESULTS ==========
568
+ INFO: [benchmark_litert_model.h:92] Signature name: serving_default
569
+ INFO: [benchmark_litert_model.h:94] Model initialization: 238.10 ms
570
+ INFO: [benchmark_litert_model.h:96] Warmup (first): 10.53 ms
571
+ INFO: [benchmark_litert_model.h:98] Warmup (avg): 6.14 ms (82 runs)
572
+ INFO: [benchmark_litert_model.h:100] Inference (avg): 6.08 ms (165 runs)
573
+ INFO: [benchmark_litert_model.h:104] Inference (min): 6.04 ms
574
+ INFO: [benchmark_litert_model.h:106] Inference (max): 6.26 ms
575
+ INFO: [benchmark_litert_model.h:108] Inference (std): 0.03
576
+ INFO: [benchmark_litert_model.h:115] Throughput: 987.30 MB/s
577
+ INFO: [benchmark_litert_model.h:124]
578
+ Memory Usage:
579
+ INFO: [benchmark_litert_model.h:126] Init footprint: 361.72 MB
580
+ INFO: [benchmark_litert_model.h:128] Overall footprint: 364.80 MB
581
+ INFO: [benchmark_litert_model.h:135] Peak memory usage not available. (peak_mem_mb &lt;= 0)
582
+ INFO: [benchmark_litert_model.h:138] ======================================
583
+
584
+ INFO: [accelerator_registry.cc:43] DestroyAccelerator: ptr=0xb40000799380c380, name=CpuAccelerator
585
+ INFO: [accelerator_registry.cc:43] DestroyAccelerator: ptr=0xb40000799380c4d0, name=NpuAccelerator
586
+ 0.0ms [ INFO ] QnnDsp &lt;I&gt; QnnMem_deRegister started
587
+ 0.0ms [ INFO ] QnnDsp &lt;I&gt; QnnMem_deRegister done. status 0x0
588
+ 0.0ms [ INFO ] QnnDsp &lt;I&gt; QnnMem_deRegister started
589
+ 0.0ms [ INFO ] QnnDsp &lt;I&gt; QnnMem_deRegister done. status 0x0
590
+ 0.0ms [ INFO ] QnnDsp &lt;I&gt; QnnMem_deRegister started
591
+ 0.0ms [ INFO ] QnnDsp &lt;I&gt; QnnMem_deRegister done. status 0x0
592
+ 0.0ms [ INFO ] QnnDsp &lt;I&gt; QnnMem_deRegister started
593
+ 0.0ms [ INFO ] QnnDsp &lt;I&gt; QnnMem_deRegister done. status 0x0
594
+ 0.0ms [ INFO ] QnnDsp &lt;I&gt; QnnMem_deRegister started
595
+ 0.0ms [ INFO ] QnnDsp &lt;I&gt; QnnMem_deRegister done. status 0x0
596
+ 0.0ms [ INFO ] QnnDsp &lt;I&gt; QnnMem_deRegister started
597
+ 0.0ms [ INFO ] QnnDsp &lt;I&gt; QnnMem_deRegister done. status 0x0
598
+ 0.0ms [ INFO ] QnnDsp &lt;I&gt; QnnMem_deRegister started
599
+ 0.0ms [ INFO ] QnnDsp &lt;I&gt; QnnMem_deRegister done. status 0x0
600
+ 0.0ms [ INFO ] QnnDsp &lt;I&gt; QnnMem_deRegister started
601
+ 0.0ms [ INFO ] QnnDsp &lt;I&gt; QnnMem_deRegister done. status 0x0
602
+ 0.0ms [ INFO ] QnnDsp &lt;I&gt; QnnMem_deRegister started
603
+ 0.0ms [ INFO ] QnnDsp &lt;I&gt; QnnMem_deRegister done. status 0x0
604
+ 0.0ms [ INFO ] QnnDsp &lt;I&gt; QnnMem_deRegister started
605
+ 0.0ms [ INFO ] QnnDsp &lt;I&gt; QnnMem_deRegister done. status 0x0
606
+ 1760239000.0ms [ INFO ] Free context with QnnGraphTransformerAdapter1760250000.0ms [ INFO ] QnnGraphTransformer context freed successfully 0.0ms [ INFO ] QnnDsp &lt;I&gt; QnnContext_free started. context = 0x1
607
+ 0.0ms [WARNING] QnnDsp &lt;W&gt; m_CFBCallbackInfoObj is not initialized, return emptyList
608
+ 0.0ms [ INFO ] QnnDsp &lt;I&gt; Number of existing contexts: 0, graphs: 0
609
+ 0.0ms [ INFO ] QnnDsp &lt;I&gt; QnnContext_free done successfully.
610
+ 0.0ms [ INFO ] QnnDsp &lt;I&gt; Exiting thread</pre></details></section><section><h2>Speed and memory</h2>
611
+ <p>2 warm-up runs, then 5 timed runs of 3 requests each (the first
612
+ request of each run is cold). Timed on the device's own clock.</p>
613
+ <div class="panel"><table><thead><tr><th>Metric (warm requests)</th><th>Median</th><th>p10</th><th>p90</th><th>n</th></tr></thead><tbody><tr><td>Time to first audio</td><td class=num>2418 ms</td><td class=num>2378 ms</td><td class=num>2435 ms</td><td class=num>10</td></tr><tr><td>Real-time factor</td><td class=num>0.449 x</td><td class=num>0.442 x</td><td class=num>0.452 x</td><td class=num>10</td></tr><tr><td>Request time</td><td class=num>2418 ms</td><td class=num>2378 ms</td><td class=num>2435 ms</td><td class=num>10</td></tr><tr><td>Time to first audio (cold)</td><td class=num>2414 ms</td><td class=num>2400 ms</td><td class=num>2426 ms</td><td class=num>5</td></tr><tr><td>Load time</td><td class=num>2227 ms</td><td class=num>2177 ms</td><td class=num>2259 ms</td><td class=num>5</td></tr><tr><td>Process wall time</td><td class=num>9673 ms</td><td class=num>9573 ms</td><td class=num>9785 ms</td><td class=num>5</td></tr><tr><td>Peak RSS (process tree)</td><td class=num>2519 MB</td><td></td><td></td><td></td></tr><tr><td>Peak VmHWM (process tree)</td><td class=num>2519 MB</td><td></td><td></td><td></td></tr></tbody></table></div><p class="sub">External cross-check (paired --repeat 3 vs 1, 5 pairs, device clock): Request time: 2344 ms; Real-time factor: 0.435 x. Graded values are capped by it.</p><p class="sub">Roofline: not computed (no a speed this model type&#x27;s roofline covers).</p></section><section><h2>Environment and reproducibility</h2><dl class="kv"><dt>os</dt><dd>android</dd><dt>gpu</dt><dd>Adreno 840</dd><dt>soc</dt><dd>Snapdragon 8 Elite Gen 5</dd><dt>brand</dt><dd>Samsung</dd><dt>device</dt><dd>Samsung Galaxy S26+</dd><dt>ram_gb</dt><dd>12</dd><dt>android</dt><dd>16</dd><dt>gpu_apis</dt><dd>[&#x27;OpenCL&#x27;, &#x27;Vulkan&#x27;]</dd><dt>released</dt><dd>2026-02</dd><dt>roofline</dt><dd>{&#x27;npu&#x27;: {&#x27;job&#x27;: &#x27;NN-174CC0&#x27;, &#x27;source&#x27;: &#x27;measured by lab/npu probe (NN-174CC0) on 2026-10-31: fp16 weight stream 69.93 GB/s (bw_l24), fp16 matmul 18.325 TFLOPS, int8 matmul 29.023 TOPS; LiteRT 2.3.1 + Qualcomm dispatch, QAIRT 2.50, burst&#x27;, &#x27;measured&#x27;: True, &#x27;measured_at&#x27;: &#x27;2026-10-31&#x27;, &#x27;measured_by&#x27;: &#x27;probe&#x27;, &#x27;peak_int8_tops&#x27;: 29.023, &#x27;peak_fp16_tflops&#x27;: 18.325, &#x27;mem_bandwidth_gbps&#x27;: 69.93, &#x27;mem_bandwidth_int8_gbps&#x27;: 70.46}, &#x27;spec&#x27;: {&#x27;source&#x27;: &#x27;spec-sheet estimate, not yet measured: LPDDR5X-10667 64-bit; Adreno 840 compute is a rough estimate&#x27;, &#x27;peak_int8_tops&#x27;: 6.0, &#x27;peak_fp16_tflops&#x27;: 6.0, &#x27;mem_bandwidth_gbps&#x27;: 85.3}, &#x27;source&#x27;: &#x27;measured on the device by NN-A61C46 on 2026-11-03: GPU read 72.6 GB/s (OpenCL read_v4)&#x27;, &#x27;measured&#x27;: True, &#x27;device_best&#x27;: {&#x27;cpu_job&#x27;: &#x27;NN-DA0137&#x27;, &#x27;gpu_job&#x27;: &#x27;NN-DA0137&#x27;, &#x27;cpu_read_gbps&#x27;: 74.03, &#x27;gpu_read_gbps&#x27;: 73.18, &#x27;cpu_measured_at&#x27;: &#x27;2026-10-23T04:46:29+00:00&#x27;, &#x27;gpu_measured_at&#x27;: &#x27;2026-10-23T04:46:29+00:00&#x27;}, &#x27;measured_at&#x27;: &#x27;2026-11-03&#x27;, &#x27;measured_by&#x27;: &#x27;device&#x27;, &#x27;device_probe&#x27;: {&#x27;job&#x27;: &#x27;NN-A61C46&#x27;, &#x27;measured_at&#x27;: &#x27;2026-11-03T03:40:37+00:00&#x27;, &#x27;cpu_read_gbps&#x27;: 60.38, &#x27;gpu_read_gbps&#x27;: 72.6}, &#x27;peak_int8_tops&#x27;: 6.0, &#x27;peak_fp16_tflops&#x27;: 6.0, &#x27;mem_bandwidth_gbps&#x27;: 72.6}</dd><dt>model_id</dt><dd>m2q</dd><dt>version_id</dt><dd>36</dd><dt>name</dt><dd>Samsung Galaxy S26+</dd><dt>processor</dt><dd>npu</dd><dt>executor</dt><dd>adb</dd><dt>reference python</dt><dd>3.12.3</dd><dt>reference numpy</dt><dd>2.5.4</dd><dt>reference nnopt_verify</dt><dd>0.1.0</dd><dt>reference platform</dt><dd>Linux-7.0.0-1014-gcp-x86_64-with-glibc2.39</dd></dl><p class="sub">REPRO.md, next to this report, lists the tools, the model and every step to get these numbers on your own device; reproduce.sh runs the measurement. results.csv and results.json hold every number in this report.</p></section><footer>Generated by nnopt-verify 0.1.0. Correctness is graded on all inputs; speed figures are medians of warm requests unless marked cold.</footer></main></body></html>
sm8850-npu-a16w8/report/reproduce.sh ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/sh
2
+ # Reproduce nnopt's numbers on your own device (REPRO.md). Build and deploy first (REPRO.md, steps 4 to 6).
3
+ # Needs python3, and adb (Android; ANDROID_SERIAL with several phones) or ssh (SSH_TARGET=user@host).
4
+ here=$(cd "$(dirname "$0")" && pwd)
5
+ root=$here; [ -d "$root/repro" ] || root=$(dirname "$here")
6
+ cd "$root" || exit 2
7
+ if [ ! -f repro/bench.py ]; then echo "no repro/ folder next to REPRO.md"; exit 2; fi
8
+ rc=0
9
+ python3 repro/bench.py "$@" || rc=$?
10
+ python3 repro/bench.py --check "$@" || rc=$?
11
+ exit $rc
sm8850-npu-a16w8/report/results.csv ADDED
@@ -0,0 +1,73 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ section,name,value,unit_or_op,threshold,passed
2
+ grade,correctness,True,,,True
3
+ grade,speed_target_met,,,,
4
+ check,cases_completed,1.0,>=,1.0,True
5
+ check,asr_wer_delta,0.0038911,<=,0.05,True
6
+ check,spectral_distance_db,7.221405514201406,<=,1.5,
7
+ check,duration_ratio_error,0.17567567567567588,<=,0.05,
8
+ check,mode:tts:runs,1.0,>=,1.0,True
9
+ check,mode:tts:audio_sane,1.0,>=,1.0,True
10
+ check,mode:tts:speech_intelligibility,0.0,<=,0.05,True
11
+ check,mode:tts:spectral_distance_db,,<=,1.5,
12
+ check,mode:stream:graded,,>=,,
13
+ check,mode:clone:graded,,>=,,
14
+ check_metric,asr_wer_port,0.04669,,,
15
+ check_metric,asr_wer_reference,0.0428,,,
16
+ check_metric,asr_wer_delta,0.003891,,,
17
+ check_metric,spectral_distance_db,7.221,,,
18
+ check_metric,worst_duration_ratio,1.176,,,
19
+ check_metric,deterministic,seeded,,,
20
+ check_metric,asr_model,openai/whisper-tiny,,,
21
+ bench,time_to_first_audio_ms.median,2417.6,ms,,
22
+ bench,time_to_first_audio_ms.p10,2378.38,ms,,
23
+ bench,time_to_first_audio_ms.p90,2435.0,ms,,
24
+ bench,time_to_first_audio_ms.min,2361.1,ms,,
25
+ bench,time_to_first_audio_ms.max,2442.2,ms,,
26
+ bench,time_to_first_audio_ms.n,10,ms,,
27
+ bench,real_time_factor.median,0.448782,x,,
28
+ bench,real_time_factor.p10,0.441501,x,,
29
+ bench,real_time_factor.p90,0.452012,x,,
30
+ bench,real_time_factor.min,0.438293,x,,
31
+ bench,real_time_factor.max,0.453348,x,,
32
+ bench,real_time_factor.n,10,x,,
33
+ bench,latency_ms.median,2417.6,ms,,
34
+ bench,latency_ms.p10,2378.38,ms,,
35
+ bench,latency_ms.p90,2435.0,ms,,
36
+ bench,latency_ms.min,2361.1,ms,,
37
+ bench,latency_ms.max,2442.2,ms,,
38
+ bench,latency_ms.n,10,ms,,
39
+ bench,cold_time_to_first_audio_ms.median,2414.0,ms,,
40
+ bench,cold_time_to_first_audio_ms.p10,2399.56,ms,,
41
+ bench,cold_time_to_first_audio_ms.p90,2425.54,ms,,
42
+ bench,cold_time_to_first_audio_ms.min,2396.0,ms,,
43
+ bench,cold_time_to_first_audio_ms.max,2431.7,ms,,
44
+ bench,cold_time_to_first_audio_ms.n,5,ms,,
45
+ bench,load_ms.median,2226.6,ms,,
46
+ bench,load_ms.p10,2176.98,ms,,
47
+ bench,load_ms.p90,2259.16,ms,,
48
+ bench,load_ms.min,2176.7,ms,,
49
+ bench,load_ms.max,2260.4,ms,,
50
+ bench,load_ms.n,5,ms,,
51
+ bench,wall_ms.median,9673.26,ms,,
52
+ bench,wall_ms.p10,9573.16,ms,,
53
+ bench,wall_ms.p90,9784.89,ms,,
54
+ bench,wall_ms.min,9532.65,ms,,
55
+ bench,wall_ms.max,9802.59,ms,,
56
+ bench,wall_ms.n,5,ms,,
57
+ bench,peak_rss_mb,2519.0,MB,,
58
+ bench,peak_hwm_mb,2519.0,MB,,
59
+ graded,time_to_first_audio_ms,2417.6,ms,,
60
+ graded,real_time_factor,0.448782,x,,
61
+ graded,latency_ms,2417.6,ms,,
62
+ graded,cold_time_to_first_audio_ms,2414.0,ms,,
63
+ graded,load_ms,2226.6,ms,,
64
+ graded,wall_ms,9673.26,ms,,
65
+ graded,peak_mem_mb,2519.0,MB,,
66
+ graded,tts.latency_ms,2454.2,,,
67
+ graded,tts.load_ms,2465.7,,,
68
+ graded,tts.real_time_factor,0.455576,,,
69
+ graded,tts.time_to_first_audio_ms,2454.2,,,
70
+ roofline,mem_bandwidth_gbps,69.93,,,
71
+ roofline,peak_gflops,18325.0,,,
72
+ roofline,figures,"{'processor': 'npu', 'figures': 'npu', 'source': 'measured by lab/npu probe (NN-174CC0) on 2026-10-31: fp16 weight stream 69.93 GB/s (bw_l24), fp16 matmul 18.325 TFLOPS, int8 matmul 29.023 TOPS; LiteRT 2.3.1 + Qualcomm dispatch, QAIRT 2.50, burst'}",,,
73
+ roofline,missing,a speed this model type's roofline covers,,,
sm8850-npu-a16w8/report/results.json ADDED
The diff for this file is too large to render. See raw diff
 
sm8850-npu-a16w8/repro/Dockerfile ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ # The machine nnopt built this deliverable on from scratch (REPRO.md, Tools): a public image and these
2
+ # packages, nothing of nnopt. build.sh fetches everything else itself. Build and use it:
3
+ # docker build --platform linux/amd64 -t build-env repro
4
+ # docker run --rm --platform linux/amd64 --user "$(id -u):$(id -g)" -e HOME=/tmp -v "$PWD:/src" -w /src -v "$PWD/inputs:/inputs:ro" -e INPUTS_DIR=/inputs build-env bash build.sh
5
+ FROM ubuntu:24.04@sha256:68ee22004a9109b44973313b02ff7b1de250f1de0f5ecb628d73f579aaff33ac
6
+ ENV DEBIAN_FRONTEND=noninteractive LANG=C.UTF-8 LC_ALL=C.UTF-8
7
+ RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates git curl python3 python3-venv build-essential unzip xz-utils \
8
+ && rm -rf /var/lib/apt/lists/*
sm8850-npu-a16w8/repro/bench.py ADDED
@@ -0,0 +1,729 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ """Reproduce nnopt's numbers on your own device: the speed with nnopt's exact settings and, with --check, the outputs
3
+ on the public cases. See ../REPRO.md.
4
+
5
+ Needs python3 (3.8 or newer, no packages), sh, and adb (Android phones) or ssh and scp (a Jetson or Mac over the
6
+ network). plan.json next to this file holds the settings nnopt measured with and nnopt's numbers to compare against.
7
+
8
+ python3 repro/bench.py # speed, nnopt's settings, compared with nnopt's numbers
9
+ python3 repro/bench.py --check # outputs on the public cases, compared with the expected outputs
10
+ python3 repro/bench.py --deploy # run deploy.sh into --dir first
11
+ python3 repro/bench.py --sustained 600 # then run back to back for 10 minutes (throttling)
12
+ python3 repro/bench.py --plan repro/galaxy-s24/plan.json # measured on several phones: your phone's numbers
13
+
14
+ Connection: --serial SERIAL (adb; or $ANDROID_SERIAL), --ssh USER@HOST (or $SSH_TARGET), --local (this machine).
15
+ --dir is where deploy.sh installed the program on the device (default: plan.json's device_dir).
16
+ Exit code: 0 everything within tolerance, 1 something outside it, 2 an error.
17
+ """
18
+
19
+ from __future__ import annotations
20
+
21
+ import argparse
22
+ import ast
23
+ import json
24
+ import math
25
+ import os
26
+ import re
27
+ import shlex
28
+ import shutil
29
+ import statistics
30
+ import struct
31
+ import subprocess
32
+ import sys
33
+ import tempfile
34
+ import time
35
+ from array import array
36
+ from pathlib import Path
37
+
38
+ HERE = Path(__file__).resolve().parent
39
+ ROOT = HERE.parent # the deliverable: build.sh, deploy.sh, REPRO.md
40
+ TOKEN_TYPES = ("text_to_text", "vision_language")
41
+ OUT_EXT = {"text_to_text": ".json", "speech_to_text": ".json", "text_to_speech": ".wav", "vision_detection": ".json",
42
+ "vision_language": ".json", "kernel": "", "audio_generation": ".wav"}
43
+
44
+
45
+ class Fail(Exception):
46
+ pass
47
+
48
+
49
+ # ---------------------------------------------------------------- the device
50
+
51
+ class Device:
52
+ def __init__(self, kind: str, serial: str | None = None, target: str | None = None):
53
+ self.kind, self.serial, self.target = kind, serial, target
54
+ tool = {"adb": "adb", "ssh": "ssh", "local": "sh"}[kind]
55
+ if shutil.which(tool) is None:
56
+ raise Fail(f"{tool} is not installed or not on PATH (REPRO.md, Tools)")
57
+ if kind == "ssh" and not target:
58
+ raise Fail("--ssh USER@HOST (or SSH_TARGET) is needed for this device")
59
+
60
+ def describe(self) -> str:
61
+ return {"adb": f"adb{' -s ' + self.serial if self.serial else ''}", "ssh": f"ssh {self.target}",
62
+ "local": "this machine"}[self.kind]
63
+
64
+ def _adb(self) -> list[str]:
65
+ return ["adb"] + (["-s", self.serial] if self.serial else [])
66
+
67
+ def sh(self, script: str, timeout: float = 600) -> tuple[int, str]:
68
+ argv = {"adb": self._adb() + ["shell", script], "ssh": ["ssh", "-o", "BatchMode=yes", self.target or "", script],
69
+ "local": ["sh", "-c", script]}[self.kind]
70
+ try:
71
+ p = subprocess.run(argv, capture_output=True, text=True, timeout=timeout)
72
+ except subprocess.TimeoutExpired:
73
+ return 124, f"timed out after {timeout:.0f} s"
74
+ return p.returncode, p.stdout + p.stderr
75
+
76
+ def push(self, local: Path, remote: str) -> None:
77
+ argv = {"adb": self._adb() + ["push", str(local), remote],
78
+ "ssh": ["scp", "-q", "-r", str(local), f"{self.target}:{remote}"],
79
+ "local": ["cp", "-R", str(local), remote]}[self.kind]
80
+ p = subprocess.run(argv, capture_output=True, text=True)
81
+ if p.returncode != 0:
82
+ raise Fail(f"could not copy {local.name} to the device: {(p.stdout + p.stderr).strip()[-300:]}")
83
+
84
+ def pull(self, remote: str, local: Path) -> bool:
85
+ argv = {"adb": self._adb() + ["pull", remote, str(local)],
86
+ "ssh": ["scp", "-q", "-r", f"{self.target}:{remote}", str(local)],
87
+ "local": ["cp", "-R", remote, str(local)]}[self.kind]
88
+ return subprocess.run(argv, capture_output=True, text=True).returncode == 0
89
+
90
+
91
+ # Runs one command on the device: times it with the device's own clock and samples the memory (RSS) of its process
92
+ # tree, as nnopt does. Prints "REPRO START_NS END_NS EXIT PEAK_RSS_KB".
93
+ WRAP = r"""
94
+ d={io}; t={tag}
95
+ now() {{ v=$(date +%s%N 2>/dev/null); case "$v" in ''|*N*) perl -MTime::HiRes=time -e 'printf("%.0f\n", time()*1e9)' 2>/dev/null || echo "$(date +%s)000000000";; *) echo "$v";; esac; }}
96
+ if [ -d /system/bin ]; then o="PID,PPID,RSS"; else o="pid,ppid,rss"; fi
97
+ rm -f "$d/$t.rc" "$d/$t.end"
98
+ s=$(now)
99
+ ( cd {dir} && {env}sh ./run.sh {args} > "$d/$t.log" 2>&1; r=$?; now > "$d/$t.end"; echo $r > "$d/$t.rc" ) &
100
+ root=$!; peak=0
101
+ while [ ! -f "$d/$t.rc" ]; do
102
+ m=$(ps -A -o $o 2>/dev/null | awk -v r=$root 'NR>1 {{ p[$1]=$2; k[$1]=$3 }} END {{ s=0; for (x in p) {{ q=x; n=0; while (q != "" && q != r && n < 64) {{ q=p[q]; n++ }} if (q == r) s+=k[x] }} print s+0 }}')
103
+ [ "${{m:-0}}" -gt "$peak" ] 2>/dev/null && peak=$m
104
+ sleep 0.2
105
+ done
106
+ echo "REPRO $s $(cat "$d/$t.end") $(cat "$d/$t.rc") $peak"
107
+ """
108
+ _MARK = re.compile(r"^REPRO (\d+) (\d+) (-?\d+) (\d+)\s*$", re.M)
109
+
110
+
111
+ def q(s: str) -> str:
112
+ return shlex.quote(s)
113
+
114
+
115
+ class Session:
116
+ """The program deployed in `folder` on the device, inputs staged in `folder`-repro-io."""
117
+
118
+ def __init__(self, dev: Device, folder: str, model_type: str, tmp: Path):
119
+ self.dev, self.dir, self.mt, self.tmp = dev, folder.rstrip("/"), model_type, tmp
120
+ self.io = self.dir + "-repro-io"
121
+ self.n = 0
122
+ rc, out = dev.sh(f"test -f {q(self.dir)}/run.sh && mkdir -p {q(self.io)} && echo ok", 60)
123
+ if "ok" not in out:
124
+ raise Fail(f"no run.sh in {self.dir} on the device: deploy first (bash deploy.sh {self.dir}, or --deploy)")
125
+
126
+ def stage(self, local: Path) -> str:
127
+ remote = f"{self.io}/{local.name}"
128
+ self.dev.push(local, remote if local.is_file() else self.io + "/")
129
+ return remote
130
+
131
+ def run(self, args: dict, *, repeat: int = 1, fetch_out: bool = False, timeout: float = 3600,
132
+ env: dict | None = None) -> dict:
133
+ self.n += 1
134
+ tag = f"r{self.n}"
135
+ out = f"{self.io}/{tag}.out{OUT_EXT[self.mt]}"
136
+ met = f"{self.io}/{tag}.metrics.json"
137
+ line = command(self.mt, args, out=out, metrics=met, repeat=repeat)
138
+ exports = "".join(f"{k}={q(str(v))} " for k, v in (env or {}).items())
139
+ rc, text = self.dev.sh(WRAP.format(io=q(self.io), tag=tag, dir=q(self.dir), args=line, env=exports), timeout)
140
+ m = _MARK.search(text)
141
+ res = {"command": "sh ./run.sh " + line, "exit": int(m.group(3)) if m else rc, "wall_ms": None,
142
+ "peak_rss_mb": None, "metrics": None, "out": None}
143
+ if m:
144
+ res["wall_ms"] = (int(m.group(2)) - int(m.group(1))) / 1e6
145
+ res["peak_rss_mb"] = int(m.group(4)) / 1024 or None
146
+ mloc = self.tmp / f"{tag}.metrics.json"
147
+ if self.dev.pull(met, mloc) and mloc.is_file():
148
+ try:
149
+ res["metrics"] = json.loads(mloc.read_text())
150
+ except ValueError:
151
+ pass
152
+ if fetch_out:
153
+ oloc = self.tmp / Path(out).name
154
+ if self.dev.pull(out, oloc) and oloc.exists():
155
+ res["out"] = oloc
156
+ if res["exit"] != 0:
157
+ _, log = self.dev.sh(f"tail -c 2000 {q(self.io)}/{tag}.log", 60)
158
+ res["log"] = log
159
+ return res
160
+
161
+ def close(self) -> None:
162
+ self.dev.sh(f"rm -rf {q(self.io)}", 120)
163
+
164
+
165
+ def command(mt: str, a: dict, *, out: str, metrics: str, repeat: int = 1) -> str:
166
+ """run.sh's arguments for one request (CONTRACT.md)."""
167
+ mode = a.get("mode", "generate")
168
+ args: list[str] = []
169
+ if mt == "audio_generation":
170
+ args = ["--text-file", q(a["input"]), "--seed", str(int(a.get("seed") or 0)),
171
+ "--seconds", f"{float(a.get('seconds') or 10):.6f}".rstrip("0").rstrip(".")]
172
+ elif mt == "vision_detection":
173
+ for im in a["images"]:
174
+ args += ["--image", q(im)]
175
+ elif mt in TOKEN_TYPES:
176
+ if mt == "vision_language":
177
+ args += ["--image", q(a["image"])]
178
+ args += ["--prompt-file", q(a["input"]), "--max-new-tokens", str(int(a["max_new_tokens"]))]
179
+ if a.get("ignore_eos"):
180
+ args.append("--ignore-eos")
181
+ elif mt == "speech_to_text":
182
+ args = ["--audio", q(a["input"])]
183
+ elif mt == "kernel":
184
+ args = ["--inputs", q(a["input"])]
185
+ else: # text_to_speech
186
+ args = ["--text-file", q(a["input"]), "--seed", str(int(a.get("seed") or 0))]
187
+ args += ["--out", q(out), "--metrics", q(metrics)]
188
+ if repeat > 1:
189
+ args += ["--repeat", str(int(repeat))]
190
+ return " ".join(args)
191
+
192
+
193
+ # ---------------------------------------------------------------- numbers
194
+
195
+ def derive(mt: str, r: dict, audio_s: float | None, batch: int = 1) -> dict:
196
+ """One request's numbers from the port's metrics, as nnopt computes them."""
197
+ t = float(r.get("total_ms") or 0)
198
+ d: dict = {"total_ms": t}
199
+ if mt == "vision_detection":
200
+ d.update(latency_ms=t, per_image_ms=t / batch, fps=batch * 1000 / t if t > 0 else None)
201
+ elif mt in TOKEN_TYPES:
202
+ ttft, n, p = float(r.get("ttft_ms") or 0), int(r.get("new_tokens") or 0), int(r.get("prompt_tokens") or 0)
203
+ dec = t - ttft
204
+ d.update(ttft_ms=ttft, tokens_per_s=(n - 1) / (dec / 1000) if dec > 0 and n > 1 else None,
205
+ prefill_tokens_per_s=p / (ttft / 1000) if ttft > 0 else None,
206
+ e2e_tokens_per_s=n / (t / 1000) if t > 0 else None)
207
+ elif mt == "speech_to_text":
208
+ d.update(latency_ms=t, real_time_factor=t / 1000 / audio_s if audio_s else None)
209
+ elif mt == "kernel":
210
+ d["latency_ms"] = t
211
+ elif mt == "audio_generation":
212
+ n, first = int(r.get("frames") or 1), float(r.get("ttfa_ms") or 0)
213
+ per = (t - first) / (n - 1) if n > 1 else t
214
+ audio_ms = 1000 * audio_s / n if audio_s else None
215
+ d.update(time_to_first_audio_ms=first, latency_ms=t, ms_per_frame=per,
216
+ real_time_factor=per / audio_ms if audio_ms else None)
217
+ else: # text_to_speech
218
+ d.update(time_to_first_audio_ms=r.get("ttfa_ms"), latency_ms=t,
219
+ real_time_factor=t / 1000 / audio_s if audio_s else None)
220
+ return d
221
+
222
+
223
+ def pct(values: list[float], p: float) -> float:
224
+ v = sorted(values)
225
+ if len(v) == 1:
226
+ return v[0]
227
+ k = (len(v) - 1) * p / 100
228
+ f = math.floor(k)
229
+ return v[f] + (v[min(f + 1, len(v) - 1)] - v[f]) * (k - f)
230
+
231
+
232
+ def stats(values) -> dict | None:
233
+ v = [float(x) for x in values if x is not None and math.isfinite(float(x))]
234
+ if not v:
235
+ return None
236
+ return {"median": statistics.median(v), "p10": pct(v, 10), "p90": pct(v, 90), "n": len(v)}
237
+
238
+
239
+ def fmt(x) -> str:
240
+ if x is None:
241
+ return "–"
242
+ a = abs(x)
243
+ return f"{x:.0f}" if a >= 1000 else f"{x:.1f}" if a >= 10 else f"{x:.3g}"
244
+
245
+
246
+ def wav_info(path: Path) -> tuple[int, int, int, int, bytes]:
247
+ """(sample rate, channels, bits, format, data) of a RIFF WAV (PCM or float)."""
248
+ b = path.read_bytes()
249
+ if b[:4] != b"RIFF" or b[8:12] != b"WAVE":
250
+ raise Fail(f"{path.name} is not a WAV file")
251
+ i, rate, ch, bits, fmt_tag, data = 12, 0, 0, 0, 0, b""
252
+ while i + 8 <= len(b):
253
+ cid, size = b[i:i + 4], struct.unpack("<I", b[i + 4:i + 8])[0]
254
+ body = b[i + 8:i + 8 + size]
255
+ if cid == b"fmt ":
256
+ fmt_tag, ch, rate = struct.unpack("<HHI", body[:8])
257
+ bits = struct.unpack("<H", body[14:16])[0]
258
+ if fmt_tag == 0xFFFE and len(body) >= 26: # WAVE_FORMAT_EXTENSIBLE: the real format is in the GUID
259
+ fmt_tag = struct.unpack("<H", body[24:26])[0]
260
+ elif cid == b"data":
261
+ data = body
262
+ i += 8 + size + (size & 1)
263
+ if not rate or not ch or not bits:
264
+ raise Fail(f"{path.name}: no WAV format chunk")
265
+ return rate, ch, bits, fmt_tag, data
266
+
267
+
268
+ def wav_seconds(path: Path) -> float:
269
+ rate, ch, bits, _, data = wav_info(path)
270
+ return len(data) / (ch * bits // 8) / rate
271
+
272
+
273
+ def wav_rms(path: Path) -> float:
274
+ rate, ch, bits, tag, data = wav_info(path)
275
+ if tag == 3 and bits == 32:
276
+ a = array("f")
277
+ elif bits == 16:
278
+ a = array("h")
279
+ else:
280
+ return float("nan")
281
+ a.frombytes(data[: len(data) // a.itemsize * a.itemsize])
282
+ if sys.byteorder == "big":
283
+ a.byteswap()
284
+ scale = 1.0 if a.typecode == "f" else 32768.0
285
+ return math.sqrt(sum((x / scale) ** 2 for x in a) / len(a)) if len(a) else 0.0
286
+
287
+
288
+ # ---------------------------------------------------------------- speed
289
+
290
+ def speed(sess: Session, plan: dict, args: argparse.Namespace) -> dict | None:
291
+ if not plan.get("settings") or not plan.get("inputs"):
292
+ print("nnopt did not measure the speed of this deliverable (see REPRO.md)")
293
+ return None
294
+ mt, st, inp = plan["model_type"], plan["settings"], plan["inputs"]
295
+ warmup = args.warmup if args.warmup is not None else int(st["warmup"])
296
+ runs = args.runs if args.runs is not None else int(st["runs"])
297
+ repeat = int(st["repeat"])
298
+ batch = int(st.get("batch") or 1)
299
+ req: dict = {"mode": plan.get("mode", "generate")}
300
+ for k in ("max_new_tokens", "ignore_eos", "seed", "seconds"):
301
+ if st.get(k) is not None:
302
+ req[k] = st[k]
303
+ staged = {k: sess.stage(HERE / v) for k, v in inp.items() if isinstance(v, str)}
304
+ if "images" in inp:
305
+ req["images"] = [sess.stage(HERE / v) for v in inp["images"]]
306
+ req.update({k: v for k, v in staged.items()})
307
+ audio_s = None
308
+ if mt == "speech_to_text":
309
+ audio_s = wav_seconds(HERE / inp["input"])
310
+ elif mt == "audio_generation":
311
+ audio_s = float(st.get("seconds") or 10)
312
+ rest = float(st.get("rest_s") or 0)
313
+ print(f"{warmup} warm-up run{'s' * (warmup != 1)}, {runs} timed run{'s' * (runs != 1)} of {repeat} "
314
+ f"request{'s' * (repeat != 1)} each{settings_text(mt, st)}")
315
+ for i in range(warmup):
316
+ r = sess.run(req, repeat=1, timeout=args.timeout)
317
+ _ok(r, f"warm-up {i + 1}")
318
+ print(f" warm-up {i + 1}/{warmup}: {r['wall_ms'] / 1000:.1f} s" if r["wall_ms"] else f" warm-up {i + 1} done")
319
+ timed, pairs, peak = [], [], []
320
+ for i in range(runs):
321
+ if rest:
322
+ time.sleep(rest)
323
+ r = sess.run(req, repeat=repeat, fetch_out=(i == 0), timeout=args.timeout)
324
+ _ok(r, f"timed run {i + 1}")
325
+ met = r["metrics"] or {}
326
+ if not isinstance(met.get("runs"), list) or len(met["runs"]) != repeat:
327
+ raise Fail(f"timed run {i + 1}: the metrics file needs {repeat} entries in \"runs\" (--repeat {repeat})")
328
+ if i == 0 and mt == "text_to_speech" and r["out"]:
329
+ audio_s = wav_seconds(r["out"])
330
+ reqs = [derive(mt, x, audio_s, batch) for x in met["runs"]]
331
+ timed.append({"wall_ms": r["wall_ms"], "load_ms": met.get("load_ms"), "requests": reqs,
332
+ "self_peak_mem_mb": met.get("peak_mem_mb")})
333
+ if r["peak_rss_mb"]:
334
+ peak.append(r["peak_rss_mb"])
335
+ line = f" timed run {i + 1}/{runs}: {r['wall_ms'] / 1000:.1f} s" if r["wall_ms"] else f" timed run {i + 1}"
336
+ if plan.get("external_check", True):
337
+ p_req, p_rep = paired(mt, req, repeat, plan)
338
+ pr = sess.run(p_req, repeat=p_rep, timeout=args.timeout)
339
+ if pr["exit"] == 0 and pr["wall_ms"] and r["wall_ms"]:
340
+ pairs.append(r["wall_ms"] - pr["wall_ms"])
341
+ print(line)
342
+ warm = [x for t in timed for x in (t["requests"][1:] if len(t["requests"]) > 1 else t["requests"])]
343
+ keys = sorted({k for x in warm for k, v in x.items() if v is not None})
344
+ summary = {k: stats(x.get(k) for x in warm) for k in keys}
345
+ summary["load_ms"] = stats(t["load_ms"] for t in timed)
346
+ graded = {k: s["median"] for k, s in summary.items() if s}
347
+ if peak:
348
+ graded["peak_mem_mb"] = max(peak)
349
+ ext = external(mt, pairs, st, repeat, batch, audio_s, plan)
350
+ if ext:
351
+ graded.update(ext_cap(mt, graded, ext))
352
+ return {"runs": timed, "summary": summary, "graded": graded, "external": ext}
353
+
354
+
355
+ def settings_text(mt: str, st: dict) -> str:
356
+ bits = []
357
+ if mt in TOKEN_TYPES:
358
+ bits.append(f"{st['max_new_tokens']} new tokens per request" + (" (--ignore-eos)" if st.get("ignore_eos") else ""))
359
+ if st.get("prompt_tokens"):
360
+ bits.append(f"a ~{st['prompt_tokens']}-token prompt")
361
+ if mt == "vision_detection" and int(st.get("batch") or 1) > 1:
362
+ bits.append(f"{st['batch']} images per request")
363
+ if st.get("resolution"):
364
+ bits.append(f"{st['resolution']} input")
365
+ if mt == "audio_generation":
366
+ bits.append(f"{st.get('seconds')} s of audio per request")
367
+ return (": " + ", ".join(bits)) if bits else ""
368
+
369
+
370
+ def paired(mt: str, req: dict, repeat: int, plan: dict) -> tuple[dict, int]:
371
+ """The same request with the least work (one new token; one audio frame), or at --repeat 1: the difference in
372
+ wall time is the device-clock speed, which keeps the port's own timings honest."""
373
+ if mt in TOKEN_TYPES:
374
+ return {**req, "max_new_tokens": 1}, repeat
375
+ if mt == "audio_generation" and plan.get("frame_seconds"):
376
+ return {**req, "seconds": plan["frame_seconds"]}, repeat
377
+ return req, 1
378
+
379
+
380
+ def external(mt, pairs, st, repeat, batch, audio_s, plan) -> dict | None:
381
+ if not pairs:
382
+ return None
383
+ d = statistics.median(pairs)
384
+ if d <= 0:
385
+ return None
386
+ if mt in TOKEN_TYPES:
387
+ return {"tokens_per_s": (int(st["max_new_tokens"]) - 1) * repeat / (d / 1000)}
388
+ if mt == "audio_generation":
389
+ fs = plan.get("frame_seconds")
390
+ n = (max(1, round(float(st.get("seconds") or 10) / fs)) - 1) * repeat if fs else 0
391
+ return {"ms_per_frame": d / n, "real_time_factor": d / n / (1000 * fs)} if n > 0 else None
392
+ if repeat < 2:
393
+ return None
394
+ per = d / (repeat - 1)
395
+ out = {"latency_ms": per}
396
+ if mt == "vision_detection":
397
+ out["fps"] = batch * 1000 / per
398
+ if audio_s:
399
+ out["real_time_factor"] = per / 1000 / audio_s
400
+ return out
401
+
402
+
403
+ def ext_cap(mt: str, g: dict, ext: dict, tol: float = 0.15) -> dict:
404
+ """nnopt's rule: a self-reported speed more than 15% better than the device-clock measurement is replaced by it."""
405
+ out = {}
406
+ if mt in TOKEN_TYPES and ext.get("tokens_per_s") and g.get("tokens_per_s"):
407
+ if g["tokens_per_s"] > ext["tokens_per_s"] * (1 + tol):
408
+ out["tokens_per_s"] = ext["tokens_per_s"]
409
+ elif mt == "audio_generation" and ext.get("ms_per_frame") and g.get("ms_per_frame"):
410
+ if ext["ms_per_frame"] > g["ms_per_frame"] * (1 + tol):
411
+ out.update(ms_per_frame=ext["ms_per_frame"], real_time_factor=ext.get("real_time_factor"))
412
+ elif ext.get("latency_ms") and g.get("latency_ms"):
413
+ ratio = ext["latency_ms"] / g["latency_ms"]
414
+ if ratio > 1 + tol:
415
+ for k in ("latency_ms", "real_time_factor", "time_to_first_audio_ms", "per_image_ms"):
416
+ if g.get(k) is not None:
417
+ out[k] = g[k] * ratio
418
+ if g.get("fps"):
419
+ out["fps"] = g["fps"] / ratio
420
+ return out
421
+
422
+
423
+ def compare(plan: dict, mine: dict) -> tuple[list[list[str]], bool]:
424
+ rows, ok = [], True
425
+ for c in plan.get("compare") or []:
426
+ got, ref, tol = mine["graded"].get(c["key"]), c.get("nnopt"), float(c.get("tolerance_pct") or 10)
427
+ if got is None or not ref:
428
+ rows.append([c["label"], fmt(got), fmt(ref), "–", "not measured"])
429
+ continue
430
+ diff = 100 * (got - ref) / ref
431
+ within = abs(diff) <= tol
432
+ ok &= within or c.get("informational", False)
433
+ rows.append([c["label"] + (f" ({c['unit']})" if c.get("unit") else ""), fmt(got), fmt(ref), f"{diff:+.1f}%",
434
+ ("yes" if within else "NO") + f" (±{tol:g}%)"])
435
+ return rows, ok
436
+
437
+
438
+ def table(head: list[str], rows: list[list[str]]) -> str:
439
+ w = [max(len(str(r[i])) for r in [head] + rows) for i in range(len(head))]
440
+ line = lambda r: " ".join(str(x).ljust(w[i]) for i, x in enumerate(r)) # noqa: E731
441
+ return "\n".join([line(head), line(["-" * n for n in w])] + [line(r) for r in rows])
442
+
443
+
444
+ def sustained(sess: Session, plan: dict, seconds: float, args: argparse.Namespace) -> dict:
445
+ mt, st, inp = plan["model_type"], plan["settings"], plan["inputs"]
446
+ key = (plan.get("compare") or [{}])[0].get("key")
447
+ req = {"mode": plan.get("mode", "generate"), **{k: st[k] for k in ("max_new_tokens", "ignore_eos", "seed", "seconds")
448
+ if st.get(k) is not None}}
449
+ req.update({k: f"{sess.io}/{Path(v).name}" for k, v in inp.items() if isinstance(v, str)})
450
+ if "images" in inp:
451
+ req["images"] = [f"{sess.io}/{Path(v).name}" for v in inp["images"]]
452
+ audio_s = wav_seconds(HERE / inp["input"]) if mt == "speech_to_text" else (
453
+ float(st.get("seconds") or 10) if mt == "audio_generation" else None)
454
+ series, t0 = [], time.monotonic()
455
+ print(f"sustained run: {seconds:.0f} s back to back")
456
+ while time.monotonic() - t0 < seconds:
457
+ r = sess.run(req, repeat=int(st.get("sustained_repeat") or st["repeat"]), timeout=args.timeout)
458
+ _ok(r, "sustained run")
459
+ reqs = [derive(mt, x, audio_s, int(st.get("batch") or 1)) for x in (r["metrics"] or {}).get("runs") or []]
460
+ s = stats(x.get(key) for x in reqs[1:] or reqs)
461
+ if s:
462
+ series.append((time.monotonic() - t0, s["median"]))
463
+ print(f" {series[-1][0]:5.0f} s {fmt(s['median'])}")
464
+ if len(series) < 2:
465
+ return {"series": series}
466
+ first = statistics.median(v for t, v in series if t <= series[0][0] + 60)
467
+ last = statistics.median(v for t, v in series if t >= series[-1][0] - 60)
468
+ return {"series": series, "first_minute": first, "last_minute": last, "ratio": last / first if first else None}
469
+
470
+
471
+ # ---------------------------------------------------------------- outputs
472
+
473
+ def words(text: str) -> list[str]:
474
+ return re.sub(r"[^\w\s']", " ", text.lower()).split()
475
+
476
+
477
+ def edits(a: list, b: list) -> int:
478
+ prev = list(range(len(b) + 1))
479
+ for i, x in enumerate(a, 1):
480
+ cur = [i]
481
+ for j, y in enumerate(b, 1):
482
+ cur.append(min(prev[j] + 1, cur[j - 1] + 1, prev[j - 1] + (x != y)))
483
+ prev = cur
484
+ return prev[-1]
485
+
486
+
487
+ def iou(a: list, b: list) -> float:
488
+ ix = max(0.0, min(a[2], b[2]) - max(a[0], b[0]))
489
+ iy = max(0.0, min(a[3], b[3]) - max(a[1], b[1]))
490
+ inter = ix * iy
491
+ union = (a[2] - a[0]) * (a[3] - a[1]) + (b[2] - b[0]) * (b[3] - b[1]) - inter
492
+ return inter / union if union > 0 else 0.0
493
+
494
+
495
+ NPY = {"f4": ("f", 4), "f8": ("d", 8), "i1": ("b", 1), "u1": ("B", 1), "i2": ("h", 2), "u2": ("H", 2),
496
+ "i4": ("i", 4), "u4": ("I", 4), "i8": ("q", 8), "u8": ("Q", 8), "b1": ("B", 1)}
497
+
498
+
499
+ def read_npy(path: Path) -> tuple[str, list[float]]:
500
+ """A NumPy .npy file (format 1.0/2.0, C order) as (dtype, flat values), with the standard library only."""
501
+ b = path.read_bytes()
502
+ if b[:6] != b"\x93NUMPY":
503
+ raise Fail(f"{path.name} is not a .npy file")
504
+ hl, off = (struct.unpack("<H", b[8:10])[0], 10) if b[6] == 1 else (struct.unpack("<I", b[8:12])[0], 12)
505
+ head = ast.literal_eval(b[off:off + hl].decode("latin1"))
506
+ descr, data = head["descr"], b[off + hl:]
507
+ if head.get("fortran_order"):
508
+ raise Fail(f"{path.name}: Fortran order is not supported")
509
+ kind = descr.lstrip("<>|=")
510
+ if kind == "f2":
511
+ n = len(data) // 2
512
+ return kind, list(struct.unpack(("<" if descr[0] != ">" else ">") + "e" * n, data[:2 * n]))
513
+ if kind not in NPY:
514
+ raise Fail(f"{path.name}: dtype {descr} is not supported here")
515
+ code, size = NPY[kind]
516
+ a = array(code)
517
+ if a.itemsize != size:
518
+ raise Fail(f"{path.name}: this Python has no {size}-byte {code} type")
519
+ a.frombytes(data[: len(data) // size * size])
520
+ if (descr[0] == ">") != (sys.byteorder == "big") and size > 1:
521
+ a.byteswap()
522
+ return kind, list(a)
523
+
524
+
525
+ def check(sess: Session, plan: dict, args: argparse.Namespace) -> bool:
526
+ c = plan.get("check") or {}
527
+ cases, rules, mt = c.get("cases") or [], c.get("rules") or {}, plan["model_type"]
528
+ if not cases:
529
+ print("no public cases to check outputs against")
530
+ return True
531
+ print(f"{len(cases)} public case{'s' * (len(cases) != 1)}: {c.get('what', 'expected outputs')}")
532
+ ok, rows = True, []
533
+ tot = {"edits": 0, "words": 0, "matched": 0, "ref": 0, "ours": 0, "prefix": [], "tok": 0}
534
+ for case in cases:
535
+ base = HERE / case["dir"]
536
+ req: dict = {"mode": "generate"}
537
+ for k in ("input", "image"):
538
+ if case.get(k):
539
+ req[k] = sess.stage(base / case[k])
540
+ if mt == "vision_detection":
541
+ req["images"] = [req.pop("input")]
542
+ exp_path = base / case["expected"] if case.get("expected") else None
543
+ exp = json.loads(exp_path.read_text()) if exp_path and exp_path.suffix == ".json" else None
544
+ if mt in TOKEN_TYPES:
545
+ req["max_new_tokens"] = max(1, len(exp["tokens"]))
546
+ if mt in ("text_to_speech", "audio_generation"):
547
+ req["seed"] = case.get("seed", 0)
548
+ if mt == "audio_generation":
549
+ req["seconds"] = case.get("seconds", 10)
550
+ r = sess.run(req, repeat=1, fetch_out=True, timeout=args.timeout)
551
+ if r["exit"] != 0 or not r["out"]:
552
+ ok = False
553
+ rows.append([case["id"], "run failed", (r.get("log") or "")[-120:].replace("\n", " ")])
554
+ continue
555
+ if mt in TOKEN_TYPES:
556
+ got = json.loads(Path(r["out"]).read_text())
557
+ same_prompt = got.get("prompt_tokens") == exp["prompt_tokens"]
558
+ n = 0
559
+ for a, b in zip(got.get("tokens") or [], exp["tokens"]):
560
+ if a != b:
561
+ break
562
+ n += 1
563
+ frac = n / max(1, len(exp["tokens"]))
564
+ tot["prefix"].append(frac)
565
+ tot["tok"] += same_prompt
566
+ rows.append([case["id"], "prompt tokens " + ("match" if same_prompt else "DIFFER"),
567
+ f"{n}/{len(exp['tokens'])} new tokens identical before the first difference"])
568
+ elif mt == "speech_to_text":
569
+ got = json.loads(Path(r["out"]).read_text()).get("text", "")
570
+ e = edits(words(got), words(exp["text"]))
571
+ tot["edits"] += e
572
+ tot["words"] += len(words(exp["text"]))
573
+ rows.append([case["id"], f"{e} word edit{'s' * (e != 1)}", got[:60]])
574
+ elif mt == "text_to_speech":
575
+ mine, ref = wav_seconds(Path(r["out"])), float(case["expected_seconds"])
576
+ within = abs(mine / ref - 1) <= float(rules.get("duration_ratio_tolerance", 0.05))
577
+ ok &= within
578
+ rows.append([case["id"], f"{mine:.2f} s of audio (expected {ref:.2f} s)", "ok" if within else "DIFFERS"])
579
+ elif mt == "vision_detection":
580
+ got = json.loads(Path(r["out"]).read_text())
581
+ thr, margin, need = float(rules.get("score_threshold", 0.3)), float(rules.get("score_margin", 0.05)), float(
582
+ rules.get("iou_match", 0.5))
583
+ ref = [(b, cl) for b, s, cl in zip(exp["boxes"], exp["scores"], exp["classes"]) if s >= thr]
584
+ ours = [(b, cl) for b, s, cl in zip(got.get("boxes", []), got.get("scores", []), got.get("classes", []))
585
+ if s >= thr - margin]
586
+ used, m = set(), 0
587
+ for b, cl in ref:
588
+ best = max(((iou(b, ob), j) for j, (ob, oc) in enumerate(ours) if oc == cl and j not in used),
589
+ default=(0.0, -1))
590
+ if best[0] >= need:
591
+ used.add(best[1])
592
+ m += 1
593
+ tot["matched"] += m
594
+ tot["ref"] += len(ref)
595
+ tot["ours"] += len([1 for b, s in zip(got.get("boxes", []), got.get("scores", [])) if s >= thr])
596
+ rows.append([case["id"], f"{m}/{len(ref)} expected objects found", f"{len(ours)} detected"])
597
+ elif mt == "kernel":
598
+ bad, total, worst = 0, 0, 0.0
599
+ for t in case["outputs"]:
600
+ pulled = Path(r["out"]) / f"{t['name']}.npy"
601
+ if not pulled.is_file():
602
+ ok = False
603
+ rows.append([case["id"], f"no {t['name']}.npy written", ""])
604
+ continue
605
+ kind, mine = read_npy(pulled)
606
+ _, ref = read_npy(base / t["expected"])
607
+ if len(mine) != len(ref):
608
+ ok = False
609
+ rows.append([case["id"], f"{t['name']}: {len(mine)} values, expected {len(ref)}", ""])
610
+ continue
611
+ if kind.startswith("f"):
612
+ rt, at = (float(rules.get("fp16_rtol", 1e-2)), float(rules.get("fp16_atol_scale", 1e-2))) \
613
+ if kind == "f2" or t.get("dtype") == "float16" else \
614
+ (float(rules.get("fp32_rtol", 1e-4)), float(rules.get("fp32_atol_scale", 1e-4)))
615
+ rms = math.sqrt(sum(x * x for x in ref) / len(ref)) if ref else 0.0
616
+ for a, b in zip(mine, ref):
617
+ d = abs(a - b)
618
+ worst = max(worst, d)
619
+ bad += not (d <= at * rms + rt * abs(b))
620
+ else:
621
+ lim = float(rules.get("int8_max_abs_diff", 1) if kind in ("i1", "u1") else rules.get("int_max_abs_diff", 0))
622
+ for a, b in zip(mine, ref):
623
+ worst = max(worst, abs(a - b))
624
+ bad += abs(a - b) > lim
625
+ total += len(ref)
626
+ frac = bad / total if total else 0.0
627
+ within = frac <= float(rules.get("max_mismatch_frac", 0.0))
628
+ ok &= within
629
+ rows.append([case["id"], f"{bad} of {total} values outside tolerance", f"largest difference {worst:.3g}"])
630
+ else: # audio_generation: free-running audio is random; length and level are what can be checked
631
+ dur, rms = wav_seconds(Path(r["out"])), wav_rms(Path(r["out"]))
632
+ want = float(case.get("seconds", 10))
633
+ within = abs(dur - want) <= 0.05 * want + 0.1 and (math.isnan(rms) or rms >= float(rules.get("free_run_min_rms", 0.001)))
634
+ ok &= within
635
+ rows.append([case["id"], f"{dur:.2f} s of audio, RMS {rms:.3g}", "ok" if within else "DIFFERS"])
636
+ print(table(["case", "result", ""], rows))
637
+ if mt in TOKEN_TYPES and tot["prefix"]:
638
+ mean, need = statistics.mean(tot["prefix"]), float(rules.get("greedy_prefix_min", 0.75))
639
+ tok_ok = tot["tok"] == len(tot["prefix"])
640
+ ok &= tok_ok and mean >= need
641
+ print(f"prompt tokens identical on {tot['tok']}/{len(tot['prefix'])} cases (needed: all); greedy prefix "
642
+ f"{mean:.2f} (needed: {need:g} or more)")
643
+ if mt == "speech_to_text" and tot["words"]:
644
+ wer, need = tot["edits"] / tot["words"], float(rules.get("wer_vs_reference_max", 0.02))
645
+ ok &= wer <= need
646
+ print(f"word error rate against the expected transcripts {wer:.3f} (needed: {need:g} or less)")
647
+ if mt == "vision_detection" and tot["ref"]:
648
+ rec, prec = tot["matched"] / tot["ref"], tot["matched"] / max(1, tot["ours"])
649
+ need_r, need_p = float(rules.get("recall_min", 0.97)), float(rules.get("precision_min", 0.97))
650
+ ok &= rec >= need_r and prec >= need_p
651
+ print(f"recall {rec:.3f} (needed {need_r:g}), precision {prec:.3f} (needed {need_p:g})")
652
+ print("outputs: " + ("REPRODUCED" if ok else "NOT reproduced"))
653
+ return ok
654
+
655
+
656
+ def _ok(r: dict, what: str) -> None:
657
+ if r["exit"] != 0:
658
+ raise Fail(f"{what} failed (exit {r['exit']}): {(r.get('log') or '').strip()[-800:]}\ncommand: {r['command']}")
659
+
660
+
661
+ # ---------------------------------------------------------------- main
662
+
663
+ def main(argv: list[str] | None = None) -> int:
664
+ ap = argparse.ArgumentParser(description="Reproduce nnopt's numbers on your own device (REPRO.md).")
665
+ ap.add_argument("--plan", default=str(HERE / "plan.json"))
666
+ ap.add_argument("--serial", help="the phone's serial (adb devices); default $ANDROID_SERIAL")
667
+ ap.add_argument("--ssh", help="USER@HOST of a Jetson or Mac; default $SSH_TARGET")
668
+ ap.add_argument("--local", action="store_true", help="the program runs on this machine")
669
+ ap.add_argument("--dir", help="where deploy.sh installed the program on the device")
670
+ ap.add_argument("--deploy", action="store_true", help="run bash deploy.sh DIR first")
671
+ ap.add_argument("--check", action="store_true", help="check the outputs on the public cases instead of the speed")
672
+ ap.add_argument("--warmup", type=int)
673
+ ap.add_argument("--runs", type=int)
674
+ ap.add_argument("--sustained", type=float, default=0.0, help="seconds of back-to-back runs after the timed runs")
675
+ ap.add_argument("--timeout", type=float, default=3600.0, help="seconds per run")
676
+ ap.add_argument("--json", help="also write the results to this file")
677
+ a = ap.parse_args(argv)
678
+ if not Path(a.plan).is_file(): # measured on several phones: each has its own plan (repro/<phone>/plan.json)
679
+ mine = sorted(p.parent.name for p in HERE.glob("*/plan.json"))
680
+ print(f"error: no {a.plan}" + (f"; nnopt measured this on several phones: pass --plan repro/<phone>/plan.json "
681
+ f"for yours, <phone> one of: {', '.join(mine)}" if mine else ""), file=sys.stderr)
682
+ return 2
683
+ plan = json.loads(Path(a.plan).read_text())
684
+ kind = "local" if a.local else "ssh" if a.ssh else "adb" if a.serial else plan.get("connection", "adb")
685
+ serial = a.serial or (os.environ.get("ANDROID_SERIAL") if kind == "adb" else None)
686
+ target = a.ssh or (os.environ.get("SSH_TARGET") if kind == "ssh" else None)
687
+ folder = a.dir or plan["device_dir"]
688
+ try:
689
+ dev = Device(kind, serial=serial, target=target)
690
+ if a.deploy:
691
+ print(f"deploy: bash deploy.sh {folder}")
692
+ env = {**os.environ, "NNOPT_PORT_DIR": folder, **({"ANDROID_SERIAL": serial} if serial else {})}
693
+ if subprocess.run(["bash", "deploy.sh", folder], cwd=ROOT, env=env).returncode != 0:
694
+ raise Fail("deploy.sh failed")
695
+ print(f"{plan.get('title', 'nnopt reproduction')} · {dev.describe()} · {folder}")
696
+ with tempfile.TemporaryDirectory(prefix="nnopt-repro-") as tmp:
697
+ sess = Session(dev, folder, plan["model_type"], Path(tmp))
698
+ try:
699
+ if a.check:
700
+ ok = check(sess, plan, a)
701
+ result = {"check": ok}
702
+ elif (mine := speed(sess, plan, a)) is None:
703
+ ok, result = True, {"speed": None}
704
+ else:
705
+ rows, ok = compare(plan, mine)
706
+ print()
707
+ print(table(["metric", "yours", "nnopt", "diff", "within"], rows))
708
+ if mine["graded"].get("peak_mem_mb"):
709
+ print(f"peak memory (process tree RSS): {fmt(mine['graded']['peak_mem_mb'])} MB")
710
+ result = {"speed": mine, "compared": rows, "within": ok}
711
+ if a.sustained > 0:
712
+ result["sustained"] = s = sustained(sess, plan, a.sustained, a)
713
+ if s.get("ratio"):
714
+ print(f"sustained: last minute / first minute = {s['ratio']:.2f}")
715
+ print("speed: " + ("REPRODUCED" if ok else "NOT reproduced (see REPRO.md, Expected results)"))
716
+ finally:
717
+ sess.close()
718
+ out = Path(a.json) if a.json else HERE / "results" / time.strftime("run-%Y%m%d-%H%M%S.json")
719
+ out.parent.mkdir(parents=True, exist_ok=True)
720
+ out.write_text(json.dumps(result, indent=1, default=str) + "\n")
721
+ print(f"results: {out}")
722
+ return 0 if ok else 1
723
+ except Fail as e:
724
+ print(f"error: {e}", file=sys.stderr)
725
+ return 2
726
+
727
+
728
+ if __name__ == "__main__":
729
+ sys.exit(main())