Friday, April 19, 2024

Rockchip NPU update 3: Real-time object detection on RK3588

Progress

Yesterday I managed to implement in my open-source driver all the remaining operations so the SSDLite MobileDet model can run on Rockchip's NPU in the RK3588 SoC.

Performance is pretty good at 30 frames per second when using just one of the 3 cores that the NPU contains.


 I uploaded the generated video to YouTube at:

You can get the source code at my branch here.

 

Next steps

Now that we got to this level of usefulness, I'm going to switch to writing a kernel driver suited for inclusion into the Linux kernel, to the drivers/accel subsystem.

There is still lots of work to do, but progress is going pretty fast, though as I write more drivers for different NPUs I will have to split my time among them. At least, until we get more contributors! :)

7 comments:

  1. Might Jasbir's work provide some additional helpful information? https://jas-hacks.blogspot.com/2024/02/rk3588-reverse-engineering-rknn.html

    ReplyDelete
  2. > Might Jasbir's work provide some additional helpful information? https://jas-hacks.blogspot.com/2024/02/rk3588-reverse-engineering-rknn.html

    Yep, I have been in contact with him since I started working on this.

    ReplyDelete
  3. > Loading external delegate from ./build/src/gallium/targets/teflon/libteflon.so with args: {}
    > rknpu: driver missing
    > Segmentation fault
    >
    > Any idea what I missed out. Thanks.

    Maybe you haven't loaded the kernel driver?

    ReplyDelete
  4. Linux kernel is aware of the presence

    cat /sys/kernel/debug/rknpu/version
    RKNPU driver: v0.9.2

    however I wasn't able to find it in module list (lsmod). I wonder if the driver is not bundled with the Ubuntu version I installed to RK1.

    ReplyDelete
  5. Dumb me, google helped. I found the source here https://github.com/airockchip/rknn-llm/tree/main/rknpu-driver
    I only need to figure out how to build it from source.

    ReplyDelete
  6. Do the cores not scale well or just not implemented yet?
    "when using just one of the 3 cores that the NPU contains"

    ReplyDelete
  7. I've also run into same problem with missing rknpu driver, it's indeed not present in lsmod, but if I use RKNNLite it will print that it use RKNN Driver with version matching with what i have in cat /proc/rknpu/version. And if I cat /rknpu/load it will print actual load i have with python demo. It makes me think that rockchip's kernel driver is loaded and working, but for some reason it loads incorrectly?

    ReplyDelete