CPEG 852 Advanced Topics in Computing Systems The Dataflow Model of Computation

Size: px
Start display at page:

Download "CPEG 852 Advanced Topics in Computing Systems The Dataflow Model of Computation"

Transcription

1 CPEG 852 Advanced Topics in Computing Systems The Dataflow Model of Computation Dynamic Dataflow Stéphane Zuckerman Computer Architecture & Parallel Systems Laboratory Electrical & Computer Engineering Dept. University of Delaware 140 Evans Hall Newark,DE 19716, United States September 8, 2015 S.Zuckerman CPEG852 Fall 15 Dataflow MoC 1 / 42

2 Outline 1 What We Know of Dataflow So Far... Static Dataflow Examples Static Dataflow Features Static Dataflow Activity Templates Recursive Program Graphs Ordinary and Tail Recursions 2 Dynamic Dataflow Introduction Dynamic Dataflow Model of Computation Dynamic Dataflow I-Structures A Bit of Theory... Dynamic Dataflow Architectures Dynamic Dataflow Architectures 3 Homework S.Zuckerman CPEG852 Fall 15 Dataflow MoC 2 / 42

3 Outline 1 What We Know of Dataflow So Far... Static Dataflow Examples Static Dataflow Features Static Dataflow Activity Templates Recursive Program Graphs Ordinary and Tail Recursions 2 Dynamic Dataflow Introduction Dynamic Dataflow Model of Computation Dynamic Dataflow I-Structures A Bit of Theory... Dynamic Dataflow Architectures Dynamic Dataflow Architectures 3 Homework S.Zuckerman CPEG852 Fall 15 Dataflow MoC 3 / 42

4 Reminder: Dataflow Model of Computation S.Zuckerman CPEG852 Fall 15 Dataflow MoC 4 / 42

5 Reminder: Dataflow Model of Computation S.Zuckerman CPEG852 Fall 15 Dataflow MoC 4 / 42

6 Reminder: Dataflow Model of Computation S.Zuckerman CPEG852 Fall 15 Dataflow MoC 4 / 42

7 Reminder: Dataflow Model of Computation S.Zuckerman CPEG852 Fall 15 Dataflow MoC 4 / 42

8 Reminder: Dataflow Model of Computation S.Zuckerman CPEG852 Fall 15 Dataflow MoC 4 / 42

9 Conditional Expressions Figure : if/else construct S.Zuckerman CPEG852 Fall 15 Dataflow MoC 5 / 42

10 Conditional Expressions Figure : if/else schema S.Zuckerman CPEG852 Fall 15 Dataflow MoC 5 / 42

11 Conditional Expressions Figure : loop schema S.Zuckerman CPEG852 Fall 15 Dataflow MoC 5 / 42

12 Static Dataflow The Golden Rule Static Dataflow s Golden Rule... for any actor to be enabled, there must be no tokens on any of its output arcs... S.Zuckerman CPEG852 Fall 15 Dataflow MoC 6 / 42

13 Example Power Function long power ( i n t x, i n t n) { i n t y = 1; f o r ( i n t i = n; i > 0; --i) y *= x; r e t u r n y; } Figure : Computation: y = x n S.Zuckerman CPEG852 Fall 15 Dataflow MoC 7 / 42

14 Example Power Function Computing y = 2 n S.Zuckerman CPEG852 Fall 15 Dataflow MoC 8 / 42

15 Static Dataflow Features One-token-per-arc Deterministic merge Conditional/iteration construction Consecutive iterations of a loop can only be pipelined A dataflow graph activity templates Opcode of the represented instruction Operand slots for holding operand values Destination address fields Token value + destination S.Zuckerman CPEG852 Fall 15 Dataflow MoC 9 / 42

16 Static Dataflow Activity Templates S.Zuckerman CPEG852 Fall 15 Dataflow MoC 10 / 42

17 Recursive Program Graphs Extension over static dataflow concepts Graph must be acyclic (DAG, directed acyclic graph) One-token-per-arc-per-invocation Iteration is expressed in terms of tail recursion S.Zuckerman CPEG852 Fall 15 Dataflow MoC 11 / 42

18 Examples of Ordinary Recursion Factorial long factorial ( long n) { i f (n == 0) r e t u r n 1; e l s e r e t u r n n * fact (n -1); } S.Zuckerman CPEG852 Fall 15 Dataflow MoC 12 / 42

19 Example Factorial DFG for fact(3) S.Zuckerman CPEG852 Fall 15 Dataflow MoC 13 / 42

20 Example Factorial DFG for fact(3) S.Zuckerman CPEG852 Fall 15 Dataflow MoC 13 / 42

21 Example Factorial DFG for fact(3) S.Zuckerman CPEG852 Fall 15 Dataflow MoC 13 / 42

22 Example Factorial DFG for fact(3) S.Zuckerman CPEG852 Fall 15 Dataflow MoC 13 / 42

23 Example Factorial DFG for fact(3) S.Zuckerman CPEG852 Fall 15 Dataflow MoC 13 / 42

24 Example Factorial DFG for fact(3) S.Zuckerman CPEG852 Fall 15 Dataflow MoC 13 / 42

25 Example Factorial DFG for fact(3) S.Zuckerman CPEG852 Fall 15 Dataflow MoC 13 / 42

26 Example Factorial DFG for fact(3) S.Zuckerman CPEG852 Fall 15 Dataflow MoC 13 / 42

27 Example Factorial DFG for fact(3) S.Zuckerman CPEG852 Fall 15 Dataflow MoC 13 / 42

28 Factorial Tail Recursive version factorial(3) S.Zuckerman CPEG852 Fall 15 Dataflow MoC 14 / 42

29 Factorial Tail Recursive version factorial(3) S.Zuckerman CPEG852 Fall 15 Dataflow MoC 14 / 42

30 Factorial Tail Recursive version factorial(3) S.Zuckerman CPEG852 Fall 15 Dataflow MoC 14 / 42

31 Factorial Tail Recursive version factorial(3) S.Zuckerman CPEG852 Fall 15 Dataflow MoC 14 / 42

32 Factorial Tail Recursive version factorial(3) S.Zuckerman CPEG852 Fall 15 Dataflow MoC 14 / 42

33 Factorial Tail Recursive version factorial(3) S.Zuckerman CPEG852 Fall 15 Dataflow MoC 14 / 42

34 Factorial Tail Recursive version factorial(3) S.Zuckerman CPEG852 Fall 15 Dataflow MoC 14 / 42

35 Factorial Tail Recursive version factorial(3) S.Zuckerman CPEG852 Fall 15 Dataflow MoC 14 / 42

36 Factorial Tail Recursive version factorial(3) S.Zuckerman CPEG852 Fall 15 Dataflow MoC 14 / 42

37 Factorial Tail Recursive version factorial(3) S.Zuckerman CPEG852 Fall 15 Dataflow MoC 14 / 42

38 Factorial Tail Recursive version factorial(3) S.Zuckerman CPEG852 Fall 15 Dataflow MoC 14 / 42

39 Factorial Tail Recursive version factorial(3) S.Zuckerman CPEG852 Fall 15 Dataflow MoC 14 / 42

40 Factorial Tail Recursive version factorial(3) S.Zuckerman CPEG852 Fall 15 Dataflow MoC 14 / 42

41 Factorial Tail Recursive version factorial(3) S.Zuckerman CPEG852 Fall 15 Dataflow MoC 14 / 42

42 Factorial Tail Recursive version factorial(3) S.Zuckerman CPEG852 Fall 15 Dataflow MoC 14 / 42

43 Factorial Tail Recursive version factorial(3) S.Zuckerman CPEG852 Fall 15 Dataflow MoC 14 / 42

44 Factorial Tail Recursive version factorial(3) S.Zuckerman CPEG852 Fall 15 Dataflow MoC 14 / 42

45 Factorial Tail Recursive version factorial(3) S.Zuckerman CPEG852 Fall 15 Dataflow MoC 14 / 42

46 Factorial Tail Recursive version factorial(3) S.Zuckerman CPEG852 Fall 15 Dataflow MoC 14 / 42

47 Factorial Tail Recursive version factorial(3) S.Zuckerman CPEG852 Fall 15 Dataflow MoC 14 / 42

48 Factorial Tail Recursive version factorial(3) S.Zuckerman CPEG852 Fall 15 Dataflow MoC 14 / 42

49 Factorial Tail Recursive version factorial(3) S.Zuckerman CPEG852 Fall 15 Dataflow MoC 14 / 42

50 Factorial Tail Recursive version factorial(3) S.Zuckerman CPEG852 Fall 15 Dataflow MoC 14 / 42

51 Factorial Tail Recursive version factorial(3) S.Zuckerman CPEG852 Fall 15 Dataflow MoC 14 / 42

52 Factorial Tail Recursive version factorial(3) S.Zuckerman CPEG852 Fall 15 Dataflow MoC 14 / 42

53 Factorial Tail Recursive version factorial(3) S.Zuckerman CPEG852 Fall 15 Dataflow MoC 14 / 42

54 Factorial Tail Recursive version factorial(3) S.Zuckerman CPEG852 Fall 15 Dataflow MoC 14 / 42

55 Factorial Tail Recursive version factorial(3) S.Zuckerman CPEG852 Fall 15 Dataflow MoC 14 / 42

56 Factorial Tail Recursive version factorial(3) S.Zuckerman CPEG852 Fall 15 Dataflow MoC 14 / 42

57 Factorial Tail Recursive version factorial(3) S.Zuckerman CPEG852 Fall 15 Dataflow MoC 14 / 42

58 Factorial Tail Recursive version factorial(3) S.Zuckerman CPEG852 Fall 15 Dataflow MoC 14 / 42

59 Factorial Tail Recursive version factorial(3) S.Zuckerman CPEG852 Fall 15 Dataflow MoC 14 / 42

60 Factorial Tail Recursive version factorial(3) S.Zuckerman CPEG852 Fall 15 Dataflow MoC 14 / 42

61 Factorial Tail Recursive version factorial(3) S.Zuckerman CPEG852 Fall 15 Dataflow MoC 14 / 42

62 Factorial Tail Recursive version factorial(3) S.Zuckerman CPEG852 Fall 15 Dataflow MoC 14 / 42

63 Outline 1 What We Know of Dataflow So Far... Static Dataflow Examples Static Dataflow Features Static Dataflow Activity Templates Recursive Program Graphs Ordinary and Tail Recursions 2 Dynamic Dataflow Introduction Dynamic Dataflow Model of Computation Dynamic Dataflow I-Structures A Bit of Theory... Dynamic Dataflow Architectures Dynamic Dataflow Architectures 3 Homework S.Zuckerman CPEG852 Fall 15 Dataflow MoC 15 / 42

64 Introduction I Static Dataflow Static dataflow allows for loops to be created Simple rules: One-token-per-arc But static dataflow has many limitations: A static dataflow actor cannot fire until all its output arcs are empty. Cannot handle procedure calls Cannot handle tail recursions Cannot handle arbitrary recursions S.Zuckerman CPEG852 Fall 15 Dataflow MoC 16 / 42

65 Introduction II Recursive Program Graphs Recursive Program Graphs extend static dataflow relax its constraints Some features: One-token-per-arc-per-invocation (also known as one-token-per-link-in-lifetime) No deterministic merge needed Graph must be acyclic (DAG, directed acyclic graph) Procedure calls are allowed through the use of the apply special actor Tail-recursive calls are allowed In fact, iterative behaviors are expressed through tail recursion Recursion is expressed by runtime copying Use of tags No token matching is needed But: still not completely general-purpose: Cannot handle arbitrary recursions Cannot handle mutual function function calls (e.g., function g calls function f, and vice-versa) S.Zuckerman CPEG852 Fall 15 Dataflow MoC 17 / 42

66 Dynamic Dataflow Model of Computation Dynamic Dataflow solves the remaining problems recursive program graphs couldn t: There is no limitation on the number of tokens per arc anymore Tokens are tagged with a color This implies new firing rules we ll examine them later Resulted in the MIT Tagged Token dataflow computer S.Zuckerman CPEG852 Fall 15 Dataflow MoC 18 / 42

67 Dynamic Dataflow I Tagged Tokens Semantics Token = Tag + Value: [v, < u, s >, d] v Value u Activation instance s Destination actor d Operand slot Loops & Function Calls Should be executed in parallel as instances of the same graph Arc A container with different tokens that have different tags ( colors ) Stored in a token store A node can fire as soon as all tokens with identical tags ( colors ) are presented in its input arcs S.Zuckerman CPEG852 Fall 15 Dataflow MoC 19 / 42

68 Revisiting Ordinary Recursions Factorial S.Zuckerman CPEG852 Fall 15 Dataflow MoC 20 / 42

69 Revisiting Ordinary Recursions Factorial S.Zuckerman CPEG852 Fall 15 Dataflow MoC 20 / 42

70 Revisiting Ordinary Recursions Factorial S.Zuckerman CPEG852 Fall 15 Dataflow MoC 20 / 42

71 Revisiting Ordinary Recursions Factorial S.Zuckerman CPEG852 Fall 15 Dataflow MoC 20 / 42

72 Revisiting Ordinary Recursions Factorial S.Zuckerman CPEG852 Fall 15 Dataflow MoC 20 / 42

73 Revisiting Ordinary Recursions Factorial S.Zuckerman CPEG852 Fall 15 Dataflow MoC 20 / 42

74 Revisiting Ordinary Recursions Factorial S.Zuckerman CPEG852 Fall 15 Dataflow MoC 20 / 42

75 Revisiting Ordinary Recursions Factorial S.Zuckerman CPEG852 Fall 15 Dataflow MoC 20 / 42

76 Revisiting Ordinary Recursions Factorial S.Zuckerman CPEG852 Fall 15 Dataflow MoC 20 / 42

77 Revisiting Ordinary Recursions Factorial S.Zuckerman CPEG852 Fall 15 Dataflow MoC 20 / 42

78 Revisiting Ordinary Recursions Factorial S.Zuckerman CPEG852 Fall 15 Dataflow MoC 20 / 42

79 Revisiting Ordinary Recursions Factorial S.Zuckerman CPEG852 Fall 15 Dataflow MoC 20 / 42

80 Revisiting Ordinary Recursions Factorial S.Zuckerman CPEG852 Fall 15 Dataflow MoC 20 / 42

81 Revisiting Ordinary Recursions Factorial S.Zuckerman CPEG852 Fall 15 Dataflow MoC 20 / 42

82 Revisiting Ordinary Recursions Factorial S.Zuckerman CPEG852 Fall 15 Dataflow MoC 20 / 42

83 Revisiting Ordinary Recursions Factorial S.Zuckerman CPEG852 Fall 15 Dataflow MoC 20 / 42

84 Revisiting Ordinary Recursions Factorial S.Zuckerman CPEG852 Fall 15 Dataflow MoC 20 / 42

85 Revisiting Ordinary Recursions Factorial S.Zuckerman CPEG852 Fall 15 Dataflow MoC 20 / 42

86 Revisiting Ordinary Recursions Factorial S.Zuckerman CPEG852 Fall 15 Dataflow MoC 20 / 42

87 Revisiting Ordinary Recursions Factorial S.Zuckerman CPEG852 Fall 15 Dataflow MoC 20 / 42

88 Revisiting Ordinary Recursions Factorial S.Zuckerman CPEG852 Fall 15 Dataflow MoC 20 / 42

89 Revisiting Ordinary Recursions Factorial S.Zuckerman CPEG852 Fall 15 Dataflow MoC 20 / 42

90 Revisiting Ordinary Recursions Factorial S.Zuckerman CPEG852 Fall 15 Dataflow MoC 20 / 42

91 Revisiting Ordinary Recursions Factorial S.Zuckerman CPEG852 Fall 15 Dataflow MoC 20 / 42

92 Revisiting Ordinary Recursions Factorial S.Zuckerman CPEG852 Fall 15 Dataflow MoC 20 / 42

93 Revisiting Ordinary Recursions Factorial S.Zuckerman CPEG852 Fall 15 Dataflow MoC 20 / 42

94 Revisiting Ordinary Recursions Factorial S.Zuckerman CPEG852 Fall 15 Dataflow MoC 20 / 42

95 Revisiting Ordinary Recursions Factorial S.Zuckerman CPEG852 Fall 15 Dataflow MoC 20 / 42

96 Revisiting Ordinary Recursions Factorial S.Zuckerman CPEG852 Fall 15 Dataflow MoC 20 / 42

97 Revisiting Ordinary Recursions Factorial S.Zuckerman CPEG852 Fall 15 Dataflow MoC 20 / 42

98 Revisiting Ordinary Recursions Factorial S.Zuckerman CPEG852 Fall 15 Dataflow MoC 20 / 42

99 Revisiting Ordinary Recursions Factorial S.Zuckerman CPEG852 Fall 15 Dataflow MoC 20 / 42

100 Dynamic Dataflow The Apply Operator S.Zuckerman CPEG852 Fall 15 Dataflow MoC 21 / 42

101 Dynamic Dataflow The Apply Operator S.Zuckerman CPEG852 Fall 15 Dataflow MoC 21 / 42

102 Dynamic Dataflow The Apply Operator S.Zuckerman CPEG852 Fall 15 Dataflow MoC 21 / 42

103 Dynamic Dataflow The Apply Operator S.Zuckerman CPEG852 Fall 15 Dataflow MoC 21 / 42

104 Dynamic Dataflow The Apply Operator S.Zuckerman CPEG852 Fall 15 Dataflow MoC 21 / 42

105 Dynamic Dataflow The Apply Operator S.Zuckerman CPEG852 Fall 15 Dataflow MoC 21 / 42

106 Dynamic Dataflow The Apply Operator S.Zuckerman CPEG852 Fall 15 Dataflow MoC 21 / 42

107 Dynamic Dataflow Features Advantages: Most parallel model out there You can be as parallel as Dynamic Dataflow, but not more Can handle arbitrary recursion Shortcomings: Needs to implement a token tag matching unit Ideally: use of associative memory (i.e., use of key-value pairs)... But it is not cost effective Instead, hashing can be used. S.Zuckerman CPEG852 Fall 15 Dataflow MoC 22 / 42

108 Dynamic Dataflow I I-Structures Contrary to the von Neumann model, dataflow models try to avoid side effects. I-Structures were designed to allow memory exploitation by dataflow programs. Special memory which follows a single assignment rule Each access to the data structure consumes it entirely Basic concept of the I-Structure: Only consume the entry on a write An I-Structure is a data repository which obeys the single assignment rule An I-Structure entry is written once, but read many times A data structure has a nil (undefined) value on a write Once written, the data becomes immutable As long as the data has not be written to the structure, all reads are deferred S.Zuckerman CPEG852 Fall 15 Dataflow MoC 23 / 42

109 Dynamic Dataflow II I-Structures This allows a program to use a data structure before it is completely defined Data structures can be incrementally created or read Status Present: The element can be read but not written Absent: The element has been attempted to be read but the element has not been written yet (initial state) Waiting: At least one read request has been deferred Error: an element was written more than once, an or out-of-range memory access happened S.Zuckerman CPEG852 Fall 15 Dataflow MoC 24 / 42

110 Dynamic Dataflow III I-Structures Elementary Operations allocate: reserves space for the new I-Structure I fetch: get the value of the new I-Structure (deferred) I store: writes a value into the specified I-Structure element Node Construction Select think...= A[i] Assign think A[i] =... S.Zuckerman CPEG852 Fall 15 Dataflow MoC 25 / 42

111 Node Construction Select S.Zuckerman CPEG852 Fall 15 Dataflow MoC 26 / 42

112 Node Construction Assign S.Zuckerman CPEG852 Fall 15 Dataflow MoC 27 / 42

113 Determinacy, Determinism, and Indeterminacy An execution is deterministic when For a given set of inputs, the computation always produces the same set of outputs The resulting computation issues operations exactly in the same order each time it is executing. An execution is determinate when For a given set of inputs, the computation always produces the same set of outputs The order of individual (sets of) instructions does not matter for the end result An execution is indeterminate or non-determinate when There is no guarantee that a given set of inputs fed to the computation will always yield the same outputs if we fire the computation with the same inputs. S.Zuckerman CPEG852 Fall 15 Dataflow MoC 28 / 42

114 Dataflow Models General Features Not history-sensitive (i.e., doesn t depend on time) Clear & simple semantics which lead to determinacy Maximal parallelism can be reached It actually can be a problem... S.Zuckerman CPEG852 Fall 15 Dataflow MoC 29 / 42

115 A Word on Eager vs. Lazy Expression Evaluation Definition: Eager Evaluation A system of expression evaluation is said to be eager when all its input arguments are evaluated before they are being used. Definition: Lazy Evaluation A system of expression evaluation is said to be lazy when its input arguments are evaluated only at the time they are needed (i.e., when the system needs to read or maybe write a value). S.Zuckerman CPEG852 Fall 15 Dataflow MoC 30 / 42

116 A Word On Strictness I Intuitive Definition A mechanism is strict if it requires all its arguments to be evaluated from the innermost expression toward its outermost expression. As a result, if an inconsistent or error state is encountered somewhere during the reduction of an expression, it will propagate the error state to the outer expressions. Formal Definition A function f is strict if f you can read this as a function applied to an invalid expression results in (or is reduced to) an invalid result S.Zuckerman CPEG852 Fall 15 Dataflow MoC 31 / 42

117 A Word On Strictness II Definition: Non-Strict Expression Reduction A function f is non-strict if f v, v Non-strict functions evaluate expressions from the outermost level down to the innermost ones By doing so, they may end up simplifying expressions which could yield errors, but which will never be reached. This feature inherently allows for more loose expression evaluation, and, as a result, for more parallelism S.Zuckerman CPEG852 Fall 15 Dataflow MoC 32 / 42

118 Using a Strict Apply Actor Provides a lot of parallelism Proposes a call-by-value type of semantics But: we lose the substitution property (also called referential transparency ) In other words: we risk losing determinacy To avoid this, a strictness analysis must be performed (at compile time) S.Zuckerman CPEG852 Fall 15 Dataflow MoC 33 / 42

119 Referential Transparency I More Formal Definitions Wikipedia s An expression is said to be referentially transparent if it can be replaced with its value without changing the behavior of a program (in other words, yielding a program that has the same effects and output on the same input). The opposite term is referential opacity. Dr. Gao s... The only thing that matters about an expression is its value, and any subexpression can be replaced by any other equal in value Moreover, the value of an expression is, within certain limits, the same when ever it occurs... S.Zuckerman CPEG852 Fall 15 Dataflow MoC 34 / 42

120 Referential Transparency II More Formal Definitions Referential Transparency and the Substitution Property Let f, g be two procedures/functions such that f appears as an application inside of g; let g be the procedure obtained from g by substituting the text of f in place of the application; In languages which are referentially transparent, the specification of the function for g will not depend on any terminating property of f, or g=g S.Zuckerman CPEG852 Fall 15 Dataflow MoC 35 / 42

121 Strictness, Eagerness, Non-Strictness, and Laziness I There is very often a confusion between eager expression evaluation and strict expression reduction lazy expression evaluation and non-strict expression reduction Eager/lazy evaluation refers to operational behavior, i.e., how the program reads (evaluates) an expression. Strict/Non-strict refers to semantics, i.e., the mathematical meaning of a given expression Which is why say that we reduce expressions (which from a mathematical point of view, boils down to meaning evaluate ). In practice, non-strict and lazy can often be used interchangeably, but beware! There is a class of expression reduction schemes called lenient executions Lenient executions are non-strict S.Zuckerman CPEG852 Fall 15 Dataflow MoC 36 / 42

122 Strictness, Eagerness, Non-Strictness, and Laziness II Lenient executions are not eager : arguments are not necessarily all evaluated before evaluating an expression, Lenient executions are not lazy: arguments may be evaluated before they are needed S.Zuckerman CPEG852 Fall 15 Dataflow MoC 37 / 42

123 Dynamic Dataflow Architecture The MIT Tagged Token Dataflow Architecture Processor Wait-Match Unit: Tokens for unary operations: go straight through Tokens for binary operations: try to match incoming token and a waiting token with same instruction address and context id Success: both token proceed forward Failure: incoming token rightarrow waiting token memory, bubble (no-op) forwarded S.Zuckerman CPEG852 Fall 15 Dataflow MoC 38 / 42

124 Dynamic Dataflow Architecture The Monsoon Dataflow Processor S.Zuckerman CPEG852 Fall 15 Dataflow MoC 39 / 42

125 Outline 1 What We Know of Dataflow So Far... Static Dataflow Examples Static Dataflow Features Static Dataflow Activity Templates Recursive Program Graphs Ordinary and Tail Recursions 2 Dynamic Dataflow Introduction Dynamic Dataflow Model of Computation Dynamic Dataflow I-Structures A Bit of Theory... Dynamic Dataflow Architectures Dynamic Dataflow Architectures 3 Homework S.Zuckerman CPEG852 Fall 15 Dataflow MoC 40 / 42

126 Homework Definition: Fibonacci Sequence U 0 = 0 U 1 = 1, n N U n = U n 1 + U n 2 Let the definition of the Fibonacci function using a pseudo-c syntax be: unsigned long fib(unsigned long n); Write the pseudo-code for the recursive version of fib Write the pseudo-code for the tail recursive version of fib Write the pseudo-code for the iterative (loop) version of fib S.Zuckerman CPEG852 Fall 15 Dataflow MoC 41 / 42

127 Homework Definition: Fibonacci Sequence U 0 = 0 U 1 = 1, n N U n = U n 1 + U n 2 Let the definition of the Fibonacci function using a pseudo-c syntax be: unsigned long fib(unsigned long n); Write the pseudo-code for the recursive version of fib Write the pseudo-code for the tail recursive version of fib Write the pseudo-code for the iterative (loop) version of fib Push tokens! Select one of the three versions you wrote for fib, and draw its corresponding dataflow graph If it is the ordinary recursive version, use dynamic dataflow If it is the tail-recursive version, use recursive program graphs If it is the iterative version, use static dataflow S.Zuckerman CPEG852 Fall 15 Dataflow MoC 41 / 42

128 References I S.Zuckerman CPEG852 Fall 15 Dataflow MoC 42 / 42

Topic B (Cont d) Dataflow Model of Computation

Topic B (Cont d) Dataflow Model of Computation opic B (Cont d) Dataflow Model of Computation Guang R. Gao ACM ellow and IEEE ellow Endowed Distinguished Professor Electrical & Computer Engineering University of Delaware ggao@capsl.udel.edu 09/07/20

More information

CPEG 852 Advanced Topics in Computing Systems The Dataflow Model of Computation

CPEG 852 Advanced Topics in Computing Systems The Dataflow Model of Computation CPEG 852 Advanced Topics in Computing Systems The Dataflow Model of Computation Stéphane Zuckerman Computer Architecture & Parallel Systems Laboratory Electrical & Computer Engineering Dept. University

More information

Topic 4b Program Execution Models Dataflow Model of Computation: A Fine-Grain Kind of PXM. CPEG421/621: Compiler Design

Topic 4b Program Execution Models Dataflow Model of Computation: A Fine-Grain Kind of PXM. CPEG421/621: Compiler Design opic 4b Program Execution Models Dataflow Model of Computation: A ine-grain Kind of PXM CPEG42/62: Compiler Design Most slides taken from Prof. Gao s and J.Manzano s previous courses, with additional material

More information

CITS3211 FUNCTIONAL PROGRAMMING. 14. Graph reduction

CITS3211 FUNCTIONAL PROGRAMMING. 14. Graph reduction CITS3211 FUNCTIONAL PROGRAMMING 14. Graph reduction Summary: This lecture discusses graph reduction, which is the basis of the most common compilation technique for lazy functional languages. CITS3211

More information

Portland State University ECE 588/688. Dataflow Architectures

Portland State University ECE 588/688. Dataflow Architectures Portland State University ECE 588/688 Dataflow Architectures Copyright by Alaa Alameldeen and Haitham Akkary 2018 Hazards in von Neumann Architectures Pipeline hazards limit performance Structural hazards

More information

Urmas Tamm Tartu 2013

Urmas Tamm Tartu 2013 The implementation and optimization of functional languages Urmas Tamm Tartu 2013 Intro The implementation of functional programming languages, Simon L. Peyton Jones, 1987 Miranda fully lazy strict a predecessor

More information

ECE 2400 Computer Systems Programming Fall 2018 Topic 2: C Recursion

ECE 2400 Computer Systems Programming Fall 2018 Topic 2: C Recursion ECE 2400 Computer Systems Programming Fall 2018 Topic 2: C Recursion School of Electrical and Computer Engineering Cornell University revision: 2018-09-13-21-07 1 Dictionary Analogy 2 2 Computing Factorial

More information

simplefun Semantics 1 The SimpleFUN Abstract Syntax 2 Semantics

simplefun Semantics 1 The SimpleFUN Abstract Syntax 2 Semantics simplefun Semantics 1 The SimpleFUN Abstract Syntax We include the abstract syntax here for easy reference when studying the domains and transition rules in the following sections. There is one minor change

More information

Sometimes it s good to be lazy

Sometimes it s good to be lazy Chapter 8 Sometimes it s good to be lazy Typically, languages such as OCaml (SML, Lisp or Scheme) evaluate expressions by a call-by-value discipline. All variables in OCaml are bound by value, which means

More information

JVM ByteCode Interpreter

JVM ByteCode Interpreter JVM ByteCode Interpreter written in Haskell (In under 1000 Lines of Code) By Louis Jenkins Presentation Schedule ( 15 Minutes) Discuss and Run the Virtual Machine first

More information

Lecture 5: Lazy Evaluation and Infinite Data Structures

Lecture 5: Lazy Evaluation and Infinite Data Structures Lecture 5: Lazy Evaluation and Infinite Data Structures Søren Haagerup Department of Mathematics and Computer Science University of Southern Denmark, Odense October 3, 2017 How does Haskell evaluate a

More information

Computer Architecture: Dataflow/Systolic Arrays

Computer Architecture: Dataflow/Systolic Arrays Data Flow Computer Architecture: Dataflow/Systolic Arrays he models we have examined all assumed Instructions are fetched and retired in sequential, control flow order his is part of the Von-Neumann model

More information

Programming Languages Third Edition. Chapter 9 Control I Expressions and Statements

Programming Languages Third Edition. Chapter 9 Control I Expressions and Statements Programming Languages Third Edition Chapter 9 Control I Expressions and Statements Objectives Understand expressions Understand conditional statements and guards Understand loops and variation on WHILE

More information

Organization of Programming Languages CS3200/5200N. Lecture 11

Organization of Programming Languages CS3200/5200N. Lecture 11 Organization of Programming Languages CS3200/5200N Razvan C. Bunescu School of Electrical Engineering and Computer Science bunescu@ohio.edu Functional vs. Imperative The design of the imperative languages

More information

CSC324 Functional Programming Efficiency Issues, Parameter Lists

CSC324 Functional Programming Efficiency Issues, Parameter Lists CSC324 Functional Programming Efficiency Issues, Parameter Lists Afsaneh Fazly 1 January 28, 2013 1 Thanks to A.Tafliovich, P.Ragde, S.McIlraith, E.Joanis, S.Stevenson, G.Penn, D.Horton 1 Example: efficiency

More information

CSCC24 Functional Programming Scheme Part 2

CSCC24 Functional Programming Scheme Part 2 CSCC24 Functional Programming Scheme Part 2 Carolyn MacLeod 1 winter 2012 1 Based on slides from Anya Tafliovich, and with many thanks to Gerald Penn and Prabhakar Ragde. 1 The Spirit of Lisp-like Languages

More information

Refactoring to Functional. Hadi Hariri

Refactoring to Functional. Hadi Hariri Refactoring to Functional Hadi Hariri Functional Programming In computer science, functional programming is a programming paradigm, a style of building the structure and elements of computer programs,

More information

IR Optimization. May 15th, Tuesday, May 14, 13

IR Optimization. May 15th, Tuesday, May 14, 13 IR Optimization May 15th, 2013 Tuesday, May 14, 13 But before we talk about IR optimization... Wrapping up IR generation Tuesday, May 14, 13 Three-Address Code Or TAC The IR that you will be using for

More information

V Advanced Data Structures

V Advanced Data Structures V Advanced Data Structures B-Trees Fibonacci Heaps 18 B-Trees B-trees are similar to RBTs, but they are better at minimizing disk I/O operations Many database systems use B-trees, or variants of them,

More information

6.006 Introduction to Algorithms Recitation 19 November 23, 2011

6.006 Introduction to Algorithms Recitation 19 November 23, 2011 The Knapsack Problem You find yourself in a vault chock full of valuable items. However, you only brought a knapsack of capacity S pounds, which means the knapsack will break down if you try to carry more

More information

CSCI-1200 Data Structures Spring 2018 Lecture 7 Order Notation & Basic Recursion

CSCI-1200 Data Structures Spring 2018 Lecture 7 Order Notation & Basic Recursion CSCI-1200 Data Structures Spring 2018 Lecture 7 Order Notation & Basic Recursion Review from Lectures 5 & 6 Arrays and pointers, Pointer arithmetic and dereferencing, Types of memory ( automatic, static,

More information

15-122: Principles of Imperative Computation, Fall 2015

15-122: Principles of Imperative Computation, Fall 2015 15-122 Programming 5 Page 1 of 10 15-122: Principles of Imperative Computation, Fall 2015 Homework 5 Programming: Clac Due: Thursday, October 15, 2015 by 22:00 In this assignment, you will implement a

More information

Functional Programming

Functional Programming Functional Programming Björn B. Brandenburg The University of North Carolina at Chapel Hill Based in part on slides and notes by S. Olivier, A. Block, N. Fisher, F. Hernandez-Campos, and D. Stotts. Brief

More information

Building a Runnable Program and Code Improvement. Dario Marasco, Greg Klepic, Tess DiStefano

Building a Runnable Program and Code Improvement. Dario Marasco, Greg Klepic, Tess DiStefano Building a Runnable Program and Code Improvement Dario Marasco, Greg Klepic, Tess DiStefano Building a Runnable Program Review Front end code Source code analysis Syntax tree Back end code Target code

More information

V Advanced Data Structures

V Advanced Data Structures V Advanced Data Structures B-Trees Fibonacci Heaps 18 B-Trees B-trees are similar to RBTs, but they are better at minimizing disk I/O operations Many database systems use B-trees, or variants of them,

More information

Summer 2017 Discussion 10: July 25, Introduction. 2 Primitives and Define

Summer 2017 Discussion 10: July 25, Introduction. 2 Primitives and Define CS 6A Scheme Summer 207 Discussion 0: July 25, 207 Introduction In the next part of the course, we will be working with the Scheme programming language. In addition to learning how to write Scheme programs,

More information

Recursion. Comp Sci 1575 Data Structures. Introduction. Simple examples. The call stack. Types of recursion. Recursive programming

Recursion. Comp Sci 1575 Data Structures. Introduction. Simple examples. The call stack. Types of recursion. Recursive programming Recursion Comp Sci 1575 Data Structures Outline 1 2 3 4 Definitions To understand, you must understand. Familiar of recursive definitions Natural numbers are either: n+1, where n is a natural number 1

More information

Lecture 2: SML Basics

Lecture 2: SML Basics 15-150 Lecture 2: SML Basics Lecture by Dan Licata January 19, 2012 I d like to start off by talking about someone named Alfred North Whitehead. With someone named Bertrand Russell, Whitehead wrote Principia

More information

Parsing II Top-down parsing. Comp 412

Parsing II Top-down parsing. Comp 412 COMP 412 FALL 2018 Parsing II Top-down parsing Comp 412 source code IR Front End Optimizer Back End IR target code Copyright 2018, Keith D. Cooper & Linda Torczon, all rights reserved. Students enrolled

More information

COMP528: Multi-core and Multi-Processor Computing

COMP528: Multi-core and Multi-Processor Computing COMP528: Multi-core and Multi-Processor Computing Dr Michael K Bane, G14, Computer Science, University of Liverpool m.k.bane@liverpool.ac.uk https://cgi.csc.liv.ac.uk/~mkbane/comp528 17 Background Reading

More information

SCHEME 10 COMPUTER SCIENCE 61A. July 26, Warm Up: Conditional Expressions. 1. What does Scheme print? scm> (if (or #t (/ 1 0)) 1 (/ 1 0))

SCHEME 10 COMPUTER SCIENCE 61A. July 26, Warm Up: Conditional Expressions. 1. What does Scheme print? scm> (if (or #t (/ 1 0)) 1 (/ 1 0)) SCHEME 0 COMPUTER SCIENCE 6A July 26, 206 0. Warm Up: Conditional Expressions. What does Scheme print? scm> (if (or #t (/ 0 (/ 0 scm> (if (> 4 3 (+ 2 3 4 (+ 3 4 (* 3 2 scm> ((if (< 4 3 + - 4 00 scm> (if

More information

CSC312 Principles of Programming Languages : Functional Programming Language. Copyright 2006 The McGraw-Hill Companies, Inc.

CSC312 Principles of Programming Languages : Functional Programming Language. Copyright 2006 The McGraw-Hill Companies, Inc. CSC312 Principles of Programming Languages : Functional Programming Language Overview of Functional Languages They emerged in the 1960 s with Lisp Functional programming mirrors mathematical functions:

More information

Intermediate representation

Intermediate representation Intermediate representation Goals: encode knowledge about the program facilitate analysis facilitate retargeting facilitate optimization scanning parsing HIR semantic analysis HIR intermediate code gen.

More information

18.3 Deleting a key from a B-tree

18.3 Deleting a key from a B-tree 18.3 Deleting a key from a B-tree B-TREE-DELETE deletes the key from the subtree rooted at We design it to guarantee that whenever it calls itself recursively on a node, the number of keys in is at least

More information

Principles of Programming Languages

Principles of Programming Languages Principles of Programming Languages www.cs.bgu.ac.il/~ppl172 Collaboration and Management Dana Fisman Lesson 5 - Data Types and Operations on Data 1 Types - what we already know Types define sets of values

More information

RACKET BASICS, ORDER OF EVALUATION, RECURSION 1

RACKET BASICS, ORDER OF EVALUATION, RECURSION 1 RACKET BASICS, ORDER OF EVALUATION, RECURSION 1 COMPUTER SCIENCE 61AS 1. What is functional programming? Give an example of a function below: Functional Programming In functional programming, you do not

More information

Homework 3: Recursion Due: 11:59 PM, Sep 25, 2018

Homework 3: Recursion Due: 11:59 PM, Sep 25, 2018 CS17 Integrated Introduction to Computer Science Klein Homework 3: Recursion Due: 11:59 PM, Sep 25, 2018 Contents 1 Factorial 3 2 Fibonacci 4 3 Odds Only 5 4 Increment All 6 5 Frequency 6 6 Sublist 7 6.1

More information

Introduction to Computing Systems Fall Lab # 3

Introduction to Computing Systems Fall Lab # 3 EE 1301 UMN Introduction to Computing Systems Fall 2013 Lab # 3 Collaboration is encouraged. You may discuss the problems with other students, but you must write up your own solutions, including all your

More information

Processadors de Llenguatge II. Functional Paradigm. Pratt A.7 Robert Harper s SML tutorial (Sec II)

Processadors de Llenguatge II. Functional Paradigm. Pratt A.7 Robert Harper s SML tutorial (Sec II) Processadors de Llenguatge II Functional Paradigm Pratt A.7 Robert Harper s SML tutorial (Sec II) Rafael Ramirez Dep Tecnologia Universitat Pompeu Fabra Paradigm Shift Imperative Paradigm State Machine

More information

Chapter 6 Control Flow. June 9, 2015

Chapter 6 Control Flow. June 9, 2015 Chapter 6 Control Flow June 9, 2015 Expression evaluation It s common in programming languages to use the idea of an expression, which might be a simple object function invocation over some number of arguments

More information

Functional Programming

Functional Programming Functional Programming COMS W4115 Prof. Stephen A. Edwards Spring 2003 Columbia University Department of Computer Science Original version by Prof. Simon Parsons Functional vs. Imperative Imperative programming

More information

Functional Programming. Pure Functional Programming

Functional Programming. Pure Functional Programming Functional Programming Pure Functional Programming Computation is largely performed by applying functions to values. The value of an expression depends only on the values of its sub-expressions (if any).

More information

Joint Entity Resolution

Joint Entity Resolution Joint Entity Resolution Steven Euijong Whang, Hector Garcia-Molina Computer Science Department, Stanford University 353 Serra Mall, Stanford, CA 94305, USA {swhang, hector}@cs.stanford.edu No Institute

More information

Introduction to Algorithms / Algorithms I Lecturer: Michael Dinitz Topic: Dynamic Programming I Date: 10/6/16

Introduction to Algorithms / Algorithms I Lecturer: Michael Dinitz Topic: Dynamic Programming I Date: 10/6/16 600.463 Introduction to Algorithms / Algorithms I Lecturer: Michael Dinitz Topic: Dynamic Programming I Date: 10/6/16 11.1 Introduction Dynamic programming can be very confusing until you ve used it a

More information

Register Allocation & Liveness Analysis

Register Allocation & Liveness Analysis Department of Computer Sciences Register Allocation & Liveness Analysis CS502 Purdue University is an Equal Opportunity/Equal Access institution. Department of Computer Sciences In IR tree code generation,

More information

EECS 144/244: Fundamental Algorithms for System Modeling, Analysis, and Optimization

EECS 144/244: Fundamental Algorithms for System Modeling, Analysis, and Optimization EECS 144/244: Fundamental Algorithms for System Modeling, Analysis, and Optimization Dataflow Lecture: SDF, Kahn Process Networks Stavros Tripakis University of California, Berkeley Stavros Tripakis: EECS

More information

Semantics via Syntax. f (4) = if define f (x) =2 x + 55.

Semantics via Syntax. f (4) = if define f (x) =2 x + 55. 1 Semantics via Syntax The specification of a programming language starts with its syntax. As every programmer knows, the syntax of a language comes in the shape of a variant of a BNF (Backus-Naur Form)

More information

To figure this out we need a more precise understanding of how ML works

To figure this out we need a more precise understanding of how ML works Announcements: What are the following numbers: 74/2/70/17 (2:30,2:30,3:35,7:30) PS2 due Thursday 9/20 11:59PM Guest lecture on Tuesday 9/25 o No RDZ office hours next Friday, I am on travel A brief comment

More information

CS 310 Advanced Data Structures and Algorithms

CS 310 Advanced Data Structures and Algorithms CS 31 Advanced Data Structures and Algorithms Graphs July 18, 17 Tong Wang UMass Boston CS 31 July 18, 17 1 / 4 Graph Definitions Graph a mathematical construction that describes objects and relations

More information

Lecture Notes on Data Representation

Lecture Notes on Data Representation Lecture Notes on Data Representation 15-814: Types and Programming Languages Frank Pfenning Lecture 9 Tuesday, October 2, 2018 1 Introduction In this lecture we ll see our type system in action. In particular

More information

Shared-memory Parallel Programming with Cilk Plus

Shared-memory Parallel Programming with Cilk Plus Shared-memory Parallel Programming with Cilk Plus John Mellor-Crummey Department of Computer Science Rice University johnmc@rice.edu COMP 422/534 Lecture 4 30 August 2018 Outline for Today Threaded programming

More information

Reading assignment: Reviews and Inspections

Reading assignment: Reviews and Inspections Foundations for SE Analysis Reading assignment: Reviews and Inspections M. E. Fagan, "Design and code inspections to reduce error in program development, IBM Systems Journal, 38 (2&3), 1999, pp. 258-287.

More information

Functional Programming in Java. CSE 219 Department of Computer Science, Stony Brook University

Functional Programming in Java. CSE 219 Department of Computer Science, Stony Brook University Functional Programming in Java CSE 219, Stony Brook University What is functional programming? There is no single precise definition of functional programming (FP) We should think of it as a programming

More information

Caches 3/23/17. Agenda. The Dataflow Model (of a Computer)

Caches 3/23/17. Agenda. The Dataflow Model (of a Computer) Agenda Caches Samira Khan March 23, 2017 Review from last lecture Data flow model Memory hierarchy More Caches The Dataflow Model (of a Computer) Von Neumann model: An instruction is fetched and executed

More information

CODE GENERATION Monday, May 31, 2010

CODE GENERATION Monday, May 31, 2010 CODE GENERATION memory management returned value actual parameters commonly placed in registers (when possible) optional control link optional access link saved machine status local data temporaries A.R.

More information

Caches. Samira Khan March 23, 2017

Caches. Samira Khan March 23, 2017 Caches Samira Khan March 23, 2017 Agenda Review from last lecture Data flow model Memory hierarchy More Caches The Dataflow Model (of a Computer) Von Neumann model: An instruction is fetched and executed

More information

Well-behaved Dataflow Graphs

Well-behaved Dataflow Graphs Well-behaved Dataflow Graphs Arvind Computer Science & Artificial Intelligence Lab Massachusetts Institute of echnology L21-1 Outline Kahnian networks and dataflow Streams with holes & agged interpretation

More information

Concurrent Models of Computation

Concurrent Models of Computation Concurrent Models of Computation Edward A. Lee Robert S. Pepper Distinguished Professor, UC Berkeley EECS 219D: Concurrent Models of Computation Fall 2011 Copyright 2011, Edward A. Lee, All rights reserved

More information

Thus, it is reasonable to compare binary search trees and binary heaps as is shown in Table 1.

Thus, it is reasonable to compare binary search trees and binary heaps as is shown in Table 1. 7.2 Binary Min-Heaps A heap is a tree-based structure, but it doesn t use the binary-search differentiation between the left and right sub-trees to create a linear ordering. Instead, a binary heap only

More information

known as non-void functions/methods in C/C++/Java called from within an expression.

known as non-void functions/methods in C/C++/Java called from within an expression. FUNCTIONS 1 OUTLINE Basic Terminology Function Call and Return Parameters Parameter Passing Mechanisms Activation Records Recursive Functions Run Time Stack Function Declaration and Call in Clite Completing

More information

Page 1. Reading assignment: Reviews and Inspections. Foundations for SE Analysis. Ideally want general models. Formal models

Page 1. Reading assignment: Reviews and Inspections. Foundations for SE Analysis. Ideally want general models. Formal models Reading assignment: Reviews and Inspections Foundations for SE Analysis M. E. Fagan, "Design and code inspections to reduce error in program development, IBM Systems Journal, 38 (2&3), 999, pp. 258-28.

More information

Induction Variable Identification (cont)

Induction Variable Identification (cont) Loop Invariant Code Motion Last Time Uses of SSA: reaching constants, dead-code elimination, induction variable identification Today Finish up induction variable identification Loop invariant code motion

More information

THE EVALUATION OF OPERANDS AND ITS PROBLEMS IN C++

THE EVALUATION OF OPERANDS AND ITS PROBLEMS IN C++ Proceedings of the South Dakota Academy of Science, Vol. 85 (2006) 107 THE EVALUATION OF OPERANDS AND ITS PROBLEMS IN C++ Dan Day and Steve Shum Computer Science Department Augustana College Sioux Falls,

More information

CSCI-1200 Data Structures Fall 2017 Lecture 10 Vector Iterators & Linked Lists

CSCI-1200 Data Structures Fall 2017 Lecture 10 Vector Iterators & Linked Lists CSCI-1200 Data Structures Fall 2017 Lecture 10 Vector Iterators & Linked Lists Review from Lecture 9 Explored a program to maintain a class enrollment list and an associated waiting list. Unfortunately,

More information

Architecture and Programming Model for High Performance Interactive Computation

Architecture and Programming Model for High Performance Interactive Computation Architecture and Programming Model for High Performance Interactive Computation Based on Title of TM127, CAPSL TM-127 By Jack B. Dennis, Arvind, Guang R. Gao, Xiaoming Li and Lian-Ping Wang April 3rd,

More information

Optimization Prof. James L. Frankel Harvard University

Optimization Prof. James L. Frankel Harvard University Optimization Prof. James L. Frankel Harvard University Version of 4:24 PM 1-May-2018 Copyright 2018, 2016, 2015 James L. Frankel. All rights reserved. Reasons to Optimize Reduce execution time Reduce memory

More information

(Not Quite) Minijava

(Not Quite) Minijava (Not Quite) Minijava CMCS22620, Spring 2004 April 5, 2004 1 Syntax program mainclass classdecl mainclass class identifier { public static void main ( String [] identifier ) block } classdecl class identifier

More information

Software Paradigms (Lesson 4) Functional Programming Paradigm

Software Paradigms (Lesson 4) Functional Programming Paradigm Software Paradigms (Lesson 4) Functional Programming Paradigm Table of Contents 1 Introduction... 2 2 Evaluation of Functions... 3 3 Compositional (Construct) Operators... 4 4 Some Implementation Issues...

More information

CS558 Programming Languages

CS558 Programming Languages CS558 Programming Languages Winter 2017 Lecture 7b Andrew Tolmach Portland State University 1994-2017 Values and Types We divide the universe of values according to types A type is a set of values and

More information

Quick announcement. Midterm date is Wednesday Oct 24, 11-12pm.

Quick announcement. Midterm date is Wednesday Oct 24, 11-12pm. Quick announcement Midterm date is Wednesday Oct 24, 11-12pm. The lambda calculus = ID (λ ID. ) ( ) The lambda calculus (Racket) = ID (lambda (ID) ) ( )

More information

Sardar Vallabhbhai Patel Institute of Technology (SVIT), Vasad M.C.A. Department COSMOS LECTURE SERIES ( ) (ODD) Code Optimization

Sardar Vallabhbhai Patel Institute of Technology (SVIT), Vasad M.C.A. Department COSMOS LECTURE SERIES ( ) (ODD) Code Optimization Sardar Vallabhbhai Patel Institute of Technology (SVIT), Vasad M.C.A. Department COSMOS LECTURE SERIES (2018-19) (ODD) Code Optimization Prof. Jonita Roman Date: 30/06/2018 Time: 9:45 to 10:45 Venue: MCA

More information

An introduction to Scheme

An introduction to Scheme An introduction to Scheme Introduction A powerful programming language is more than just a means for instructing a computer to perform tasks. The language also serves as a framework within which we organize

More information

Expressions and Casting. Data Manipulation. Simple Program 11/5/2013

Expressions and Casting. Data Manipulation. Simple Program 11/5/2013 Expressions and Casting C# Programming Rob Miles Data Manipulation We know that programs use data storage (variables) to hold values and statements to process the data The statements are obeyed in sequence

More information

Programming Language Pragmatics

Programming Language Pragmatics Chapter 10 :: Functional Languages Programming Language Pragmatics Michael L. Scott Historical Origins The imperative and functional models grew out of work undertaken Alan Turing, Alonzo Church, Stephen

More information

Compiler Code Generation COMP360

Compiler Code Generation COMP360 Compiler Code Generation COMP360 Students who acquire large debts putting themselves through school are unlikely to think about changing society. When you trap people in a system of debt, they can t afford

More information

CS4215 Programming Language Implementation. Martin Henz

CS4215 Programming Language Implementation. Martin Henz CS4215 Programming Language Implementation Martin Henz Thursday 15 March, 2012 2 Chapter 11 impl: A Simple Imperative Language 11.1 Introduction So far, we considered only languages, in which an identifier

More information

Fall 2018 Discussion 8: October 24, 2018 Solutions. 1 Introduction. 2 Primitives

Fall 2018 Discussion 8: October 24, 2018 Solutions. 1 Introduction. 2 Primitives CS 6A Scheme Fall 208 Discussion 8: October 24, 208 Solutions Introduction In the next part of the course, we will be working with the Scheme programming language. In addition to learning how to write

More information

Weeks 6&7: Procedures and Parameter Passing

Weeks 6&7: Procedures and Parameter Passing CS320 Principles of Programming Languages Weeks 6&7: Procedures and Parameter Passing Jingke Li Portland State University Fall 2017 PSU CS320 Fall 17 Weeks 6&7: Procedures and Parameter Passing 1 / 45

More information

A Propagation Engine for GCC

A Propagation Engine for GCC A Propagation Engine for GCC Diego Novillo Red Hat Canada dnovillo@redhat.com May 1, 2005 Abstract Several analyses and transformations work by propagating known values and attributes throughout the program.

More information

SCHEME 8. 1 Introduction. 2 Primitives COMPUTER SCIENCE 61A. March 23, 2017

SCHEME 8. 1 Introduction. 2 Primitives COMPUTER SCIENCE 61A. March 23, 2017 SCHEME 8 COMPUTER SCIENCE 61A March 2, 2017 1 Introduction In the next part of the course, we will be working with the Scheme programming language. In addition to learning how to write Scheme programs,

More information

Dataflow Architectures. Karin Strauss

Dataflow Architectures. Karin Strauss Dataflow Architectures Karin Strauss Introduction Dataflow machines: programmable computers with hardware optimized for fine grain data-driven parallel computation fine grain: at the instruction granularity

More information

Functional Programming. Big Picture. Design of Programming Languages

Functional Programming. Big Picture. Design of Programming Languages Functional Programming Big Picture What we ve learned so far: Imperative Programming Languages Variables, binding, scoping, reference environment, etc What s next: Functional Programming Languages Semantics

More information

Chapter 15. Functional Programming Languages

Chapter 15. Functional Programming Languages Chapter 15 Functional Programming Languages Copyright 2009 Addison-Wesley. All rights reserved. 1-2 Chapter 15 Topics Introduction Mathematical Functions Fundamentals of Functional Programming Languages

More information

Programming Language Concepts: Lecture 14

Programming Language Concepts: Lecture 14 Programming Language Concepts: Lecture 14 Madhavan Mukund Chennai Mathematical Institute madhavan@cmi.ac.in http://www.cmi.ac.in/~madhavan/courses/pl2009 PLC 2009, Lecture 14, 11 March 2009 Function programming

More information

A Bad Name. CS 2210: Optimization. Register Allocation. Optimization. Reaching Definitions. Dataflow Analyses 4/10/2013

A Bad Name. CS 2210: Optimization. Register Allocation. Optimization. Reaching Definitions. Dataflow Analyses 4/10/2013 A Bad Name Optimization is the process by which we turn a program into a better one, for some definition of better. CS 2210: Optimization This is impossible in the general case. For instance, a fully optimizing

More information

Functional Programming for Imperative Programmers

Functional Programming for Imperative Programmers Functional Programming for Imperative Programmers R. Sekar This document introduces functional programming for those that are used to imperative languages, but are trying to come to terms with recursion

More information

Fundamental Concepts. Chapter 1

Fundamental Concepts. Chapter 1 Chapter 1 Fundamental Concepts This book is about the mathematical foundations of programming, with a special attention on computing with infinite objects. How can mathematics help in programming? There

More information

Expressions and Casting

Expressions and Casting Expressions and Casting C# Programming Rob Miles Data Manipulation We know that programs use data storage (variables) to hold values and statements to process the data The statements are obeyed in sequence

More information

What does my program mean?

What does my program mean? September 16, 2015 L02-1 What does my program mean? Armando Solar Lezama Computer Science and Artificial Intelligence Laboratory M.I.T. Adapted from Arvind 2010. Used with permission. September 16, 2015

More information

Functional Programming Languages (FPL)

Functional Programming Languages (FPL) Functional Programming Languages (FPL) 1. Definitions... 2 2. Applications... 2 3. Examples... 3 4. FPL Characteristics:... 3 5. Lambda calculus (LC)... 4 6. Functions in FPLs... 7 7. Modern functional

More information

Ben Lee* and A. R. Hurson** *Oregon State University Department of Electrical and Computer Engineering Corvallis, Oregon

Ben Lee* and A. R. Hurson** *Oregon State University Department of Electrical and Computer Engineering Corvallis, Oregon ISSUES IN DATAFLOW COMPUTING Ben Lee* and A. R. Hurson** *Oregon State University Department of Electrical and Computer Engineering Corvallis, Oregon 97331-3211 **The Pennsylvania State University Department

More information

Multi-Paradigm Approach for Teaching Programming

Multi-Paradigm Approach for Teaching Programming Multi-Paradigm Approach for Teaching Laxmi P Gewali* and John T Minor School of Computer Science University of Nevada, Las Vegas 4505 Maryland Parkway, Las Vegas Nevada 89154 Abstract: Selecting an appropriate

More information

Introduction to Electronic Design Automation. Model of Computation. Model of Computation. Model of Computation

Introduction to Electronic Design Automation. Model of Computation. Model of Computation. Model of Computation Introduction to Electronic Design Automation Model of Computation Jie-Hong Roland Jiang 江介宏 Department of Electrical Engineering National Taiwan University Spring 03 Model of Computation In system design,

More information

CS1102: Macros and Recursion

CS1102: Macros and Recursion CS1102: Macros and Recursion Kathi Fisler, WPI October 5, 2009 This lecture looks at several more macro examples. It aims to show you when you can use recursion safely with macros and when you can t. 1

More information

Streams and Evalutation Strategies

Streams and Evalutation Strategies Data and Program Structure Streams and Evalutation Strategies Lecture V Ahmed Rezine Linköpings Universitet TDDA69, VT 2014 Lecture 2: Class descriptions - message passing ( define ( make-account balance

More information

G Programming Languages - Fall 2012

G Programming Languages - Fall 2012 G22.2110-003 Programming Languages - Fall 2012 Lecture 3 Thomas Wies New York University Review Last week Names and Bindings Lifetimes and Allocation Garbage Collection Scope Outline Control Flow Sequencing

More information

/633 Introduction to Algorithms Lecturer: Michael Dinitz Topic: Priority Queues / Heaps Date: 9/27/17

/633 Introduction to Algorithms Lecturer: Michael Dinitz Topic: Priority Queues / Heaps Date: 9/27/17 01.433/33 Introduction to Algorithms Lecturer: Michael Dinitz Topic: Priority Queues / Heaps Date: 9/2/1.1 Introduction In this lecture we ll talk about a useful abstraction, priority queues, which are

More information

CPS 506 Comparative Programming Languages. Programming Language Paradigm

CPS 506 Comparative Programming Languages. Programming Language Paradigm CPS 506 Comparative Programming Languages Functional Programming Language Paradigm Topics Introduction Mathematical Functions Fundamentals of Functional Programming Languages The First Functional Programming

More information

Lecture 5: Declarative Programming. The Declarative Kernel Language Machine. September 12th, 2011

Lecture 5: Declarative Programming. The Declarative Kernel Language Machine. September 12th, 2011 Lecture 5: Declarative Programming. The Declarative Kernel Language Machine September 12th, 2011 1 Lecture Outline Declarative Programming contd Dataflow Variables contd Expressions and Statements Functions

More information

The PCAT Programming Language Reference Manual

The PCAT Programming Language Reference Manual The PCAT Programming Language Reference Manual Andrew Tolmach and Jingke Li Dept. of Computer Science Portland State University September 27, 1995 (revised October 15, 2002) 1 Introduction The PCAT language

More information