Resize permutability constraints with per cc objective
@@ -382,6 +382,17 @@ PlutoConstraints *get_permutability_constraints(PlutoProg *prog) {
if (dep->cst == NULL) {
/* First time, compute the constraints */
compute_permutability_constraints_dep(dep, prog);
+ if (options->per_cc_obj) {
+ int num_cols_to_add = (npar + 1) * (prog->ddg->num_ccs);
+ pluto_constraints_add_leading_dims(dep->cst, num_cols_to_add);
+ int cc_id = prog->stmts[dep->src]->cc_id;
+ unsigned source_col_offset = (npar + 1) * prog->ddg->num_ccs;
+ unsigned target_col_offset = npar + 1 + (npar + 1) * cc_id;
+ for (int j = 0; j < npar + 1; j++) {
+ pluto_constraints_interchange_cols(dep->cst, source_col_offset + j,
+ target_col_offset + j);
+ }
+ }
IF_DEBUG(fprintf(stdout, "\tFor dep %d; num_constraints: %d\n", i + 1,
dep->cst->nrows));
@@ -389,13 +400,17 @@ PlutoConstraints *get_permutability_constraints(PlutoProg *prog) {
}
}
+ int ncols = CST_WIDTH;
+ if (options->per_cc_obj) {
+ ncols += (npar + 1) * prog->ddg->num_ccs;
+ }
if (!prog->globcst) {
- prog->globcst = pluto_constraints_alloc(total_cst_rows, CST_WIDTH);
+ prog->globcst = pluto_constraints_alloc(total_cst_rows, ncols);
}
globcst = prog->globcst;
- globcst->ncols = CST_WIDTH;
+ globcst->ncols = ncols;
globcst->nrows = 0;
/* Add constraints to globcst */
