ibm labs in haifa generation core: ibm's systematic constraint solver
TRANSCRIPT
IBM Labs in Haifa
Generation Core: IBM's Systematic Constraint Solver
IBM Haifa Labs
2 © 2008 IBM Corporation
Outline
Introduction to constraint satisfaction problems (CSP) Constraint satisfaction at IBM Haifa Solving approaches Generation Core (GEC): IBM’s systematic CSP solver Special features
– Large domains
– Specialized propagators
– Random solutions
– Hierarchical soft constraints
– Conditional sub-problems
IBM Haifa Labs
3 © 2008 IBM Corporation
A CSP consists of:
A set of VariablesA set of Variables v1, v2, ..., vn A finite domainfinite domain for each variable: for each vi, vi є Di
ConstraintsConstraints A set of relations between the variables
IBM Haifa Labs
4 © 2008 IBM Corporation
The round-table problem
King Arthur would like to seat all his knights around the round table
Each knight must sit between two knights he knows
Lancelot knows GalahadEctor knows Kay
Percival knows LancelotGareth knows GawainGareth knows Lionel
Galahad knows PercivalPellinore knows Kay
...
IBM Haifa Labs
5 © 2008 IBM Corporation
Every variable is assigned a value from its domain, such that all constraints are satisfied
All solutions are created equal
Solution for a CSP
IBM Haifa Labs
6 © 2008 IBM Corporation
Constraint satisfaction at IBM Haifa Research Labs
Two state-of-the-art solving engines – systematic and stochastic
Major application: test generation for hardware verification
Other applications
– Workforce management
– Truck configuration
– Floor planning
IBM Haifa Labs
7 © 2008 IBM Corporation
Generation Core (GEC)
IBM’s systematic CSP engine
On a par with leading tools in the industry (ILOG, SICStus)
Generic
Dozens of engineers involved in development, modeling, and applications of CSP
15 years of development experience
Research activity
IBM Haifa Labs
8 © 2008 IBM Corporation
GEC solution algorithm
MAC
Instantiation
MAC
Instantiation
MACInstantiation
MAC
Systematic approach Based on Maintain Arc Consistency (MAC) [Mackworth 1977]
backtrack
IBM Haifa Labs
9 © 2008 IBM Corporation
MAC Example
R2: {(y,z): yz}
R1: {(x,y,z): x=y+z}
X: {1,2,3} Y: {1,2,3} Z: {1,2,3}
X: {1,2,3} Y: {1,2,3} Z: {1,2,3}
X: {1,2,3} Y: {1,2,3} Z: {1,2,3}
X: {1,2,3} Y: {1,2,3} Z: {1,2,3}
X: {1,2,3} Y: {1,2,3} Z: {1,2,3}
AC
AC
instantiation
Don’t give up yet
AC
IBM Haifa Labs
10 © 2008 IBM Corporation
MAC example - backtracking
R2: {(y,z): yz}
R1: {(x,y,z): x=y+z}
X: {1,2,3} Y: {1,2,3} Z: {1,2,3}
X: {1,2,3} Y: {1,2,3} Z: {1,2,3}
X: {1,2,3} Y: {1,2,3} Z: {1,2,3}
X: {1,2,3} Y: {1,2,3} Z: {1,2,3}
X: {1,2,3} Y: {1,2,3} Z: {1,2,3}
instantiation
instantiation
AC
IBM Haifa Labs
11 © 2008 IBM Corporation
GEC algorithm summary
Make all constraints locally consistent Through reducing the variable domains Iteratively until a fixed-point is achieved Backtrack if a domain is reduced to an empty set If backtracking is exhausted problem is unsolvable
Repeat until all variables are reduced to a single value or failure occurs
Choose a variable (which was not yet assigned) Choose and assign a value for the selected variable
Choose a soft constraint and activate it
IBM Haifa Labs
12 © 2008 IBM Corporation
Main Application: Simulation-Based Functional Verification of Processors
FunctionalSpecification
DesignSimulator
Expected Behavior Actual Behavior
Stimuli (test-cases)Stimuli Generator
IBM Haifa Labs
13 © 2008 IBM Corporation
How GEC fits into the test generation process
Stimuli Generator
Architecture specification
Expert knowledge definingcorner cases
Constraint solverGEC constraint solver
Stimuli (test-cases)
Model
Used to verify all PowerPC designs in IBM over the last seven years : i/p series servers, Cell, Xbox™
IBM Haifa Labs
14 © 2008 IBM Corporation
Example of constraints
add R1 R2 , R3
load Rx 1000 (Ry)
???? ?? Rz
mult Rz ?? , ??
Quality: sum zero
Validity: x != y
Input scenario: same register
IBM Haifa Labs
15 © 2008 IBM Corporation
Special features: Large number domains
Represented as masks:
0X0X = {0000, 0100, 0001, 0101}
Length of numbers often 64 or 128 bits longDomains can have sizes of 264
IBM Haifa Labs
16 © 2008 IBM Corporation
Special Features: Specialized propagators
For arithmetic operations: +, *, /, ... For logical expressions: and, or, implies, ... For bit operations: shift, rotate, concatenate, ...
Rich expression language to represent constraints
But users also have the option of defining their own propagators in C++ code!
IBM Haifa Labs
17 © 2008 IBM Corporation
Special Features: Random Solutions
Every operation of the solver on a given problem produces a different solution
Strive toward uniformity of solutions (sometimes difficult)
Guarantee not to ‘lose’ solutions Essential for testing because of unpredictability of bugs
User preferences allowed by Allowing hierarchy of soft constraints Value ordering Variable ordering
User preferences allowed by Allowing hierarchy of soft constraints Value ordering Variable ordering
All solutions are created equal
IBM Haifa Labs
18 © 2008 IBM Corporation
Special Features: Conditional Sub-problems
Existence variables control the existence of certain sub-problems
{true,false}false
IBM Haifa Labs
19 © 2008 IBM Corporation
CSP is a dynamic field used to solve ‘hard’ problems (non-polynomial, non-linear)
Haifa Research Labs have a large group working on research and development in CSP
Haifa CSP tools are already in usage as a critical link in the chain of processor development
Also used in other applications within and outside of IBM
Summary