#lang scribble/base @(require racket) @(require scribble/core) @(require scribble/html-properties) @(define Racket (hyperlink "http://racket-lang.org" "Racket")) @(define Z3 (hyperlink "http://research.microsoft.com/en-us/um/redmond/projects/z3/" "Z3")) @(define xpose3 (hyperlink "../xpose/xpose3.sk" "xpose3.sk")) @(define xpose2 (hyperlink "../xpose/xpose2.sk" "xpose2.sk")) @(define xpose3-QF_AUFLIA (hyperlink "../xpose/xpose3-QF_AUFLIA.smt2" "QF_AUFLIA encoding")) @(define L3 (hyperlink "../L3.pdf" "Lecture 3")) @(define hw-style (make-style "hw-style" (list (make-css-addition "hw-style.css")))) @title[#:style @hw-style]{CS294 HW 2} This assignment builds on the material in @L3, which covers the translation of straight-line code into formulas. To learn how to translate programs with control flow, loops, pointers, etc., please read the following paper by next Thursday, September 6: @tabular[(list (list @hspace[5] @para{Daniel Kroening, Edmund Clarke and Karen Yorav. @(hyperlink "http://www.cs.cmu.edu/~svc/papers/view-publications-cky03.html" "Behavioral Consistency of C and Verilog Programs Using Bounded Model Checking"). DAC 2003.} @hspace[5]))] HW 2 is due at 12:00 a.m. on @bold{September 10, 2012}. @section[#:tag "part 1"]{A QF_AUFBV encoding of SIMD transpose} Encode @xpose3 in @Z3, using @emph{only} the theories of arrays and bitvectors. There should be no values of sort Int in your encoding. You can create the encoding manually, but we suggest writing a script to generate it. Here is the Racket @(hyperlink "../xpose/xpose3-QF_AUFLIA.rkt" "script") we showed in @L3 for generating the @(identity @xpose3-QF_AUFLIA). The encoding should produce values for the holes in @xpose3 so that it correctly transposes the following input matrix: @verbatim|{ 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15}| @Z3 should be able to solve your QF_AUFBV encoding at least @bold{2 times faster} than the @(identity @xpose3-QF_AUFLIA). On our machines, a bitvector encoding is about 6 times faster. For this part of the assignment, please @seclink["submit"]{submit} the following: @itemlist[@item{An @tt{xpose3-QF_AUFBV.smt2} file that contains your encoding. We will test it using @(identity @Z3).} @item{An @tt{xpose3-QF_AUFBV.*} script that contains your generator, if you used one. If the generator is written in a language other than Racket or Python, you should also provide complete instructions for compiling and executing it.}] @section[#:tag "part 2"]{An SMT encoding of SIMD transpose with additional holes} Encode @xpose2 in @Z3, using any combination of theories you want. The encoding should work on the following input matrix: @verbatim|{ 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16}| We'll hold a contest for the fastest encoding. For this part of the assignment, please @seclink["submit"]{submit} the following: @itemlist[@item{An @tt{xpose2.smt2} file that contains your encoding. We will test it using @(identity @Z3).} @item{An @tt{xpose2.*} script that contains your generator, if you used one. If the generator is written in a language other than Racket or Python, you should also provide complete instructions for compiling and executing it.}] @section{Extra credit} Some fun things to try for extra credit: @itemlist[@item{Win the encoding contest from @seclink["part 2"]{Part 2}!} @item{Explain why the input matrix from @seclink["part 1"]{Part 1} does not sufficiently constrain the set of programs in @seclink["part 2"]{Part 2}. That is, the program synthesized in @seclink["part 2"]{Part 2} using the matrix from @seclink["part 1"]{Part 1} will not work on some inputs. Why?} @item{Scale your encoding to larger matrices: 8x8, 16x16, etc.} @item{Try using a different solver.} @item{Produce an encoding that does not correspond to the operational semantics of transpose.} ] @section[#:tag "submit"]{Submission instructions} Create a @tt{@emph{username}.zip} archive of all the files specified in @seclink["part 1"]{Part 1} and @seclink["part 2"]{Part 2} of the assignment, where @emph{username} is your Google Groups ID. Email the archive to @(author+email "" "emina@eecs.berkeley.edu" #:obfuscate? #t) and @(author+email "" "bodik@cs.berkeley.edu" #:obfuscate? #t) by 12:00 a.m. on @bold{September 10, 2012}.