Dependency Analysis We want to “parallelize” program to make it run faster. For that, we need dependence analysis to ensure correctness.

Slides:



Advertisements
Similar presentations
Programming In C++ Spring Semester 2013 Lecture 3 Programming In C++, Lecture 3 By Umer Rana.
Advertisements

While loops.
How SAS implements structured programming constructs
COSC513 Operating System Research Paper Fundamental Properties of Programming for Parallelism Student: Feng Chen (134192)
Instruction-Level Parallel Processors {Objective: executing two or more instructions in parallel} 4.1 Evolution and overview of ILP-processors 4.2 Dependencies.
Programmability Issues
Optimizing single thread performance Dependence Loop transformations.
EECC551 - Shaaban #1 Fall 2003 lec# Pipelining and Exploiting Instruction-Level Parallelism (ILP) Pipelining increases performance by overlapping.
Supercomputing in Plain English Stupid Compiler Tricks PRESENTERNAME PRESENTERTITLE PRESENTERDEPARTMENT PRESENTERINSTITUTION DAY MONTH DATE YEAR Your Logo.
Loops (Part 1) Computer Science Erwin High School Fall 2014.
Compiler Challenges, Introduction to Data Dependences Allen and Kennedy, Chapter 1, 2.
EECC551 - Shaaban #1 Winter 2002 lec# Pipelining and Exploiting Instruction-Level Parallelism (ILP) Pipelining increases performance by overlapping.
EECC551 - Shaaban #1 Spring 2004 lec# Definition of basic instruction blocks Increasing Instruction-Level Parallelism & Size of Basic Blocks.
Adapted from slides by Marie desJardins
CC0002NI – Computer Programming Computer Programming Er. Saroj Sharan Regmi Week 7.
REPETITION STRUCTURES. Topics Introduction to Repetition Structures The while Loop: a Condition- Controlled Loop The for Loop: a Count-Controlled Loop.
1. Know the different types of flow block 2. Understand how problems can be broken down into smaller problems.
INTRODUCTION TO COMPUTING CHAPTER NO. 06. Compilers and Language Translation Introduction The Compilation Process Phase 1 – Lexical Analysis Phase 2 –
Algorithmic Problem Solving CMSC 201 Adapted from slides by Marie desJardins (Spring 2015 Prof Chang version)
© The McGraw-Hill Companies, 2006 Chapter 4 Implementing methods.
Supercomputing in Plain English Instruction Level Parallelism Henry Neeman Director OU Supercomputing Center for Education & Research October
CPS120 Introduction to Computer Science Iteration (Looping)
Supercomputing in Plain English An Introduction to High Performance Computing Part III: Instruction Level Parallelism and Scalar Optimization Henry Neeman,
Chapter 7 File I/O 1. File, Record & Field 2 The file is just a chunk of disk space set aside for data and given a name. The computer has no idea what.
Pseudocode Simple Program Design Third Edition A Step-by-Step Approach 2.
CS 211: Computer Architecture Lecture 6 Module 2 Exploiting Instruction Level Parallelism with Software Approaches Instructor: Morris Lancaster.
Visual Basic Programming
More on Logic Today we look at the for loop and then put all of this together to look at some more complex forms of logic that a program will need The.
1 Ch. 6 Iteration (Loops) Loops repeat a set of instructions Two types of loops: –Definite loops ( for ) perform instructions explicit number of times.
Parallel Programming & Cluster Computing Stupid Compiler Tricks Henry Neeman, University of Oklahoma Paul Gray, University of Northern Iowa SC08 Education.
CSCI-100 Introduction to Computing
Supercomputing and Science An Introduction to High Performance Computing Part IV: Dependency Analysis and Stupid Compiler Tricks Henry Neeman, Director.
CPS120 Introduction to Computer Science Iteration (Looping)
Fundamentals of Algorithms MCS - 2 Lecture # 5. Representation of Algorithms (continued) Flowcharts.
ALGORITHMS.
 In computer programming, a loop is a sequence of instruction s that is continually repeated until a certain condition is reached.  PHP Loops :  In.
More Python!. Lists, Variables with more than one value Variables can point to more than one value at a time. The simplest way to do this is with a List.
Supercomputing in Plain English Stupid Compiler Tricks Henry Neeman, Director OU Supercomputing Center for Education & Research Blue Waters Undergraduate.
Structured Programming The Basics. Control structures They control the order of execution What order statements will be done in, or whether they will.
GCSE Computing#BristolMet Session Objectives #23 MUST understand what is meant by the programming term iteration SHOULD describe methods of looping used.
Algorithms and Pseudocode
More on Logic Today we look at the for loop and then put all of this together to look at some more complex forms of logic that a program will need The.
Lecture 1 INTRODUCTION TO ALGORITHMS Professor Uday Reddy
Flow Control in Imperative Languages. Activity 1 What does the word: ‘Imperative’ mean? 5mins …having CONTROL and ORDER!
Supercomputing in Plain English An Introduction to High Performance Computing Part IV:Stupid Compiler Tricks Henry Neeman, Director OU Supercomputing Center.
Control Structures WHILE Statement Looping. S E Q C E N U E REPITITION …a step or sequence of steps that are repeated until some condition is satisfied.
CSC263 Tutorial 1 Big-O, Ω, ϴ Trevor Brown
Structured Programming The Basics
Discussion 4 eecs 183 Hannah Westra.
Applied Discrete Mathematics Week 2: Functions and Sequences
Advanced EasyC Jim Cline July 20-21, 2017.
Dependence Analysis Important and difficult
Think What will be the output?
Algorithm Analysis CSE 2011 Winter September 2018.
Parallel Programming & Cluster Computing Stupid Compiler Tricks
Supercomputing in Plain English Stupid Compiler Tricks
Program Design Introduction to Computer Programming By:
Program Flow CSCE 121 J. Michael Moore.
Axiomatic semantics Points to discuss: The assignment statement
Algorithms Take a look at the worksheet. What do we already know, and what will we have to learn in this term?
Applied Discrete Mathematics Week 6: Computation
Algorithm Discovery and Design
Design and Implementation
Problem Solving Designing Algorithms.
ICT Gaming Lesson 2.
Basic Concepts of Algorithm
Programming with Shared Memory Specifying parallelism
IPC144 Introduction to Programming Using C Week 2 – Lesson 2
Presentation transcript:

Dependency Analysis We want to “parallelize” program to make it run faster. For that, we need dependence analysis to ensure correctness

Supercomputing in Plain English: Compilers OU Supercomputing Center for Education & Research 2 What Is Dependency Analysis? Dependency analysis describes of how different parts of a program affect one another, and how various parts require other parts in order to operate correctly. A control dependency governs how different sequences of instructions, specifically branches affect each other. A data dependency governs how different pieces of data affect each other.

Supercomputing in Plain English: Compilers OU Supercomputing Center for Education & Research 3 Why Do Dependencies Matter? Dependencies can affect whether we can execute a particular part of the program in parallel. SLOW If we cannot execute that part of the program in parallel, then it’ll be SLOW.

Supercomputing in Plain English: Compilers OU Supercomputing Center for Education & Research 4 Control Dependencies Every program has a well-defined flow of control that moves from instruction to instruction to instruction. This flow can be affected by several kinds of operations: Loops Branches (if, select case/switch) Function/subroutine calls I/O (typically implemented as calls) Dependencies affect parallelization!

Supercomputing in Plain English: Compilers OU Supercomputing Center for Education & Research 5 Data Dependencies “A data dependence occurs when an instruction is dependent on data from a previous instruction and therefore cannot be moved before the earlier instruction [or executed in parallel].” [6] a = x + y + cos(z); b = a * c; The value of b depends on the value of a, so these two statements must be executed in order.

Supercomputing in Plain English: Compilers OU Supercomputing Center for Education & Research 6 Types of Data Dependence Flow (or True) dependence – read after write “False” dependence Anti-dependence – write after read Output dependence – write after write ??? Input dependence – read after read

Supercomputing in Plain English: Compilers OU Supercomputing Center for Education & Research 7 False Dependencies x = a / b; y = x + 2; x = a – e; Notice that x is assigned two different values, but only one of them is retained after these statements are done executing. In this context, the final value of x is the “output.” Again, we are forced to execute in order.

Supercomputing in Plain English: Compilers OU Supercomputing Center for Education & Research 8 Loop Carried Dependency DO i = 2, length a(i) = a(i-1) + b(i) END DO Here, each iteration of the loop depends on the previous iteration. That is, the iteration i=3 depends on iteration i=2, iteration i=4 depends on i=3, iteration i=5 depends on i=4, etc. This is called a loop carried dependency. There is no way to execute iteration i until after iteration i-1 has completed, so this loop can’t be parallelized.

Stupid Compiler Tricks

Supercomputing in Plain English: Compilers OU Supercomputing Center for Education & Research 10 Variable Renaming x = y * z q = r + x * 2 x = a + b x0 = y * z q = r + x0 * 2 x = a + b BeforeAfter The original code has an output dependency, while the new code doesn’t – but the final value of x is still correct.