Docsity

Computer Architecture Lecture 3: Performance, Technology & Delay Modeling, Slides of Computer Science

Partial preview of the text

Download Computer Architecture Lecture 3: Performance, Technology & Delay Modeling and more Slides Computer Science in PDF only on Docsity!

CS 152: Computer Architecture

and Engineering

Lecture 3

Performance, Technology & Delay Modeling

Review: Salient features of MIPS I

  • 32-bit fixed format inst (3 formats)
  • 32 32-bit GPR (R0 contains zero) and 32 FP registers

(+ HI LO)

  • Partitioned by software convention
  • 3-address, reg-reg arithmetic instr.
  • Single address mode for load/store:

base+displacement

  • No indirection, scaled
  • 16-bit immediate plus LUI
  • Simple branch conditions
  • Compare against zero or two registers for =,≠
  • No integer condition codes
  • Support for 8 bit, 16 bit, and 32 bit integers
  • Support for 32 bit and 64 bit floating point

Review: When Does MIPS Sign Extend?

  • When value is sign extended, copy upper bit to full value:

Examples of sign extending 8 bits to 16 bits:

  • When is an immediate value sign extended?
    • Arithmetic instructions (add, sub, etc.) sign extend immediates even for the unsigned versions of the instructions!
    • Logical instructions do not sign extend

addi $r2, $r3, -1 has 0xFFFF in immediate field and will extend to 0xFFFFFFFF before adding

andi $r2, $r3, -1 has 0xFFFF in immediate field and will extend to 0x0000FFFF before anding

  • Kinda weird to put negative numbers in logical instructions

Review: Details of the MIPS Instruction Set

  • Register zero always has the value zero (even if you try to write it)
  • Branch/jump and link put the return addr.

PC+4 into the link register (R31), also called “ra”

  • All instructions change all 32 bits of the destination register

(including lui, lb, lh) and all read all 32 bits of sources (add, and, …)

  • Difference between signed and unsigned versions:
    • For add and subtract: signed causes exception on overflow » No difference in sign-extension behavior!
    • For multiply and divide, distinguishes type of operation
  • Thus, overflow can occur in these arithmetic and logical instructions:
    • add, sub, addi
    • it cannot occur in addu, subu, addiu, and, or, xor, nor, shifts, mult, multu, div, divu
  • Immediate arithmetic & logical instructions are extended as follows:
    • logical immediates ops are zero extended to 32 bits
    • arithmetic immediates ops are sign extended to 32 bits (including addu)
  • Data loaded by the instructions lb and lh are extended as follows:
    • lbu, lhu are zero extended
    • lb, lh are sign extended

Two Notions of “Performance”

Which has higher performance?

  • Time to do the task (Execution Time)
    • execution time, response time, latency
  • Tasks per day, hour, week, sec, ns. .. (Performance)
    • throughput, bandwidth

Response time and throughput often are in opposition

Plane

Boeing 747

BAD/Sud Concorde

Speed

610 mph

1350 mph

DC to Paris

6.5 hours

3 hours

Passengers

Throughput (pmph)

Definitions

• Performance is in units of things-per-second

  • bigger is better

• If we are primarily concerned with response time

  • performance(x) = 1

execution_time(x)

" X is n times faster than Y" means

Performance(X)

n = ----------------------

Performance(Y)

Basis of Evaluation

Actual Target Workload

Full Application Benchmarks

Small “Kernel” Benchmarks

Microbenchmarks

Pros Cons

  • representative
    • very specific
    • non-portable
    • difficult to run, or measure
    • hard to identify cause
  • portable
  • widely used
  • improvements useful in reality
  • easy to run, early in design cycle
  • identify peak capability and potential bottlenecks
    • less representative
    • easy to “fool”
    • “peak” may be a long way from application performance

SPEC

  • Eighteen application benchmarks (with

inputs) reflecting a technical computing

workload

  • Eight integer
    • go, m88ksim, gcc, compress, li, ijpeg, perl, vortex
  • Ten floating-point intensive
    • tomcatv, swim, su2cor, hydro2d, mgrid, applu,

turb3d, apsi, fppp, wave

  • Must run with standard compiler flags
    • eliminate special undocumented incantations that

may not even generate working code for real

programs

CPI

CPU time = ClockCycleTime * ΣCPI * I

i = 1
n
i i

CPI = Σ CPI * F where F = I

i = 1
n
i i i i

Instruction Count "instruction frequency"

Invest Resources where time is Spent!

CPI (^) ave = (CPU Time * Clock Rate) / Instruction Count = Clock Cycles / Instruction Count

“Average cycles per instruction”

Aspects of CPU Performance

CPU time = Seconds = Instructions x Cycles x Seconds Program Program Instruction Cycle

instr count CPI clock rate

Program

Compiler

Instr. Set

Organization

Technology

Example (RISC Processor)

Typical Mix

Base Machine (Reg / Reg)

Op Freq Cycles CPI(i) % Time

ALU 50% 1 .5 23%

Load 20% 5 1.0 45%

Store 10% 3 .3 14%

Branch 20% 2 .4 18%

How much faster would the machine be if a better data cache

reduced the average load time to 2 cycles?

How does this compare with using branch prediction to shave a

cycle off the branch time?

What if two ALU instructions could be executed at once?

Summary: Evaluating Instruction Sets and Implementation

  • Design-time metrics:
    • Can it be implemented, in how long, at what cost?
    • Can it be programmed? Ease of compilation?
  • Static Metrics:
    • How many bytes does the program occupy in memory?
  • Dynamic Metrics:
    • How many instructions are executed?
    • How many bytes does the processor fetch to execute the program?
    • How many clocks are required per instruction?
    • How "lean" a clock is practical?
  • Best Metric:

Time to execute the program!

NOTE: Depends on instructions set, processor organization, and compilation techniques.

CPI

Inst. Count Cycle Time

Finite State Machines:

  • System state is explicit in representation
  • Transitions between states represented as arrows with inputs on

arcs

  • Output may be either part of state or on arcs

Alpha/

Delta/

Beta/

“Mod 3 Machine”

Input (MSB first)

Mod 3

Mealey Machine”

Moore Machine”

Implementation as Combinational Logic + Latch

Alpha/

Delta/

Beta/

Latch

Combinational

Logic Input Stateold Statenew Div

0 0 0

00 01 10

00 10 01

0 0 1 1 1 1

00 01 10

01 00 10

0 1 1