在Hexagon HVX DSP上运行nnlib测试应用遇问题求助
I've been testing different versions of nnlibs from CodeAurora with SDK 3.0, 3.2, and 3.3.3. The closest I got to success was using commit 7321d49318a33a99e978b18411adee43df7ddaea (Jan 2018) paired with SDK 3.3.3: running graph_app would show the help message, but all attempts failed due to image file mismatches.
Looking into the test/graph_app.c code, there are strict validation rules for file size, element dimensions, depth, etc. Even after adjusting the input to meet these rules, the app gets stuck at the "Run!" stage, causing the device to crash—requiring a re-mount via ADB to access the DSP again.
Additionally, when trying the latest nnlib version, I hit a missing header file issue: pmu_adsp.h is nowhere to be found in the project.
Update
Following @Erich Plondke's suggestion, I tried using a tiny input image, which gave me relevant node info, but the core problem still persists. I'm reaching out for technical help here.
Relevant Commands & Outputs
1. graph_app Help Output
$ adb shell /data/graph_app Usage: testapp [--flag flagopt] [inputfile [inputfile...]] flag name type default function height int 0 Height of the input data. 0 == autodetect-square width int 0 Width of the input data. 0 == autodetect-square depth int 3 Depth of the input data iters int 1 Number of times to run each input perfdump int 0 Generate performance dump pmu int 0 Get Performance Monitor Unit information elementsize int 1 Element Size (uint8==1,float==4) layer_reorder string NULL Reorder depth layers. ("210" changes RGB to BGR) pprint_floats int 0 Pretty-Print output as floats pprint_imagenet int 1 Pretty-print output, getting top 5 values and use imagenet categories debug int 0 Debug verbosity level. Higher numbers get more verbosity. benchmark int 0 Bechmark mode. Reduce work at the end of execution. Reduces messages. bus_bw int 0 Collect bus BW node_perf int 0 Show the cycles each node consumed in last execution graph_rebuild int 0 Number of times to build/destroy the graph showaddress int 0 Show the offset of some item in the .so, useful for
2. Image Mismatch Error Output
$adb shell data/graph_app --height 200 --width 200 --depth 1 --iters 1 --perfdump 0 --pmu 0 --pprint_floats 0 --pprint_imagenet 1 --debug 0 /data/keyboard_299x299.jpg return value from dspCV_initQ6() : 0 node 66122 success node 66304 success node 66637 success Init graph done.Prepare a830e780 success! nn @ a830e780: id=0x0 debug_level=0 node @ a830ecf0: id=0x1024a type=0x0(INPUT) n_inputs=0 n_outputs=1 padding=0(WHATEVER) node @ a830edd0: id=0x10300 type=0x2(Nop) n_inputs=1 n_outputs=1 padding=0(WHATEVER) node @ a830eed0: id=0x1044d type=0x1(OUTPUT) n_inputs=1 n_outputs=0 padding=0(WHATEVER) 3 nodes total. Using </data/keyboard_299x299.jpg> image size 25763 does not match element size 1, depth 1, width 200, height 200
3. Validation Code Snippet from graph_app.c
if ((filesize % elementsize != 0) || (elements % depth != 0) || (height * width != area)) { printf("image size %d does not match " "element size %d, " "depth %d, " "width %d, " "height %d, " "elements %d, " "area %d\n ", filesize, elementsize, depth, width, height, elements, area); return -1; }
4. Node Info from Tiny Input Attempt
21 nodes total. Init graph done.Prepare 9a912180 success! nn @ 9a912180: id=0x0 debug_level=0 node @ 9a912610: id=0x1000b type=0x3(Const) n_inputs=0 n_outputs=1 padding=0(WHATEVER) node @ 9a912a20: id=0x1000c type=0x3(Const) n_inputs=0 n_outputs=1 padding=0(WHATEVER) node @ 9a912b20: id=0x1000d type=0x3(Const) n_inputs=0 n_outputs=1 padding=0(WHATEVER) node @ 9a912b70: id=0x1000e type=0x3(Const) n_inputs=0 n_outputs=1 padding=0(WHATEVER) node @ 9a912c20: id=0x1000f type=0x3(Const) n_inputs=0 n_outputs=1 padding=0(WHATEVER) node @ 9a912d30: id=0x10010 type=0x3(Const) n_inputs=0 n_outputs=1 padding=0(WHATEVER) node @ 9a912ec0: id=0x10011 type=0x3(Const) n_inputs=0 n_outputs=1 padding=0(WHATEVER) node @ 9a912fa0: id=0x10012 type=0x3(Const) n_inputs=0 n_outputs=1 padding=0(WHATEVER) node @ 9a912ff0: id=0x10250 type=0x3(Const) n_inputs=0 n_outputs=1 padding=0(WHATEVER) node @ 9a913040: id=0x1024a type=0x0(INPUT) n_inputs=0 n_outputs=1 padding=0(WHATEVER) node @ 9a9130c0: id=0x1024b type=0xe(Flatten) n_inputs=2 n_outputs=1 padding=0(WHATEVER) node @ 9a939af0: id=0x1024c type=0x21(Min_f) n_inputs=2 n_outputs=1 padding=0(WHATEVER) node @ 9a939bd0: id=0x1024d type=0x23(Max_f) n_inputs=2 n_outputs=1 padding=0(WHATEVER) node @ 9a939cb0: id=0x1024e type=0x25(Quantize) n_inputs=3 n_outputs=3 padding=0(WHATEVER) node @ 9a93a8a0: id=0x10254 type=0x29(Supernode_8x8p8to8) n_inputs=12 n_outputs=3 padding=2(VALID) node @ 9a93a4e0: id=0x10442 type=0x27(Dequantize) n_inputs=3 n_outputs=1 padding=0(WHATEVER) node @ 9a93a5d0: id=0x1044d type=0x1(OUTPUT) n_inputs=1 n_outp
内容的提问来源于stack exchange,提问作者Amir

