CS 230 – Introduction to Computers and Computer Systems Lecture 14 – Performance Measures CS 230 - Spring 2020 3-1
CPU Clocking Clock period also called cycle time duration of a clock cycle in units of time SI units of time in seconds per clock cycle ps = 10 -12 s ns = 10 -9 s μ s = 10 -6 s ms = 10 -3 s example 250ps = 0.25ns = 250*10 -12 s CS 230 - Spring 2020 3-2
CPU Clocking Clock frequency inverse of clock period measured in cycles per second: Hertz (Hz) SI units of Hz: THz = 10 12 Hz GHz = 10 9 Hz MHz = 10 6 Hz KHz = 10 3 Hz example processor with a clock period of 250ps = 250*10 -12 s Inverse(250*10 -12 s) = 0.004*10 12 Hz = 0.004THz = 4GHz CS 230 - Spring 2020 3-3
Instruction Count and CPI Cycles per instruction abbreviated CPI determined by instruction set architecture (ISA) different CPUs/programs might have different CPI different instruction types can take different numbers of cycles not all ISAs use the 5-stage pipeline Instruction count total number of instructions run in a program CS 230 - Spring 2020 3-4
Instruction Count and CPI CPU Time time spent executing instructions in a program only the instructions that actually run does not include waiting for input or other devices Performance equation: CPU Time = Instruction count CPI Clock period CS 230 - Spring 2020 3-5
Example Consider the following cycle time table for some ISA: Instruction Type Branch Memory Everything Else Cycles 5 13 3 How many cycles does the below program take to execute on a processor built with that ISA? addi $3, $0, 14 addi $30, $30, -8 sw $3, 0($30) bne $3, $0, x sw $2, 4($30) x: lw $2, 0($30) addi $30, $30, 8 jr $31 CS 230 - Spring 2020 3-6
Example Consider the following cycle time table for some ISA: Instruction Type Branch Memory Everything Else Cycles 5 13 3 How many cycles does the below program take to execute on a processor built with that ISA? addi $3, $0, 14 3 addi $30, $30, -8 3 sw $3, 0($30) bne $3, $0, x sw $2, 4($30) x: lw $2, 0($30) addi $30, $30, 8 jr $31 CS 230 - Spring 2020 3-7
Example Consider the following cycle time table for some ISA: Instruction Type Branch Memory Everything Else Cycles 5 13 3 How many cycles does the below program take to execute on a processor built with that ISA? addi $3, $0, 14 3 addi $30, $30, -8 3 sw $3, 0($30) 13 bne $3, $0, x sw $2, 4($30) x: lw $2, 0($30) addi $30, $30, 8 jr $31 CS 230 - Spring 2020 3-8
Example Consider the following cycle time table for some ISA: Instruction Type Branch Memory Everything Else Cycles 5 13 3 How many cycles does the below program take to execute on a processor built with that ISA? addi $3, $0, 14 3 addi $30, $30, -8 3 sw $3, 0($30) 13 bne $3, $0, x 5 sw $2, 4($30) x: lw $2, 0($30) addi $30, $30, 8 jr $31 CS 230 - Spring 2020 3-9
Example Consider the following cycle time table for some ISA: Instruction Type Branch Memory Everything Else Cycles 5 13 3 How many cycles does the below program take to execute on a processor built with that ISA? addi $3, $0, 14 3 addi $30, $30, -8 3 sw $3, 0($30) 13 bne $3, $0, x 5 sw $2, 4($30) x: lw $2, 0($30) 13 addi $30, $30, 8 jr $31 CS 230 - Spring 2020 3-10
Example Consider the following cycle time table for some ISA: Instruction Type Branch Memory Everything Else Cycles 5 13 3 How many cycles does the below program take to execute on a processor built with that ISA? addi $3, $0, 14 3 addi $30, $30, -8 3 sw $3, 0($30) 13 bne $3, $0, x 5 sw $2, 4($30) x: lw $2, 0($30) 13 addi $30, $30, 8 3 jr $31 3 CS 230 - Spring 2020 3-11
Example Consider the following cycle time table for some ISA: Instruction Type Branch Memory Everything Else Cycles 5 13 3 How many cycles does the below program take to execute on a processor built with that ISA? addi $3, $0, 14 3 addi $30, $30, -8 3 sw $3, 0($30) 13 bne $3, $0, x 5 sw $2, 4($30) x: lw $2, 0($30) 13 addi $30, $30, 8 3 jr $31 + 3 43 cycles CS 230 - Spring 2020 3-12
Example What is the CPI for the processor on that program? addi $3, $0, 14 addi $30, $30, -8 sw $3, 0($30) bne $3, $0, x sw $2, 4($30) x: lw $2, 0($30) addi $30, $30, 8 jr $31 CS 230 - Spring 2020 3-13
Example What is the CPI for the processor on that program? addi $3, $0, 14 3 addi $30, $30, -8 3 sw $3, 0($30) 13 bne $3, $0, x 5 sw $2, 4($30) x: lw $2, 0($30) 13 addi $30, $30, 8 3 jr $31 + 3 43 cycles CS 230 - Spring 2020 3-14
Example What is the CPI for the processor on that program? addi $3, $0, 14 3 addi $30, $30, -8 3 sw $3, 0($30) 13 bne $3, $0, x 5 sw $2, 4($30) x: lw $2, 0($30) 13 addi $30, $30, 8 3 jr $31 + 3 43 cycles 7 instructions CS 230 - Spring 2020 3-15
Example What is the CPI for the processor running that program? addi $3, $0, 14 3 addi $30, $30, -8 3 sw $3, 0($30) 13 bne $3, $0, x 5 sw $2, 4($30) x: lw $2, 0($30) 13 addi $30, $30, 8 3 jr $31 + 3 43 cycles 7 instructions 43 cycles 7 instructions CS 230 - Spring 2020 3-16
Example What is the CPI for the processor running that program? addi $3, $0, 14 3 addi $30, $30, -8 3 sw $3, 0($30) 13 bne $3, $0, x 5 sw $2, 4($30) x: lw $2, 0($30) 13 addi $30, $30, 8 3 jr $31 + 3 43 cycles 7 instructions 43 cycles = 6.14 CPI 7 instructions CS 230 - Spring 2020 3-17
Example How long would this program take to execute if the processor was running at a clock frequency of 5GHz? addi $3, $0, 14 addi $30, $30, -8 sw $3, 0($30) bne $3, $0, x sw $2, 4($30) x: lw $2, 0($30) addi $30, $30, 8 jr $31 CS 230 - Spring 2020 3-18
Example How long would this program take to execute if the processor was running at a clock frequency of 5GHz? addi $3, $0, 14 addi $30, $30, -8 sw $3, 0($30) bne $3, $0, x sw $2, 4($30) x: lw $2, 0($30) addi $30, $30, 8 jr $31 7 instructions 6.14 CPI CS 230 - Spring 2020 3-19
Example How long would this program take to execute if the processor was running at a clock frequency of 5GHz? addi $3, $0, 14 addi $30, $30, -8 sw $3, 0($30) bne $3, $0, x sw $2, 4($30) x: lw $2, 0($30) addi $30, $30, 8 jr $31 7 instructions 6.14 CPI 1 5GHz CS 230 - Spring 2020 3-20
Example How long would this program take to execute if the processor was running at a clock frequency of 5GHz? addi $3, $0, 14 addi $30, $30, -8 sw $3, 0($30) bne $3, $0, x sw $2, 4($30) x: lw $2, 0($30) addi $30, $30, 8 jr $31 7 instructions 6.14 CPI 1 = 0.2 ns/cycle 5GHz CS 230 - Spring 2020 3-21
Example How long would this program take to execute if the processor was running at a clock frequency of 5GHz? addi $3, $0, 14 addi $30, $30, -8 sw $3, 0($30) bne $3, $0, x sw $2, 4($30) x: lw $2, 0($30) addi $30, $30, 8 jr $31 7 instructions 6.14 CPI 1 = 0.2 ns/cycle 5GHz 7 instr. 6.14 CPI 0.2ns/cycle CS 230 - Spring 2020 3-22
Example How long would this program take to execute if the processor was running at a clock frequency of 5GHz? addi $3, $0, 14 addi $30, $30, -8 sw $3, 0($30) bne $3, $0, x sw $2, 4($30) x: lw $2, 0($30) addi $30, $30, 8 jr $31 7 instructions 6.14 CPI 1 = 0.2 ns/cycle 5GHz 7 instr. 6.14 CPI 0.2ns/cycle = 8.6ns CS 230 - Spring 2020 3-23
Try it Yourself Consider the following cycle time table for some ISA: Instruction Type Branch Memory Mult/Div Everything Else Cycles 6 9 4 2 How many cycles does the below program take to execute on a processor built with that ISA? If that processor ran at 100MHz, how long would it take? What is the CPI? addi $1, $0, 15 addi $2, $1, 3 mult $1, $2 mflo $3 bne $3, $1, x sw $2, 4($8) x: jr $31 CS 230 - Spring 2020 3-24
Try it Yourself Consider the following cycle time table for some ISA: Instruction Type Branch Memory Mult/Div Everything Else Cycles 6 9 4 2 How many cycles does the below program take to execute on a processor built with that ISA? If that processor ran at 100MHz, how long would it take? What is the CPI? addi $1, $0, 15 2 addi $2, $1, 3 2 mult $1, $2 4 mflo $3 2 bne $3, $1, x 6 sw $2, 4($8) x: jr $31 2 CS 230 - Spring 2020 3-25
Try it Yourself Consider the following cycle time table for some ISA: Instruction Type Branch Memory Mult/Div Everything Else Cycles 6 9 4 2 How many cycles does the below program take to execute on a processor built with that ISA? If that processor ran at 100MHz, how long would it take? What is the CPI? addi $1, $0, 15 2 addi $2, $1, 3 2 mult $1, $2 4 mflo $3 2 bne $3, $1, x 6 sw $2, 4($8) x: jr $31 + 2 18 cycles CS 230 - Spring 2020 3-26
Recommend
More recommend