Computer Systems Structure - CPU Hazards

Choose a study mode

Play Quiz
Study Flashcards
Spaced Repetition
Chat to Lesson

Podcast

Play an AI-generated podcast conversation about this lesson

Questions and Answers

What action is taken if the instruction is identified as a non-branch instruction?

  • Enter the instruction into the branch-target buffer
  • Continue execution normally (correct)
  • Initiate a misprediction process
  • Jump to the predicted address

What happens when a mispredicted branch occurs?

  • The branch-target buffer is not updated
  • The processor delays the execution to resolve the prediction
  • The fetched instructions are retained for future use
  • The execution is restarted at the correctly predicted address (correct)

What is the function of the branch-target buffer in this context?

  • To track the execution of non-branch instructions
  • To hold all executed instructions
  • To store the address of predicted branch targets (correct)
  • To ensure no branches are taken during execution

During the instruction decoding phase (ID), what determines if the next action involves a branch?

<p>The type of instruction being processed (B)</p> Signup and view all the answers

What does the system do if there is an entry found in the branch-target buffer and the instruction is a taken branch?

<p>Fetch the instruction at the predicted address (D)</p> Signup and view all the answers

What is the primary purpose of the scoreboard method in CPU architecture?

<p>To dynamically schedule a pipeline allowing out-of-order execution when there are no hazards. (B)</p> Signup and view all the answers

Which stage of instruction processing involves checking for structural and write-after-write (WAW) hazards?

<p>Issue (B)</p> Signup and view all the answers

In the scoreboard structure, what does the 'Busy' status indicate?

<p>The functional unit is currently in use. (D)</p> Signup and view all the answers

What must occur before an instruction can proceed to the Read operands stage?

<p>No read-after-write (RAW) hazards are present. (A)</p> Signup and view all the answers

How does the scoreboard handle stalled instructions?

<p>It monitors execution flow until dependencies are resolved before issuing the stalled instruction. (A)</p> Signup and view all the answers

Which hazard type is checked during the Write result stage of instruction processing?

<p>Write-after-read (WAR) (B)</p> Signup and view all the answers

What aspect does the 'Register result status' of the scoreboard indicate?

<p>Which functional unit will write to each register, if applicable. (A)</p> Signup and view all the answers

In which computer was the scoreboard method first used?

<p>CDC 6600 (A)</p> Signup and view all the answers

What is the role of a Tournament predictor in branch prediction?

<p>To combine both global and local predictors with a selector. (B)</p> Signup and view all the answers

How does the 2-bit local predictor perform when dealing with significant branches?

<p>It fails on important branches unless adjusted. (A)</p> Signup and view all the answers

What is included in the Branch Target Buffer (BTB)?

<p>Targets of taken branches stored in associative memory. (B)</p> Signup and view all the answers

What is the size of memory used for 1024 entries in a local and global prediction (2,2) BHT?

<p>8 kbits (B)</p> Signup and view all the answers

What phenomenon occurs when comparing the misprediction rates of different predictors?

<p>Misprediction statistics vary significantly among different prediction strategies. (D)</p> Signup and view all the answers

What is a primary benefit of Tomasulo’s algorithm compared to the Scoreboard method?

<p>It resolves WAR and WAW dependencies. (B)</p> Signup and view all the answers

What is a significant limitation of the Scoreboard method?

<p>It introduces stall phases when required functional units are busy. (A)</p> Signup and view all the answers

Which distinctive feature does Tomasulo’s algorithm employ to manage data dependencies?

<p>Register renaming. (A)</p> Signup and view all the answers

What hardware component is primarily increased in quantity when implementing the Scoreboard method?

<p>Data buses. (B)</p> Signup and view all the answers

What are reservation stations used for in Tomasulo’s algorithm?

<p>To fetch and store instruction operands. (A)</p> Signup and view all the answers

Which is NOT a feature of Tomasulo’s algorithm?

<p>Utilizing control hazards. (B)</p> Signup and view all the answers

What role do redundant functional units serve in Tomasulo's algorithm?

<p>Prevent structural hazards. (C)</p> Signup and view all the answers

Which functional unit is not typically referenced in the context of the P6 architecture?

<p>Graphical Processing Unit. (A)</p> Signup and view all the answers

When is an instruction issued in Tomasulo’s algorithm?

<p>Only if the required functional unit and all operands are available. (B)</p> Signup and view all the answers

In which stage of Tomasulo's algorithm is the instruction's result written back to the destination register?

<p>Write result. (D)</p> Signup and view all the answers

What role does the Re-order Buffer (ROB) serve in a processor's architecture?

<p>It holds data regarding instructions in their original order. (B)</p> Signup and view all the answers

What is the primary benefit of dynamic branch prediction over static branch prediction?

<p>It accounts for historical execution patterns of branches. (A)</p> Signup and view all the answers

Which statement accurately describes the commit stage in Tomasulo’s algorithm?

<p>It transfers data from the re-order buffer to registers or memory. (D)</p> Signup and view all the answers

What is a major drawback of static branch prediction?

<p>It fails in the presence of many conditional jumps. (B)</p> Signup and view all the answers

Which of the following correctly describes the saturating counters used in dynamic branch prediction?

<p>They are binary storage systems with four distinct states. (B)</p> Signup and view all the answers

What occurs when a branch is taken during pipeline execution?

<p>The pipeline must be flushed and reinitialized. (A)</p> Signup and view all the answers

In the context of Netburst architecture, what advantage does scheduling all functional units in advance provide?

<p>It enables functional units to operate with minimal stalling. (D)</p> Signup and view all the answers

How does the branch history table (BHT) aid in dynamic branch prediction?

<p>It keeps a log of all executed branch instructions for future reference. (D)</p> Signup and view all the answers

What type of branches does static prediction identify as always taken?

<p>Unconditional jumps (D)</p> Signup and view all the answers

What is a likely consequence of a branch prediction mismatch?

<p>Reduced processor performance. (C)</p> Signup and view all the answers

What does a two-level adaptive predictor utilize to make predictions?

<p>A pattern of taken and not taken branches (B)</p> Signup and view all the answers

What is the main drawback of a global branch predictor?

<p>It performs poorly with uncorrelated branches. (B)</p> Signup and view all the answers

Which predictors concatenate local and global branch histories?

<p>Hybrid predictor (C)</p> Signup and view all the answers

In a gshare predictor, how is the index in the prediction history table determined?

<p>By XORing the global history buffer with the jump address. (A)</p> Signup and view all the answers

What is the function of local branch prediction?

<p>Storing separate history buffers for each jump instruction. (D)</p> Signup and view all the answers

What type of predictor is used to detect loops in conditional jumps?

<p>Loop predictor (B)</p> Signup and view all the answers

What method does the Agree predictor utilize?

<p>It applies a XOR operation to combine local and global predictors. (A)</p> Signup and view all the answers

What information does the global branch predictor primarily use?

<p>Shared history across all conditional jumps. (D)</p> Signup and view all the answers

What is the primary purpose of the prediction history buffer?

<p>To remember previous branch targets. (D)</p> Signup and view all the answers

What is the role of a pattern history table in branch prediction?

<p>To store the patterns of taken and not taken branches. (D)</p> Signup and view all the answers

Which branch predictor type is characterized by individual history buffers?

<p>Local predictor (C)</p> Signup and view all the answers

Which architecture was noted for using local branch predictors with 4-bit history?

<p>Pentium II and III (B)</p> Signup and view all the answers

What is the influence of a two-bit counter in branch prediction?

<p>It represents the state of each branch prediction. (D)</p> Signup and view all the answers

What is one drawback of using a global branch predictor over a local branch predictor?

<p>It may yield poorer results with uncorrelated jumps. (C)</p> Signup and view all the answers

Flashcards

Scoreboard method

A method for dynamically scheduling a pipeline to execute instructions out-of-order, avoiding conflicts and utilizing available hardware.

Issue (ID1)

The first stage of the Scoreboard method where the instruction is decoded, checked for structural and write-after-write (WAW) hazards, and stalled if necessary.

Read operands (ID2)

The second stage of the Scoreboard method where the instruction waits for read-after-write (RAW) hazards to be resolved before reading operands.

Execution (EX)

The third stage of the Scoreboard method where the instruction performs the operation on the operands, and may take multiple cycles to complete.

Signup and view all the flashcards

Write result (WB)

The final stage of the Scoreboard method where the instruction writes the result to the destination register, stalling if a write-after-read (WAR) hazard occurs.

Signup and view all the flashcards

Scoreboard structure

A component of the Scoreboard method that tracks the status of each instruction and functional unit.

Signup and view all the flashcards

Functional unit status

A section of the Scoreboard structure that keeps track of the state of the functional unit (FU) – if it is busy, the operation being performed, and source and destination registers.

Signup and view all the flashcards

Register result status

A section of the Scoreboard structure that indicates which functional unit will write to each register.

Signup and view all the flashcards

Tomasulo's Algorithm

A technique for addressing structural hazards in pipelined processors. It uses a set of buffers called reservation stations to hold instructions and their operands, allowing multiple instructions to be active simultaneously.

Signup and view all the flashcards

Floating-Point Unit (FPU)

A specialized hardware unit within a processor that performs floating-point operations such as addition, subtraction, multiplication, and division.

Signup and view all the flashcards

Structural Hazard

A type of hazard that occurs when multiple instructions require access to the same resource, such as a functional unit or memory location, simultaneously.

Signup and view all the flashcards

Common Data Bus (CDB)

A special bus within a processor that allows data to be broadcast to multiple locations simultaneously. This helps avoid unnecessary stalls when waiting for data to be written back to a register.

Signup and view all the flashcards

Register Renaming

A technique used in Tomasulo's algorithm to create multiple copies of registers, allowing different instructions to use the same register name without creating data dependencies.

Signup and view all the flashcards

Data Dependency (RAW)

A type of dependency that occurs when an instruction needs to use the result of a previous instruction, but the result is not yet available in the destination register.

Signup and view all the flashcards

Write After Read (WAR) Dependency

A type of dependency that occurs when an instruction needs to write to a register that another instruction is reading from. This can lead to incorrect results unless handled properly.

Signup and view all the flashcards

Write After Write (WAW) Dependency

A type of dependency that occurs when two instructions need to write to the same register. This can lead to incorrect results if the instructions are not executed in the correct order.

Signup and view all the flashcards

Reservation Stations

Buffers within a pipelined processor that hold instructions and their operands during the execution stages. They allow multiple instructions to be active simultaneously and reduce the need to wait for data dependencies.

Signup and view all the flashcards

Commit stage

An extra stage added to the instruction execution sequence, besides issue, execute and write result, in Tomasulo's algorithm.

Signup and view all the flashcards

Re-order buffer (ROB)

A buffer that stores instructions executed out-of-order, allowing for efficient commit in their original order.

Signup and view all the flashcards

Branch prediction

A technique used to optimize program execution by predicting the direction of a branch instruction before it is actually executed.

Signup and view all the flashcards

Static branch prediction

A method of branch prediction based on the nature of the branch instruction itself.

Signup and view all the flashcards

Dynamic branch prediction

A method of branch prediction that uses the history of branch instructions to make more informed predictions.

Signup and view all the flashcards

Next line predictor

A dynamic branch prediction method that stores the pointer to the next instruction or group of instructions, along with the decision and target of the branch.

Signup and view all the flashcards

Saturating counters

A dynamic branch prediction method that uses saturating counters to remember the history of each branch.

Signup and view all the flashcards

Branch History Table (BHT)

A table used to store the decision and target address of every executed conditional jump, which helps predict future executions of the same instructions.

Signup and view all the flashcards

Branch Target Buffer (BTB)

A buffer used to store the target address of branches, which can be quickly accessed during branch prediction.

Signup and view all the flashcards

Prediction state

The state associated with each entry in the BTB, indicating whether a branch is likely to be taken or not. This helps the processor make better predictions.

Signup and view all the flashcards

Correct prediction

When the processor predicts a branch correctly, it can continue fetching instructions from the predicted target address, allowing it to execute instructions without delays.

Signup and view all the flashcards

Misprediction

When the processor predicts a branch incorrectly, it needs to discard the fetched instructions based on the incorrect prediction and start fetching from the actual branch target. This causes a stall in the pipeline.

Signup and view all the flashcards

Local branch prediction

A technique where the prediction is based on the recent history of a specific conditional jump instruction. It uses a separate history buffer for each instruction.

Signup and view all the flashcards

Global branch prediction

A technique where the prediction is based on a shared global history of all conditional jumps. It utilizes correlations between branches for prediction.

Signup and view all the flashcards

Two-level adaptive predictor

A two-level adaptive predictor uses a history buffer (n bits) to track past branch outcomes and a pattern history table to predict future outcomes based on repeating patterns.

Signup and view all the flashcards

Gshare predictor

A type of global branch predictor where the index into the pattern history table is calculated by XOR-ing the global history buffer with the branch address.

Signup and view all the flashcards

Gselect predictor

A type of global branch predictor where the index into the pattern history table is constructed by concatenating the global history buffer and the branch address.

Signup and view all the flashcards

Hybrid branch prediction

A technique that combines local and global branch prediction for a more accurate prediction. It can concatenate local and global histories or make decisions using voting.

Signup and view all the flashcards

Loop predictor

A type of branch prediction that specifically targets loop structures. It tracks loop iterations using a counter and may be part of a hybrid predictor.

Signup and view all the flashcards

Prediction of indirect jumps

A challenge in branch prediction where the jump target has multiple possibilities. It requires storing previous targets and using a larger history buffer.

Signup and view all the flashcards

Prediction of function returns

A technique that uses a copy of the stack to store return addresses of executed functions, enabling prediction of function returns without performing actual jumps.

Signup and view all the flashcards

Local branch predictor in Pentium II/III

A local branch predictor with a 4-bit history buffer and a 16-entry pattern history table for each conditional jump, used in Pentium II and III processors.

Signup and view all the flashcards

Global branch prediction in modern CPUs

Global branch predictors are used in Pentium M, Core 2, and AMD processors, using either gshare or gselect for index calculation.

Signup and view all the flashcards

Alloyed branch prediction

A branch prediction technique that combines local and global histories, sometimes with the branch address, for a more accurate prediction.

Signup and view all the flashcards

Agree predictor

A prediction approach that XORs the predictions of the local and global predictors, used in Pentium 4, for better accuracy.

Signup and view all the flashcards

Loop predictor in a hybrid system

A predictor that is part of a hybrid system and detects loop structures, counting loop iterations and using this information for prediction.

Signup and view all the flashcards

Study Notes

Computer Systems Structure - Central Processing Unit (CPU)

  • The central processing unit (CPU) is a core component of computer systems.

Hazard Cases and Solutions

  • Solutions for hazard cases in CPU pipelines involve techniques like scoreboard methods, Tomasulo's method, and branch prediction.

Scoreboard Method

  • Used initially in the CDC 6600 computer (1966).
  • Dynamically schedules instructions in a pipeline to avoid conflicts, enabling out-of-order execution if hardware is available, and no structural hazards.
  • Logs data dependencies for each instruction.
  • Releases instructions only when the scoreboard confirms no conflicts with previously issued, incomplete instructions.
  • If an instruction stalls due to dependencies, the scoreboard monitors the pipeline to resolve those dependencies before continuing the stalled instruction.
  • Instructions progress through four stages (Issue, Decode, Read Operands, Execution, Write result) before completion.
  • Stages include operations like checking for structural and WAW hazards, and waiting for RAW hazards resolution.
  • Scoreboard hardware has a similar cost to an FPU but could be more demanding on buses in modern processors.
  • Important to note, this method does not handle forwarding.
  • Stalls occur when required functional units are busy, affecting subsequent instructions.

Tomasulo's Algorithm

  • Avoids structural hazards and resolves WAR and WAW hazards using register renaming and a Common Data Bus (CDB).
  • Used first in IBM 360/91 computer (1969).
  • Employs register renaming to create multiple copies of physical registers, minimizing dependencies.
  • Real data dependencies cause no problems, unlike the limited number of registers causing a bottleneck.
  • Data is placed on a CDB, and made available promptly, avoiding unnecessary delays in execution until the data is written into the destination register.
  • Instructions proceed through issue, execute, write stages, carefully managing RAW dependencies and utilizing virtual values until real ones become available.
  • Crucial to note this addresses issues not resolved by the scoreboard method.

Reservation Stations

  • Buffers that acquire and store instruction operands for immediate availability.
  • Reservation stations keep the data and result of an instruction.
  • Points to registers (data is available) or other reservation stations containing necessary data before writing back to a register.
  • Stores the result of an instruction execution and releases functional units once instruction execution completes.
  • This release then makes results available for other reservation stations, avoiding delays.

Branch Prediction

  • A method for mitigating control hazards caused by conditional jumps, by predicting the correct branch path.
  • Static prediction is based on analyzing the branch instruction itself, to determine if it will take the branch or not. Common cases like procedure calls and unconditional jumps are analyzed to predict the decision.
  • Dynamic prediction incorporates history of previous branch executions, to predict future behavior.
  • Methods include next line prediction, and saturating counters.

Branch Prediction Methods (Dynamic)

  • Next line predictor - Method stores the address of the next instruction(s) after the jump, along with the branch target address.
  • Saturating counters - Use one or two bits to keep track of the decision taken in past executions. States such as Strongly not taken, weakly not taken, weakly taken, and strongly taken are used.
  • Various prediction methods and modifications such as Two-level adaptive prediction, are described.

Branch Target Buffer (BTB)

  • A dedicated structure containing target addresses for taken branches from past calculations, enabling faster future evaluation. -Contains jump instruction address, target address, and prediction state.

Tournament Predictor

  • A powerful prediction method that combines local and global information using a selector to determine the ideal prediction based on a given branch.

Correlated Prediction - Overview

  • This method combines aspects of local and global prediction, to improve accuracy.
  • It considers a history table where each entry is assigned four predictors.

Misprediction Statistics/General

  • Statistics about misprediction rates from simulations of the different architectures.
  • Various configurations can be evaluated (number of entries, or bits per history table entry).

Commit Stage (Tomasulo's Algorithm)

  • An additional stage in Tomasulo's algorithm, ROB (Reorder Buffer) assists in committing instructions in the correct order, even if their execution was out of order.
  • Results are written to the ROB (Reorder Buffer) and not directly into the final destinations to allow for later reordering and avoiding pipeline stalls.

Studying That Suits You

Use AI to generate personalized quizzes and flashcards to suit your learning preferences.

Quiz Team

Related Documents

More Like This

Understanding CPU Pipeline Stages and Hazards
12 questions

HandierConnemara618 avatar
HandierConnemara618
Hazards in Pipelined Processing
41 questions

Hazards in Pipelined Processing

IllustriousSuccess3527 avatar
IllustriousSuccess3527
Computer System Structure: The CPU
20 questions
Use Quizgecko on...
Browser
Browser