clock typing of n synchronous programs
play

Clock Typing of n-Synchronous Programs Louis Mandel Florence - PowerPoint PPT Presentation

Clock Typing of n-Synchronous Programs Louis Mandel Florence Plateau Marc Pouzet Laboratoire de Recherche en Informatique Universit e Paris-Sud 11 INRIA Saclay Ile-de-France DCC 20-21/03/2010 Kahn Process Networks [Gilles Kahn,


  1. Clock Typing of n-Synchronous Programs Louis Mandel Florence Plateau Marc Pouzet Laboratoire de Recherche en Informatique Universit´ e Paris-Sud 11 INRIA Saclay – Ile-de-France DCC – 20-21/03/2010

  2. Kahn Process Networks [Gilles Kahn, 1974] x y i o P Q R Network of processes • concurrent execution • communication through buffers of sufficient size If processes are deterministic then the network is deterministic 2

  3. Programming Kahn Process Networks Problem: computation of sufficient buffer sizes • risk of data loss, of deadlock • sometimes, need of infinite buffers Goal: • rejection of infinite buffers • automatic sizing of buffers Related work: • Synchronous Data Flow and variants [Lee et al. ] [Buck] • scheduling [Carlier, Chretienne] [Baccelli, Cohen, Quadrat] • Network Calculus [Cruz], Real-time Calculus [Thiele et al. ] 3

  4. Dataflow Synchronous Model Programming Kahn networks without buffers: • programming languages: Lustre, Signal, Lucid Synchrone • instantaneous consumption of produced data • strong guaranties: bounded memory, absence of deadlocks But: communication without buffers sometimes too restrictive (e.g. multimedia applications) 4

  5. n-Synchronous Model: Programming Kahn Networks with Bounded Memory • accept to store data in buffers Automatic methods at compile time to: • reject networks needing infinite memory • compute activation paces of computations nodes • compute sufficient buffers sizes More flexibility with the same guaranties 5

  6. Overview 1. Lucy-n: a n-Synchronous Extension of Lustre 2. Clock Typing 3. Application to Latency Insensitive Design 6

  7. Lucy-n: a n-Synchronous Extension of Lustre

  8. A Dataflow Synchronous Kernel x flow values clock 5 7 3 6 2 8 1 ... 1111111 ... x 8

  9. A Dataflow Synchronous Kernel Sampling c x when flow values clock 5 7 3 6 2 8 1 ... 1111111 ... x c 1 0 1 0 1 0 1 ... 5 3 2 1 1010101 ... x when c ... clock ( x when c ) = clock ( x ) on c def on operator : = 0 . ( w 1 on w 2 ) 0 .w 1 on w 2 def = 1 . ( w 1 on w 2 ) 1 .w 1 on 1 .w 2 def = 0 . ( w 1 on w 2 ) 1 .w 1 on 0 .w 2 8

  10. A Dataflow Synchronous Kernel Sampling c d x when when flow values clock 5 7 3 6 2 8 1 ... 1111111 ... x c 1 0 1 0 1 0 1 ... 5 3 2 1 1010101 ... x when c ... d 1 0 1 1 ... 5 2 1 1000101 ... (x when c) when d ... clock ( (x when c) when d ) = clock ( x when c ) on d def on operator : = 0 . ( w 1 on w 2 ) 0 .w 1 on w 2 def = 1 . ( w 1 on w 2 ) 1 .w 1 on 1 .w 2 def = 0 . ( w 1 on w 2 ) 1 .w 1 on 0 .w 2 8

  11. A Dataflow Synchronous Kernel Merging c x’ merge y’ flow value clock 5 3 2 1 1010101 ... x’ ... 2 5 1 0101010 ... y’ ... c 1 0 1 0 1 0 1 ... 5 2 3 5 2 1 1 1111111 ... merge c x’ y’ ... 9

  12. A Dataflow Synchronous Kernel Scalar Operators x z + y flow values clock 5 7 3 6 2 8 1 111111 ... x ... 3 2 1 5 4 1 7 111111 ... ... y 8 9 4 11 6 9 8 111111 ... z = x + y ... 10

  13. A Dataflow Synchronous Kernel Scalar Operators c x z t + when y flow values clock 5 7 3 6 2 8 1 111111 ... x ... 3 2 1 5 4 1 7 111111 ... ... y 8 9 4 11 6 9 8 111111 ... z = x + y ... ... c 1 0 1 0 1 0 1 8 4 6 8 101010 ... ... t = z when c 10

  14. A Dataflow Synchronous Kernel Scalar Operators c x z t + when y o c + r when flow values clock 5 7 3 6 2 8 1 111111 ... x ... 3 2 1 5 4 1 7 111111 ... ... y 8 9 4 11 6 9 8 111111 ... z = x + y ... ... c 1 0 1 0 1 0 1 8 4 6 8 101010 ... ... t = z when c 3 1 4 7 ... 101010 ... r = y when c 11 5 10 15 101010 ... ... o = t + r 10

  15. A Dataflow Synchronous Kernel Scalar Operators c x z t + when y o + r flow values clock 5 7 3 6 2 8 1 111111 ... x ... 3 2 1 5 4 1 7 111111 ... ... y 8 9 4 11 6 9 8 111111 ... z = x + y ... ... c 1 0 1 0 1 0 1 8 4 6 8 101010 ... ... t = z when c 3 2 1 5 4 1 7 ... 111111 ... r = y rejected o = t + r 11

  16. A Dataflow Synchronous Kernel Scalar Operators c x z t + when y o c’ + r when flow values clock 5 7 3 6 2 8 1 111111 ... x ... 3 2 1 5 4 1 7 111111 ... ... y 8 9 4 11 6 9 8 111111 ... z = x + y ... ... c 1 0 1 0 1 0 1 8 4 6 8 101010 ... ... t = z when c 2 5 1 ... 010101 ... r = y when c’ rejected o = t + r 12

  17. n-Synchronous Extension: Bufferization Operator c x z t t’ + when y o c’ + r when flow values clock 8 4 6 8 t = z when c ... 101010 ... 8 4 6 ... 010101 ... t’ = buffer(t) 2 5 1 ... 010101 ... r = y when c’ 10 9 7 ... 010101 ... o = t’ + r • adaptability relation ⇒ communication through a bounded buffer • example : 101010 ... < : 010101 ... 13

  18. Adaptability Relation Cumulative Function 11 Number of ones 10 O w 1 9 8 7 6 5 4 3 2 1 0 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 Instants w 1 1 1 0 1 0 1 1 0 1 0 1 1 0 1 0 1 O w 1 : cumulative function of the word w 1 14

  19. Adaptability Relation 11 Number of ones 10 O w 1 9 O w 2 8 7 Writings in the buffer 6 5 4 3 2 Readings in the buffer 1 0 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 Instants buffer size size ( w 1 , w 2 ) = max i ∈ N ( O w 1 ( i ) − O w 2 ( i )) def adaptability w 1 < : w 2 ⇔ ∃ n ∈ N , ∀ i, 0 ≤ O w 1 ( i ) − O w 2 ( i ) ≤ n 15

  20. Ultimately Periodic Clocks Example : 0(00111) = 0 00111 00111 ... Verification of relations on clocks • equality test: 0(00111 00111) = 0 00(111 00) • adaptability test: (11010) < : 0(00111) Clock expressions • computation of on : 0(00111) on (101) = 0(00101) 16

  21. Clock Typing

  22. Typing plus plus c x z t t’ + when y o c’ + r when let node plus_plus (x,y) = o where 4 rec z = x + y 5 and t = z when c 6 and t’= buffer(t) 7 and r = y when c’ 8 and o = t’ + r 9 val plus_plus : (int * int) -> int val plus_plus :: forall ’a. (’a * ’a) -> ’a on c’ Buffer line 7, characters 10-19: size = 1 18

  23. Clock Calculus Example plus plus c x x z t t’ α x + when y y o c’ + α y r when   α x = = = α y       C =       19

  24. Clock Calculus Example plus plus c x x z z t t’ α x + when y y α z o c’ + α y r when   α x = = α y = = = α z =       C =       19

  25. Clock Calculus Example plus plus c x x z z t t t’ t’ α x + when α z on c y y α z o c’ + α y r r when α y on c ′   α x = = α y = = = α z =       C =       19

  26. Clock Calculus Example plus plus c x x z z t t t t’ t’ t’ α x + when α z on c y y α z α t ′ o c’ + α y r r when α y on c ′   α x = = α y = = = α z =       C = < : α z on c < : < : α t ′       19

  27. Clock Calculus Example plus plus c x x z z t t t t’ t’ t’ α x + when α z on c y y α z α t ′ o o c’ + α y α o r r when α y on c ′   α x = = = α y = = = α z       C = < : α z on c < : < : α t ′   α y on c ′ =   = = α t ′ = = = α o   19

  28. Clock Calculus Example plus plus c x x z z t t t t’ t’ t’ α x + when α z on c y y α z α t ′ o o c’ + α y α o r r when α y on c ′   α x = = α y = = = α z =       ( α x × α y ) → α o such that C = < : α z on c < : < : α t ′   α y on c ′ =   = = α t ′ = = = α o   20

  29. Clock Calculus Example plus plus c x x z z t t t t’ t’ t’ α x + when α z on c y y α z α t ′ o o c’ + α y α o r r when α y on c ′   = = = α = = = α α       ( α × α ) → α o such that C = < : α on c < : < : α t ′   α on c ′ =   = = α t ′ = = = α o   21

  30. Clock Calculus Example plus plus c x x z z t t t t’ t’ t’ α x + when α z on c y y α z α t ′ o o c’ + α y α o r r when α y on c ′         ( α × α ) → α o such that C = < : α on c < : < : α t ′   α on c ′ =   = α t ′ = = = = α o   22

  31. Clock Calculus Example plus plus c x x z z t t t t’ t’ t’ α x + when α z on c y y α z α t ′ o o c’ + α y α o r r when α y on c ′         ( α × α ) → α on c ′ such that C = < : < : α on c ′ α on c < :   α on c ′ = = α on c ′ =   = = = α on c ′   23

  32. Clock Calculus Example plus plus c x x z z t t t t’ t’ t’ α x + when α z on c y y α z α t ′ o o c’ + α y α o r r when α y on c ′         ( α × α ) → α on c ′ such that C = < : < : α on c ′ α on c < :       24

Recommend


More recommend