phased scheduling of stream programs
play

Phased Scheduling of Stream Programs Michal Karczmarek, William - PowerPoint PPT Presentation

Phased Scheduling of Stream Programs Michal Karczmarek, William Thies and Saman Amarasinghe MIT LCS Streaming Application Domain Based on audio, video and data streams Increasingly prevalent Embedded systems Cell phones,


  1. Steady State Example 0 � 3:2 Rate Converter pop = 1 � First filter (A) upsamples by A push = 3 factor of 3 � Second filter (B) downsamples 0 by factor of two � Schedule: pop = 2 � AABBB B push = 1 3

  2. Steady State Example 2 � 3:2 Rate Converter pop = 1 � First filter (A) upsamples by A push = 3 factor of 3 � Second filter (B) downsamples 0 by factor of two � Schedule: pop = 2 � AABBB B push = 1 � A 0

  3. Steady State Example 1 � 3:2 Rate Converter pop = 1 � First filter (A) upsamples by A push = 3 factor of 3 � Second filter (B) downsamples 0 by factor of two � Schedule: pop = 2 � AABBB B push = 1 � A 0

  4. Steady State Example 1 � 3:2 Rate Converter pop = 1 � First filter (A) upsamples by A push = 3 factor of 3 � Second filter (B) downsamples 3 by factor of two � Schedule: pop = 2 � AABBB B push = 1 � A 0

  5. Steady State Example 1 � 3:2 Rate Converter pop = 1 � First filter (A) upsamples by A push = 3 factor of 3 � Second filter (B) downsamples 3 by factor of two � Schedule: pop = 2 � AABBB B push = 1 � AB 0

  6. Steady State Example 1 � 3:2 Rate Converter pop = 1 � First filter (A) upsamples by A push = 3 factor of 3 � Second filter (B) downsamples 1 by factor of two � Schedule: pop = 2 � AABBB B push = 1 � AB 0

  7. Steady State Example 1 � 3:2 Rate Converter pop = 1 � First filter (A) upsamples by A push = 3 factor of 3 � Second filter (B) downsamples 1 by factor of two � Schedule: pop = 2 � AABBB B push = 1 � AB 1

  8. Steady State Example 1 � 3:2 Rate Converter pop = 1 � First filter (A) upsamples by A push = 3 factor of 3 � Second filter (B) downsamples 1 by factor of two � Schedule: pop = 2 � AABBB B push = 1 � ABA 1

  9. Steady State Example 0 � 3:2 Rate Converter pop = 1 � First filter (A) upsamples by A push = 3 factor of 3 � Second filter (B) downsamples 1 by factor of two � Schedule: pop = 2 � AABBB B push = 1 � ABA 1

  10. Steady State Example 0 � 3:2 Rate Converter pop = 1 � First filter (A) upsamples by A push = 3 factor of 3 � Second filter (B) downsamples 4 by factor of two � Schedule: pop = 2 � AABBB B push = 1 � ABA 1

  11. Steady State Example 0 � 3:2 Rate Converter pop = 1 � First filter (A) upsamples by A push = 3 factor of 3 � Second filter (B) downsamples 4 by factor of two � Schedule: pop = 2 � AABBB B push = 1 � ABAB 1

  12. Steady State Example 0 � 3:2 Rate Converter pop = 1 � First filter (A) upsamples by A push = 3 factor of 3 � Second filter (B) downsamples 2 by factor of two � Schedule: pop = 2 � AABBB B push = 1 � ABAB 1

  13. Steady State Example 0 � 3:2 Rate Converter pop = 1 � First filter (A) upsamples by A push = 3 factor of 3 � Second filter (B) downsamples 2 by factor of two � Schedule: pop = 2 � AABBB B push = 1 � ABAB 2

  14. Steady State Example 0 � 3:2 Rate Converter pop = 1 � First filter (A) upsamples by A push = 3 factor of 3 � Second filter (B) downsamples 2 by factor of two � Schedule: pop = 2 � AABBB B push = 1 � ABABB 2

  15. Steady State Example 0 � 3:2 Rate Converter pop = 1 � First filter (A) upsamples by A push = 3 factor of 3 � Second filter (B) downsamples 0 by factor of two � Schedule: pop = 2 � AABBB B push = 1 � ABABB 2

  16. Steady State Example 0 � 3:2 Rate Converter pop = 1 � First filter (A) upsamples by A push = 3 factor of 3 � Second filter (B) downsamples 0 by factor of two � Schedule: pop = 2 � AABBB B push = 1 � ABABB 3

  17. Steady State Example 0 � 3:2 Rate Converter pop = 1 � First filter (A) upsamples by A push = 3 factor of 3 � Second filter (B) downsamples 0 by factor of two � Schedule: pop = 2 � AABBB B push = 1 � ABABB 3

  18. Steady State Example - Buffers 0 � AABBB requires 6 data pop = 1 items of buffer space A push = 3 between filters A and B � ABABB requires 4 data 0 items of buffer space between filters A and B pop = 2 B push = 1 3

  19. Steady State Example - Latency 0 � AABBB – First data item pop = 1 output after third execution A of an filter push = 3 � Also A already consumed 2 0 data items � ABABB – First data item output after second execution pop = 2 B of an filter push = 1 � A consumed only 1 data item 3

  20. Initialization 3 � Filter Peeking provides a new pop = 1 challenge A push = 3 � Just Steady State doesn’t work: � 0 peek = 3, pop = 2 B push = 1 0

  21. Initialization 2 � Filter Peeking provides a new pop = 1 challenge A push = 3 � Just Steady State doesn’t work: � A 3 peek = 3, pop = 2 B push = 1 0

  22. Initialization 1 � Filter Peeking provides a new pop = 1 challenge A push = 3 � Just Steady State doesn’t work: � AA 6 peek = 3, pop = 2 B push = 1 0

  23. Initialization 1 � Filter Peeking provides a new pop = 1 challenge A push = 3 � Just Steady State doesn’t work: � AAB 4 peek = 3, pop = 2 B push = 1 1

  24. Initialization 1 � Filter Peeking provides a new pop = 1 challenge A push = 3 � Just Steady State doesn’t work: � AABB 2 � Can’t execute B again! peek = 3, pop = 2 B push = 1 2

  25. Initialization 1 � Filter Peeking provides a new pop = 1 challenge A push = 3 � Just Steady State doesn’t work: � AABB 2 � Can’t execute B again! � Can’t execute A one extra time: peek = 3, pop = 2 B push = 1 � AABB 2

  26. Initialization 0 � Filter Peeking provides a new pop = 1 challenge A push = 3 � Just Steady State doesn’t work: � AABB 5 � Can’t execute B again! � Can’t execute A one extra time: peek = 3, pop = 2 B push = 1 � AABBA 2

  27. Initialization 0 � Filter Peeking provides a new pop = 1 challenge A push = 3 � Just Steady State doesn’t work: � AABB 3 � Can’t execute B again! � Can’t execute A one extra time: peek = 3, pop = 2 B push = 1 � AABBAB � Left 3 items between A and B! 3

  28. Initialization 0 � Must have data between A and B pop = 1 before starting execution of Steady A push = 3 State Schedule � Construct two schedules: 3 � One for Initialization � One for Steady State peek = 3, pop = 2 � Initialization Schedule leaves data in B buffers so Steady State can execute push = 1 3

  29. Initialization 3 � Initialization Schedule: pop = 1 � A push = 3 0 peek = 3, pop = 2 B push = 1 0

  30. Initialization 2 � Initialization Schedule: pop = 1 � A A push = 3 3 peek = 3, pop = 2 B push = 1 0

  31. Initialization 2 � Initialization Schedule: pop = 1 � A A push = 3 � Leave 3 items between A and B � Steady State Schedule: 3 � peek = 3, pop = 2 B push = 1 0

  32. Initialization 1 � Initialization Schedule: pop = 1 � A A push = 3 � Leave 3 items between A and B � Steady State Schedule: 6 � A peek = 3, pop = 2 B push = 1 0

  33. Initialization 0 � Initialization Schedule: pop = 1 � A A push = 3 � Leave 3 items between A and B � Steady State Schedule: 9 � AA peek = 3, pop = 2 B push = 1 0

  34. Initialization 0 � Initialization Schedule: pop = 1 � A A push = 3 � Leave 3 items between A and B � Steady State Schedule: 7 � AAB peek = 3, pop = 2 B push = 1 1

  35. Initialization 0 � Initialization Schedule: pop = 1 � A A push = 3 � Leave 3 items between A and B � Steady State Schedule: 5 � AABB peek = 3, pop = 2 B push = 1 2

  36. Initialization 0 � Initialization Schedule: pop = 1 � A A push = 3 � Leave 3 items between A and B � Steady State Schedule: 3 � AABBB peek = 3, pop = 2 B push = 1 3

  37. Initialization 0 � Initialization Schedule: pop = 1 � A A push = 3 � Leave 3 items between A and B � Steady State Schedule: 3 � AABBB � Leave 3 items between A and B peek = 3, pop = 2 B push = 1 3

  38. Initialization 0 � Initialization Schedule: pop = 1 � A A push = 3 � Leave 3 items between A and B � Steady State Schedule: 3 � AABBB � Leave 3 items between A and B peek = 3, pop = 2 B push = 1 � See paper for more details 3

  39. Overview � General Stream Concepts � StreamIt Details � Program Steady State and Initialization � Single Appearance and Pull Scheduling � Phased Scheduling � Minimal Latency � Results � Related Work and Conclusion

  40. Scheduling � Steady State tells us how many times each component needs to execute � Need to decide on an order of execution � Order of execution affects � Buffer size � Schedule size � Latency

  41. Single Appearance Scheduling (SAS) � Every Filter is listed in the schedule only once � Use loop-nests to express the multiplicity of execution of Filters � Buffer size is not optimal � Schedule size is minimal

  42. Schedule Size � Schedules can be stored in two ways � Explicitly – in a schedule data structure � Implicitly – as code which executes the schedule’s loop-nests � Schedule size = number of appearances of nodes (filters and splitters/joiners) in the schedule � Single appearance schedule size is same as number of nodes in the program � Other scheduling techniques can have larger size � SAS schedule size is minimal: all nodes must appear in every schedule at least once

  43. SAS Example – Buffer Size 1 � Example: CD-DAT 147 * A 2 � CD to Digital Audio Tape rate converter 3 98 * B 2 � Mismatched rates cause large number of executions in Steady 7 28 * C State 8 7 32 * D 5

  44. SAS Example – Buffer Size 1 � Naïve SAS schedule: 147 * A 2 � 147A 98B 28C 32D 294 3 � Required Buffer Size: 714 98 * B 2 � Unnecessarily large buffer 196 requirements! 7 28 * C 8 224 7 32 * D 5

  45. SAS Example – Buffer Size � Naïve SAS schedule: 1 A 2 � 147A 98B 28C 32D � Required Buffer Size: 714 3 B � Unnecessarily large buffer 2 requirements! 7 � Optimal SAS CD-DAT schedule: C 8 � 49{3A 2B} 4{7C 8D} � Required Buffer size: 258 7 D 5

  46. SAS Example – Buffer Size � Naïve SAS schedule: 1 3 * A 2 � 147A 98B 28C 32D 6 � Required Buffer Size: 714 3 2 * B � Unnecessarily large buffer 2 requirements! 7 � Optimal SAS CD-DAT schedule: C 8 � 49{3A 2B} 4{7C 8D} � Required Buffer size: 258 7 D 5

  47. SAS Example – Buffer Size � Naïve SAS schedule: 1 3 * A 2 � 147A 98B 28C 32D 6 � Required Buffer Size: 714 3 2 * B � Unnecessarily large buffer 2 requirements! 7 � Optimal SAS CD-DAT schedule: C 8 � 49{3A 2B} 4{7C 8D} � Required Buffer size: 258 7 D 5

  48. SAS Example – Buffer Size � Naïve SAS schedule: 1 A 2 � 147A 98B 28C 32D 49 * 6 � Required Buffer Size: 714 3 B � Unnecessarily large buffer 2 requirements! 7 � Optimal SAS CD-DAT schedule: C 8 � 49{3A 2B} 4{7C 8D} � Required Buffer size: 258 7 D 5

  49. SAS Example – Buffer Size � Naïve SAS schedule: 1 A 2 � 147A 98B 28C 32D 49 * 6 � Required Buffer Size: 714 3 B � Unnecessarily large buffer 2 requirements! 7 � Optimal SAS CD-DAT schedule: 7 * C 8 � 49{3A 2B} 4{7C 8D} 56 � Required Buffer size: 258 7 8 * D 5

  50. SAS Example – Buffer Size � Naïve SAS schedule: 1 A 2 � 147A 98B 28C 32D 49 * 6 � Required Buffer Size: 714 3 B � Unnecessarily large buffer 2 requirements! 7 � Optimal SAS CD-DAT schedule: 7 * C 8 � 49{3A 2B} 4{7C 8D} 56 � Required Buffer size: 258 7 8 * D 5

  51. SAS Example – Buffer Size � Naïve SAS schedule: 1 A 2 � 147A 98B 28C 32D 49 * 6 � Required Buffer Size: 714 3 B � Unnecessarily large buffer 2 requirements! 7 � Optimal SAS CD-DAT schedule: C 8 � 49{3A 2B} 4{7C 8D} 4 * 56 � Required Buffer size: 258 7 D 5

  52. SAS Example – Buffer Size � Naïve SAS schedule: 1 A 2 � 147A 98B 28C 32D 49 * 6 � Required Buffer Size: 714 3 B � Unnecessarily large buffer 2 196 requirements! 7 � Optimal SAS CD-DAT schedule: C 8 � 49{3A 2B} 4{7C 8D} 4 * 56 � Required Buffer size: 258 7 D 5

  53. SAS Example – Buffer Size � Naïve SAS schedule: 1 A 2 � 147A 98B 28C 32D 6 � Required Buffer Size: 714 3 B � Unnecessarily large buffer 2 196 requirements! 7 � Optimal SAS CD-DAT schedule: C 8 � 49{3A 2B} 4{7C 8D} 56 � Required Buffer size: 258 7 D 5

  54. Pull Schedule Example – Buffer Size 1 � Pull Scheduling: A 2 � Always execute the bottom-most element 4 possible 3 B � CD-DAT schedule: 2 8 � 2A B A B 2A B A B C D … A B C 2D 7 � Required Buffer Size: 26 C 8 � 251 entries in the schedule 14 � Hard to implement efficiently, as 7 schedule is VERY large D 5

  55. SAS vs Pull Schedule Buffer Size Schedule Size SAS 258 4 Pull Schedule 26 251 Need something in between SAS and Pull Scheduling

  56. Overview � General Stream Concepts � StreamIt Details � Program Steady State and Initialization � Single Appearance and Pull Scheduling � Phased Scheduling � Minimal Latency � Results � Related Work and Conclusion

Recommend


More recommend