Git Product home page Git Product logo

rk3588-npu's Introduction

rk3588-npu

Reverse engineering the rk3588 npu.

Internals of the NPU, similarity to NVDLA and matrix muplication support covered in blog post. Example integration llama2.c running tinystories covered in blog post

To build :

mkdir build
meson build
cd build
ninja

To run tests (tested against 5.10 kernel) :

ninja -C build test

rk3588-npu's People

Contributors

mtx512 avatar

Stargazers

Balint Cristian avatar  avatar yang avatar AlekseySukhovey avatar XellossRyan avatar Vladislav Sorokin avatar yushuhuang avatar Haixuan Xavier Tao avatar traceback avatar Riley Sutton avatar Abhisit Sangjan avatar Yihui Xiong avatar Xin Zhou avatar Gábor Sebestyén avatar Andy Si avatar Andrei Radulescu avatar Lu avatar AJAY SAHU avatar Egidijus Ligeika avatar kakuty avatar Jevin Sweval avatar Henri Vasserman avatar Bernhard J. Conzelmann avatar  avatar Angel-HF avatar Xiangyu Li avatar J.V.B. avatar  avatar Maple Xie avatar  avatar Link avatar Vitalii Kozlovskyi avatar  avatar Dick Tang avatar  avatar wtj avatar yibit avatar Marc Altmann avatar Martin Gabdushev avatar  avatar  avatar Christopher Fleetwood avatar Martin Chang avatar Joey Burke avatar  avatar Ryan Johnson avatar Apachiww avatar Darío Clavijo avatar YanxingLiu avatar PP88PP avatar  avatar  avatar Tim Kersey avatar Xuebin Ruan avatar bryce avatar Rafael Ristovski avatar Georgi Gerganov avatar 快乐的我531 avatar

Watchers

Jevin Sweval avatar wtj avatar  avatar  avatar 快乐的我531 avatar Marc Altmann avatar J.V.B. avatar  avatar

rk3588-npu's Issues

run on rk3568

Hi, I'm trying to run your code on rk3568.
but when I run ./matmul_fp16_test 1 32 16 I get "RKNPU_SUBMIT returned -1"
and the output in dmesg:

RKNPU: job: 000000004eb23a7b, iommu domain id: 0, wait_count: 1, continue wait: 0, commit elapse time: 6251358us, wait time: 6251362us, timeout: 6000000us
RKNPU: failed to wait job, task counter: 0, flags: 0x5, ret = 0, elapsed time: 6252728us
RKNPU: job timeout, flags: 0x0:
RKNPU: 	core 0 irq status: 0x0, raw status: 0x0, require mask: 0x300, task counter: 0x0, elapsed time: 6359758us

I added a register dump to the rknpu.ko driver and run rknn_matmul_api_demo (from rknn toolkit2)
by doing
./rknn_matmul_api_demo 1 1 32 16 0 0 1 1 1,
in the rknpu.ko driver, in rknpu_job.c in the rknpu_job_subcore_commit_pc function, the first_task->regcmd_addr dump looks like this: (full dump in rknn_matmul_api_demo_dump.txt )

[  302.972445]   0: 0x02010000000e1004 ( op: 0x0201 reg: 0x1004 value: 0x0000000e )
[  302.973188]   1: 0x04010000000e2004 ( op: 0x0401 reg: 0x2004 value: 0x0000000e )
[  302.973840]   2: 0x08010000000e3004 ( op: 0x0801 reg: 0x3004 value: 0x0000000e )
[  302.974668]   3: 0x0201000000711040 ( op: 0x0201 reg: 0x1040 value: 0x00000071 )
[  302.975319]   4: 0x10010000000e4004 ( op: 0x1001 reg: 0x4004 value: 0x0000000e )
[  302.975965]   5: 0x020100000220100c ( op: 0x0201 reg: 0x100c value: 0x00000220 )
[  302.976611]   6: 0x0201000000101010 ( op: 0x0201 reg: 0x1010 value: 0x00000010 )
[  302.977256]   7: 0x0201000000091014 ( op: 0x0201 reg: 0x1014 value: 0x00000009 )
[  302.977903]   8: 0x0201000000001018 ( op: 0x0201 reg: 0x1018 value: 0x00000000 )
...

as I understand from your source codes op 0x0201 is OP_REG_CNA,
but what does 0x0401 mean - is there a place where I can read about it?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.