1.26k likes | 1.38k Views
Phased Scheduling of Stream Programs. Michal Karczmarek, William Thies and Saman Amarasinghe MIT L C S. Streaming Application Domain. Based on audio, video and data streams Increasingly prevalent Embedded systems Cell phones, handheld computers, etc. Desktop applications Streaming media
E N D
Phased Schedulingof 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, handheld computers, etc. • Desktop applications • Streaming media • Software radio • Real-time encryption • High-performance servers • Software Routers (ex. Click) • Cell phone base stations • HDTV editing consoles
Properties of Stream Programs • A large (possibly infinite) amount of data • Limited lifespan of each data item • Little processing of each data item • A regular, static computation pattern • Stream program structure is relatively constant • A lot of opportunities for compiler optimizations
StreamIt Language Source • Streaming Language from MIT LCS • Similar to Synchronous Data Flow (SDF) • Provides hierarchy & structure • Four Structures: • Filter • Pipeline • SplitJoin • FeedbackLoop • All Structures have Single-Input Channel Single-Output Channel • Filters allow ‘peeking’ – looking at items which are not consumed LPF Splitter LPF LPF LPF LPF CClip HPF HPF HPF HPF ACorr Compress Compress Compress Compress Joiner Sink
Our Contributions New scheduling technique called Phased Scheduling • Small buffer sizes for hierarchical programs • Fine grained control over schedule size vs buffer size tradeoff • Allows for separate compilation by always avoiding deadlock • Performs initialization for peeking Filters
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
Stream Programs • Consist of Filters and Channels • Filters perform computation • Channels act as FIFO queues for data between Filters filter filter filter filter
Filters • Execute a work function which: • Consumes data from their input • Produces data to their output • Filters consume and produce constant amount of data on every execution of the work function • Rates are known at compilation time • Filter executions are atomic filter
Stream Program Schedule • Describes the order in which filters are executed • Needs to manage grossly mismatched rates between filters • Manages data buffered up in channels between filters • Controls latency of data processing
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
StreamIt - Filter • Performs the computation • Consumes pop data items • Produces push data items • Inspects peek data items peek, pop push
StreamIt - Filter • Example: • FIR filter peek = 3 pop = 1 FIR push = 1
StreamIt - Filter • Example: • FIR filter • Inspects 3 data items peek = 3 pop = 1 FIR push = 1
StreamIt - Filter • Example: • FIR filter • Inspects 3 data items • Consumes 1 data item peek = 3 pop = 1 FIR push = 1
StreamIt - Filter • Example: • FIR filter • Inspects 3 data items • Consumes 1 data item • Produces 1 data item peek = 3 pop = 1 FIR push = 1
StreamIt - Filter • Example: • FIR filter • Inspects 3 data items • Consumes 1 data item • Produces 1 data item peek = 3 pop = 1 FIR push = 1
StreamIt - Filter • Example: • FIR filter • Inspects 3 data items • Consumes 1 data item • Produces 1 data item • And again… peek = 3 pop = 1 FIR push = 1
StreamIt - Filter • Example: • FIR filter • Inspects 3 data items • Consumes 1 data item • Produces 1 data item • And again… peek = 3 pop = 1 FIR push = 1
StreamIt - Filter • Example: • FIR filter • Inspects 3 data items • Consumes 1 data item • Produces 1 data item • And again… peek = 3 pop = 1 FIR push = 1
StreamIt - Filter • Example: • FIR filter • Inspects 3 data items • Consumes 1 data item • Produces 1 data item • And again… peek = 3 pop = 1 FIR push = 1
StreamIt - Filter • Example: • FIR filter • Inspects 3 data items • Consumes 1 data item • Produces 1 data item • And again… peek = 3 pop = 1 FIR push = 1
StreamIt Pipeline • Connects multiple components together • Sequential (data-wise) computation • Inserts implicit buffers between them A B C
StreamIt SplitJoin • Also connects several components together • Parallel computation construct • Allows for computation of same data (DUPLICATE splitter) or different data (ROUND_ROBIN splitter) splitter A B joiner
StreamIt FeedbackLoop delay • ONLY structure to allow data cycles • Needs initialization on feedbackPath • Amount of data on feedbackPath is delay joiner B L splitter
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
Scheduling – Steady State • Every valid stream graph has a Steady State • Steady State does not change amount of data buffered between components • Steady State can be executed repeatedly forever without growing buffers
Steady State Example • 3:2 Rate Converter • First filter (A) upsamples by factor of 3 • Second filter (B) downsamples by factor of 2 pop = 1 A push = 3 pop = 2 B push = 1
Steady State Example • A executes 2 times • pushes 2 * 3 = 6 items • B executes 3 times • pops 3 * 2 = 6 items • Number of data items stored between Filters does not change pop = 1 A push = 3 2 * pop = 2 B push = 1 3 *
Steady State Example 2 • 3:2 Rate Converter • First filter (A) upsamples by factor of 3 • Second filter (B) downsamples by factor of two • Schedule: pop = 1 A push = 3 0 pop = 2 B push = 1 0
Steady State Example 2 • 3:2 Rate Converter • First filter (A) upsamples by factor of 3 • Second filter (B) downsamples by factor of two • Schedule: • A pop = 1 A push = 3 0 pop = 2 B push = 1 0
Steady State Example 1 • 3:2 Rate Converter • First filter (A) upsamples by factor of 3 • Second filter (B) downsamples by factor of two • Schedule: • A pop = 1 A push = 3 0 pop = 2 B push = 1 0
Steady State Example 1 • 3:2 Rate Converter • First filter (A) upsamples by factor of 3 • Second filter (B) downsamples by factor of two • Schedule: • A pop = 1 A push = 3 3 pop = 2 B push = 1 0
Steady State Example 1 • 3:2 Rate Converter • First filter (A) upsamples by factor of 3 • Second filter (B) downsamples by factor of two • Schedule: • AA pop = 1 A push = 3 3 pop = 2 B push = 1 0
Steady State Example 0 • 3:2 Rate Converter • First filter (A) upsamples by factor of 3 • Second filter (B) downsamples by factor of two • Schedule: • AA pop = 1 A push = 3 3 pop = 2 B push = 1 0
Steady State Example 0 • 3:2 Rate Converter • First filter (A) upsamples by factor of 3 • Second filter (B) downsamples by factor of two • Schedule: • AA pop = 1 A push = 3 6 pop = 2 B push = 1 0
Steady State Example 0 • 3:2 Rate Converter • First filter (A) upsamples by factor of 3 • Second filter (B) downsamples by factor of two • Schedule: • AAB pop = 1 A push = 3 6 pop = 2 B push = 1 0
Steady State Example 0 • 3:2 Rate Converter • First filter (A) upsamples by factor of 3 • Second filter (B) downsamples by factor of two • Schedule: • AAB pop = 1 A push = 3 4 pop = 2 B push = 1 0
Steady State Example 0 • 3:2 Rate Converter • First filter (A) upsamples by factor of 3 • Second filter (B) downsamples by factor of two • Schedule: • AAB pop = 1 A push = 3 4 pop = 2 B push = 1 1
Steady State Example 0 • 3:2 Rate Converter • First filter (A) upsamples by factor of 3 • Second filter (B) downsamples by factor of two • Schedule: • AABB pop = 1 A push = 3 4 pop = 2 B push = 1 1
Steady State Example 0 • 3:2 Rate Converter • First filter (A) upsamples by factor of 3 • Second filter (B) downsamples by factor of two • Schedule: • AABB pop = 1 A push = 3 2 pop = 2 B push = 1 1
Steady State Example 0 • 3:2 Rate Converter • First filter (A) upsamples by factor of 3 • Second filter (B) downsamples by factor of two • Schedule: • AABB pop = 1 A push = 3 2 pop = 2 B push = 1 2
Steady State Example 0 • 3:2 Rate Converter • First filter (A) upsamples by factor of 3 • Second filter (B) downsamples by factor of two • Schedule: • AABBB pop = 1 A push = 3 2 pop = 2 B push = 1 2
Steady State Example 0 • 3:2 Rate Converter • First filter (A) upsamples by factor of 3 • Second filter (B) downsamples by factor of two • Schedule: • AABBB pop = 1 A push = 3 0 pop = 2 B push = 1 2
Steady State Example 0 • 3:2 Rate Converter • First filter (A) upsamples by factor of 3 • Second filter (B) downsamples by factor of two • Schedule: • AABBB pop = 1 A push = 3 0 pop = 2 B push = 1 3
Steady State Example 0 • 3:2 Rate Converter • First filter (A) upsamples by factor of 3 • Second filter (B) downsamples by factor of two • Schedule: • AABBB pop = 1 A push = 3 0 pop = 2 B push = 1 3
Steady State Example 2 • 3:2 Rate Converter • First filter (A) upsamples by factor of 3 • Second filter (B) downsamples by factor of two • Schedule: • AABBB • A pop = 1 A push = 3 0 pop = 2 B push = 1 0
Steady State Example 1 • 3:2 Rate Converter • First filter (A) upsamples by factor of 3 • Second filter (B) downsamples by factor of two • Schedule: • AABBB • A pop = 1 A push = 3 0 pop = 2 B push = 1 0
Steady State Example 1 • 3:2 Rate Converter • First filter (A) upsamples by factor of 3 • Second filter (B) downsamples by factor of two • Schedule: • AABBB • A pop = 1 A push = 3 3 pop = 2 B push = 1 0
Steady State Example 1 • 3:2 Rate Converter • First filter (A) upsamples by factor of 3 • Second filter (B) downsamples by factor of two • Schedule: • AABBB • AB pop = 1 A push = 3 3 pop = 2 B push = 1 0
Steady State Example 1 • 3:2 Rate Converter • First filter (A) upsamples by factor of 3 • Second filter (B) downsamples by factor of two • Schedule: • AABBB • AB pop = 1 A push = 3 1 pop = 2 B push = 1 0