riscv-perf-model icon indicating copy to clipboard operation
riscv-perf-model copied to clipboard

Fix flushing to rewind Fetch back to flush point

Open ghost opened this issue 2 years ago • 4 comments

For STF reading (and possibly JSON), when the core is flushed, Fetch needs to refetch instructions from the flushed point. Currently it just flushes and keeps going.

ghost avatar Nov 23 '22 20:11 ghost

After attending the perf-model meeting, I got the point that the difficulties are the iterator always goes forward and the STF cannot be read using the index.

So I think we can store the iterator for every branch instruction ( maybe store it in Inst class ), assign it to next_it_ when flushing to rewind Fetch back to the flush point

dingiso avatar Dec 31 '22 03:12 dingiso

So I think we can store the iterator for every branch instruction ( maybe store it in Inst class ), assign it to next_it_ when flushing to rewind Fetch back to the flush point

Yep, you can definitely do that. Or, since it's copyable, store the STF iterator to the instruction itself. Then we can support the two types of flushes:

  1. Inclusive: The instruction should be included in the flush (think about loads/stores that miss in the TLB)
  2. Redirecting: The instruction should not be included in the flush, but fetching starts at the next instruction (think mispredicted branches, RFIs, etc)

If the instruction had the iterator to itself, this can be used to start fetching from either the flushing instruction OR the next instruction. Remember, you can ++ the iterator to get to the next instruction.

klingaard avatar Dec 31 '22 16:12 klingaard

Hey! I am participating in LFX with this project. Can I work on this issue?

lata-11 avatar May 06 '23 17:05 lata-11

Absolutely! Feel free to assign to yourself and let us know (either in this issue or in a discussion post) how you'll be tackling it. Thanks!

klingaard avatar May 07 '23 22:05 klingaard