EPFL-LAP / dynamatic

DHLS (Dynamic High-Level Synthesis) compiler based on MLIR
Other
65 stars 19 forks source link

[LSQ Load] Buffer Needed After LSQ Load #136

Open Jiahui17 opened 2 months ago

Jiahui17 commented 2 months ago

This issue is related to #135

In the benchmark while_loop_2.c in #135, we see that the return value from a load can be used to trigger LSQ group allocation

Currently, our LSQ load port does not buffer the data returned from memory. This has a deadlock risk, as depicted in the following:

why_buffer_after_lsq_load

Here there are two BBs (BB1, BB2, top-to-bottom), each with a load port sending requests to the LSQ. The LSQ's load queue only has 1 slot.

If there is no buffer between the load port in the first BB and the group allocation, we have the depicted deadlock situation:

  1. We cannot allocate in BB2, since there is still one pending load in the queue.
  2. The pending load cannot leave the queue and enter BB1 because it is waiting for the allocation in BB2.

Solution

Just put a buffer after the loadOp to make sure that the token can always leave the load queue.