Changes between Version 23 and Version 24 of venice/npu


Ignore:
Timestamp:
02/26/2026 10:39:47 PM (7 weeks ago)
Author:
Ryan Erb
Comment:

update examples

Legend:

Unmodified
Added
Removed
Modified
  • venice/npu

    v23 v24  
    232232
    233233== Upstream / Mainline NPU support (via Mesa)
     234
    234235The IMX8MP has a Verisilicon NPU which is from Vivante. Vivante supports this via their vivante driver (/dev/galcore) but that is not an opensource driver so it would make sense to want to support the NPU with it's opensource equivalent (etnaviv driver). Support for this has been added to the Linux 6.10 kernel.
    235236
     
    241242
    242243
    243 On a Gateworks Venice board with an IMX8MP and an Ubuntu noble root filesystem:
    244 - update kernel to v6.10 with NPU support (if using an older kernel)
    245 {{{#!bash
    246 # update kernel
    247 cd /tmp && wget https://dev.gateworks.com/venice/kernel/linux-venice-6.10.6.tar.xz && tar -C / -xvf linux*.tar.xz --keep-directory-symlink && reboot
    248 }}}
    249 - create a non-root user (always a good idea but not required for mesa)
     244Requirements:
     245 * Gateworks Venice board with an IMX8MP and an Ubuntu noble root filesystem with a 6.10 or newer kernel
     246
     247- Create a non-root user (always a good idea but not required for mesa)
    250248{{{#!bash
    251249# create user
     
    260258su -l $USER
    261259}}}
    262 - to avoid a lot of python dependency issues with tensorflow-lite install an older version of python using the [https://launchpad.net/%7Edeadsnakes/+archive/ubuntu/ppa deadsnakes ppa] and create a virtualenv
     260- To avoid a lot of python dependency issues with tensorflow-lite install an older version of python using the [https://launchpad.net/%7Edeadsnakes/+archive/ubuntu/ppa deadsnakes ppa] and create a virtualenv
    263261{{{#!bash
    264262sudo add-apt-repository ppa:deadsnakes/ppa
     
    271269}}}
    272270 - Note Python 3.9, 3.10, 3.11 work, 3.12 does not
    273 - build mesa (22.2.0-devel fork with updated teflon support for imx8mp)
     271- Build mesa (22.2.0-devel fork with updated teflon support for imx8mp)
    274272{{{#!bash
    275273# install build deps
     
    287285cd ..
    288286}}}
    289 - install tensorflow lite runtime (requires python <= 2.11)
     287- Install tensorflow lite runtime (requires python <= 2.11)
    290288{{{#!bash
    291289pip3 install tflite_runtime
    292290}}}
    293 - clone tensorflow for some examples and assets used below
     291- Clone tensorflow for some examples and assets used below
    294292{{{#!bash
    295293git clone https://github.com/tensorflow/tensorflow.git
    296294}}}
    297 - run teflon image classification test
    298 {{{#!bash
    299 # note this test requires python pillow, python numpy<2.0 and write access to /dev/dri/renderD128
     295- Run teflon image classification test
     296{{{#!bash
     297# Note this test requires python pillow, python numpy<2.0 and write access to /dev/dri/renderD128
    300298pip3 install "numpy<2.0" pillow
    301299groups # make sure your in the render group (or have write access to /dev/dri/renderD128)
     
    312310 -e ~/mesa/build/src/gallium/targets/teflon/libteflon.so
    313311}}}
    314 - run tensorflow label_image example:
    315  * first we need to patch the label_image example to use tflite_runtime
    316 {{{#!bash
    317 cd ~/tensorflow
    318 cat <<EOF |
     312- Run tensorflow label_image example:
     313 * First we need to patch the label_image example to use tflite_runtime. Use a text editor like vi to edit the file ~/tensorflow/tensorflow/lite/examples/python/label_image.py per the patch changes below:
     314{{{#!bash
    319315diff --git a/tensorflow/lite/examples/python/label_image.py b/tensorflow/lite/examples/python/label_image.py
    320316index d26454f921f..08c65962bf1 100644
     
    340336       num_threads=args.num_threads)
    341337
    342 EOF
    343 patch -p1
    344 }}}
    345  * now we can run the label_image example:
     338
     339}}}
     340 * Now we can run the label_image example:
    346341{{{#!bash
    347342# without acceleration (175.993ms on imx8mp)
     
    350345  -l ~/mesa/src/gallium/frontends/teflon/tests/labels_mobilenet_quant_v1_224.txt \
    351346  -i ~/tensorflow/tensorflow/lite/examples/label_image/testdata/grace_hopper.bmp
     3470.874510: military uniform
     3480.031373: Windsor tie
     3490.015686: mortarboard
     3500.011765: bulletproof vest
     3510.007843: bow tie
     352time: 176.267ms
     353
    352354# with acceleration (14.138ms on imx8mp)
    353355python3 ~/tensorflow/tensorflow/lite/examples/python/label_image.py \
     
    356358 -i ~/tensorflow/tensorflow/lite/examples/label_image/testdata/grace_hopper.bmp \
    357359 -e ~/mesa/build/src/gallium/targets/teflon/libteflon.so
     360Loading external delegate from /root/mesa/build/src/gallium/targets/teflon/libteflon.so with args: {}
     3610.870588: military uniform
     3620.031373: Windsor tie
     3630.011765: mortarboard
     3640.007843: bow tie
     3650.007843: bulletproof vest
     366time: 14.234ms
     367
    358368}}}
    359369