This is a discontinued project (master thesis).
Feel free to contact me if you wanna know more.
Hardware accelerator for Machine Learning on TUL PYNQ™-Z2 board, based on Xilinx Zynq SoC
Erasmus Master Thesis @Chalmers University of Technology and Polythecnic of Turin
Clone this repo to your local machine using and feel free to contribute!
$ git clone https://github.com/franout/Cogitantium.git
For using the accelerator you only need to install tensorflow wheel and python according to Tensorflow for Pynq-Z2
The following command are used for loading and using the accelerator into the Tensorflow Lite environment:
DTPU_lib=tflite.load_delegate("./DTPU_delegate.so",options=[])
interpreter = tflite.Interpreter(model_path=tflite_model_file,experimental_delegates=[DTPU_lib])
The shared library is created with the following command :
$ python3.5 ./dtpu/software/create_library.py
Note: in the same folder there must be present the DTPU_delegate.cpp and DTPU_delegate.py used for building the library.
For editing, simulating and synthesizing the verilog code you can use whatever IDE and tools you prefer. In this project Xilinx Vivado Tools have been used
The hardware accelerator is capable of tensor convolution, generally speaking matrix multiplication and accumulation.
-
General architecture
- Logical view
- Real Implementation
- Datapath of dtpu core
-
Customizable hardware parameters (pre-synthesis)
- ROWS, rows in the matrix multiplication unit (MXU)
- COLUMNS, columns in the matrix multiplication unit (MXU)
- SIZE WMEMORY, size of weight memory
- ADDRESS SIZE WMEMORY
- ADDRESS SIZE CSR
- SIZE CSR, size of control and status register memor
- DATA WIDTH CSR
- DATA WIDTH WMEMORY
- DATA WIDTH FIFO IN
- DATA DIDTH FIFO OUT
- MAX BOARD DSP, max dsp entities on the board
For creating models:
$ python3.5 ./dtpu/software/create_models.py
Other models can be found at Hosted Models
For executing a models is necessary to run:
$ sudo python3.5 ./dtpu/software/run_model.py
The already quantized model must be present in the same folder of the previous script. Moreover, sudo is necessary for being able to program the FPGA witht the pynq python package.
The shared library for using the accelerator has been created according to Tensorflow Delegate
. The API can be checked into the /dtpu/software/create_library.py (a more detailed explanation will be done).
- IN PROGRESS
For testing the solo accelerator you can use:
$ sudo python3.5 ./dtpu/run_dtpu.py
Reach out to me at one of the following places!
GNU General Public License v3.0