Bit-Vector Optimization ALEXANDER NADER AND VADIM RYVCHIN INTEL TACAS 2016.

Slides:



Advertisements
Similar presentations
Hybrid BDD and All-SAT Method for Model Checking Orna Grumberg Joint work with Assaf Schuster and Avi Yadgar Technion – Israel Institute of Technology.
Advertisements

Finding bugs: Analysis Techniques & Tools Symbolic Execution & Constraint Solving CS161 Computer Security Cho, Chia Yuan.
Satisfiability Modulo Theories (An introduction)
Linear Programming (LP) (Chap.29)
Introduction to MiniSat v1.14 Presented by Yunho Kim Provable Software Lab, KAIST.
Propositional and First Order Reasoning. Terminology Propositional variable: boolean variable (p) Literal: propositional variable or its negation p 
Proofs from SAT Solvers Yeting Ge ACSys NYU Nov
Daniel Kroening and Ofer Strichman 1 Decision Procedures An Algorithmic Point of View SAT.
IBM Labs in Haifa © 2005 IBM Corporation Adaptive Application of SAT Solving Techniques Ohad Shacham and Karen Yorav Presented by Sharon Barner.
1 NP-Complete Problems. 2 We discuss some hard problems:  how hard? (computational complexity)  what makes them hard?  any solutions? Definitions 
Tuning SAT-checkers for Bounded Model-Checking A bounded guided tour Ofer Strichman Carnegie Mellon University.
© 2002 Fadi A. Aloul, University of Michigan PBS: A Pseudo-Boolean Solver and Optimizer Fadi A. Aloul, Arathi Ramani, Igor L. Markov, Karem A. Sakallah.
Using Excel Solver for Linear Optimization Problems
Lecture 7: Linear Programming in Excel AGEC 352 Spring 2011 – February 9, 2011 R. Keeney.
Student:Victoria Kravchenko Supervisors:Prof. Yoram Moses Liat Atsmon.
Nikolaj Bjørner Microsoft Research Lecture 3. DayTopicsLab 1Overview of SMT and applications. SAT solving, Z3 Encoding combinatorial problems with Z3.
Heuristics for Efficient SAT Solving As implemented in GRASP, Chaff and GSAT.
Linear Programming Excel Solver. MAX8X 1 + 5X 2 s.t.2X 1 + 1X 2 ≤ 1000 (Plastic) 3X 1 + 4X 2 ≤ 2400 (Prod. Time) X 1 + X 2 ≤ 700 (Total Prod.) X 1 - X.
GRASP-an efficient SAT solver Pankaj Chauhan. 6/19/ : GRASP and Chaff2 What is SAT? Given a propositional formula in CNF, find an assignment.
Efficient SAT Solving for Non- clausal Formulas using DPLL, Graphs, and Watched-cuts Himanshu Jain Edmund M. Clarke.
State-of-the-art in SAT solvers
Computability and Complexity 24-1 Computability and Complexity Andrei Bulatov Approximation.
Stochastic greedy local search Chapter 7 ICS-275 Spring 2007.
1 Abstraction Refinement for Bounded Model Checking Anubhav Gupta, CMU Ofer Strichman, Technion Highly Jet Lagged.
Computational Methods for Management and Economics Carla Gomes Module 4 Displaying and Solving LP Models on a Spreadsheet.
Linear Programming Optimal Solutions and Models Without Unique Optimal Solutions.
SAT Solving Presented by Avi Yadgar. The SAT Problem Given a Boolean formula, look for assignment A for such that.  A is a solution for. A partial assignment.
Daniel Kroening and Ofer Strichman Decision Procedure
Is Bit-Vector Reasoning as Hard as NExpTime in Practice?
SAT Solver Math Foundations of Computer Science. 2 Boolean Expressions  A Boolean expression is a Boolean function  Any Boolean function can be written.
Boolean Satisfiability and SAT Solvers
SAT and SMT solvers Ayrat Khalimov (based on Georg Hofferek‘s slides) AKDV 2014.
Types of IP Models All-integer linear programs Mixed integer linear programs (MILP) Binary integer linear programs, mixed or all integer: some or all of.
The Complexity of Optimization Problems. Summary -Complexity of algorithms and problems -Complexity classes: P and NP -Reducibility -Karp reducibility.
Linear Programming McGraw-Hill/Irwin Copyright © 2012 by The McGraw-Hill Companies, Inc. All rights reserved.
Introduction to Satisfiability Modulo Theories
Incremental formal verification of hardware Hana Chockler Alexander Ivrii Arie Matsliah Shiri Moran Ziv Nevo IBM Research - Haifa.
1 Systems Analysis Methods Dr. Jerrell T. Stracener, SAE Fellow SMU EMIS 5300/7300 NTU SY-521-N NTU SY-521-N SMU EMIS 5300/7300 Statistical Analysis Other.
Parallelizing MiniSat I-Ting Angelina Lee Justin Zhang May 05, Final Project Presentation.
HW #1. Due Mar 22 Midnight Verify the following program using SAT solver 1. Translate the program into a SSA form 2. Create a Boolean formula from.
Goal Seek and Solver. Goal seeking helps you n Find a specific value for a target cell by adjusting the value of one other cell whose value is allowed.
HW #2. Due Mar 27 23:59 Do NOT forget to submit both a hardcopy solution to the HW box and a softcopy solution to TA (Youngjoo Kim):
On the Relation between SAT and BDDs for Equivalence Checking Sherief Reda Rolf Drechsler Alex Orailoglu Computer Science & Engineering Dept. University.
February 22-25, 2010 Designers Work Less with Quality Formal Equivalence Checking by Orly Cohen, Moran Gordon, Michael Lifshits, Alexander Nadel, and Vadim.
Linear Programming Optimal Solutions and Models Without Unique Optimal Solutions.
McGraw-Hill/Irwin Copyright © 2009 by The McGraw-Hill Companies, Inc. All Rights Reserved. Supplement 6 Linear Programming.
Preprocessing in Incremental SAT Alexander Nadel 1, Vadim Ryvchin 1,2, and Ofer Strichman 2 1 – Intel, Haifa, Israel 2 – Technion, Haifa, Israel SAT’12,
C OMPUTING U NSAT C ORES O F B OOLEAN A ND SMT F ORMULAS Computing Small Unsatisfiable Cores in Satisfiability Modulo Theories Alessandro Cimatti, Alberto.
Satisfiability and SAT Solvers CS 270 Math Foundations of CS Jeremy Johnson.
TU/e Algorithms (2IL15) – Lecture 12 1 Linear Programming.
Linear Programming McGraw-Hill/Irwin Copyright © 2012 by The McGraw-Hill Companies, Inc. All rights reserved.
TU/e Algorithms (2IL15) – Lecture 12 1 Linear Programming.
Satisfiability Modulo Theories and DPLL(T) Andrew Reynolds March 18, 2015.
© 2012 IBM Corporation Perfect Hashing and CNF Encodings of Cardinality Constraints Yael Ben-Haim Alexander Ivrii Oded Margalit Arie Matsliah SAT 2012.
SAT for Software Model Checking Introduction to SAT-problem for newbie
Efficient Generation of Small Interpolants in CNF (for Model Checking)
Hybrid BDD and All-SAT Method for Model Checking
Parallelism in SAT Solvers
Solving Linear Arithmetic with SAT-based MC
Satisfiability Modulo Theories
Simple Circuit-Based SAT Solver
Mining backbone literals in incremental SAT
SAT-Based Area Recovery in Technology Mapping
Linear Programming Excel Solver.
HW #2. Due Apr 25 23:59 Do NOT forget to submit both a hardcopy solution to the HW box and a softcopy solution to TA.
Canonical Computation without Canonical Data Structure
SAT-based Methods: Logic Synthesis and Technology Mapping
GRASP-an efficient SAT solver
Faster Extraction of High-Level Minimal Unsatisfiable Cores
Presentation transcript:

Bit-Vector Optimization ALEXANDER NADER AND VADIM RYVCHIN INTEL TACAS 2016

 Bit-vector – (example: unsinged 7 bit type)  Logical Operands (OR, AND, XOR, IMPLIES, ITE…)  Basic math operands (+, -, *, /, mod, >, <, …)  Assertions  … 2 Bit-Vector SMT V 1 : Bitvector[16] V 2 : Bitvector[16] V 1 := 0x4 Assert(V 2 > 3) U := V 1 + V 2 (check-sat) Satisfiable V 1 = 0x4 V 2 = 0x6 U = 0xA

 Input:  BV Formula F  Term t[n]=[t n-1, t n-2, …, t 0 ]  Output:  Satisfiable solution for F which maximizes t. 3 Optimization Bit-Vector (OBV) V 1 : Bitvector[16] V 2 : Bitvector[16] V 1 := 0x4 U := V 1 + V 2 M := ¬U (maximize M) Satisfiable V 1 = 0x4 V 2 = 0x0 U = 0x4 M = 0xFFFB

 Naïve Approaches : Linear and Binary search  Weighted MAX-SAT : applied in extension to Z3, vZ 4 OBV – Previous Work

 Given a satisfiable formula F and the optimization target t[n]: 1. Solve F with SMT Solver 2. while Solve return SAT do 1. res = value(t) 2. Assert t > res 3. Solve F with an SMT Solver 3. return last model returned by Solve 5 Naïve Linear Search (NLS) t=v 0  t=v 1  t=v 2 … : v 0 < v 1 < v 2 …

 Given a satisfiable formula F and the optimization target t[n]: 1. Solve F with SMT Solver 2. min = value(t), max = 2 n while min < max do 1. Assert t > (min + (max – min)/2) 2. Solve F with an SMT Solver 3. If SAT: min = (min + (max – min)/2) 4. If UNSAT: max = (min + (max – min)/2) 4. return last model returned by Solve 6 Naïve Binary Search (NBS) 0 2 n -1 v0v0 max min t > mid

 Given a satisfiable formula F and the optimization target t[n]: 1. Solve F with SMT Solver 2. min = value(t), max = 2 n while min < max do 1. Assert t > (min + (max – min)/2) 2. Solve F with an SMT Solver 3. If SAT: min = (min + (max – min)/2) 4. If UNSAT: max = (min + (max – min)/2) 4. return last model returned by Solve 7 Naïve Binary Search (NBS) 0 2 n -1 v0v0 max min

 MAX-SAT:  Input: hard clauses and soft weighted clauses  Solution: satisfies all hard clauses and maximizes the weight of soft clauses.  Given a satisfiable formula F and the optimization target t[n]:  Preprocess and Translate F to MAX-SAT Format:  Each CNF clause is a hard clause  Weighted Soft: { ( t i ), w=2 i : i = 0..n-1}  Run MAX-SAT Solver 8 Weighted MAX-SAT Approach

 Naïve Linear Search  Naïve Binary Search  Weighted MAX-SAT approach  Weak Assumptions Optimization  Inline Binary Search 9 How to solve OBV? Our approaches

 Use Minisat’s Assumptions scheme for the solution  Given a satisfiable formula F and the optimization target t[n]: 1. Pre-process and Translate F to CNF 2. Solve F with SAT Solver with t[n] as weak assumptions: t n-1, t n-2, …, t 0 10 Optimization with Weak Assumptions – OBV-WA

 First decisions with specific order starting from MSB t n-1 toward LSB t 0.  If negation of one assumption is implied by other assumptions (during BCP):  It continues to the next assumption (in contrast to Minisat’s approach) 11 Weak Assumptions

 t n-1 - The first decision OBV-WA Example t n-1 v1v1v1v1 ¬v 2 decision level 1 First Decision t n- 1 BCP

 t n-1 - The first decision  t n-2 - The second decision  t n-3 - The third decision OBV-WA Example t n-1 v1v1v1v1 ¬v 2 decision level 1 t n-2 ¬v 3 v4v4v4v4 decision level 2 t n-3 v4v4v4v4 decision level 3

 t n-1 - The first decision  t n-2 - The second decision  t n-3 - The third decision OBV-WA Example t n-1 v1v1v1v1 ¬v 2 decision level 1 t n-2 ¬v 3 v4v4v4v4 decision level 2 t n-3 v4v4v4v4 decision level 3 BackTrack

 t n-1 - The first decision  t n-2 - The second decision  ¬t n-3 – Implied by t n-1 OBV-WA Example t n-1 v1v1v1v1 ¬v 2 decision level 1 ¬t n-3 t n-2

 Check satisfiability of F: from t = 2 n-1 towards t = 0  t is decreased by δ > 1 when no model between [t; t - δ + 1] 16 OBV-WA

 Given a satisfiable formula F and the optimization target t[n]: 1. Pre-process and Translate F to CNF 2. µ = SAT() // (Solve F with SMT Solver = SAT()) 3. a = {} 4. For i : n–1.. 0 do 1. If t i  µ then a = a U {t i } 2. Else β = SatUnderAssumptions(a U {t i }) 1. If β is a model then µ = β, a = a U {t i } 2. Else a = a U {¬t i } 5. Return µ 17 Optimization with Inline Binary Search – OBV-BS

18 OBV-BS Example t n-1 t n-2 t n-3 t n-4 t0t0 Assume

19 OBV-BS Example t n-1 t n-2 t n-3 t n-4 t0t0 Assume Run SAT SolverResult SAT

20 OBV-BS Example t n-3 t n-4 t0t0 SATUNSAT

21 OBV-BS Example t n-3 t n-4 t0t0 Assume

22 OBV-BS Example t0t0

 Which one is better?  Depends on the problem: if almost all t i are 1 then OBV-WA as it assigns 1 to all bits first, otherwise OBV-BS 23 OBV-WA vs. OBV-BS

Our Application in Chip Design 24

Chip Design Fixer 25 "PhysicalDesign" by Linear77 - Own work. Licensed under CC BY 3.0 via Wikimedia Commons -

General Cell Placement Problem  Cell – A basic logic or a memory element  Grid – Set of placement locations  Input:  Set of cells  Placement Grid  Constraints:  Non-overlapping constraints  Timing constraints  Thermal constraints  Output:  A legal placement satisfies all the constraints 26

Our Problem - Placement Fixer  Assumption: Placement of standard cells has already been generated  A new set of design constraints of different priority, introduced late in the process  Re-running the placer from scratch is not an option:  Satisfy backward compatibility  Stability  Run-time requirements  Post-processing fixer tool is required 27

Placement Fixer Problem  Input:  Grid of size (X; Y )  Set of n non-overlapping (but possibly touching) rectangles placed on the grid  Allowed movement for of cells on the grid  Violations between pairs of touching rectangles  Each violation has a unique priority  Parity preservation : for each rectangle the y- coordinate at the new location must be even if the original y-coordinate is even.  Output:  New cells placement while minimizing violations 28

Placement Problem P(b, t, d): b – bottom cell t – top cell d - delta 29

Placement Solution 30

Our Solution  For every shiftable cell:  Declare two variables x,y representing possible locations on the grid  Limit x,y by the allowed movement  y mod 2 == parity constraint  For every pair of cells:  Prevent overlapping if they can overlap  For each potential violation add bit to bitvector in increasing priority order – receiving a long bitvector  Minimize the bitvector  done efficiently using our SMT solver 31

 We encoded our problem to LIA  Opti-MathSAT  Zv – LIA 32 Additional Reduction

33 Experimental Results

34 OBV-WA vs. OBV-BS

35