Skip to content

Commit a6c3781

Browse files
[APPack] Added Max Displacement Metric
Added the ability to print the max displacement from the placement reconstruction to the original flat placement. This metric will help show another dimension to the flat placement reconstruction. Generally, if the average displacement is low, that may not be good if that means that one atom is placed way farther away than where it would like. This can really hurt quality.
1 parent 183e552 commit a6c3781

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

vpr/src/base/load_flat_place.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
#include "load_flat_place.h"
1010

11+
#include <algorithm>
1112
#include <fstream>
1213
#include <unordered_set>
1314
#include "atom_lookup.h"
@@ -254,7 +255,8 @@ void log_flat_placement_reconstruction_info(
254255
// Go through each atom and compute how much it has displaced and count
255256
// how many have been displaced beyond some threshold.
256257
constexpr float disp_threashold = 0.5f;
257-
float total_disp = 0;
258+
float total_disp = 0.f;
259+
float max_disp = 0.f;
258260
unsigned num_atoms_missplaced = 0;
259261
for (AtomBlockId atom_blk_id : atom_netlist.blocks()) {
260262
// TODO: Currently only handle the case when all of the position
@@ -281,6 +283,9 @@ void log_flat_placement_reconstruction_info(
281283
float dlayer = blk_layer - clb_loc.loc.layer;
282284
float dist = std::sqrt((dx * dx) + (dy * dy) + (dlayer * dlayer));
283285

286+
// Collect the max displacement.
287+
max_disp = std::max(max_disp, dist);
288+
284289
// Accumulate into the total displacement.
285290
total_disp += dist;
286291

@@ -311,6 +316,8 @@ void log_flat_placement_reconstruction_info(
311316
total_disp);
312317
VTR_LOG("\tAverage atom displacement of initial placement from flat placement: %f\n",
313318
total_disp / static_cast<float>(num_atoms));
319+
VTR_LOG("\tMax atom displacement of initial placement from flat placement: %f\n",
320+
max_disp);
314321
VTR_LOG("\tPercent of atoms misplaced from the flat placement: %f\n",
315322
static_cast<float>(num_atoms_missplaced) / static_cast<float>(num_atoms));
316323
}

0 commit comments

Comments
 (0)