Skip to content

Commit 73332ab

Browse files
doxygen comments for congestion related matrices in NetCostHandler
1 parent 04a84cd commit 73332ab

File tree

4 files changed

+26
-6
lines changed

4 files changed

+26
-6
lines changed

vpr/src/base/stats.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ void routing_stats(const Netlist<>& net_list,
2828
/**
2929
* @brief Calculates the routing channel width at each grid location.
3030
*
31-
* Iterates through all RR nodes and counts how many wires pass through each (x, y) location
31+
* Iterates through all RR nodes and counts how many wires pass through each (layer, x, y) location
3232
* for both horizontal (CHANX) and vertical (CHANY) channels.
3333
*
3434
* @return A pair of 3D matrices:
@@ -73,6 +73,8 @@ void print_device_utilization(const float target_device_utilization);
7373
* - Occupancy percentage (occupancy / capacity)
7474
* - Channel capacity
7575
*
76+
* TODO: extend to 3D
77+
*
7678
* @param filename Output file path.
7779
* @param occupancy Matrix of occupancy counts.
7880
* @param capacity_list List of channel capacities (per y for chanx, per x for chany).

vpr/src/place/net_cost_handler.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1842,7 +1842,7 @@ double NetCostHandler::estimate_routing_chan_util(bool compute_congestion_cost /
18421842
congestion_modeling_started_ = true;
18431843

18441844
double cong_cost = 0.;
1845-
// Compute congestion cost using recomputed bounding boxes and channel utilization map
1845+
// Compute congestion cost using computed bounding boxes and channel utilization map
18461846
if (compute_congestion_cost) {
18471847
for (ClusterNetId net_id : cluster_ctx.clb_nlist.nets()) {
18481848
if (!cluster_ctx.clb_nlist.net_is_ignored(net_id)) {

vpr/src/place/net_cost_handler.h

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -143,15 +143,22 @@ class NetCostHandler {
143143
/**
144144
* @brief Estimates routing channel utilization and computes the congestion cost
145145
* for each net.
146+
* @param compute_congestion_cost Indicates whether computing congestion cost is needed.
146147
*
147148
* For each net, distributes estimated wirelength across its bounding box
148149
* and accumulates demand for different routing channels. Normalizes by channel widths
149150
* (e.g. a value of 0.5 means 50% of the wiring in a channel is expected to be used).
150151
*
151-
* @return Total congestion cost.
152+
* @note This method assumes that net bounding boxes are already computed.
153+
*
154+
* @return Total congestion cost if requested.
152155
*/
153156
double estimate_routing_chan_util(bool compute_congestion_cost = true);
154157

158+
/**
159+
* @brief Returns the estimated routing channel usage for each location in the grid.
160+
* The channel usage estimates are computed in estimate_routing_chan_util().
161+
*/
155162
const ChannelData<vtr::NdMatrix<double, 3>>& get_chan_util() const;
156163

157164
private:
@@ -268,10 +275,21 @@ class NetCostHandler {
268275
*/
269276
ChannelData<vtr::PrefixSum1D<int>> acc_chan_width_;
270277

271-
ChannelData<vtr::PrefixSum2D<double>> acc_chan_util_;
272-
278+
/**
279+
* @brief Estimated routing usage per channel segment,
280+
* indexed by [layer][x][y]. Values represent normalized wire demand
281+
* contribution from all nets distributed over their bounding boxes.
282+
*/
273283
ChannelData<vtr::NdMatrix<double, 3>> chan_util_;
274284

285+
/**
286+
* @brief Accumulated (prefix sum) channel utilization in each direction (x/y),
287+
* on the base layer. Enables fast computation of average utilization
288+
* over a net’s bounding box during congestion cost estimation.
289+
*/
290+
ChannelData<vtr::PrefixSum2D<double>> acc_chan_util_;
291+
292+
/// Available channel width per grid location, indexed by [layer][x][y].
275293
ChannelData<vtr::NdMatrix<int, 3>> chan_width_;
276294

277295
/**

vpr/src/route/route_utilization.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ ChannelData<vtr::NdMatrix<double, 3>> RoutingChanUtilEstimator::estimate_routing
2323
// Compute net bounding boxes
2424
net_cost_handler_->comp_bb_cong_cost(e_cost_methods::NORMAL);
2525

26-
// Estimate routing channel utilization using
26+
// Estimate routing channel usage
2727
net_cost_handler_->estimate_routing_chan_util(/*compute_congestion_cost=*/false);
2828

2929
return net_cost_handler_->get_chan_util();

0 commit comments

Comments
 (0)