TraceMaker
C++ API of the engine
Loading...
Searching...
No Matches
global.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: GPL-3.0-or-later
2#pragma once
3// Global placement (design doc 04 §3 A–C).
4//
5// (A) Quadratic placement with the bound-to-bound (B2B) net model: Spindler, Schlichtmann, Johannes,
6// "Kraftwerk2 — A Fast Force-Directed Quadratic Placement Approach Using an Accurate Net Model",
7// IEEE TCAD 27(8), 2008. Each net connects every pin to the net's two extreme pins with weight
8// w·2/((p−1)·|x_i − x_j|), which reproduces HPWL at the linearisation point; the SPD systems are solved
9// with Jacobi-preconditioned conjugate gradient (Eigen) and re-linearised.
10// (B) Spreading: SimPL (Kim, Lee, Markov, "SimPL: An Effective Placement Algorithm", ICCAD 2010 / TCAD
11// 2012): alternate the quadratic solve (lower-bound placement) with a rough legalisation (upper-bound
12// placement) and pull the parts towards it with anchor pseudo-nets of growing weight.
13// (C) Rotation: coordinate descent; each step is the exact HPWL optimum for one part with the others fixed.
14#include <array>
15#include <cstdint>
16#include <string>
17#include <vector>
18
19#include "place/legality.hpp"
20
21namespace tmk::place {
22
23// (A) Solves the B2B quadratic program for the movable parts (rotations taken from `pl`), `relinearise`
24// times. Optional anchors pull part i towards anchor[i] with weight anchor_w[i] × (the part's net weight in
25// the current linearisation); 0 = no anchor.
26void quadratic_place(const Problem& p, Placement& pl, int relinearise, const std::vector<Point>* anchor = nullptr,
27 const std::vector<double>* anchor_w = nullptr);
28
30 int iterations = 0;
31 double overflow_start = 0, overflow_end = 0; // bin density overflow of the quadratic placement
32 std::int64_t hpwl_lower = 0, hpwl_upper = 0; // weighted HPWL of the last lower/upper placements
33 std::vector<std::string> log;
34};
35
36// (B) SimPL loop starting from a quadratic placement `pl`; on return `pl` holds the spread (upper-bound)
37// placement.
38// `trace` (optional) receives the spread placement of every iteration.
39SpreadStats spread(const Problem& p, Placement& pl, int max_iterations = 40, double target_overflow = 0.10,
40 std::vector<Placement>* trace = nullptr);
41
42// Bin density overflow of a placement: Σ max(0, demand − capacity) / Σ demand over a bin grid per side.
43double density_overflow(const Problem& p, const Placement& pl);
44
45// Movable courtyard area (incl. clearance) / free board area, per side.
46std::array<double, 2> utilisation(const Problem& p);
47
48// (C) Rotation coordinate descent over the movable parts (HPWL of each part's nets). Returns the number of
49// rotation changes; terminates because every change strictly lowers the weighted HPWL.
50int optimise_rotations(const Problem& p, Placement& pl, int max_passes = 20);
51
52// Nets touching each part (sorted, unique).
53std::vector<std::vector<int>> part_nets(const Problem& p);
54
55} // namespace tmk::place
Placement legality (design doc 04 §3 D/E): exact integer tests of courtyards, through-hole obstacles,...
SpreadStats spread(const Problem &p, Placement &pl, int max_iterations=40, double target_overflow=0.10, std::vector< Placement > *trace=nullptr)
(B) SimPL loop starting from a quadratic placement pl; on return pl holds the spread (upper-bound) pl...
std::array< double, 2 > utilisation(const Problem &p)
Movable courtyard area (incl. clearance) / free board area, per side.
std::vector< std::vector< int > > part_nets(const Problem &p)
Nets touching each part (sorted, unique).
int optimise_rotations(const Problem &p, Placement &pl, int max_passes=20)
(C) Rotation coordinate descent over the movable parts (HPWL of each part's nets).
void quadratic_place(const Problem &p, Placement &pl, int relinearise, const std::vector< Point > *anchor=nullptr, const std::vector< double > *anchor_w=nullptr)
(A) Solves the B2B quadratic program for the movable parts (rotations taken from pl),...
double density_overflow(const Problem &p, const Placement &pl)
Bin density overflow of a placement: Σ max(0, demand − capacity) / Σ demand over a bin grid per side.
std::int64_t hpwl_upper
weighted HPWL of the last lower/upper placements
Definition global.hpp:32
std::int64_t hpwl_lower
Definition global.hpp:32
std::vector< std::string > log
Definition global.hpp:33
double overflow_end
bin density overflow of the quadratic placement
Definition global.hpp:31