Definitioncore
Resource compatibility graph
Also called operation compatibility graph.
A graph whose vertices are operations or variables and whose edges join pairs that may share one unit or register; a binding is a partition into cliques.
A resource compatibility graph is an undirected graph built from a scheduled design in high-level synthesis. Its vertices are the operations of one unit type, or the variables (values) that need storage, and an edge joins two of them when they may use the same functional unit or the same register. Its complement is the conflict graph. A binding of the vertices to hardware instances is exactly a partition of the compatibility graph into cliques, so the fewest instances is the least number of cliques in such a partition.
Definition
The model is the one of resource-constrained scheduling. A sequencing graph , part of a control data flow graph, has a delay in steps for each operation , and a schedule gives each a start step . There is no chaining. Two operations are mutually exclusive when no execution of the design runs both of them, for example because they are on the two arms of one branch.
Busy set. A unit that is not pipelined is busy with in the steps . A pipelined unit accepts a new operation in each step, so for it .
Operation compatibility graph. Fix a unit type , and let be the operations that a unit of type can execute. The compatibility graph of type is with
Lifetime. A value is written at the end of step , the last step of the operation that makes it, and it is last read in step . A register holds it in the steps
All reads in a step see the register contents from the start of the step, as in a finite state machine with datapath. So a register that is read for the last time in step can be written at the end of step . A primary input has when it is ready before step 1, and a result that leaves the design at the end has for latency .
Variable compatibility graph. Its vertices are the values, and is an edge exactly when or and are never live in the same execution.
Conflict graph. The conflict graph of either kind is the complement: the same vertices, with an edge exactly when the pair is not compatible.
Binding as a clique partition. A binding of type maps each to one instance of type so that two operations on one instance are never busy in the same step of any execution. The classes of a binding are cliques of , because two members of one class are never busy together. Conversely, every partition of into cliques of is a binding with one instance per clique. In each step of each execution, at most one member of a clique is busy, since any two members are compatible. So the least number of instances of type is the clique partition number of , which is the chromatic number of the conflict graph. The same holds for registers and the variable compatibility graph. This is the clique cover problem on .
Interval and circular-arc structure. An interval graph is the intersection graph of a finite family of intervals of the line: one vertex per interval, and an edge when two intervals meet. For a schedule of straight-line code, with no mutually exclusive pairs, every busy set and every lifetime is a set of consecutive steps, so the conflict graph is an interval graph. Its complement, the compatibility graph, has a transitive orientation: direct when ends before starts. If and , then ends before starts, so . A graph with such an orientation is a comparability graph. For values that live across the back edge of a loop, the lifetimes are arcs of a circle with one point per step of the loop body, and the conflict graph is a circular-arc graph, the intersection graph of a family of arcs of a circle.
Consequence for straight-line code. Interval graphs are chordal and hence perfect. Pairwise intersecting intervals share a common point: the largest left end lies in all of them. So the largest clique of the conflict graph is the largest number of operations busy in one step, or of values live in one step, and by the interval coloring depth theorem this many units or registers suffice. Circular-arc graphs are not perfect in general, and coloring them is NP-complete, see circular-arc coloring.
Examples and non-examples
A small schedule. Take unit delays except for , and these starts:
| operation | type | start | busy set | note |
|---|---|---|---|---|
| mul | 1 | |||
| mul | 1 | |||
| mul | 2 | |||
| mul | 3 | delay 2, not pipelined | ||
| add | 2 | |||
| add | 3 | |||
| add | 4 | then arm of a branch | ||
| add | 4 | else arm of the same branch |
The multiplier graph has the 5 edges , , , and . Only is missing, because both are busy in step 1. The adder graph is complete on 4 vertices: and share step 4, but they are mutually exclusive. So the least binding has 2 multipliers, and , and 1 adder. If the branch analysis did not detect that and exclude each other, the edge would be missing and 2 adders would be needed.
A variable graph. Let be written at the end of step 1 and last read in step 3, written at the end of step 3 and read in step 4, and written at the end of step 2 and read in step 4. Then , and . The only edge is : is read in step 3 and is written at the end of step 3, so they can share a register. Two registers are needed, since meets both.
Non-example: the data flow graph. The edges of the sequencing graph are dependences. They say nothing about sharing. Two operations joined by a dependence are in different steps, so they are often compatible, and two operations with no dependence may be busy in the same step.
Non-example: one graph for several unit types. Let run on an adder or an ALU, on an ALU or a subtractor, and on a subtractor or an adder, all in different steps. Every pair can share some type of unit, so a graph with an edge for each such pair is a triangle. But no single unit type runs all three, so the triangle is not a valid binding. The definition fixes the unit type for this reason.
Non-example: a loop. A loop body of 5 steps with five values, where value is live in steps and , and value 5 is live in step 5 and in step 1 of the next iteration, gives the conflict graph . Every step has 2 live values, but needs 3 colors. This conflict graph is a circular-arc graph that is not an interval graph, and the depth bound fails for it.
Related definitions
- Conflict graph. The complement of the compatibility graph. In a compiler, the conflict graph of the values is the interference graph of the register allocation problem.
- Clique partition. A partition of the vertex set into cliques. The fewest cliques is the subject of the clique cover problem, and it equals the chromatic number of the complement, see graph coloring.
- Interval graph and comparability graph. Defined above. The conflict graph of straight-line code is an interval graph, and its compatibility graph is a comparability graph. Both are perfect.
- Circular-arc graph. Defined above. It appears for values that cross the back edge of a loop, see register binding.
- Weighted compatibility graph. An edge weight measures how much interconnect two operations save when they share a unit, for example the number of common operand sources. Binders such as Tseng-Siewiorek clique partitioning use these weights or the number of common neighbours to choose merges.
- Bindings that use it. Resource binding for operations and register binding for values are clique partition problems on these graphs.
References
- Giovanni De Micheli, Synthesis and Optimization of Digital Circuits, McGraw-Hill, 1994, Chapter 6, Resource Sharing and Binding (the compatibility and conflict graphs of operations and of variables)
- Chia-Jeng Tseng and Daniel P. Siewiorek, Automated synthesis of data paths in digital systems, IEEE Transactions on Computer-Aided Design 5(3), 379 to 395, 1986, the compatibility graphs of operations, of variables and of data transfers, and their partition into cliques
- Martin Charles Golumbic, Algorithmic Graph Theory and Perfect Graphs, second edition, Elsevier, 2004, Chapter 8, Interval Graphs (interval graphs are chordal and perfect, and their complements are comparability graphs)
Where this leads
About this page
The build computes these levels from the evidence in the repository. Each row says what the next level needs. Read what the levels mean.
| Ladder | Level | What the next level needs |
|---|---|---|
| Human proof | H0 no proof |
|
| Lean | L0 no Lean part |
|
| Visual | V0 none |
|
| Writing | W4 complete |
|
Tag 5PJXVD Edit this page History Report an error Markdown