Skip to content
This repository was archived by the owner on Apr 28, 2023. It is now read-only.

Commit daac7ae

Browse files
author
Sven Verdoolaege
committed
MappedScop::map: add extra sanity check on mappings
This check is similar to one performed by tightenLaunchBounds, which will be removed when tightenLaunchBounds gets implemented in terms of the actual mapping instead of the filter derived from the mapping.
1 parent fc63411 commit daac7ae

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

tc/core/polyhedral/cuda/mapped_scop.cc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,17 @@ namespace {
5858
* the minimal value of the mapping) may not help much because
5959
* those identifiers may get used in other parts of the tree.
6060
* Furthermore, at that point it is too late to change the mapping.
61+
*
62+
* Also double check that the minimum is non-negative.
63+
* This should always be the case since the affine functions in "list"
64+
* are all the result of a modulo operation.
65+
* A value of NaN means that the domain is empty.
6166
*/
6267
static void checkMinimum(isl::union_set domain, isl::union_pw_aff_list list) {
6368
for (auto upa : list) {
6469
upa = upa.intersect_domain(domain);
6570
auto min = upa.min_val();
71+
TC_CHECK(min.is_nonneg()) << "mapping to negative block/thread" << min;
6672
LOG_IF(WARNING, min.is_pos())
6773
<< "Opportunity for shifting mapping -> min:" << min;
6874
}

0 commit comments

Comments
 (0)