From 281c1f4029eaff4215a81dbb9f0c2ce17da40706 Mon Sep 17 00:00:00 2001 From: Clifford Wolf Date: Sat, 26 Sep 2015 10:42:27 +0200 Subject: [PATCH] Some cleanups in qwp --- passes/cmds/qwp.cc | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/passes/cmds/qwp.cc b/passes/cmds/qwp.cc index f76de326a..784076c37 100644 --- a/passes/cmds/qwp.cc +++ b/passes/cmds/qwp.cc @@ -203,8 +203,8 @@ struct QwpWorker void solve(bool alt_mode = false) { - // A := observation_matrix - // y := observation_rhs_vector + // A := constraint_matrix + // y := constraint_rhs_vector // // AA = A' * A // Ay = A' * y @@ -215,6 +215,10 @@ struct QwpWorker int N = GetSize(nodes), N1 = N+1; vector M(N * N1); + // Edge constraints: + // A[i,:] := [ 0 0 .... 0 weight 0 ... 0 -weight 0 ... 0 0], y[i] := 0 + // + // i.e. nonzero columns in A[i,:] at the two node indices. for (auto &edge : edges) { int idx1 = edge.first.first; @@ -228,6 +232,14 @@ struct QwpWorker M[idx2 + idx1*N1] += -weight * weight; } + // Node constraints: + // A[i,:] := [ 0 0 .... 0 weight 0 ... 0 0], y[i] := weight * pos + // + // i.e. nonzero column in A[i,:] at the node index + // + // "tied" nodes have a large weight, pinning them in position. Untied + // nodes have a small weight, giving then a tiny preference to stay at + // the current position, making sure that AA never is singular. for (int idx = 0; idx < GetSize(nodes); idx++) { auto &node = nodes[idx]; @@ -453,7 +465,7 @@ struct QwpWorker config.dump_file << stringf("\n"); } - void run_worker(int indent, bool return_after_solve = false) + void run_worker(int indent) { int count_cells = 0; @@ -481,9 +493,6 @@ struct QwpWorker solve(); solve(true); - if (return_after_solve) - return; - // detect median position and check for break condition vector> sorted_pos; @@ -769,7 +778,7 @@ struct QwpPass : public Pass { log(" -dump \n"); log(" Dump a protocol of the placement algorithm to the html file.\n"); log("\n"); - log("Note: This implementation of a quadratic wirelength placer uses unoptimized\n"); + log("Note: This implementation of a quadratic wirelength placer uses exact\n"); log("dense matrix operations. It is only a toy-placer for small circuits.\n"); log("\n"); } -- 2.30.2