stanford-ppl / spatial

Spatial: "Specify Parameterized Accelerators Through Inordinately Abstract Language"
https://spatial.stanford.edu
MIT License
271 stars 33 forks source link

FIFO not duplicated during outer loop unrolling #269

Closed yaqiz01 closed 4 years ago

yaqiz01 commented 4 years ago

FIFO fifoIn read by the unrolled outer loop is not duplicated in the IR. Test FIFOParRead

yaqiz01 commented 4 years ago

Branch issue269_fifo

mattfel1 commented 4 years ago

I'm looking at it now. I think the IR is actually correct but the chisel template is messing up. It banks the FIFO by 2, which is correct since the two unrolled deqs may conflict and it can serve both of them with this banking scheme. The vcs sim gives all 0s now so I'm looking into that.

mattfel1 commented 4 years ago

This is confusing. In the template, I assume that a FIFO needs to serve as many elements as its widest reader. This means that outer loop unrolling of a read, or multiple reads in the same inner controller, are not supported properly in the template even though they are handled correctly during banking. The information about concurrency of the different accesses is lost by the time we reach the chisel template.

I'm going to make the FIFO template a little more complicated by allowing it serve all readers simultaneously, regardless of their concurrency. I don't think this will have too big of an impact since most apps use FIFOs as a single-writer, single-reader type of queue.

yaqiz01 commented 4 years ago

It's actually not a feature I need. I just want to make sure I interpret the IR correctly. If it's too much trouble we can leave it for now

mattfel1 commented 4 years ago

Fixed. Multiple enqs and deqs can operate simultaneously now as long as the banking analyzer banked properly for them.