@@ -153,89 +153,36 @@ NetCostHandler::NetCostHandler(const t_placer_opts& placer_opts,
153
153
}
154
154
155
155
void NetCostHandler::alloc_and_load_chan_w_factors_for_place_cost_ (float place_cost_exp) {
156
- auto & device_ctx = g_vpr_ctx.device ();
156
+ const auto & device_ctx = g_vpr_ctx.device ();
157
157
158
158
const int grid_height = device_ctx.grid .height ();
159
159
const int grid_width = device_ctx.grid .width ();
160
160
161
161
/* Access arrays below as chan?_place_cost_fac_(subhigh, sublow). Since subhigh must be greater than or
162
162
* equal to sublow, we will only access the lower half of a matrix, but we allocate the whole matrix anyway
163
163
* for simplicity, so we can use the vtr utility matrix functions. */
164
- acc_chanx_width_ = vtr::NdOffsetMatrix<int , 1 >({{{-1 , grid_height}}});
165
- acc_chany_width_ = vtr::NdOffsetMatrix<int , 1 >({{{-1 , grid_width}}});
164
+ acc_chanx_width_ = vtr::NdOffsetMatrix<int , 1 >({{{-2 , grid_height}}});
165
+ acc_chany_width_ = vtr::NdOffsetMatrix<int , 1 >({{{-2 , grid_width}}});
166
166
167
167
// First compute the number of tracks between channel high and channel low, inclusive.
168
- acc_chanx_width_[-1 ] = 0 ;
168
+ acc_chanx_width_[-2 ] = 0 ;
169
+ acc_chanx_width_[-1 ] = 1 ;
169
170
for (int y = 0 ; y < grid_height; y++) {
170
171
acc_chanx_width_[y] = acc_chanx_width_[y - 1 ] + device_ctx.chan_width .x_list [y];
171
172
if (acc_chanx_width_[y] == acc_chanx_width_[y - 1 ]) {
172
173
acc_chanx_width_[y]++;
173
174
}
174
175
}
175
176
176
- acc_chany_width_[-1 ] = 0 ;
177
- for (int x = 0 ; x < grid_height; x++) {
177
+ acc_chany_width_[-2 ] = 0 ;
178
+ acc_chany_width_[-1 ] = 1 ;
179
+ for (int x = 0 ; x < grid_width; x++) {
178
180
acc_chany_width_[x] = acc_chany_width_[x - 1 ] + device_ctx.chan_width .y_list [x];
179
181
if (acc_chany_width_[x] == acc_chany_width_[x - 1 ]) {
180
182
acc_chany_width_[x]++;
181
183
}
182
184
}
183
185
184
-
185
- // /* Now compute the inverse of the average number of tracks per channel *
186
- // * between high and low. The cost function divides by the average *
187
- // * number of tracks per channel, so by storing the inverse I convert *
188
- // * this to a faster multiplication. Take this final number to the *
189
- // * place_cost_exp power -- numbers other than one mean this is no *
190
- // * longer a simple "average number of tracks"; it is some power of *
191
- // * that, allowing greater penalization of narrow channels. */
192
- // for (int high = -1; high < grid_height; high++) {
193
- // for (int low = -1; low <= high; low++) {
194
- // /* Since we will divide the wiring cost by the average channel *
195
- // * capacity between high and low, having only 0 width channels *
196
- // * will result in infinite wiring capacity normalization *
197
- // * factor, and extremely bad placer behaviour. Hence we change *
198
- // * this to a small (1 track) channel capacity instead. */
199
- // if (chanx_place_cost_fac_[high][low] == 0.0f) {
200
- // VTR_LOG_WARN("CHANX place cost fac is 0 at %d %d\n", high, low);
201
- // chanx_place_cost_fac_[high][low] = 1.0f;
202
- // }
203
- //
204
- // chanx_place_cost_fac_[high][low] = (high - low + 1.) / chanx_place_cost_fac_[high][low];
205
- // chanx_place_cost_fac_[high][low] = pow((double)chanx_place_cost_fac_[high][low], (double)place_cost_exp);
206
- // }
207
- // }
208
- //
209
- // /* Now do the same thing for the y-directed channels. First get the
210
- // * number of tracks between channel high and channel low, inclusive. */
211
- // chany_place_cost_fac_[-1][-1] = 0;
212
- //
213
- // for (int high = 0; high < grid_width; high++) {
214
- // chany_place_cost_fac_[high][high] = device_ctx.chan_width.y_list[high];
215
- // for (int low = -1; low < high; low++) {
216
- // chany_place_cost_fac_[high][low] = chany_place_cost_fac_[high - 1][low] + device_ctx.chan_width.y_list[high];
217
- // }
218
- // }
219
- //
220
- // /* Now compute the inverse of the average number of tracks per channel
221
- // * between high and low. Take to specified power. */
222
- // for (int high = -1; high < grid_width; high++) {
223
- // for (int low = -1; low <= high; low++) {
224
- // /* Since we will divide the wiring cost by the average channel *
225
- // * capacity between high and low, having only 0 width channels *
226
- // * will result in infinite wiring capacity normalization *
227
- // * factor, and extremely bad placer behaviour. Hence we change *
228
- // * this to a small (1 track) channel capacity instead. */
229
- // if (chany_place_cost_fac_[high][low] == 0.0f) {
230
- // VTR_LOG_WARN("CHANY place cost fac is 0 at %d %d\n", high, low);
231
- // chany_place_cost_fac_[high][low] = 1.0f;
232
- // }
233
- //
234
- // chany_place_cost_fac_[high][low] = (high - low + 1.) / chany_place_cost_fac_[high][low];
235
- // chany_place_cost_fac_[high][low] = pow((double)chany_place_cost_fac_[high][low], (double)place_cost_exp);
236
- // }
237
- // }
238
-
239
186
if (device_ctx.grid .get_num_layers () > 1 ) {
240
187
alloc_and_load_for_fast_vertical_cost_update_ (place_cost_exp);
241
188
}
0 commit comments