node_len = pbqp->num_nodes;
#if KAPS_TIMING
- ir_timer_t *t_fill_buckets = ir_timer_register("be_pbqp_fill_buckets", "PBQP Fill Nodes into buckets");
- ir_timer_reset_and_start(t_fill_buckets);
+ ir_timer_t *t_fill_buckets = ir_timer_new();
+ ir_timer_start(t_fill_buckets);
#endif
for (node_index = 0; node_index < node_len; ++node_index) {
#if KAPS_TIMING
ir_timer_stop(t_fill_buckets);
- printf("%-20s: %8.3lf msec\n", ir_timer_get_description(t_fill_buckets), (double)ir_timer_elapsed_usec(t_fill_buckets) / 1000.0);
+ printf("PBQP Fill Nodes into buckets: %8.3lf msec\n", (double)ir_timer_elapsed_usec(t_fill_buckets) / 1000.0);
#endif
}
pbqp_matrix *old_matrix;
pbqp_matrix *new_matrix;
pbqp_node *other_node;
+ vector *other_vec;
unsigned other_len;
unsigned other_index;
unsigned tgt_index;
assert(old_matrix);
if (old_edge->tgt == src_node) {
- other_node = edge->src;
+ other_node = old_edge->src;
other_len = old_matrix->rows;
}
else {
- other_node = edge->tgt;
+ other_node = old_edge->tgt;
other_len = old_matrix->cols;
}
assert(other_node);
+ other_vec = other_node->costs;
new_matrix = pbqp_matrix_alloc(pbqp, tgt_len, other_len);
for (tgt_index = 0; tgt_index < tgt_len; ++tgt_index) {
unsigned src_index = mapping[tgt_index];
+ if (tgt_vec->entries[tgt_index].data == INF_COSTS)
+ continue;
+
for (other_index = 0; other_index < other_len; ++other_index) {
+ if (other_vec->entries[other_index].data == INF_COSTS)
+ continue;
+
new_matrix->entries[tgt_index*other_len+other_index] = old_matrix->entries[other_index*src_len+src_index];
}
}
for (tgt_index = 0; tgt_index < tgt_len; ++tgt_index) {
unsigned src_index = mapping[tgt_index];
+ if (tgt_vec->entries[tgt_index].data == INF_COSTS)
+ continue;
+
for (other_index = 0; other_index < other_len; ++other_index) {
+ if (other_vec->entries[other_index].data == INF_COSTS)
+ continue;
+
new_matrix->entries[tgt_index*other_len+other_index] = old_matrix->entries[src_index*other_len+other_index];
}
}
add_edge_costs(pbqp, tgt_node->index, other_node->index, new_matrix);
- disconnect_edge(src_node, old_edge);
- disconnect_edge(other_node, old_edge);
+ delete_edge(old_edge);
+ reorder_node(src_node);
+ reorder_node(other_node);
new_edge = get_edge(pbqp, tgt_node->index, other_node->index);
insert_into_rm_bucket(new_edge);
pbqp_matrix *old_matrix;
pbqp_matrix *new_matrix;
pbqp_node *other_node;
+ vector *other_vec;
unsigned other_len;
unsigned other_index;
unsigned src_index;
assert(old_matrix);
if (old_edge->tgt == tgt_node) {
- other_node = edge->src;
+ other_node = old_edge->src;
other_len = old_matrix->rows;
}
else {
- other_node = edge->tgt;
+ other_node = old_edge->tgt;
other_len = old_matrix->cols;
}
assert(other_node);
+ other_vec = other_node->costs;
new_matrix = pbqp_matrix_alloc(pbqp, src_len, other_len);
for (src_index = 0; src_index < src_len; ++src_index) {
unsigned tgt_index = mapping[src_index];
+ if (src_vec->entries[src_index].data == INF_COSTS)
+ continue;
+
for (other_index = 0; other_index < other_len; ++other_index) {
+ if (other_vec->entries[other_index].data == INF_COSTS)
+ continue;
+
new_matrix->entries[src_index*other_len+other_index] = old_matrix->entries[other_index*tgt_len+tgt_index];
}
}
for (src_index = 0; src_index < src_len; ++src_index) {
unsigned tgt_index = mapping[src_index];
+ if (src_vec->entries[src_index].data == INF_COSTS)
+ continue;
+
for (other_index = 0; other_index < other_len; ++other_index) {
+ if (other_vec->entries[other_index].data == INF_COSTS)
+ continue;
+
new_matrix->entries[src_index*other_len+other_index] = old_matrix->entries[tgt_index*other_len+other_index];
}
}
add_edge_costs(pbqp, src_node->index, other_node->index, new_matrix);
- disconnect_edge(tgt_node, old_edge);
- disconnect_edge(other_node, old_edge);
+ delete_edge(old_edge);
+ reorder_node(tgt_node);
+ reorder_node(other_node);
new_edge = get_edge(pbqp, src_node->index, other_node->index);
insert_into_rm_bucket(new_edge);
assert(pbqp);
#if KAPS_TIMING
- ir_timer_t *t_int_simpl = ir_timer_register("be_pbqp_init_simp", "PBQP Initial simplify edges");
- ir_timer_reset_and_start(t_int_simpl);
+ ir_timer_t *t_int_simpl = ir_timer_new();
+ ir_timer_start(t_int_simpl);
#endif
#if KAPS_DUMP
#if KAPS_TIMING
ir_timer_stop(t_int_simpl);
- printf("%-20s: %8.3lf msec\n", ir_timer_get_description(t_int_simpl), (double)ir_timer_elapsed_usec(t_int_simpl) / 1000.0);
+ printf("PBQP Initial simplify edges: %8.3lf msec\n", (double)ir_timer_elapsed_usec(t_int_simpl) / 1000.0);
#endif
}
num solution = 0;
#if KAPS_TIMING
- ir_timer_t *t_det_solution = ir_timer_register("be_det_solution", "PBQP Determine Solution");
+ ir_timer_t *t_det_solution = ir_timer_new();
ir_timer_reset_and_start(t_det_solution);
#endif
#if KAPS_TIMING
ir_timer_stop(t_det_solution);
- printf("%-20s: %8.3lf msec\n", ir_timer_get_description(t_det_solution), (double)ir_timer_elapsed_usec(t_det_solution) / 1000.0);
+ printf("PBQP Determine Solution: %8.3lf msec\n", (double)ir_timer_elapsed_usec(t_det_solution) / 1000.0);
#endif
return solution;