Dulranga's Notes
Semester 3Computer Architecture

Superscalar Architecture

With pipelined processing, we can achieve at most IPC=1, this is "Scalar Architecture" With superscalar architecture, we can achieve IPC>1

Flynn's Bottleneck

The limit on a scalar pipelined processor: it can fetch, decode and issue at most one instruction per clock cycle. This caps throughput at IPC ≤ 1, however well the pipeline is optimized.

Data Level Parallelism

This is basically "batch processing". i.e. Processing different parts of a big dataset using multiple processing units. but the task happening in units are same. Ex: Summing up a huge array of numbers.

  • First 1000 elements - Unit 1
  • Second 1000 elements - Unit 2
  • etc

Task Level Parallelism

Separating different tasks into different processing units.

Instruction Level Parallelism

Executing different instructions in parallel. This is the key improvement to achieve 1 < IPC

Core Components

ComponentRole
Wide fetch/decodePulls several instructions from the instruction cache each cycle
Multiple execution unitsE.g., several ALUs, FPUs, load/store units and branch units
Dispatch/issue logicDecides which instructions can safely run together
Register renamingRemoves false dependencies (WAR, WAW) by mapping architectural registers to a larger set of physical registers
Reservation stations / issue queuesHold instructions until their operands are ready
Reorder buffer (ROB)Makes results commit in program order, which keeps exceptions precise
Branch predictorGuesses branch outcomes so the pipeline stays full

Out of Order Execution (OoO)

Instructions that are independent from other instructions, even though they are maybe written after others, can be executed out of order and reorder when getting out from the processor.

1: LOAD  R1, [mem]     ; cache miss, takes ~100 cycles
2: ADD   R2, R1, R3    ; depends on R1 (must wait for instruction 1)
3: MUL   R4, R5, R6     ; independent
4: SUB   R7, R8, R9     ; independent

The execution order might be 1 → 3 → 4 → 2, but the committed order is 1 → 2 → 3 → 4.

Re Order Buffer (ROB)

This buffer is used to hold all the "executed instructions" while they are waiting for the not executed onces to be finished to maintain order when released from the processor

Data Hazards

Read after Write (RAW)

It is also known as True dependency or Flow dependency. It occurs when the value produced by an instruction is required by a subsequent instruction. For example,

ADD R1, --, --;  
SUB --, R1, --;

Stalls are required to handle these hazards. 

Write after Read (WAR)

False Dependency (ie. does not need to be written to the same register)

It is also known as anti dependency. These hazards occur when the output register of an instruction is used right after read by a previous instruction. For example,

ADD --, R1, --;  
SUB R1, --, --;

Write after Write (WAW)

false dependency

It is also known as output dependency. These hazards occur when the output register of an instruction is used for write after written by previous instruction. For example,

ADD R1, --, --;  
SUB R1, --, --;

Read after Read (RAR)

It occurs when the instruction both read from the same register. For example,

ADD --, R1, --;  
SUB --, R1, --;

Since reading a register value does not change the register value, these Read after Read (RAR) hazards don't cause a problem for the processor.

Register Renaming

this can remove false dependancies easily. We physically assign a different register to two instructions when they perform WAR or WAW instructions. First instruction will read/write into a different register than the second instruction.

Flynn's Taxonomy

flynn-taxonomy.png

SISD (Single Instruction, Single Data)

  • This is a traditional sequential uniprocessor. One instruction stream operates on one data stream.
  • Examples are old single-core CPUs and simple microcontrollers.

SIMD (Single Instruction, Multiple Data)

  • One instruction is applied to many data elements at once.
  • It suits data-parallel work such as graphics, image processing and matrix operations.
  • Examples are x86 SSE/AVX, ARM NEON and GPUs (which are strictly SIMT, a close relative).
for i in 0..3: C[i] = A[i] + B[i]   // one vector ADD handles all four

MISD (Multiple Instruction, Single Data)

  • Several different instructions operate on the same data stream.
  • It is rare in practice. It is sometimes associated with fault-tolerant systems that run redundant computations on the same input and compare the results, such as flight control computers.

MIMD (Multiple Instruction, Multiple Data)

  • Independent processors run different instructions on different data.
  • This is the most common form of parallel system today.
  • Examples are multicore CPUs, clusters and distributed systems.
  • It is often subdivided into shared-memory and distributed-memory (message-passing) systems.

On this page