Skip to content

Commit de05313

Browse files
use calcualted channel width for post-placement channel util estimate
1 parent bdfec62 commit de05313

File tree

1 file changed

+27
-9
lines changed

1 file changed

+27
-9
lines changed

vpr/src/place/net_cost_handler.cpp

Lines changed: 27 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
#include "vtr_ndmatrix.h"
3636
#include "PlacerCriticalities.h"
3737
#include "vtr_prefix_sum.h"
38+
#include "stats.h"
3839

3940
#include <array>
4041

@@ -1829,19 +1830,36 @@ std::pair<vtr::NdMatrix<double, 3>, vtr::NdMatrix<double, 3>> NetCostHandler::e
18291830
}
18301831
}
18311832

1832-
const t_chan_width& chan_width = device_ctx.chan_width;
1833+
const auto[chanx_width, chany_width] = calculate_channel_width();
18331834

1834-
for (size_t x = 0; x < chanx_util.dim_size(0); ++x) {
1835-
for (size_t y = 0; y < chanx_util.dim_size(1); ++y) {
1836-
chanx_util[0][x][y] /= chan_width.x_list[y];
1837-
}
1838-
}
1835+
VTR_ASSERT(chanx_util.size() == chany_util.size());
1836+
VTR_ASSERT(chanx_util.ndims() == chany_util.ndims());
1837+
VTR_ASSERT(chanx_util.size() == chanx_width.size());
1838+
VTR_ASSERT(chanx_util.ndims() == chanx_width.ndims());
1839+
VTR_ASSERT(chany_util.size() == chany_width.size());
1840+
VTR_ASSERT(chany_util.ndims() == chany_width.ndims());
1841+
1842+
for (size_t layer = 0; layer < chanx_util.dim_size(0); ++layer) {
1843+
for (size_t x = 0; x < chanx_util.dim_size(1); ++x) {
1844+
for (size_t y = 0; y < chanx_util.dim_size(2); ++y) {
1845+
if (chanx_width[layer][x][y] > 0) {
1846+
chanx_util[layer][x][y] /= chanx_width[layer][x][y];
1847+
} else {
1848+
VTR_ASSERT_SAFE(chanx_width[layer][x][y] == 0);
1849+
chanx_util[layer][x][y] = 1.;
1850+
}
18391851

1840-
for (size_t x = 0; x < chany_util.dim_size(0); ++x) {
1841-
for (size_t y = 0; y < chany_util.dim_size(1); ++y) {
1842-
chany_util[0][x][y] /= chan_width.y_list[x];
1852+
if (chany_width[layer][x][y] > 0) {
1853+
chany_util[layer][x][y] /= chany_width[layer][x][y];
1854+
} else {
1855+
VTR_ASSERT_SAFE(chany_width[layer][x][y] == 0);
1856+
chany_util[layer][x][y] = 1.;
1857+
}
1858+
1859+
}
18431860
}
18441861
}
18451862

1863+
18461864
return {chanx_util, chany_util};
18471865
}

0 commit comments

Comments
 (0)