From e01464e2ac2bf3bd2752e10b48d2fc3ffc4fdf9e Mon Sep 17 00:00:00 2001 From: Clifford Wolf Date: Thu, 28 Apr 2016 23:17:30 +0200 Subject: [PATCH] Added "qwp -v" --- passes/cmds/qwp.cc | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/passes/cmds/qwp.cc b/passes/cmds/qwp.cc index 8deb262b2..1b800b6df 100644 --- a/passes/cmds/qwp.cc +++ b/passes/cmds/qwp.cc @@ -40,6 +40,7 @@ struct QwpConfig { bool ltr; bool alpha; + bool verbose; double grid; std::ofstream dump_file; @@ -47,6 +48,7 @@ struct QwpConfig QwpConfig() { ltr = false; alpha = false; + verbose = false; grid = 1.0 / 16; } }; @@ -211,10 +213,16 @@ struct QwpWorker // // M := [AA Ay] + if (config.verbose) + log("> System size: %d^2\n", GetSize(nodes)); + // Row major order int N = GetSize(nodes), N1 = N+1; vector M(N * N1); + if (config.verbose) + log("> Edge constraints: %d\n", GetSize(edges)); + // Edge constraints: // A[i,:] := [ 0 0 .... 0 weight 0 ... 0 -weight 0 ... 0 0], y[i] := 0 // @@ -232,6 +240,9 @@ struct QwpWorker M[idx2 + idx1*N1] += -weight * weight; } + if (config.verbose) + log("> Node constraints: %d\n", GetSize(nodes)); + // Node constraints: // A[i,:] := [ 0 0 .... 0 weight 0 ... 0 0], y[i] := weight * pos // @@ -263,6 +274,9 @@ struct QwpWorker } #endif + if (config.verbose) + log("> Solving\n"); + // Solve "AA*x = Ay" // (least squares fit for "A*x = y") // @@ -277,6 +291,9 @@ struct QwpWorker // gaussian elimination for (int i = 0; i < N; i++) { + if (config.verbose && ((i+1) % (N/15)) == 0) + log("> Solved %d%%: %d/%d\n", (100*(i+1))/N, i+1, N); + // find best row int best_row = queue.front(); int best_row_queue_idx = 0; @@ -312,6 +329,9 @@ struct QwpWorker } } + if (config.verbose) + log("> Solved\n"); + log_assert(queue.empty()); log_assert(GetSize(pivot_cache) == N); @@ -334,6 +354,9 @@ struct QwpWorker } #endif + if (config.verbose) + log("> Update nodes\n"); + // update node positions for (int i = 0; i < N; i++) { @@ -778,6 +801,9 @@ struct QwpPass : public Pass { log(" -dump \n"); log(" Dump a protocol of the placement algorithm to the html file.\n"); log("\n"); + log(" -v\n"); + log(" Verbose solver output for profiling or debugging\n"); + log("\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"); @@ -799,6 +825,10 @@ struct QwpPass : public Pass { config.alpha = true; continue; } + if (args[argidx] == "-v") { + config.verbose = true; + continue; + } if (args[argidx] == "-grid" && argidx+1 < args.size()) { config.grid = 1.0 / atoi(args[++argidx].c_str()); continue; -- 2.30.2