hossein1387 / BARVINN

BARVINN: A Barrel RISC-V Neural Network Accelerator: https://barvinn.readthedocs.io/en/latest/
MIT License
75 stars 11 forks source link

Conv C code compilation error #21

Closed schegde closed 2 years ago

schegde commented 2 years ago

To generate the RISCV firmwares for BARVINN simulation, I am trying to compile the convolution C code in csrc/conv/ . So I installed the rv32 RISCV compilation toolchain as per the Picorv32 instructions. When I do make all in the conv folder, I get the following error: image

I am actually not able to find the definitions for these macros across the entire repo(including in csrc/conv/common/pito.h : image

Could you confirm about these?

hossein1387 commented 2 years ago

Could you please confirm on which branch of Pito/BARVINN and MVU you are?

schegde commented 2 years ago

I am currently on origin/master <-> 3649e73b for BARVINN ; origin/master <-> 5e24521b for PITO_RISCV ; and aff7d9d4 for MVU

hossein1387 commented 2 years ago

I am in the process of adding a memory subsystem to BARVINN and our first FPGA target is ALVEO U200. The DMA engine is under construction and the code you see is a left over of this development.

If you just want to try a simple Conv kernel on BARVINN, you can comment line 46 and 54 and the code will perform a Convolution between an input of size 1x3x32x32 and weight size of 64x64x3x3. The computation is divided between 8 MVUs. This code assumes that the data is already prepared in the correct format in input and weight buffers. The purpose of the DMA calls is actually to request the host to send over data in the correct format for the computation.

To use DMA engine and the host, you can follow my work on mem_sub_system branch on Pito. I should have some results soon.

schegde commented 2 years ago

Ahh, I see that makes sense. Thanks for the added clarification about the the DMA engine part being under construction. Sorry for the confusion, you had mentioned about that in #20 . With the lines commented, I am able to generate the firmware files!. I will give a try with full BARVINN simulation now.

hossein1387 commented 2 years ago

Awesome! let me know if you have more questions!

schegde commented 2 years ago

Sorry, needed a bit more clarification. You mentioned the csrc/conv2d.c will do 3x32x32 input with 64x64x3x3 weight. Shouldn't the weights be 3x64x3x3 since we only have 3 input channels? Also for preparing the input and weight RAMs , I can use the MVU_Code_gen repository to generate the weight.hex and input.hex necessary for the conv_tester.sv simulation, right?

hossein1387 commented 2 years ago

oops, I meant input size is 1x64x32x32. And yes, you can use MVU_Code_gen to generate weights and input necessary for the conv_tester.sv.