Speculative Execution Flashcards
Define speculative execution
A performance technique where the processor busses the outcome of condition operations, such as branch instructions and begins excepting instructions ahead of time
What is the goal of speculative execution
Goal is to keep the processor’s pipeline filled with instructions, improving efficiency and mining idle time while waiting for decisions
How does Speculative work
- Processor keeps track of the state of registers, memory, and other resources
- If the speculative is correct, the results are committed to the processor’s architectural state (i.e. the final state visible to software)
- If the speculative is incorrect, the speculative instructions are discarded, the pipeline is flushed, and the processor rolls back to the correct state before the branch, restating execution from the correct path
what is speculative execution based off
previous branch executions
How does speculative execution improve CPU performance
By executing instructions ahead of time based on branch predictions, speculative execution minimizes idle cycles and increases throughput, allowing the CPU to work on multiple tasks simultaneously
What role does branch prediction play in speculative execution?
Branch prediction estimates which path a conditional branch will take. The CPU then speculatively executes instructions along the predicted path and later discards the results if the prediction was incorrect.
What is a rollback in the context of speculative execution?
A rollback is the process by which the CPU discards the results of speculatively executed instructions when it turns out the branch prediction was wrong, ensuring that no incorrect data affects the program’s state.
What is in-order execution
Instructions are executed in the exact sequence they appear in the program.
If one instruction is delayed (e.g. waiting for a memory load), the entire pipeline can stall, waiting for an instruction to complete
What is out-of-order execution
the processor does not have to wait fro earlier instructions to complete if later instructions are ready to execute
It can bypass stalled instructions and execute other that have necessary resources and data