* Ecole Normale Superieure, 45 rue d’Ulm, 75230 Paris, France
*/
+#include <limits.h>
#include <isl/aff.h>
#include <isl/set.h>
#include <isl/ilp.h>
* of domains that share some values of the outer dimensions.
* That is, domains in different components do not share any values
* of the outer dimensions. This means that these components
- * can be freely reorderd.
+ * can be freely reordered.
* Within each of the components, we sort the domains according
* to the execution order at the current depth.
*
return 0;
}
- if (!data->lower || isl_int_cmp_si(data->tmp, *data->n) < 0) {
+ if (isl_int_cmp_si(data->tmp, INT_MAX) <= 0 &&
+ (!data->lower || isl_int_cmp_si(data->tmp, *data->n) < 0)) {
isl_aff_free(data->lower);
data->lower = lower;
*data->n = isl_int_get_si(data->tmp);
*
* "sep_class" contains the user-specified split into separation classes
* specialized to the current depth.
- * "done" contains the union of th separation domains that have already
+ * "done" contains the union of the separation domains that have already
* been handled.
+ * "atomic" contains the domain that has effectively been made atomic.
+ * This domain may be larger than the intersection of option[atomic]
+ * and the schedule domain.
*/
struct isl_codegen_domains {
isl_basic_set_list *list;
isl_map *sep_class;
isl_set *done;
+ isl_set *atomic;
};
/* Add domains to domains->list for each individual value of the current
/* Construct a single basic set that includes the intersection of
* the schedule domain, the atomic option domain and the class domain.
- * Add the resulting basic set to domains->list.
+ * Add the resulting basic set to domains->list and save a copy
+ * in domains->atomic for use in compute_partial_domains.
*
* We construct a single domain rather than trying to combine
* the schedule domains of individual domains because we are working
atomic_domain = isl_set_intersect(atomic_domain, isl_set_copy(domain));
empty = isl_set_is_empty(atomic_domain);
if (empty < 0 || empty) {
- isl_set_free(atomic_domain);
+ domains->atomic = atomic_domain;
return empty < 0 ? -1 : 0;
}
atomic_domain = isl_set_coalesce(atomic_domain);
bset = isl_set_unshifted_simple_hull(atomic_domain);
+ domains->atomic = isl_set_from_basic_set(isl_basic_set_copy(bset));
domains->list = isl_basic_set_list_add(domains->list, bset);
return 0;
* the result with the current "class_domain" to ensure that the domains
* are disjoint from those generated from other class domains.
*
+ * The domain that has been made atomic may be larger than specified
+ * by the user since it needs to be representable as a single basic set.
+ * This possibly larger domain is stored in domains->atomic by
+ * compute_atomic_domain.
+ *
* If anything is left after handling separate, unroll and atomic,
* we split it up into basic sets and append the basic sets to domains->list.
*/
domain = isl_set_intersect(domain, isl_set_copy(class_domain));
if (compute_atomic_domain(domains, domain) < 0)
- goto error;
- domain = isl_set_subtract(domain,
- isl_set_copy(domains->option[atomic]));
+ domain = isl_set_free(domain);
+ domain = isl_set_subtract(domain, domains->atomic);
domain = isl_set_coalesce(domain);
domain = isl_set_make_disjoint(domain);