High-Performance Embedded Systems-on-a-Chip Lecture 12: Executing Alpha Sanjay Rajopadhye Computer Science, Colorado State University High-Performance Embedded Systems-on-a-Chip p.1/10
Outline Operational Semantics High-Performance Embedded Systems-on-a-Chip p.2/10
Outline Operational Semantics Scanning polyhedra High-Performance Embedded Systems-on-a-Chip p.2/10
Outline Operational Semantics Scanning polyhedra Horrendously inefficient code generation High-Performance Embedded Systems-on-a-Chip p.2/10
Outline Operational Semantics Scanning polyhedra Horrendously inefficient code generation (In)efficient code: allocation memory for domains High-Performance Embedded Systems-on-a-Chip p.2/10
Outline Operational Semantics Scanning polyhedra Horrendously inefficient code generation (In)efficient code: allocation memory for domains Efficient code generation High-Performance Embedded Systems-on-a-Chip p.2/10
Operational Semantics of Alpha (expressions) Expressions denote mappings from indices to values Define a function Type that actually (operationally) computes this mapping. is defined recursively Six syntax rules six cases if otherwise High-Performance Embedded Systems-on-a-Chip p.3/10
"! The function High-Performance Embedded Systems-on-a-Chip p.4/10
" function The! $ &% # $ # High-Performance Embedded Systems-on-a-Chip p.4/10
" )) function The! $ &% # $ # + ' ( '( *) ). +, -.-/- -/-.-/0 if +. High-Performance Embedded Systems-on-a-Chip p.4/10
" )) function The! $ &% # $ # + ' ( '( *) ). +, -.-/- -/-.-/0 if +. 21 High-Performance Embedded Systems-on-a-Chip p.4/10
" )) 3 ) function The! $ &% # $ # + ' ( '( *) ). +, -.-/- -/-.-/0 if +. 21 3 High-Performance Embedded Systems-on-a-Chip p.4/10
" )) 3 ) function The! $ &% # $ # + ' ( '( *) ). +, -.-/- -/-.-/0 if +. 21 3 Var 6 245( High-Performance Embedded Systems-on-a-Chip p.4/10
Semantics of Equations Equations do not denote mappings from indices to values High-Performance Embedded Systems-on-a-Chip p.5/10
Semantics of Equations Equations do not denote mappings from indices to values Denotational Semantics: Equations denote additions to a store of definitions High-Performance Embedded Systems-on-a-Chip p.5/10
Semantics of Equations Equations do not denote mappings from indices to values Denotational Semantics: Equations denote additions to a store of definitions Operational Semantics: High-Performance Embedded Systems-on-a-Chip p.5/10
6 Semantics of Equations Equations do not denote mappings from indices to values Denotational Semantics: Equations denote additions to a store of definitions Operational Semantics: 245( = defun Var High-Performance Embedded Systems-on-a-Chip p.5/10
Semantics of programs (systems) Denotational Semantics: programs denote mappings from input variables to output variables (strict) Operational Semantics: 1. Read Input Variables 2. Compute (Local) and Output Variables 3. Write Output Variables High-Performance Embedded Systems-on-a-Chip p.6/10
7 7 Scanning Polyhedra Given a polyhedron Problem: (generate code to) visit (in lexicographic order) all the integer points in High-Performance Embedded Systems-on-a-Chip p.7/10
Nonstrict Operational Semantics 1. Read Input Variables 2. Write Output Variables (computing only those local variables that are necessary) High-Performance Embedded Systems-on-a-Chip p.8/10
Nonstrict Operational Semantics 1. Read Input Variables 2. Write Output Variables (computing only those local variables that are necessary) this will yield horribly inefficient code High-Performance Embedded Systems-on-a-Chip p.8/10
Improvement Use memoization to avoid recomputation Allocate memory, store previously computed values, and evaluate only (at most) once High-Performance Embedded Systems-on-a-Chip p.9/10
Drawbacks and Improvements Main Drawback: Too many context switches factor of 5 to 8 for simple examples High-Performance Embedded Systems-on-a-Chip p.10/10
Drawbacks and Improvements Main Drawback: Too many context switches factor of 5 to 8 for simple examples Solution: Determine a schedule, and visit the points in the domains of the variables in that order High-Performance Embedded Systems-on-a-Chip p.10/10
Drawbacks and Improvements Main Drawback: Too many context switches factor of 5 to 8 for simple examples Solution: Determine a schedule, and visit the points in the domains of the variables in that order Key issues: How to determine a schedule How to exploit this to generate code (scanning unions of polyhedra) High-Performance Embedded Systems-on-a-Chip p.10/10