neurosim / DNN_NeuroSim_V1.3

Benchmark framework of compute-in-memory based accelerators for deep neural network (inference engine focused)
62 stars 36 forks source link

Questions about HTree::CalculateLatency #38

Closed onefanwu closed 10 months ago

onefanwu commented 1 year ago

Hi @neurosim and @alu75 , At line 718 of Chip.cpp, I found that the x_init and y_init of GhTree->CalculateLatency are always 0, which causes the condition "if (((!x_init) && (!y_init)) || ((!x_end) && (!y_end)))" in HTree::CalculateLatency to always be satisfied. And thus, at the same time, x_end and y_end become invalid variables. I'm wondering if this is a bug or if the tileLocaEachLayer is just useless.

Also, at line from 326 to 338 of Chip.cpp, in the calculation of tileLocaEachLayer in ChipFloorPlan, why thisTileTotal is not accumulated from i=0, but from i=1?

neurosim commented 1 year ago

Hi! Thanks for your question. The tileLocaEachLayer is not used so please just ignore it. The leaf-to-leaf transmission in HTree is only used between PEs when novel mapping is applied. The tile input and output always transfer from and to the global buffer instead of directly flowing to the next tile to simplify the dataflow design.

onefanwu commented 1 year ago

Thank you very much for your detailed and critical reply, which is very helpful.

onefanwu commented 1 year ago

Hi @neurosim and @alu75 , I have a follow-up question about H-Tree. When performing matrix-vector multiplication, the input vector should be copied in multiple copies to the corresponding tile-level buffer. According to my understanding, if a matrix is stored as n columns of tiles, then an input vector needs to be copied n times and written to the corresponding tile-level buffer.

However, at line 718 of Chip.cpp, the last argument of "GhTree->CalculateLatency()" only considers the size of one input vector and one output vector, ignoring how many columns of tiles there are.

I am not quite sure if my understanding is correct and I hope you can shed some light on this.

onefanwu commented 1 year ago

Perhaps the number of rows of tiles should be taken into account, just like AdderTree.