Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

In-order Early Halting Fix #294

Merged
merged 12 commits into from
May 19, 2023
Merged

In-order Early Halting Fix #294

merged 12 commits into from
May 19, 2023

Conversation

dANW34V3R
Copy link
Contributor

This pull request adds:

  • Correct tagging of RISC-V multiply and divide instructions
  • Renaming of knownTarget_ to knownOffset_ and fixing the RISC-V assignment to this variable

This pull request fixes:

  • With the specific sequence of instructions: branch, multi-cycle instruction, branch, the in-order core would sometimes incorrectly halt.

    This would only happen in the case that each branch instruction set knownTarget_ to a value outside the valid range defined by the program size. This is due to incorrectly setting the variable as the instruction's own address had not been initialised and so was some garbage value different on each run.

    This caused a halt because the first mispredicted branch causes a bubble when the fetch unit halts not knowing what to fetch next. Once executed, a multicycle instruction is fetched and flows normally through the pipeline. This is immediately followed by another branch which mispredicts in the same way. This puts the pipeline in the state: write-back unit and completion slots empty due to bubble caused by first branch, execute unit stalled while multicycle instruction executes, front end buffers stalled waiting on the execute unit and fetch unit halted due to second branch mispredict.

    The condition for the in-order core to halt was: the fetch unit has halted and the heads of the buffers are empty - in the above state this appears to be the case as, when stalled, the buffers do not swap the head and tail. Therefore, even after being decoded, the second branch is stuck in the tail of the decode to execute buffer and so it appears empty. The completion slots are empty due to the bubble from the first branch and the fetch to decode buffer is empty due to the bubble created by the second branch. The fetch unit has halted as the second branch has predicted outside the valid range. As all conditions are true, the in-order pipeline halts and the simulation ends.

    A test has been created to force this state and fails sometimes before the fix is implemented.

    To fix this, the halting condition is updated so that the head or tail of the buffer is checked depending on whether it is stalled or not and the execute unit is checked to see if there is an instruction currently executing. The test now always passes.

@dANW34V3R dANW34V3R requested review from jj16791, FinnWilkinson and rahahahat and removed request for jj16791 February 28, 2023 16:07
src/include/simeng/Instruction.hh Outdated Show resolved Hide resolved
src/lib/arch/riscv/Instruction_decode.cc Show resolved Hide resolved
src/lib/models/inorder/Core.cc Show resolved Hide resolved
src/lib/models/inorder/Core.cc Show resolved Hide resolved
src/lib/models/inorder/Core.cc Outdated Show resolved Hide resolved
src/lib/pipeline/ExecuteUnit.cc Outdated Show resolved Hide resolved
test/regression/riscv/InorderPipeline.cc Show resolved Hide resolved
@FinnWilkinson FinnWilkinson added the bug Something isn't working label Mar 29, 2023
src/include/simeng/BranchPredictor.hh Outdated Show resolved Hide resolved
src/include/simeng/GenericPredictor.hh Outdated Show resolved Hide resolved
src/include/simeng/Instruction.hh Outdated Show resolved Hide resolved
src/include/simeng/Instruction.hh Outdated Show resolved Hide resolved
src/include/simeng/arch/aarch64/Instruction.hh Outdated Show resolved Hide resolved
src/include/simeng/arch/riscv/Instruction.hh Outdated Show resolved Hide resolved
src/lib/models/inorder/Core.cc Show resolved Hide resolved
@dANW34V3R dANW34V3R merged commit a36e679 into dev May 19, 2023
jj16791 pushed a commit that referenced this pull request May 19, 2023
@dANW34V3R dANW34V3R deleted the earlyHalting branch October 13, 2023 12:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants