Skip to content

Commit

Permalink
Merge pull request #12 from coneoproject/fix-subset-projection
Browse files Browse the repository at this point in the history
Project correctly from subsets
  • Loading branch information
FabioLuporini committed Aug 4, 2016
2 parents 6c37e2d + 46e7b97 commit 3e4c60f
Showing 1 changed file with 18 additions and 12 deletions.
30 changes: 18 additions & 12 deletions sparsetiling/src/tiling.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,19 +124,22 @@ void project_forward (loop_t* tiledLoop,

// if projecting from a subset, an older projection must be present. This
// is used to replicate an untouched iteration color and tile.
set_t* superset = set_super(tiledLoop->set);
set_t* outSuperset = set_super(descMap->outSet);
if (superset && (! outSuperset || descMap->outSet->size != superset->size)) {
projection_t::iterator oldProjIter2tc = prevLoopProj->find (projIter2tc);
ASSERT (oldProjIter2tc != prevLoopProj->end(),
"Projecting from subset lacks old projection");
projection_t::iterator oldProjIter2tc = prevLoopProj->find (projIter2tc);
if (oldProjIter2tc != prevLoopProj->end()) {
#pragma omp for schedule(static)
for (int i = 0; i < projSetSize; i++) {
if (projIter2tile[i] == -1) {
projIter2tile[i] = (*oldProjIter2tc)->iter2tile[i];
projIter2color[i] = (*oldProjIter2tc)->iter2color[i];
}
}
}
else {
set_t* superset = set_super(tiledLoop->set);
set_t* outSuperset = set_super(descMap->outSet);
ASSERT (! (superset && (! outSuperset || descMap->outSet->size != superset->size)),
"Need old projection for subsets");
}

map_free (descMap, true);
}
Expand Down Expand Up @@ -273,19 +276,22 @@ void project_backward (loop_t* tiledLoop,

// if projecting from a subset, an older projection must be present. This
// is used to replicate an untouched iteration color and tile.
set_t* superset = set_super(tiledLoop->set);
set_t* outSuperset = set_super(descMap->outSet);
if (superset && (! outSuperset || descMap->outSet->size != superset->size)) {
projection_t::iterator oldProjIter2tc = prevLoopProj->find (projIter2tc);
ASSERT (oldProjIter2tc != prevLoopProj->end(),
"Projecting from subset lacks old projection");
projection_t::iterator oldProjIter2tc = prevLoopProj->find (projIter2tc);
if (oldProjIter2tc != prevLoopProj->end()) {
#pragma omp for schedule(static)
for (int i = 0; i < projSetSize; i++) {
if (projIter2tile[i] == INT_MAX) {
projIter2tile[i] = (*oldProjIter2tc)->iter2tile[i];
projIter2color[i] = (*oldProjIter2tc)->iter2color[i];
}
}
}
else {
set_t* superset = set_super(tiledLoop->set);
set_t* outSuperset = set_super(descMap->outSet);
ASSERT (! (superset && (! outSuperset || descMap->outSet->size != superset->size)),
"Need old projection for subsets");
}

map_free (descMap, true);
}
Expand Down

0 comments on commit 3e4c60f

Please sign in to comment.