PRACTICE QUESTIONS March 16th, 2012 1. Loop fission (also called loop distribution) is a transformation where a single loop is broken into two or more
smaller loops: for I = 1, N S1; S2; endfor I => for I = 1, N S1; endfor I for I = 1, N S2; endfor I
(a)
1.loop interchange/permutation
1.1 Intuitively, if an iteration is dependent on an iteration in its upper left hand corner, permutation is illegal.
1.2 Correctness of general permutation
Transformation matrix: T
Dependence matrix: D
Matrix in which each
Intermediate Representations
Intermediate Representations
Source Code
Front End
IR
Middle End
IR
Back End
Target Code
Front end - produces an intermediate representation (IR) Middle end - transforms the IR into an equivalent IR that
runs more efficiently
Linear Loop Transformations
Story so far
Permutation of perfectly nested loop can be modeled as a linear transformation on the iteration space of the loop nest. Legality of permutation can be determined from the dependence matrix of the loop nest. Transfo
Transformations and Dependences
Recall:
Polyhedral algebra tools for
Determining emptiness of convex polyhedra Enumerating integers in such a polyhedron.
Central ideas:
Reduction of matrices to echelon from by unimodular column operations, Fourier-Mot
Simple Dependence Testing
Main Theme
Determining whether dependencies exist between two subscripted references to the same array in a loop nest
Several tests to detect these dependencies
Basics: Indices and Subscripts
Index: Index variable for some loop s
SIMDization Spring 2012
Vector Processors
Initially developed for super-computing applications, today important for multimedia. Vector processors have high-level operations that work on linear arrays of numbers: "vectors"
SCALAR (1 operation) r1 r2 VECTO
Code Generation Using Fourier Motzkin
Previously Data dependences and loops Loop transformations Unimodular transformation framework Kelly and Pugh transformation framework (affine transformations per statement) Today Code generation use Fourier Motzkin t
Homework 2 (Due March 20th, 2012)
1. [25points] Identify the dependences in the following loop nest and indicate whether (a) they are loopindependent or loop-carried, and (b) whether they are flow, anti or output dependences? for i = 3, 100 U[i] = V[i] +
Global Register Allocation via Graph Coloring CSE 521 Penn State University
Spring 2012
Register Allocation
Part of the compiler's back end
IR
Instruction Selection
m register IR
Register Allocation
k register IR
Instruction Scheduling
Machine code
Errors
Advanced Compiler Construction
CSE 521 Penn State University
Spring 2012
CSE 521
This is CSE 521 - "Advanced Compiler Construction"
Subject Matter
Compiler-based advanced code improvement techniques
Sometimes called "optimization"
Analysis required to
CSc 553 Principles of Compilation 33 : Loop Dependence Department of Computer Science University of Arizona
[email protected] Copyright c 2011 Christian Collberg
Data Dependence Analysis
Data Dependence Analysis I
Dependence Graphs I
There can be three k