Joint Minimization of Code and Data for Synchronous Dataflow Programs

13
Joint Minimization of Code and Data for Synchronous Dataflow Programs Kaushik Ravindran EE 249 – Presentation

description

Joint Minimization of Code and Data for Synchronous Dataflow Programs. Kaushik Ravindran EE 249 – Presentation. Objective. Develop a methodology for chain-structured SDF graphs to minimize Code size Buffer memory Extend this into heuristic solutions for general acyclic SDF graphs. - PowerPoint PPT Presentation

Transcript of Joint Minimization of Code and Data for Synchronous Dataflow Programs

Page 1: Joint Minimization of Code and Data for Synchronous Dataflow Programs

Joint Minimization of Code and Data for Synchronous

Dataflow Programs

Kaushik Ravindran

EE 249 – Presentation

Page 2: Joint Minimization of Code and Data for Synchronous Dataflow Programs

Objective

Develop a methodology for chain-structured SDF graphs to minimize

Code size

Buffer memory

Extend this into heuristic solutions for general acyclic SDF graphs

Page 3: Joint Minimization of Code and Data for Synchronous Dataflow Programs

Quick Overview

Dataflow networksCollection of functional actors connected over unbounded FIFO buffers

Synchronous Dataflow (SDF)# of tokens produced per actor fixed

Deadlock and boundedness are decidable

A B C20 10 20 10

Page 4: Joint Minimization of Code and Data for Synchronous Dataflow Programs

Motivation

Code size minimizationCode replication each time an actor appears in schedule

Amount of on-chip memory limited

Single Appearance schedules – optimally compact inline representation of SDF

Buffer memory optimizationChoose schedule that minimizes buffer memory

Page 5: Joint Minimization of Code and Data for Synchronous Dataflow Programs

Schedules and Loops

Revisit

Repetitions vectorqG = (1, 2, 4) - Minimum number of actor firings

• q[source(e)] * produce(e) = q[sink(e)]*consume(e)

Flat single appearance schedule• (ω(1A)(2B)(4C))

(nS1S2…Sk) – ‘n’ successive firings of S1…Sk

A B C20 10 20 10

Page 6: Joint Minimization of Code and Data for Synchronous Dataflow Programs

Impact of schedule on buffer size

Valid schedules Buffer size1. ABCBCCC 502. A(2B(2C)) 403. A(2B)(4C) 604. A(2BC)(2C) 50

For a consistent SDF graph, there exists a fully reduced single appearance schedule occupying minimum possible buffer memory

A B C20 10 20 10

Page 7: Joint Minimization of Code and Data for Synchronous Dataflow Programs

R-Schedules

Recursively decompose chain-structured graph (G) into left (SL) and right (SR) subgraphs

Set or R-schedules always contains a schedule that attains minimum buffer requirement

Number of R-schedules = (1/n)(2n-2 C n-1)where n = number of actors in chain SDF

Page 8: Joint Minimization of Code and Data for Synchronous Dataflow Programs

Dynamic Programming Algorithm

Determine R-schedule that minimizes buffer memory requirement

Minimum buffer memory requirement is cost of subgraphs and cost of split

b[i,j] = min(b[i,k] + b[k+1,j] + ci,j[k])

for i <= k < j

Running time O(n3)

Page 9: Joint Minimization of Code and Data for Synchronous Dataflow Programs

Heuristic Solution

Introduce split on edge where minimum amount of data is transferred

Average run time O(n * log (n))

Can apply heuristic to arbitrary acyclic SDFPartition SDF into smaller subgraphsApply exact dynamic programming algorithm to minimum size subgraphs

Page 10: Joint Minimization of Code and Data for Synchronous Dataflow Programs

Directed Acyclic SDF graphs

Topological sortOrdering of vertices, such that source vertex of each edge occurs earlier than sink vertex

Flat single appearance schedule corresponds to any valid topological sort

Four possible topological

sorts

A

B

C

D

s t

Page 11: Joint Minimization of Code and Data for Synchronous Dataflow Programs

Heuristic – Minimum legal cuts into Bounded Sets

Extend heuristic for chain-structured graphFind cut with minimum amount of data transferred

• Kernighan and Lin approach

Recursively partition left and right halves to obtain schedule bodies

Run dynamic programming algorithm to optimize schedule

Page 12: Joint Minimization of Code and Data for Synchronous Dataflow Programs

In retrospect

Main objectivesMinimize code size

• Through single appearance schedules

Minimize buffer memory• Through buffer optimal looped schedules

Dynamic programming algorithmFor well ordered SDF graphs

Heuristic algorithms For general acyclic SDF graphs

Page 13: Joint Minimization of Code and Data for Synchronous Dataflow Programs

Possible improvements – future work

Consideration of a shared buffer approachCalculate minimum shared buffer size for looped schedules

Trade-offs between code size Vs buffer sizeConsider a multiple appearance schedule that could optimize buffer usage

Extend study to arbitrary SDF graphs