Introduction to Computer Systems Class 01 15-213 “The Class That Gives CMU Its Zip!” Randal E. Bryant August 30, 2005.

Slides:



Advertisements
Similar presentations
CS492B Analysis of Concurrent Programs Memory Hierarchy Jaehyuk Huh Computer Science, KAIST Part of slides are based on CS:App from CMU.
Advertisements

Program Optimization (Chapter 5)
1 Carnegie Mellon Machine-Level Programming II: Arithmetic & Control / : Introduction to Computer Systems 6 th Lecture, Jan 29, 2015 Carnegie.
Dynamic Memory Management CAS CS210 Ying Ye Boston University.
University of Washington The Hardware/Software Interface CSE351 Spring st Lecture, March 28 Instructor: Luis Ceze Teaching Assistants: Aaron Miller,
University of Washington Last Time For loops  for loop → while loop → do-while loop → goto version  for loop → while loop → goto “jump to middle” version.
Introduction to Computer Systems Topics: Theme Five great realities of computer systems How this fits within CS curriculum S ‘08 class01a.ppt
Machine-Level Programming III: Procedures Apr. 17, 2006 Topics IA32 stack discipline Register saving conventions Creating pointers to local variables CS213.
– 1 – , F’02 ICS05 Instructor: Peter A. Dinda TA: Bin Lin Recitation 4.
Machine-Level Programming III: Procedures Jan 30, 2003
Introduction to Computer Systems* Topics: Theme Five great realities of computer systems How this fits within CS curriculum F ’07 class01a.ppt
Stack Activation Records Topics IA32 stack discipline Register saving conventions Creating pointers to local variables February 6, 2003 CSCE 212H Computer.
Computer Systems: A Programmer’s Perspective
Introduction to Computer Systems Topics: Theme Five great realities of computer systems How this fits within CS curriculum F ’04 class01a.ppt
1 Machine-Level Programming I: Basics Computer Systems Organization Andrew Case Slides adapted from Jinyang Li, Randy Bryant and Dave O’Hallaron.
CS 270 CS 270: Computer Organization Course Overview Instructor: Professor Stephen P. Carl.
Computer Architecture and Operating Systems CS 3230 :Assembly Section Lecture 7 Department of Computer Science and Software Engineering University of Wisconsin-Platteville.
Lee CSCE 312 TAMU 1 Based on slides provided by Randy Bryant and Dave O’Hallaron Machine-Level Programming III: Switch Statements and IA32 Procedures Instructor:
Ithaca College Machine-Level Programming IV: IA32 Procedures Comp 21000: Introduction to Computer Systems & Assembly Lang Spring 2013 * Modified slides.
1 Carnegie Mellon Machine-Level Programming II: Arithmetic & Control : Introduction to Computer Systems 5 th Lecture, Sep. 7, 2010 Carnegie Mellon.
1 Seoul National University Machine-Level Programming II: Arithmetic & Control.
Machine-Level Programming III: Switch Statements and IA32 Procedures Seoul National University.
Fabián E. Bustamante, Spring 2007 Machine-Level Programming III - Procedures Today IA32 stack discipline Register saving conventions Creating pointers.
Lec 1Systems Architecture1 Systems Architecture Lecture 1: Random Access Machines Jeremy R. Johnson Anatole D. Ruslanov William M. Mongan Some material.
1 Carnegie Mellon The course that gives CMU its “Zip”! Course Overview (18-213): Introduction to Computer Systems 1 st Lecture, Aug. 26, 2014 Instructors:
1 Code Optimization. 2 Outline Machine-Independent Optimization –Code motion –Memory optimization Suggested reading –5.2 ~ 5.6.
Assembly Language and Computer Organization Topics: Theme Programming in C Great realities of computer systems How this fits within CS curriculum Logistical.
Assembly Language and Computer Organization Topics: Theme Programming in C Great realities of computer systems How this fits within CS curriculum Logistical.
University of Amsterdam Computer Systems – optimizing program performance Arnoud Visser 1 Computer Systems Optimizing program performance.
Introduction to Computer Systems Topics: Theme Five great realities of computer systems How this fits within CS curriculum Logistical issues F ‘08.
Derived from "x86 Assembly Registers and the Stack" by Rodney BeedeRodney Beede x86 Assembly Registers and the Stack Nov 2009.
Introduction to Computer Systems Topics: Theme Five great realities of computer systems (continued) “The class that bytes”
University of Amsterdam Computer Systems – optimizing program performance Arnoud Visser 1 Computer Systems Optimizing program performance.
Carnegie Mellon 1 Odds and Ends Intro to x86-64 Memory Layout.
Introduction to Computer Systems Topics: Theme Five great realities of computer systems How this fits within CS curriculum F ’06 class01a.ppt
1 Carnegie Mellon Machine-Level Programming II: Arithmetic and Control Lecture, Feb. 28, 2012 These slides are from website which.
Assembly Language and Computer Organization Topics: Theme Programming in C Great realities of computer systems How this fits within CS curriculum Logistical.
Carnegie Mellon 1 Machine-Level Programming I: Basics Lecture, Feb. 21, 2013 These slides are from website which accompanies the.
Machine Independent Optimizations Topics Code motion Reduction in strength Common subexpression sharing.
University of Amsterdam Computer Systems – the instruction set architecture Arnoud Visser 1 Computer Systems The instruction set architecture.
Machine-Dependent Optimization CS 105 “Tour of the Black Holes of Computing”
1 Code Optimization. 2 Outline Machine-Independent Optimization –Code motion –Memory optimization Suggested reading –5.2 ~ 5.6.
1 Writing Cache Friendly Code Make the common case go fast  Focus on the inner loops of the core functions Minimize the misses in the inner loops  Repeated.
IA32 Stack –Region of memory managed with stack discipline –Grows toward lower addresses –Register %esp indicates lowest stack address address of top element.
1 Bryant and O’Hallaron, Computer Systems: A Programmer’s Perspective, Third Edition Carnegie Mellon Course Overview Introduction to Computer Systems 1.
Carnegie Mellon Machine-Level Programming II: Arithmetic & Control /18-243: Introduction to Computer Systems 6th Lecture, 5 June 2012 Carnegie Mellon.
1 Binghamton University Machine-Level Programming II: Arithmetic & Control CS220: Computer Systems II.
Reading Condition Codes (Cont.)
Credits and Disclaimers
The course that gives CMU its “Zip”!
Conditional Branch Example
Computer Systems: A Programmer’s Perspective aka: CS:APP
Homework In-line Assembly Code Machine Language
Assembly Language and Computer Organization
Assembly Language Programming V: In-line Assembly Code
Assembly Language and Computer Organization
Machine-Level Programming 4 Procedures
Introduction to Computer Systems
Machine-Level Programming 2 Control Flow
Machine-Level Programming III: Procedures Sept 18, 2001
Machine-Level Representation of Programs III
Machine-Level Programming: Introduction
COMP 2130 Intro Computer Systems Thompson Rivers University
Optimizing program performance
C structures and Compilation to IA32
Lecture 11: Machine-Dependent Optimization
Credits and Disclaimers
Presentation transcript:

Introduction to Computer Systems Class “The Class That Gives CMU Its Zip!” Randal E. Bryant August 30, 2005

– 2 – , F’05 refbug _fun: pushl%ebp movl$ , %edx movl%esp, %ebp subl$16, %esp movl8(%ebp), %eax fldlLC0 fstpl-8(%ebp) movl%edx, -16(%ebp,%eax,4) fldl-8(%ebp) leave ret double fun(int i) { volatile double d[1] = {3.14}; volatile long int a[2]; a[i] = ; /* Possibly out of bounds */ return d[0]; }

– 3 – , F’05 copyij & copyji void copyji(int src[2048][2048], int dst[2048][2048]) { int i,j; for (j = 0; j < 2048; j++) for (i = 0; i < 2048; i++) dst[i][j] = src[i][j]; } void copyij(int src[2048][2048], int dst[2048][2048]) { int i,j; for (i = 0; i < 2048; i++) for (j = 0; j < 2048; j++) dst[i][j] = src[i][j]; }

– 4 – , F’05 The Memory Mountain Read throughput (MB/s) Stride (words) Working set size (bytes) Pentium III Xeon 550 MHz 16 KB on-chip L1 d-cache 16 KB on-chip L1 i-cache 512 KB off-chip unified L2 cache L1 L2 Mem xe copyij copyji

– 5 – , F’05 abs_combine L21: movl%ebx, 4(%esp) leal-16(%ebp), %eax incl%ebx movl%eax, 8(%esp) movl%edi, (%esp) call_get_vec_element movl-16(%ebp), %eax movl(%esi), %edx imull%edx, %eax movl%eax, (%esi) movl%edi, (%esp) call_vec_length cmpl%ebx, %eax jgL21 void abs_combine(vec_ptr v, long int *dest) { int i; *dest = 1; for (i = 0; i < vec_length(v); i++) { long int val; get_vec_element(v, i, &val); *dest = *dest * val; }

– 6 – , F’05 direct_combine L30: movl(%eax,%edx,4), %ebx incl%edx imull%ebx, %ecx cmpl%esi, %edx jlL30 void direct_combine(vec_ptr v, long int *dest) { int i; int length = vec_length(v); long int *data = get_vec_start(v); long int x = 1; for (i = 0; i < length; i++) { x = x * data[i]; } *dest = x; }

– 7 – , F’05 void parallel_combine(vec_ptr v, long int *dest) { int length = vec_length(v); int limit = length-7; long int *data = get_vec_start(v); long int x = 1; int i; /* Combine 8 elements at a time */ for (i = 0; i < limit; i+=8) { long int t1 = data[i] * data[i+1]; long int t2 = data[i+2] * data[i+3]; long int u1 = t1 * t2; long int t3 = data[i+4] * data[i+5]; long int t4 = data[i+6] * data[i+7]; long int u2 = t3 * t4; x = x * (u1 * u2); } /* Finish any remaining elements */ for (; i < length; i++) { x = x * data[i]; } *dest = x; } parallel_combine

– 8 – , F’05 Role within Curriculum CS 211 Fundamental Structures CS 213 Systems CS 412 Operating Systems CS 411 Compilers Processes Mem. Mgmt Machine Code Optimization Data Structures Applications Programming CS 212 Execution Models CS 441 Networks Network Protocols ECE 447 Architecture ECE 349 Embedded Systems Exec. Model Memory System CS 113 C Programming