StreamBit: Sketching high-performance implementations of bitstream programs Armando Solar-Lezama, Rastislav Bodik UC Berkeley.

Slides:



Advertisements
Similar presentations
Parallel Programming Patterns Eun-Gyu Kim June 10, 2004.
Advertisements

CHAPTER 2 GC101 Program’s algorithm 1. COMMUNICATING WITH A COMPUTER  Programming languages bridge the gap between human thought processes and computer.
Computer Abstractions and Technology
Infinite Horizon Problems
Extensible Processors. 2 ASIP Gain performance by:  Specialized hardware for the whole application (ASIC). −  Almost no flexibility. −High cost.  Use.
Sketching high-performance implementations of bitstream programs. Armando Solar-Lezama, Rastislav Bodik UC Berkeley.
Algorithms and Problem Solving-1 Algorithms and Problem Solving.
1 Optimisation Although Constraint Logic Programming is somehow focussed in constraint satisfaction (closer to a “logical” view), constraint optimisation.
Algorithms and Problem Solving. Learn about problem solving skills Explore the algorithmic approach for problem solving Learn about algorithm development.
Cognitive Processes PSY 334 Chapter 8 – Problem Solving May 21, 2003.
Two techniques for programming by sketching (Stanford, November 2004) Rastislav Bodik, David Mandelin, Armando Solar-Lezama, Lin Xu UC Berkeley Rodric.
Lecture 10: Support Vector Machines
EE694v-Verification-Lect5-1- Lecture 5 - Verification Tools Automation improves the efficiency and reliability of the verification process Some tools,
Review Rong Jin. Comparison of Different Classification Models  The goal of all classifiers Predicating class label y for an input x Estimate p(y|x)
Programming. Software is made by programmers Computers need all kinds of software, from operating systems to applications People learn how to tell the.
SS ZG653Second Semester, Topic Architectural Patterns Pipe and Filter.
Domain-Specific Software Engineering Alex Adamec.
CASE Tools And Their Effect On Software Quality Peter Geddis – pxg07u.
1 Chapter-01 Introduction to Computers and C++ Programming.
DCT 1123 PROBLEM SOLVING & ALGORITHMS INTRODUCTION TO PROGRAMMING.
SEC(R) 2008 Intel® Concurrent Collections for C++ - a model for parallel programming Nikolay Kurtov Software and Services.
Lesson 7 Guide for Software Design Description (SDD)
1 Yolanda Gil Information Sciences InstituteJanuary 10, 2010 Requirements for caBIG Infrastructure to Support Semantic Workflows Yolanda.
1 Computing Software. Programming Style Programs that are not documented internally, while they may do what is requested, can be difficult to understand.
CSC-115 Introduction to Computer Programming
Course Overview. What are Computers? From Outside –CPU box, Monitor, Keyboard, mouse and Printers From inside –ICs, Chipsets, Hard Disks, PCB cards, Drives,
Inverse Matrices and Systems
Intro to Lexing & Parsing CS 153. Two pieces conceptually: – Recognizing syntactically valid phrases. – Extracting semantic content from the syntax. E.g.,
Abstraction IS 101Y/CMSC 101 Computational Thinking and Design Tuesday, September 17, 2013 Marie desJardins University of Maryland, Baltimore County.
Enabling Refinement with Synthesis Armando Solar-Lezama with work by Zhilei Xu and many others*
SE: CHAPTER 7 Writing The Program
Generative Programming. Automated Assembly Lines.
Introduction to Algorithms (2 nd edition) by Cormen, Leiserson, Rivest & Stein Chapter 1: The Role of Algorithms in Computing (slides by N. Adlai A. DePano)
Introduction to Problem Solving. Steps in Programming A Very Simplified Picture –Problem Definition & Analysis – High Level Strategy for a solution –Arriving.
CS221 Algorithm Basics. What is an algorithm? An algorithm is a list of instructions that transform input information into a desired output. Each instruction.
1 Markov Decision Processes Infinite Horizon Problems Alan Fern * * Based in part on slides by Craig Boutilier and Daniel Weld.
Data Structures and Algorithms Dr. Tehseen Zia Assistant Professor Dept. Computer Science and IT University of Sargodha Lecture 1.
CSC321 Introduction to Neural Networks and Machine Learning Lecture 3: Learning in multi-layer networks Geoffrey Hinton.
Linear Programming Maximize Subject to Worst case polynomial time algorithms for linear programming 1.The ellipsoid algorithm (Khachian, 1979) 2.Interior.
Advanced Software Development Karl Lieberherr CSG 260 Fall Semester
21/1/ Analysis - Model of real-world situation - What ? System Design - Overall architecture (sub-systems) Object Design - Refinement of Design.
CSC321: Introduction to Neural Networks and Machine Learning Lecture 23: Linear Support Vector Machines Geoffrey Hinton.
Onlinedeeneislam.blogspot.com1 Design and Analysis of Algorithms Slide # 1 Download From
September 1999Compaq Computer CorporationSlide 1 of 16 Verification of cache-coherence protocols with TLA+ Homayoon Akhiani, Damien Doligez, Paul Harter,
Peter Andreae Computer Science Victoria University of Wellington Copyright: Peter Andreae, Victoria University of Wellington2012 Analysing Costs COMP 103.
Chapter 1 The Phases of Software Development. Software Development Phases ● Specification of the task ● Design of a solution ● Implementation of solution.
CSCI-235 Micro-Computers in Science Algorithms Part II.
BITS Pilani Pilani Campus Data Structure and Algorithms Design Dr. Maheswari Karthikeyan Lecture1.
PROGRAMMING FUNDAMENTALS INTRODUCTION TO PROGRAMMING. Computer Programming Concepts. Flowchart. Structured Programming Design. Implementation Documentation.
Introduction to Problem Solving Programming is a problem solving activity. When you write a program, you are actually writing an instruction for the computer.
Introduction to Computer Programming Concepts M. Uyguroğlu R. Uyguroğlu.
 Programming methodology: ◦ is a process of developing programs that involves strategically dividing important tasks into functions to be utilized by.
CHAPTER 2 GC101 Program’s algorithm 1. COMMUNICATING WITH A COMPUTER  Programming languages bridge the gap between human thought processes and computer.
Introduction toData structures and Algorithms
Advanced Computer Systems
Algorithms and Problem Solving
Algorithms II Software Development Life-Cycle.
CSCI-235 Micro-Computer Applications
Parallel Programming Patterns
Reading: Pedro Domingos: A Few Useful Things to Know about Machine Learning source: /cacm12.pdf reading.
Support Vector Machines Introduction to Data Mining, 2nd Edition by
Programming by Sketching for Bit-Streaming Programs
STUDY AND IMPLEMENTATION
Programming.
Algorithms and Problem Solving
Templates of slides for P4 Experiments with your synthesizer
Chapter5: Synchronous Sequential Logic – Part 4
Query Optimization.
Armando Solar-Lezama, Rastislav Bodik UC Berkeley
_Synthesis__________________ __Of_______________________ ___First-Order_____Dynamic___ _____________Programming___ _______________Algorithms___ Yewen (Evan)
Presentation transcript:

StreamBit: Sketching high-performance implementations of bitstream programs Armando Solar-Lezama, Rastislav Bodik UC Berkeley

Bitstream Programs Bitstream programs: A Growing Domain –Crypto: DES, Serpent, Rijndael, … –coding in general – NSA/BitTwiddle Bitstream programs operate under strict constraints –Performance is very important Resource constrained environments like smartcards –Correctness is crucial Subtle bug in Blowfish implementation allowed over half the keys to be cracked in less than 10 minutes Efficient bitstream programs are hard to write

Current State of the art Lots of hand compilation –Tedious –Error prone –Not portable: optimizing for different word-size non-trivial Difficult to automate –Exponentially many choices –Greedy is Bad Description from NIST documentCode from LibDES

We can do better Separate specification from implementation –Specify the task without regard for performance –Specify Implementation without regard for bug How? –High level program encodes Task description –Sequence of transformations from Task description into equivalent Low Level program encodes an implementation –Transformations can be Sketched! Task description Implementation

Example “Drop every third bit in the bit stream.” Exhibits many features of complicated permutations –Exponentially many choices –Greedy choice is suboptimal Fast implementation can be sketched functionality sketch ???????????????? ???????????????? ???????????????? ???????????????? FAST implementation + 

What you gain Drop Third Benchmark: –Speedups over naïve code with a 14 line sketch: 32 bit on a Pentium IV: 83.8% 64 bit on an Itanium II: 233% DES Benchmark: –32 bit on a Pentium IV with 30 line sketch: 634% speedup over naïve Within ¾ of hand optimized libDES

The DSL: StreamIt High-level bitstream algorithms written a language derived from StreamIt –Synchronous Dataflow language –Filters represented internally as matrices consumes a 3-bit chunk of input; produces a 2-bit of output. xyzxyz xyxy x =

Implementation in StreamIt Make each filter correspond to one basic operation available in the hardware Example duplicate or t1 = in AND 1100 t2 = in SHIFTL 1 t3 = t2 AND 0010 out = t1 OR t3 in

The Full Picture For every task there is a space of programs that describe it Greedy Transformation algorithm defines a path from any program to an implementation Halfway Transformation can be used to get a different implementation A Sketch can simplify the process of writing a transformation Level of abstraction (high low) Implementations Task Description

Greedy Transformation Defines a default implementation for any program Leveraged by the user for custom implementations Example: Drop Third Bit –Unroll filter –decompose into filters operating on W=4 bits of input. –decompose into filters producing W=4 bits of output

Half way transformations Allows the user to guide lowering –Impart structure to the filter –Bring it closer to the desired implementation Add structure by decomposing into a pipeline of steps –Equivalent to specifying a matrix decomposition. –filter = filter1 filter2 guarantees correctness This can be done hierarchically, –Detail is only added where necessary.

F.F_1 Half way transformations-example User provides high level decomposition System Takes care of Lowering F.F_i Correctness is guaranteed as long as [F.F_3] [F.F_2] [F.F_1] = F Avoid spelling out the decomposition: Sketch It! F F.F_2 F.F_3 F.F_1 F.F_2 F.F_3 Half way transformation to specify FAST bit shifting algorithm:

Sketching: How it works Start with a sketch Define x i,j as the amount bit i will move on step j Semantic equivalence imposes linear constraints on the x i,j Many of the constraints in the sketch also impose linear constraints on x i,j Solving the linear constraints produces a space of possible solutions Map the nonlinear constraints to this solution space Search SketchDecomp[ [shift(1:32 by 0 || 1)], [shift(1:32 by 0 || 2)], [shift(1:32 by 0 || 4)], [shift(1:32 by 0 || 8)] ]( Filter );

Programming with StreamBit StreamBit program close to original task description Clever algebraic transformation expressed as a sketch Description from NIST document StreamIt Code SketchDecomp[ [ shift(1:2:31 by -33), shift(34:2:64 by 33), shift(1:64 by 0 || 33 || -33) ], [ ] ] (DES Encoding.IP); Sketch

Productivity User still has to come up with clever idea –People are good at clever ideas –Machines are good at tedious details Sketching allows user to experiment with different implementations –6 different implementations in one afternoon –Don’t have to worry about bugs

Concluding Remarks StreamBit allows for –Task specification oblivious to performance –Implementation specification without bugs Same idea may apply in other domains –If people currently resort to very low level coding –If some algebraic structure can be imposed on the task –It may be amiable to Sketching.