High-Performance Embedded High-Performance Embedded - - PowerPoint PPT Presentation

high performance embedded high performance embedded
SMART_READER_LITE
LIVE PREVIEW

High-Performance Embedded High-Performance Embedded - - PowerPoint PPT Presentation

High-Performance Embedded High-Performance Embedded Systems-on-a-Chip Systems-on-a-Chip Sanjay Rajopadhye Sanjay Rajopadhye Computer Science, Colorado State Computer Science, Colorado State University University Lecture 10: Alpha Lecture


slide-1
SLIDE 1

High-Performance Embedded Systems-on-a-Chip Sanjay Rajopadhye Computer Science, Colorado State University Lecture 10: Alpha High-Performance Embedded Systems-on-a-Chip Sanjay Rajopadhye Computer Science, Colorado State University Lecture 10: Alpha

slide-2
SLIDE 2

2

Outline

  • Introduction
  • ALPHA Syntax
  • (Denotational) Semantics
  • Substitution, Normalization, & . . .
  • Change of Basis
slide-3
SLIDE 3

3

Introduction

  • Functional (equational, single-assignment, . . . )
  • Declarative
  • Polyhedral Domains
  • Systems of Affine Recurrences
  • Reductions
  • Data-Parallel
slide-4
SLIDE 4

4

The Essence of Data Parallelism

  • Collections of elementary data objects
  • Pointwise Operations
  • Alignment of different collections
  • Conditional operations on (parts of) collections
  • Reductions/Scans of associative and commutative
  • perators
slide-5
SLIDE 5

5

ALPHA Syntax (BNF)

system Name : Domain ( [Var∗ : Domain of Type]∗) returns ( [Var∗ : Domain of Type]∗) var [Var∗ : Domain of Type]∗ let [Var = Expression ]∗ tel

slide-6
SLIDE 6

6

Alpha Domains

  • Dual Representation of polyhedra: finite number of

inequalities (constraints), or finite number of generators

  • Alpha (external) syntax:

{Idx∗ | [ IdExpr >= IdExpr ]∗ }

  • Internally, both representations are maintained
slide-7
SLIDE 7

7

Alpha Expression Syntax

  • Var| Const

Atomic

  • ExpressionopExpression

Pointwise Ops

  • Domain : Expression

Restriction

  • case [ Expression ]∗ esac

Case

  • Expression. Dep

Affine Dependency where Dep is

( Idx ∗ -> IdExpr ∗)

  • reduce (op, Dep , Expression)

Reduction

slide-8
SLIDE 8

8

Example (Fibonacci)

system FibSys : {N| 1<=N} () returns(F : integer ); var Fib : {i | 1 <= i <= N} of integer let Fib = case {i| i<=2} : 1.(i -> ) ; {i| i>=3} : Fib.(i -> i-1) + Fib.(i -> i-2) ; esac ; F = Fib.( ->N) ; tel ;

slide-9
SLIDE 9

9

Outline

  • Introduction
  • ALPHA Syntax
  • (Denotational) Semantics
  • Substitution, Normalization, & . . .
  • Change of Basis
slide-10
SLIDE 10

10

Semantics of ALPHA Expressions

  • Each expression denotes a function from a domain,

D to a Type (real, integer or boolean)

  • The Semantic function is compositional, and

straightforward (eg, A + B denotes the sum of A and B) . . .

  • Domains too are straightforward
  • . . . except for affine dependency and reductions
slide-11
SLIDE 11

11

Domains of ALPHA Expressions

  • consts, vars

D(c) = Z0 D(V ) = Dom(V )

  • ops

D(e1 op e2) = D(e1) ∩ D(e2)

  • restriction

D(D : e) = D ∩ D(e)

  • case

D(case e1; ..; en; esac) = n

i=1 D(ei)

slide-12
SLIDE 12

12

Affine Dependency

  • Q: What does the expression e.(z → f(z)) mean?
  • A: An expression whose value at z is the same as

the value of e at f(z), for example:

Y = X.(i,j -> i) or Y[i,j] = X[i]

  • Where is it defined?

D(e.(z → f(z))) = f −1(D(e))

slide-13
SLIDE 13

13

Reductions

  • Q: What does reduce(⊕, (z → f(z)), e) mean

(and where is it defined)?

  • A1: Its domain is the projection of D(e), the

domain of e, by f:

D[reduce(⊕, (z → f(z), e))] = f(D(e))

  • A2: Its value at some z′ in this domain is the result
  • f applying ⊕ to the vlaues of e at all points that are

mapped to z′ by f

slide-14
SLIDE 14

14

Outline

  • Introduction
  • ALPHA Syntax
  • (Denotational) Semantics
  • Substitution, Normalization, & . . .
  • Change of Basis
slide-15
SLIDE 15

15

Substitution

substituteInDef[Fib, Fib, 1]; show[] system FibSys : {N| 1<=N} () returns(F : integer ); var Fib : {i | 1 <= i <= N} of integer let Fib = case {i| i<=2} : 1.(i -> ) ; {i| i>=3} : case {i | i<=2}:1.(i->); {i | 3<=i}:Fib.(i->i-1) + Fib.(i->i-2); esac .(i -> i-1) +Fib.(i -> i-2) ; esac ; F = Fib.( ->N) ; tel ;

slide-16
SLIDE 16

16

Normalization: syntax of a normal expression

  • BasicExpr::= Var| Const| Var.Dep | Const.Dep
  • InnerExpr::= BasicExpr| BasicExprop InnerExpr
  • NormalExpr::=

– InnerExpr| Domain :InnerExpr| – case [ InnerExpr]∗ esac – case [ Domain :InnerExpr]∗ esac

slide-17
SLIDE 17

17

Normalization Rules (subset)

No. Replace By Comments 1

e.f e

if f(z) = z 2

(e1 ⊕ e2).f (e1.f) ⊕ (e2.f)

3

e ⊕

case

e1;

. . .

en;

esac case

e ⊕ e1;

. . .

e ⊕ en;

esac

slide-18
SLIDE 18

18

Some More Rules (subset)

No. Replace By Comments 4

(D : e1) ⊕ e2 D : (e1 ⊕ e2)

5

e1 ⊕ (D : e2) D : (e1 ⊕ e2)

6

(e.f1).f2 e.f f = f1 ◦ f2

7

D1 : (D2 : e) D : E D = D1 ∩ D2

8

(D : e).f D′ : (e.f) D′ = f −1(D)

slide-19
SLIDE 19

19

Normalization, example

normalize[]; show[] system FibSys : {N| 1<=N} () returns(F : integer ); var Fib : {i | 1 <= i <= N} of integer let Fib = case {i| i<=2} : 1.(i -> ) ; {i| i=3} : 1.(i ->) + Fib.(i -> i-2) ; {i| i>=4} : Fib.(i -> i-2) + Fib.(i -> i-3) + Fib.(i -> i-2) ; esac ; F = Fib.( ->N) ; tel ;