@@ -115,12 +115,22 @@ void alloc_and_load_rr_indexed_data(const std::vector<t_segment_inf>& segment_in
115
115
load_rr_indexed_data_T_values ((CHANX_COST_INDEX_START + num_segment),
116
116
num_segment, CHANY, nodes_per_chan, L_rr_node_indices);
117
117
118
+ // Scan CHANX/CHANY indexed data and search for uninitialized costs.
119
+ //
120
+ // This would occur if a segment ends up only being used as CHANX or a
121
+ // CHANY, but not both. If this occurs, then copying the orthogonal
122
+ // pair's cost data is likely a better choice than leaving it as -1.
123
+ //
124
+ // The primary reason for this fixup is to avoid propagating negative
125
+ // values in cost functions.
118
126
for (int cost_index = CHANX_COST_INDEX_START;
119
127
cost_index < CHANX_COST_INDEX_START + 2 * num_segment; cost_index++) {
120
128
int ortho_cost_index = device_ctx.rr_indexed_data [cost_index].ortho_cost_index ;
121
- /* If segments doesn't have data (e.g. doesn't exists), check if ortho
122
- * segment does exist. If so, copy that data. */
129
+
130
+ // Check if this data is uninitialized, but the orthogonal data is
131
+ // initialized.
123
132
if (device_ctx.rr_indexed_data [cost_index].T_linear == OPEN && device_ctx.rr_indexed_data [ortho_cost_index].T_linear != OPEN) {
133
+ // Copy orthogonal data over.
124
134
device_ctx.rr_indexed_data [cost_index].T_linear = device_ctx.rr_indexed_data [ortho_cost_index].T_linear ;
125
135
device_ctx.rr_indexed_data [cost_index].T_quadratic = device_ctx.rr_indexed_data [ortho_cost_index].T_quadratic ;
126
136
device_ctx.rr_indexed_data [cost_index].C_load = device_ctx.rr_indexed_data [ortho_cost_index].C_load ;
0 commit comments