Problemadvanced
Hardware-software partitioning
Also called hardware/software codesign partitioning, HW/SW partitioning.
Split the tasks of a system between software on a processor and custom hardware to meet timing at the least cost, as in the Vulcan and COSYMA codesign systems.
Hardware-software partitioning decides, for each task of a system, whether it runs as software on a processor or as a custom hardware block, such as a coprocessor made by high-level synthesis. Hardware is faster but costs area, and moving data between the two sides costs time. The goal is the least running time within an area budget, or the least area that meets a deadline. With an area budget, the problem contains the knapsack problem and is NP-hard. With communication costs but no budget, it is a minimum cut and takes polynomial time. The codesign systems Vulcan (Gupta and De Micheli, 1993) and COSYMA (Ernst, Henkel and Benner, 1993) attacked it from opposite ends.
In plain words
A gadget has many jobs to do. Each job can run as a program on a cheap general processor, or as a special circuit that is much faster but takes chip area. The chip area is limited. If two jobs that talk a lot sit on different sides, the data must cross between processor and circuit, which costs time too. The task is to choose which jobs become circuits so that the whole gadget is as fast as possible without going over the area limit. It is like packing a bag: each job that becomes a circuit takes room and saves time, and the bag has a fixed size.
Definition
Input.
- A set of tasks. Task takes time in software and in hardware, and its hardware version has area .
- A communication cost for each pair of tasks, paid when and are on different sides. It is 0 for tasks that do not exchange data.
- An area budget .
Feasible solutions. A set of tasks to put in hardware, with . The other tasks run in software.
Objective. The processor and the hardware run one task at a time, so the time is
Minimize .
Decision form. Given the input and a time , is there a feasible with ?
The gain of task is , the time saved by moving it to hardware. With no communication costs, , so the problem is to choose tasks of largest total gain within the area budget.
Variants
- Least area for a deadline. Fix the time bound and minimize . Vulcan works in this form.
- Concurrent execution. The processor and the hardware run at the same time, so the time is the length of a schedule of the task graph, as in resource-constrained scheduling, not a sum.
- Several processors and accelerators. Each task picks one of several targets, which is a form of module selection at the system level.
- Granularity. The tasks can be processes, functions, loops or basic blocks. COSYMA partitions basic blocks, and finer grains give more choices and more communication.
- Shared hardware. Two tasks in hardware may share units, so the area of is less than the sum of the . Then the cost depends on a later resource binding.
- Energy. The objective is the energy, with a deadline, for battery-powered devices.
Examples
Four tasks. The tasks, with software time, hardware time and area, are , , and , with no communication costs. All in software takes . The gains are . The best time for each budget:
| budget | best | time |
|---|---|---|
| 5 | or | 19 |
| 6 | 18 | |
| 7 | 16 | |
| 9 | or | 14 |
| 14 | all four | 7 |
The task with the best gain per unit of area is (3 per 2), then (7 per 5), (4 per 3) and (5 per 4). Taking tasks in this order while they fit gives with time 19 for budget 6, while gives 18. So the order by gain per area is not optimal.
Communication. Add a cost to the example. With budget 6, still takes 18, since both are in hardware and pay nothing. With budget 4, takes and takes , and takes , the best. Communication makes tasks that talk prefer the same side.
Known algorithms
- Dynamic programming. With no communication costs, the knapsack recurrence over the budget is exact in time for integer areas, which is pseudo-polynomial. See the knapsack problem.
- Greedy by gain per area. Fast, and exact for the fractional relaxation, see fractional knapsack. The example shows it is not exact for whole tasks.
- Integer programming. A 0-1 variable per task, and one per communicating pair, gives exact solutions for moderate sizes, see 0-1 integer programming.
- Minimum cut. With no area budget, exact in polynomial time, as shown below.
- Moves from all hardware. Vulcan (Gupta and De Micheli, 1993) starts with everything in hardware and moves operations to software while the timing constraints hold. Heuristic.
- Moves from all software. COSYMA (Ernst, Henkel and Benner, 1993) starts with everything in software and moves basic blocks to hardware by simulated annealing until the time constraint holds. Heuristic.
- Local search. Moves in the style of Kernighan-Lin swap tasks between the sides to reduce the communication. Heuristic.
Bounds
Lower bound. Every partition takes at least , which is reached when the budget allows every task its faster side and there are no communication costs.
Fractional bound. With no communication costs, the best gain is at most the gain of the fractional relaxation, in which a task may be split. Taking tasks by gain per area and a fraction of the first that does not fit gives that relaxation. In the example with budget 6, it takes and of , for a gain of , so no partition beats a time of . The best is 18.
Approximation. With no communication costs, the better of the greedy set and the single task of largest gain that fits has at least half of the best gain, as for the knapsack problem, and the knapsack approximation schemes apply to the gain.
Reductions
From knapsack, so NP-hard. Take a knapsack instance with values , weights , capacity and target . Make task with , and , no communication costs, and budget . Then , and fits the budget exactly when its weight is at most . So some has exactly when some set of weight at most has value at least . The construction takes linear time, and a partition is checked in polynomial time, so the decision form is NP-complete. The areas carry the numbers of the knapsack instance, so this shows NP-hardness in the weak sense, matching the pseudo-polynomial dynamic program.
To minimum cut, with no budget. Take , so every fits. Build a network with a source for software and a sink for hardware, an arc of capacity and an arc of capacity for each task, and arcs and of capacity for each pair. For a cut with the side , put the tasks of in software and the others in . The cut contains for each software task, for each hardware task, and one arc of capacity for each pair split by the cut. So the cut capacity is exactly , and a minimum cut gives an optimal partition. This is Stone's construction (1977) for assigning modules to two processors.
Applications
- Embedded systems. Codesign tools choose which functions of a controller, a codec or a signal chain become accelerators.
- FPGA systems on chip. Chips with a processor and programmable logic let the designer move functions between the two, and the partition is redone as the design evolves.
- Accelerator offload. The choice of which kernels go to a GPU or an accelerator, with the data transfer cost, is the same problem with the bus as the communication cost. The speedup is limited by the software part, as in Amdahl's law.
References
- Rajesh K. Gupta and Giovanni De Micheli, Hardware-software cosynthesis for digital systems, IEEE Design and Test of Computers 10(3), 29 to 41, 1993, whole paper (the Vulcan system, which starts from an all-hardware design and moves operations to software under timing constraints)
- Rolf Ernst, Jörg Henkel and Thomas Benner, Hardware-software cosynthesis for microcontrollers, IEEE Design and Test of Computers 10(4), 64 to 75, 1993, whole paper (the COSYMA system, which starts from an all-software design and moves basic blocks to hardware by simulated annealing)
- Harold S. Stone, Multiprocessor scheduling with the aid of network flow algorithms, IEEE Transactions on Software Engineering SE-3(1), 1977, whole paper (the assignment of program modules to two processors with communication costs as a minimum cut)
- Michael R. Garey and David S. Johnson, Computers and Intractability, A Guide to the Theory of NP-Completeness, W. H. Freeman, 1979, Appendix A6, problem MP9, Knapsack
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 | W2 basic |
|
Tag JR7CA6 Edit this page History Report an error Markdown