Changes between Version 18 and Version 19 of venice/npu


Ignore:
Timestamp:
08/19/2024 11:10:36 PM (4 weeks ago)
Author:
Tim Harvey
Comment:

updated upstream/mainline example to use python3.9 to avoid python dependency issues

Legend:

Unmodified
Added
Removed
Modified
  • venice/npu

    v18 v19  
    236236Therefore to support the NPU you need to build a custom fork of mesa that is being worked on by [https://blog.tomeuvizoso.net/ Tomeu Vizoso] with the work being sponsored by [https://ideasonboard.com/ Ideas On board].
    237237
    238 On a Gateworks Venice board with an IMX8MP and Ubuntu 22.04 (jammy) root filesystem:
     238On a Gateworks Venice board with an IMX8MP and an Ubuntu root filesystem:
    239239- update kernel to v6.10 with NPU support
    240240{{{#!bash
     
    255255su -l $USER
    256256}}}
    257 - install python virtualenv which allows us to prevent conflicts between package libraries
    258 {{{#!bash
    259 sudo apt update && sudo apt upgrade -y && sudo apt install -y python3-pip python3-venv
    260 # create tflite1-env" virtualenv
    261 python3 -m venv tflite1-env
     257- to avoid a lot of python dependency issues with tensorflow-lite install an older version of python (python3.9) using the [https://launchpad.net/%7Edeadsnakes/+archive/ubuntu/ppa deadsnakes ppa] and create a virtualenv
     258{{{#!bash
     259sudo add-apt-repository ppa:deadsnakes/ppa
     260sudo apt update
     261sudo apt install -y python3.9 python3.9-venv
     262# create tflite-env virtualenv
     263python3.9 -m venv tflite-env
    262264# activate the venv (repeat or every new shell)
    263 source tflite1-env/bin/activate
     265source tflite-env/bin/activate
    264266}}}
    265267- build mesa (fork with updated teflon support for imx8mp)
     
    273275# mesa requires meson >= 1.1.0 (newer than jammy's), pycparser >= 2.20, and mako
    274276pip3 install meson pycparser mako
    275 ~/tflite1-env/bin/meson setup build -Dgallium-drivers=etnaviv -Dvulkan-drivers= -Dteflon=true
    276 ~/tflite1-env/bin/meson compile -C build # 20 mins or so on imx8mp
     277meson setup build -Dgallium-drivers=etnaviv -Dvulkan-drivers= -Dteflon=true
     278meson compile -C build # 20 mins or so on imx8mp
    277279ldd build/src/gallium/targets/teflon/libteflon.so
    278280}}}
     
    288290{{{#!bash
    289291# note this test requires python pillow, python numpy<2.0 and write access to /dev/dri/renderD128
    290 pip3 install "numpy<2.0" pillow tflite_runtime # tflite_runtime requires pillow as well as numpy<2
     292pip3 install "numpy<2.0" pillow
    291293groups # make sure your in the render group (or have write access to /dev/dri/renderD128)
    292294# without teflon (175.335ms on imx8mp)
     
    333335patch -p1
    334336# without acceleration (175.993ms on imx8mp)
    335 python3 ~/tensorflow/lite/examples/python/label_image.py \
     337python3 ~/tensorflow/tensorflow/lite/examples/python/label_image.py \
    336338  -m ~/mesa/src/gallium/targets/teflon/tests/mobilenet_v1_1.0_224_quant.tflite \
    337339  -l ~/mesa/src/gallium/frontends/teflon/tests/labels_mobilenet_quant_v1_224.txt \
    338340  -i ~/tensorflow/tensorflow/lite/examples/label_image/testdata/grace_hopper.bmp
    339341# with acceleration (14.138ms on imx8mp)
    340 python3 ~/tensorflow/lite/examples/python/label_image.py \
     342python3 ~/tensorflow/tensorflow/lite/examples/python/label_image.py \
    341343 -m ~/mesa/src/gallium/targets/teflon/tests/mobilenet_v1_1.0_224_quant.tflite \
    342344 -l ~/mesa/src/gallium/frontends/teflon/tests/labels_mobilenet_quant_v1_224.txt \