forked from OSchip/llvm-project
Adapt to introduction of isl_space
Polly should now be compiled with CLooG 0c252c88946b27b7b61a1a8d8fd7f94d2461dbfd and isl 56b7d238929980e62218525b4b3be121af386edf. The most convenient way to update is utils/checkout_cloog.sh. llvm-svn: 141251
This commit is contained in:
parent
f3e3f6645e
commit
f53388034d
|
@ -38,7 +38,7 @@ struct isl_map;
|
|||
struct isl_basic_map;
|
||||
struct isl_set;
|
||||
struct isl_ctx;
|
||||
struct isl_dim;
|
||||
struct isl_space;
|
||||
struct isl_constraint;
|
||||
|
||||
namespace polly {
|
||||
|
@ -255,9 +255,9 @@ class ScopStmt {
|
|||
|
||||
/// Build the statment.
|
||||
//@{
|
||||
isl_set *toUpperLoopBound(const SCEVAffFunc &UpperBound, isl_dim *dim,
|
||||
isl_set *toUpperLoopBound(const SCEVAffFunc &UpperBound, isl_space *space,
|
||||
unsigned BoundedDimension) const;
|
||||
isl_set *toConditionSet(const Comparison &Cmp, isl_dim *dim) const;
|
||||
isl_set *toConditionSet(const Comparison &Cmp, isl_space *space) const;
|
||||
void addConditionsToDomain(TempScop &tempScop, const Region &CurRegion);
|
||||
void buildIterationDomainFromLoops(TempScop &tempScop);
|
||||
void buildIterationDomain(TempScop &tempScop, const Region &CurRegion);
|
||||
|
|
|
@ -52,9 +52,9 @@ Dependences::Dependences() : ScopPass(ID) {
|
|||
}
|
||||
|
||||
bool Dependences::runOnScop(Scop &S) {
|
||||
isl_dim *dim = isl_dim_alloc(S.getCtx(), 0, 0, 0);
|
||||
isl_dim *Model = isl_set_get_dim(S.getContext());
|
||||
dim = isl_dim_align_params(dim, Model);
|
||||
isl_space *Space = isl_space_alloc(S.getCtx(), 0, 0, 0);
|
||||
isl_space *Model = isl_set_get_dim(S.getContext());
|
||||
Space = isl_space_align_params(Space, Model);
|
||||
|
||||
if (sink)
|
||||
isl_union_map_free(sink);
|
||||
|
@ -65,10 +65,10 @@ bool Dependences::runOnScop(Scop &S) {
|
|||
if (may_source)
|
||||
isl_union_map_free(may_source);
|
||||
|
||||
sink = isl_union_map_empty(isl_dim_copy(dim));
|
||||
must_source = isl_union_map_empty(isl_dim_copy(dim));
|
||||
may_source = isl_union_map_empty(isl_dim_copy(dim));
|
||||
isl_union_map *schedule = isl_union_map_empty(dim);
|
||||
sink = isl_union_map_empty(isl_space_copy(Space));
|
||||
must_source = isl_union_map_empty(isl_space_copy(Space));
|
||||
may_source = isl_union_map_empty(isl_space_copy(Space));
|
||||
isl_union_map *schedule = isl_union_map_empty(Space);
|
||||
|
||||
if (must_dep)
|
||||
isl_union_map_free(must_dep);
|
||||
|
@ -155,11 +155,11 @@ bool Dependences::isValidScattering(StatementToIslMapTy *NewScattering) {
|
|||
if (LegalityCheckDisabled)
|
||||
return true;
|
||||
|
||||
isl_dim *dim = isl_dim_alloc(S.getCtx(), 0, 0, 0);
|
||||
isl_space *Space = isl_space_alloc(S.getCtx(), 0, 0, 0);
|
||||
|
||||
isl_union_map *schedule = isl_union_map_empty(dim);
|
||||
isl_union_map *schedule = isl_union_map_empty(Space);
|
||||
|
||||
isl_dim *Model = isl_set_get_dim(S.getContext());
|
||||
isl_space *Model = isl_set_get_space(S.getContext());
|
||||
schedule = isl_union_map_align_params(schedule, Model);
|
||||
|
||||
for (Scop::iterator SI = S.begin(), SE = S.end(); SI != SE; ++SI) {
|
||||
|
@ -241,11 +241,11 @@ bool Dependences::isValidScattering(StatementToIslMapTy *NewScattering) {
|
|||
return isValid;
|
||||
}
|
||||
|
||||
isl_union_map* getCombinedScheduleForDim(Scop *scop, unsigned dimLevel) {
|
||||
isl_dim *dim = isl_dim_alloc(scop->getCtx(), 0, 0, 0);
|
||||
isl_union_map* getCombinedScheduleForSpace(Scop *scop, unsigned dimLevel) {
|
||||
isl_space *Space = isl_space_alloc(scop->getCtx(), 0, 0, 0);
|
||||
|
||||
isl_union_map *schedule = isl_union_map_empty(dim);
|
||||
isl_dim *Model = isl_set_get_dim(scop->getContext());
|
||||
isl_union_map *schedule = isl_union_map_empty(Space);
|
||||
isl_space *Model = isl_set_get_space(scop->getContext());
|
||||
schedule = isl_union_map_align_params(schedule, Model);
|
||||
|
||||
for (Scop::iterator SI = scop->begin(), SE = scop->end(); SI != SE; ++SI) {
|
||||
|
@ -263,8 +263,8 @@ isl_union_map* getCombinedScheduleForDim(Scop *scop, unsigned dimLevel) {
|
|||
bool Dependences::isParallelDimension(isl_set *loopDomain,
|
||||
unsigned parallelDimension) {
|
||||
Scop *S = &getCurScop();
|
||||
isl_union_map *schedule = getCombinedScheduleForDim(S, parallelDimension);
|
||||
isl_dim *dimModel = isl_union_map_get_dim(schedule);
|
||||
isl_union_map *schedule = getCombinedScheduleForSpace(S, parallelDimension);
|
||||
isl_space *SpaceModel = isl_union_map_get_space(schedule);
|
||||
|
||||
// Calculate distance vector.
|
||||
isl_union_set *scheduleSubset;
|
||||
|
@ -311,14 +311,16 @@ bool Dependences::isParallelDimension(isl_set *loopDomain,
|
|||
|
||||
isl_union_set *distance_waw = isl_union_map_deltas(restrictedDeps_waw);
|
||||
|
||||
isl_dim *dim = isl_dim_set_alloc(S->getCtx(), 0, parallelDimension);
|
||||
isl_space *Space = isl_space_set_alloc(S->getCtx(), 0, parallelDimension);
|
||||
|
||||
// [0, 0, 0, 0] - All zero
|
||||
isl_basic_set *allZeroBS = isl_basic_set_universe(isl_dim_copy(dim));
|
||||
unsigned dimensions = isl_dim_size(dim, isl_dim_set);
|
||||
isl_basic_set *allZeroBS = isl_basic_set_universe(isl_space_copy(Space));
|
||||
unsigned dimensions = isl_space_dim(Space, isl_dim_set);
|
||||
isl_local_space *LocalSpace;
|
||||
LocalSpace = isl_local_space_from_space(isl_space_copy(Space));
|
||||
|
||||
for (unsigned i = 0; i < dimensions; i++) {
|
||||
isl_constraint *c = isl_equality_alloc(isl_dim_copy(dim));
|
||||
isl_constraint *c = isl_equality_alloc(isl_local_space_copy(LocalSpace));
|
||||
isl_int v;
|
||||
isl_int_init(v);
|
||||
isl_int_set_si(v, -1);
|
||||
|
@ -328,15 +330,15 @@ bool Dependences::isParallelDimension(isl_set *loopDomain,
|
|||
}
|
||||
|
||||
isl_set *allZero = isl_set_from_basic_set(allZeroBS);
|
||||
allZero = isl_set_align_params(allZero, isl_dim_copy(dimModel));
|
||||
allZero = isl_set_align_params(allZero, isl_space_copy(SpaceModel));
|
||||
|
||||
// All zero, last unknown.
|
||||
// [0, 0, 0, ?]
|
||||
isl_basic_set *lastUnknownBS = isl_basic_set_universe(isl_dim_copy(dim));
|
||||
dimensions = isl_dim_size(dim, isl_dim_set);
|
||||
isl_basic_set *lastUnknownBS = isl_basic_set_universe(isl_space_copy(Space));
|
||||
dimensions = isl_space_dim(Space, isl_dim_set);
|
||||
|
||||
for (unsigned i = 0; i < dimensions - 1; i++) {
|
||||
isl_constraint *c = isl_equality_alloc(isl_dim_copy(dim));
|
||||
isl_constraint *c = isl_equality_alloc(isl_local_space_copy(LocalSpace));
|
||||
isl_int v;
|
||||
isl_int_init(v);
|
||||
isl_int_set_si(v, -1);
|
||||
|
@ -345,8 +347,10 @@ bool Dependences::isParallelDimension(isl_set *loopDomain,
|
|||
isl_int_clear(v);
|
||||
}
|
||||
|
||||
isl_local_space_free(LocalSpace);
|
||||
|
||||
isl_set *lastUnknown = isl_set_from_basic_set(lastUnknownBS);
|
||||
lastUnknown = isl_set_align_params(lastUnknown, dimModel);
|
||||
lastUnknown = isl_set_align_params(lastUnknown, SpaceModel);
|
||||
|
||||
// Valid distance vectors
|
||||
isl_set *validDistances = isl_set_subtract(lastUnknown, allZero);
|
||||
|
@ -365,7 +369,7 @@ bool Dependences::isParallelDimension(isl_set *loopDomain,
|
|||
&& isl_union_set_is_empty(nonValid_war)
|
||||
&& isl_union_set_is_empty(nonValid_waw);
|
||||
|
||||
isl_dim_free(dim);
|
||||
isl_space_free(Space);
|
||||
isl_union_set_free(nonValid);
|
||||
isl_union_set_free(nonValid_war);
|
||||
isl_union_set_free(nonValid_waw);
|
||||
|
@ -430,8 +434,8 @@ void Dependences::releaseMemory() {
|
|||
}
|
||||
|
||||
isl_union_map *Dependences::getDependences(int type) {
|
||||
isl_dim *dim = isl_union_map_get_dim(must_dep);
|
||||
isl_union_map *dependences = isl_union_map_empty(dim);
|
||||
isl_space *Space = isl_union_map_get_space(must_dep);
|
||||
isl_union_map *dependences = isl_union_map_empty(Space);
|
||||
|
||||
if (type & TYPE_RAW)
|
||||
dependences = isl_union_map_union(dependences,
|
||||
|
|
|
@ -40,6 +40,7 @@
|
|||
#include "isl/map.h"
|
||||
#include "isl/aff.h"
|
||||
#include "isl/printer.h"
|
||||
#include "isl/local_space.h"
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
@ -71,7 +72,7 @@ static std::string convertInt(int number)
|
|||
struct SCEVAffinator : public SCEVVisitor<SCEVAffinator, isl_pw_aff*> {
|
||||
private:
|
||||
isl_ctx *ctx;
|
||||
int NbLoopDims;
|
||||
int NbLoopSpaces;
|
||||
const Scop *scop;
|
||||
|
||||
/// baseAdress is set if we analyze a memory access. It holds the base address
|
||||
|
@ -97,11 +98,12 @@ public:
|
|||
if (*PI == scev) {
|
||||
isl_id *ID = isl_id_alloc(ctx, ("p" + convertInt(i)).c_str(),
|
||||
(void *) scev);
|
||||
isl_dim *Dim = isl_dim_set_alloc(ctx, 1, NbLoopDims);
|
||||
Dim = isl_dim_set_dim_id(Dim, isl_dim_param, 0, ID);
|
||||
isl_space *Space = isl_space_set_alloc(ctx, 1, NbLoopSpaces);
|
||||
Space = isl_space_set_dim_id(Space, isl_dim_param, 0, ID);
|
||||
|
||||
isl_set *Domain = isl_set_universe(isl_dim_copy(Dim));
|
||||
isl_aff *Affine = isl_aff_zero(isl_local_space_from_dim(Dim));
|
||||
isl_set *Domain = isl_set_universe(isl_space_copy(Space));
|
||||
isl_aff *Affine = isl_aff_zero_on_domain(
|
||||
isl_local_space_from_space(Space));
|
||||
Affine = isl_aff_add_coefficient_si(Affine, isl_dim_param, 0, 1);
|
||||
|
||||
return isl_pw_aff_alloc(Domain, Affine);
|
||||
|
@ -114,7 +116,7 @@ public:
|
|||
|
||||
SCEVAffinator(const ScopStmt *stmt, const Value *baseAddress) :
|
||||
ctx(stmt->getParent()->getCtx()),
|
||||
NbLoopDims(stmt->getNumIterators()),
|
||||
NbLoopSpaces(stmt->getNumIterators()),
|
||||
scop(stmt->getParent()),
|
||||
baseAddress(baseAddress) {};
|
||||
|
||||
|
@ -135,10 +137,10 @@ public:
|
|||
// this constant correctly.
|
||||
MPZ_from_APInt(v, Value->getValue(), /* isSigned */ true);
|
||||
|
||||
isl_dim *dim = isl_dim_set_alloc(ctx, 0, NbLoopDims);
|
||||
isl_local_space *ls = isl_local_space_from_dim(isl_dim_copy(dim));
|
||||
isl_aff *Affine = isl_aff_zero(ls);
|
||||
isl_set *Domain = isl_set_universe(dim);
|
||||
isl_space *Space = isl_space_set_alloc(ctx, 0, NbLoopSpaces);
|
||||
isl_local_space *ls = isl_local_space_from_space(isl_space_copy(Space));
|
||||
isl_aff *Affine = isl_aff_zero_on_domain(ls);
|
||||
isl_set *Domain = isl_set_universe(Space);
|
||||
|
||||
Affine = isl_aff_add_constant(Affine, v);
|
||||
isl_int_clear(v);
|
||||
|
@ -207,13 +209,13 @@ public:
|
|||
|
||||
isl_pw_aff *Start = visit(Expr->getStart());
|
||||
isl_pw_aff *Step = visit(Expr->getOperand(1));
|
||||
isl_dim *Dim = isl_dim_set_alloc (ctx, 0, NbLoopDims);
|
||||
isl_local_space *LocalSpace = isl_local_space_from_dim (Dim);
|
||||
isl_space *Space = isl_space_set_alloc(ctx, 0, NbLoopSpaces);
|
||||
isl_local_space *LocalSpace = isl_local_space_from_space(Space);
|
||||
|
||||
int loopDimension = getLoopDepth(Expr->getLoop());
|
||||
|
||||
isl_aff *LAff = isl_aff_set_coefficient_si (isl_aff_zero (LocalSpace),
|
||||
isl_dim_set, loopDimension, 1);
|
||||
isl_aff *LAff = isl_aff_set_coefficient_si(
|
||||
isl_aff_zero_on_domain (LocalSpace), isl_dim_in, loopDimension, 1);
|
||||
isl_pw_aff *LPwAff = isl_pw_aff_from_aff(LAff);
|
||||
|
||||
// TODO: Do we need to check for NSW and NUW?
|
||||
|
@ -238,21 +240,21 @@ public:
|
|||
__isl_give isl_pw_aff *visitUnknown(const SCEVUnknown* Expr) {
|
||||
Value *Value = Expr->getValue();
|
||||
|
||||
isl_dim *Dim;
|
||||
isl_space *Space;
|
||||
|
||||
/// If baseAddress is set, we ignore its Value object in the scev and do not
|
||||
/// add it to the isl_pw_aff. This is because it is regarded as defining the
|
||||
/// name of an array, in contrast to its array subscript.
|
||||
if (baseAddress != Value) {
|
||||
isl_id *ID = isl_id_alloc(ctx, Value->getNameStr().c_str(), Value);
|
||||
Dim = isl_dim_set_alloc(ctx, 1, NbLoopDims);
|
||||
Dim = isl_dim_set_dim_id(Dim, isl_dim_param, 0, ID);
|
||||
Space = isl_space_set_alloc(ctx, 1, NbLoopSpaces);
|
||||
Space = isl_space_set_dim_id(Space, isl_dim_param, 0, ID);
|
||||
} else {
|
||||
Dim = isl_dim_set_alloc(ctx, 0, NbLoopDims);
|
||||
Space = isl_space_set_alloc(ctx, 0, NbLoopSpaces);
|
||||
}
|
||||
|
||||
isl_set *Domain = isl_set_universe(isl_dim_copy(Dim));
|
||||
isl_aff *Affine = isl_aff_zero(isl_local_space_from_dim(Dim));
|
||||
isl_set *Domain = isl_set_universe(isl_space_copy(Space));
|
||||
isl_aff *Affine = isl_aff_zero_on_domain(isl_local_space_from_space(Space));
|
||||
|
||||
if (baseAddress != Value)
|
||||
Affine = isl_aff_add_coefficient_si(Affine, isl_dim_param, 0, 1);
|
||||
|
@ -298,14 +300,14 @@ std::string MemoryAccess::getAccessFunctionStr() const {
|
|||
}
|
||||
|
||||
isl_basic_map *MemoryAccess::createBasicAccessMap(ScopStmt *Statement) {
|
||||
isl_dim *dim = isl_dim_alloc(Statement->getIslContext(), 0,
|
||||
Statement->getNumIterators(), 1);
|
||||
isl_space *Space = isl_space_alloc(Statement->getIslContext(), 0,
|
||||
Statement->getNumIterators(), 1);
|
||||
setBaseName();
|
||||
|
||||
dim = isl_dim_set_tuple_name(dim, isl_dim_out, getBaseName().c_str());
|
||||
dim = isl_dim_set_tuple_name(dim, isl_dim_in, Statement->getBaseName());
|
||||
Space = isl_space_set_tuple_name(Space, isl_dim_out, getBaseName().c_str());
|
||||
Space = isl_space_set_tuple_name(Space, isl_dim_in, Statement->getBaseName());
|
||||
|
||||
return isl_basic_map_universe(dim);
|
||||
return isl_basic_map_universe(Space);
|
||||
}
|
||||
|
||||
MemoryAccess::MemoryAccess(const SCEVAffFunc &AffFunc, ScopStmt *Statement) {
|
||||
|
@ -338,7 +340,7 @@ MemoryAccess::MemoryAccess(const SCEVAffFunc &AffFunc, ScopStmt *Statement) {
|
|||
AccessRelation = isl_map_set_tuple_name(AccessRelation, isl_dim_out,
|
||||
getBaseName().c_str());
|
||||
|
||||
isl_dim *Model = isl_set_get_dim(Statement->getParent()->getContext());
|
||||
isl_space *Model = isl_set_get_space(Statement->getParent()->getContext());
|
||||
AccessRelation = isl_map_align_params(AccessRelation, Model);
|
||||
}
|
||||
|
||||
|
@ -350,7 +352,7 @@ MemoryAccess::MemoryAccess(const Value *BaseAddress, ScopStmt *Statement) {
|
|||
|
||||
isl_basic_map *BasicAccessMap = createBasicAccessMap(Statement);
|
||||
AccessRelation = isl_map_from_basic_map(BasicAccessMap);
|
||||
isl_dim *Model = isl_set_get_dim(Statement->getParent()->getContext());
|
||||
isl_space *Model = isl_set_get_space(Statement->getParent()->getContext());
|
||||
AccessRelation = isl_map_align_params(AccessRelation, Model);
|
||||
}
|
||||
|
||||
|
@ -375,9 +377,10 @@ void MemoryAccess::dump() const {
|
|||
// set[i0, i1, ..., iX] -> set[o0, o1, ..., oX]
|
||||
// : i0 = o0, i1 = o1, ..., i(X-1) = o(X-1), iX < oX
|
||||
//
|
||||
static isl_map *getEqualAndLarger(isl_dim *setDomain) {
|
||||
isl_dim *mapDomain = isl_dim_map_from_set(setDomain);
|
||||
static isl_map *getEqualAndLarger(isl_space *setDomain) {
|
||||
isl_space *mapDomain = isl_space_map_from_set(setDomain);
|
||||
isl_basic_map *bmap = isl_basic_map_universe(mapDomain);
|
||||
isl_local_space *MapLocalSpace = isl_local_space_from_space(mapDomain);
|
||||
|
||||
// Set all but the last dimension to be equal for the input and output
|
||||
//
|
||||
|
@ -386,7 +389,7 @@ static isl_map *getEqualAndLarger(isl_dim *setDomain) {
|
|||
for (unsigned i = 0; i < isl_basic_map_n_in(bmap) - 1; ++i) {
|
||||
isl_int v;
|
||||
isl_int_init(v);
|
||||
isl_constraint *c = isl_equality_alloc(isl_basic_map_get_dim(bmap));
|
||||
isl_constraint *c = isl_equality_alloc(isl_local_space_copy(MapLocalSpace));
|
||||
|
||||
isl_int_set_si(v, 1);
|
||||
isl_constraint_set_coefficient(c, isl_dim_in, i, v);
|
||||
|
@ -406,7 +409,7 @@ static isl_map *getEqualAndLarger(isl_dim *setDomain) {
|
|||
unsigned lastDimension = isl_basic_map_n_in(bmap) - 1;
|
||||
isl_int v;
|
||||
isl_int_init(v);
|
||||
isl_constraint *c = isl_inequality_alloc(isl_basic_map_get_dim(bmap));
|
||||
isl_constraint *c = isl_inequality_alloc(isl_local_space_copy(MapLocalSpace));
|
||||
isl_int_set_si(v, -1);
|
||||
isl_constraint_set_coefficient(c, isl_dim_in, lastDimension, v);
|
||||
isl_int_set_si(v, 1);
|
||||
|
@ -436,7 +439,7 @@ isl_set *MemoryAccess::getStride(const isl_set *domainSubset) const {
|
|||
scattering = isl_map_set_tuple_name(scattering, isl_dim_in, "");
|
||||
scatteringDomain = isl_set_set_tuple_name(scatteringDomain, "");
|
||||
|
||||
isl_map *nextScatt = getEqualAndLarger(isl_set_get_dim(scatteringDomain));
|
||||
isl_map *nextScatt = getEqualAndLarger(isl_set_get_space(scatteringDomain));
|
||||
nextScatt = isl_map_lexmin(nextScatt);
|
||||
|
||||
scattering = isl_map_intersect_domain(scattering, scatteringDomain);
|
||||
|
@ -451,7 +454,9 @@ isl_set *MemoryAccess::getStride(const isl_set *domainSubset) const {
|
|||
|
||||
bool MemoryAccess::isStrideZero(const isl_set *domainSubset) const {
|
||||
isl_set *stride = getStride(domainSubset);
|
||||
isl_constraint *c = isl_equality_alloc(isl_set_get_dim(stride));
|
||||
isl_space *StrideSpace = isl_set_get_space(stride);
|
||||
isl_local_space *StrideLS = isl_local_space_from_space(StrideSpace);
|
||||
isl_constraint *c = isl_equality_alloc(StrideLS);
|
||||
|
||||
isl_int v;
|
||||
isl_int_init(v);
|
||||
|
@ -461,7 +466,7 @@ bool MemoryAccess::isStrideZero(const isl_set *domainSubset) const {
|
|||
isl_constraint_set_constant(c, v);
|
||||
isl_int_clear(v);
|
||||
|
||||
isl_basic_set *bset = isl_basic_set_universe(isl_set_get_dim(stride));
|
||||
isl_basic_set *bset = isl_basic_set_universe(isl_set_get_space(stride));
|
||||
|
||||
bset = isl_basic_set_add_constraint(bset, c);
|
||||
isl_set *strideZero = isl_set_from_basic_set(bset);
|
||||
|
@ -476,7 +481,9 @@ bool MemoryAccess::isStrideZero(const isl_set *domainSubset) const {
|
|||
|
||||
bool MemoryAccess::isStrideOne(const isl_set *domainSubset) const {
|
||||
isl_set *stride = getStride(domainSubset);
|
||||
isl_constraint *c = isl_equality_alloc(isl_set_get_dim(stride));
|
||||
isl_space *StrideSpace = isl_set_get_space(stride);
|
||||
isl_local_space *StrideLSpace = isl_local_space_from_space(StrideSpace);
|
||||
isl_constraint *c = isl_equality_alloc(StrideLSpace);
|
||||
|
||||
isl_int v;
|
||||
isl_int_init(v);
|
||||
|
@ -486,7 +493,7 @@ bool MemoryAccess::isStrideOne(const isl_set *domainSubset) const {
|
|||
isl_constraint_set_constant(c, v);
|
||||
isl_int_clear(v);
|
||||
|
||||
isl_basic_set *bset = isl_basic_set_universe(isl_set_get_dim(stride));
|
||||
isl_basic_set *bset = isl_basic_set_universe(isl_set_get_space(stride));
|
||||
|
||||
bset = isl_basic_set_add_constraint(bset, c);
|
||||
isl_set *strideOne = isl_set_from_basic_set(bset);
|
||||
|
@ -512,17 +519,19 @@ void ScopStmt::setScattering(isl_map *scattering) {
|
|||
|
||||
void ScopStmt::buildScattering(SmallVectorImpl<unsigned> &Scatter) {
|
||||
unsigned NumberOfIterators = getNumIterators();
|
||||
unsigned ScatDim = Parent.getMaxLoopDepth() * 2 + 1;
|
||||
isl_dim *dim = isl_dim_alloc(Parent.getCtx(), 0, NumberOfIterators, ScatDim);
|
||||
dim = isl_dim_set_tuple_name(dim, isl_dim_out, "scattering");
|
||||
dim = isl_dim_set_tuple_name(dim, isl_dim_in, getBaseName());
|
||||
isl_basic_map *bmap = isl_basic_map_universe(isl_dim_copy(dim));
|
||||
unsigned ScatSpace = Parent.getMaxLoopDepth() * 2 + 1;
|
||||
isl_space *Space = isl_space_alloc(Parent.getCtx(), 0, NumberOfIterators,
|
||||
ScatSpace);
|
||||
Space = isl_space_set_tuple_name(Space, isl_dim_out, "scattering");
|
||||
Space = isl_space_set_tuple_name(Space, isl_dim_in, getBaseName());
|
||||
isl_local_space *LSpace = isl_local_space_from_space(isl_space_copy(Space));
|
||||
isl_basic_map *bmap = isl_basic_map_universe(Space);
|
||||
isl_int v;
|
||||
isl_int_init(v);
|
||||
|
||||
// Loop dimensions.
|
||||
for (unsigned i = 0; i < NumberOfIterators; ++i) {
|
||||
isl_constraint *c = isl_equality_alloc(isl_dim_copy(dim));
|
||||
isl_constraint *c = isl_equality_alloc(isl_local_space_copy(LSpace));
|
||||
isl_int_set_si(v, 1);
|
||||
isl_constraint_set_coefficient(c, isl_dim_out, 2 * i + 1, v);
|
||||
isl_int_set_si(v, -1);
|
||||
|
@ -533,7 +542,7 @@ void ScopStmt::buildScattering(SmallVectorImpl<unsigned> &Scatter) {
|
|||
|
||||
// Constant dimensions
|
||||
for (unsigned i = 0; i < NumberOfIterators + 1; ++i) {
|
||||
isl_constraint *c = isl_equality_alloc(isl_dim_copy(dim));
|
||||
isl_constraint *c = isl_equality_alloc(isl_local_space_copy(LSpace));
|
||||
isl_int_set_si(v, -1);
|
||||
isl_constraint_set_coefficient(c, isl_dim_out, 2 * i, v);
|
||||
isl_int_set_si(v, Scatter[i]);
|
||||
|
@ -543,8 +552,8 @@ void ScopStmt::buildScattering(SmallVectorImpl<unsigned> &Scatter) {
|
|||
}
|
||||
|
||||
// Fill scattering dimensions.
|
||||
for (unsigned i = 2 * NumberOfIterators + 1; i < ScatDim ; ++i) {
|
||||
isl_constraint *c = isl_equality_alloc(isl_dim_copy(dim));
|
||||
for (unsigned i = 2 * NumberOfIterators + 1; i < ScatSpace ; ++i) {
|
||||
isl_constraint *c = isl_equality_alloc(isl_local_space_copy(LSpace));
|
||||
isl_int_set_si(v, 1);
|
||||
isl_constraint_set_coefficient(c, isl_dim_out, i, v);
|
||||
isl_int_set_si(v, 0);
|
||||
|
@ -554,9 +563,8 @@ void ScopStmt::buildScattering(SmallVectorImpl<unsigned> &Scatter) {
|
|||
}
|
||||
|
||||
isl_int_clear(v);
|
||||
isl_dim_free(dim);
|
||||
Scattering = isl_map_from_basic_map(bmap);
|
||||
isl_dim *Model = isl_set_get_dim(getParent()->getContext());
|
||||
isl_space *Model = isl_set_get_space(getParent()->getContext());
|
||||
Scattering = isl_map_align_params(Scattering, Model);
|
||||
}
|
||||
|
||||
|
@ -570,7 +578,8 @@ void ScopStmt::buildAccesses(TempScop &tempScop, const Region &CurRegion) {
|
|||
}
|
||||
}
|
||||
|
||||
isl_set *ScopStmt::toConditionSet(const Comparison &Comp, isl_dim *dim) const {
|
||||
isl_set *ScopStmt::toConditionSet(const Comparison &Comp,
|
||||
isl_space *space) const {
|
||||
isl_pw_aff *LHS = SCEVAffinator::getPwAff(this, Comp.getLHS()->OriginalSCEV,
|
||||
0);
|
||||
isl_pw_aff *RHS = SCEVAffinator::getPwAff(this, Comp.getRHS()->OriginalSCEV,
|
||||
|
@ -606,41 +615,45 @@ isl_set *ScopStmt::toConditionSet(const Comparison &Comp, isl_dim *dim) const {
|
|||
llvm_unreachable("Non integer predicate not supported");
|
||||
}
|
||||
|
||||
set = isl_set_set_tuple_name(set, isl_dim_get_tuple_name(dim, isl_dim_set));
|
||||
set = isl_set_set_tuple_name(set, isl_space_get_tuple_name(space, isl_dim_set));
|
||||
|
||||
return set;
|
||||
}
|
||||
|
||||
isl_set *ScopStmt::toUpperLoopBound(const SCEVAffFunc &UpperBound, isl_dim *Dim,
|
||||
isl_set *ScopStmt::toUpperLoopBound(const SCEVAffFunc &UpperBound,
|
||||
isl_space *Space,
|
||||
unsigned BoundedDimension) const {
|
||||
// FIXME: We should choose a consistent scheme of when to name the dimensions.
|
||||
isl_dim *UnnamedDim = isl_dim_copy(Dim);
|
||||
UnnamedDim = isl_dim_set_tuple_name(UnnamedDim, isl_dim_set, 0);
|
||||
isl_local_space *LocalSpace = isl_local_space_from_dim (UnnamedDim);
|
||||
isl_aff *LAff = isl_aff_set_coefficient_si (isl_aff_zero (LocalSpace),
|
||||
isl_dim_set, BoundedDimension, 1);
|
||||
isl_pw_aff *BoundedDim = isl_pw_aff_from_aff(LAff);
|
||||
isl_space *UnnamedSpace = isl_space_copy(Space);
|
||||
UnnamedSpace = isl_space_set_tuple_name(UnnamedSpace, isl_dim_set, 0);
|
||||
isl_local_space *LocalSpace = isl_local_space_from_space(UnnamedSpace);
|
||||
isl_aff *LAff = isl_aff_set_coefficient_si(isl_aff_zero_on_domain(LocalSpace),
|
||||
isl_dim_in, BoundedDimension, 1);
|
||||
isl_pw_aff *BoundedSpace = isl_pw_aff_from_aff(LAff);
|
||||
isl_pw_aff *Bound = SCEVAffinator::getPwAff(this, UpperBound.OriginalSCEV, 0);
|
||||
isl_set *set = isl_pw_aff_le_set(BoundedDim, Bound);
|
||||
set = isl_set_set_tuple_name(set, isl_dim_get_tuple_name(Dim, isl_dim_set));
|
||||
isl_dim_free(Dim);
|
||||
isl_set *set = isl_pw_aff_le_set(BoundedSpace, Bound);
|
||||
set = isl_set_set_tuple_name(set, isl_space_get_tuple_name(Space, isl_dim_set));
|
||||
isl_space_free(Space);
|
||||
return set;
|
||||
}
|
||||
|
||||
void ScopStmt::buildIterationDomainFromLoops(TempScop &tempScop) {
|
||||
isl_dim *dim = isl_dim_set_alloc(getIslContext(), 0, getNumIterators());
|
||||
dim = isl_dim_set_tuple_name(dim, isl_dim_set, getBaseName());
|
||||
isl_space *Space = isl_space_set_alloc(getIslContext(), 0, getNumIterators());
|
||||
Space = isl_space_set_tuple_name(Space, isl_dim_set, getBaseName());
|
||||
|
||||
Domain = isl_set_universe(isl_dim_copy(dim));
|
||||
Domain = isl_set_align_params(Domain, isl_set_get_dim(Parent.getContext()));
|
||||
Domain = isl_set_universe(isl_space_copy(Space));
|
||||
Domain = isl_set_align_params(Domain, isl_set_get_space(Parent.getContext()));
|
||||
|
||||
isl_int v;
|
||||
isl_int_init(v);
|
||||
|
||||
isl_local_space *LocalSpace;
|
||||
LocalSpace = isl_local_space_from_space(isl_space_copy(Space));
|
||||
|
||||
for (int i = 0, e = getNumIterators(); i != e; ++i) {
|
||||
// Lower bound: IV >= 0.
|
||||
isl_basic_set *bset = isl_basic_set_universe(isl_dim_copy(dim));
|
||||
isl_constraint *c = isl_inequality_alloc(isl_dim_copy(dim));
|
||||
isl_basic_set *bset = isl_basic_set_universe(isl_space_copy(Space));
|
||||
isl_constraint *c = isl_inequality_alloc(isl_local_space_copy(LocalSpace));
|
||||
isl_int_set_si(v, 1);
|
||||
isl_constraint_set_coefficient(c, isl_dim_set, i, v);
|
||||
bset = isl_basic_set_add_constraint(bset, c);
|
||||
|
@ -649,17 +662,19 @@ void ScopStmt::buildIterationDomainFromLoops(TempScop &tempScop) {
|
|||
// Upper bound: IV <= NumberOfIterations.
|
||||
const Loop *L = getLoopForDimension(i);
|
||||
const SCEVAffFunc &UpperBound = tempScop.getLoopBound(L);
|
||||
isl_set *UpperBoundSet = toUpperLoopBound(UpperBound, isl_dim_copy(dim), i);
|
||||
isl_set *UpperBoundSet = toUpperLoopBound(UpperBound, isl_space_copy(Space),
|
||||
i);
|
||||
Domain = isl_set_intersect(Domain, UpperBoundSet);
|
||||
}
|
||||
|
||||
isl_dim_free(dim);
|
||||
isl_local_space_free(LocalSpace);
|
||||
isl_space_free(Space);
|
||||
isl_int_clear(v);
|
||||
}
|
||||
|
||||
void ScopStmt::addConditionsToDomain(TempScop &tempScop,
|
||||
const Region &CurRegion) {
|
||||
isl_dim *dim = isl_set_get_dim(Domain);
|
||||
isl_space *Space = isl_set_get_space(Domain);
|
||||
const Region *TopR = tempScop.getMaxRegion().getParent(),
|
||||
*CurR = &CurRegion;
|
||||
const BasicBlock *CurEntry = BB;
|
||||
|
@ -672,7 +687,7 @@ void ScopStmt::addConditionsToDomain(TempScop &tempScop,
|
|||
if (const BBCond *Cnd = tempScop.getBBCond(CurEntry))
|
||||
for (BBCond::const_iterator I = Cnd->begin(), E = Cnd->end();
|
||||
I != E; ++I) {
|
||||
isl_set *c = toConditionSet(*I, dim);
|
||||
isl_set *c = toConditionSet(*I, Space);
|
||||
Domain = isl_set_intersect(Domain, c);
|
||||
}
|
||||
}
|
||||
|
@ -680,7 +695,7 @@ void ScopStmt::addConditionsToDomain(TempScop &tempScop,
|
|||
CurR = CurR->getParent();
|
||||
} while (TopR != CurR);
|
||||
|
||||
isl_dim_free(dim);
|
||||
isl_space_free(Space);
|
||||
}
|
||||
|
||||
void ScopStmt::buildIterationDomain(TempScop &tempScop, const Region &CurRegion)
|
||||
|
@ -720,22 +735,22 @@ ScopStmt::ScopStmt(Scop &parent, SmallVectorImpl<unsigned> &Scatter)
|
|||
|
||||
// Build iteration domain.
|
||||
std::string IterationDomainString = "{[i0] : i0 = 0}";
|
||||
Domain = isl_set_read_from_str(Parent.getCtx(), IterationDomainString.c_str(),
|
||||
-1);
|
||||
Domain = isl_set_read_from_str(Parent.getCtx(),
|
||||
IterationDomainString.c_str());
|
||||
Domain = isl_set_set_tuple_name(Domain, getBaseName());
|
||||
isl_dim *Model = isl_set_get_dim(getParent()->getContext());
|
||||
Domain = isl_set_align_params(Domain, isl_dim_copy(Model));
|
||||
isl_space *Model = isl_set_get_space(getParent()->getContext());
|
||||
Domain = isl_set_align_params(Domain, isl_space_copy(Model));
|
||||
|
||||
// Build scattering.
|
||||
unsigned ScatDim = Parent.getMaxLoopDepth() * 2 + 1;
|
||||
isl_dim *dim = isl_dim_alloc(Parent.getCtx(), 0, 1, ScatDim);
|
||||
dim = isl_dim_set_tuple_name(dim, isl_dim_out, "scattering");
|
||||
dim = isl_dim_set_tuple_name(dim, isl_dim_in, getBaseName());
|
||||
isl_basic_map *bmap = isl_basic_map_universe(isl_dim_copy(dim));
|
||||
unsigned ScatSpace = Parent.getMaxLoopDepth() * 2 + 1;
|
||||
isl_space *Space = isl_space_alloc(Parent.getCtx(), 0, 1, ScatSpace);
|
||||
Space = isl_space_set_tuple_name(Space, isl_dim_out, "scattering");
|
||||
Space = isl_space_set_tuple_name(Space, isl_dim_in, getBaseName());
|
||||
isl_basic_map *bmap = isl_basic_map_universe(isl_space_copy(Space));
|
||||
isl_int v;
|
||||
isl_int_init(v);
|
||||
|
||||
isl_constraint *c = isl_equality_alloc(dim);
|
||||
isl_constraint *c = isl_equality_alloc(isl_local_space_from_space(Space));
|
||||
isl_int_set_si(v, -1);
|
||||
isl_constraint_set_coefficient(c, isl_dim_out, 0, v);
|
||||
|
||||
|
@ -863,7 +878,7 @@ Scop::Scop(TempScop &tempScop, LoopInfo &LI, ScalarEvolution &ScalarEvolution,
|
|||
ParamSetType &Params = tempScop.getParamSet();
|
||||
Parameters.insert(Parameters.begin(), Params.begin(), Params.end());
|
||||
|
||||
isl_dim *dim = isl_dim_set_alloc(ctx, getNumParams(), 0);
|
||||
isl_space *Space = isl_space_set_alloc(ctx, getNumParams(), 0);
|
||||
|
||||
int i = 0;
|
||||
for (ParamSetType::iterator PI = Params.begin(), PE = Params.end();
|
||||
|
@ -872,13 +887,13 @@ Scop::Scop(TempScop &tempScop, LoopInfo &LI, ScalarEvolution &ScalarEvolution,
|
|||
isl_id *id = isl_id_alloc(ctx,
|
||||
("p" + convertInt(i)).c_str(),
|
||||
(void *) scev);
|
||||
dim = isl_dim_set_dim_id(dim, isl_dim_param, i, id);
|
||||
Space = isl_space_set_dim_id(Space, isl_dim_param, i, id);
|
||||
i++;
|
||||
}
|
||||
|
||||
// TODO: Insert relations between parameters.
|
||||
// TODO: Insert constraints on parameters.
|
||||
Context = isl_set_universe (dim);
|
||||
Context = isl_set_universe (Space);
|
||||
|
||||
SmallVector<Loop*, 8> NestLoops;
|
||||
SmallVector<unsigned, 8> Scatter;
|
||||
|
|
|
@ -362,8 +362,8 @@ public:
|
|||
isl_map *currentAccessRelation = access.getAccessFunction();
|
||||
isl_map *newAccessRelation = access.getNewAccessFunction();
|
||||
|
||||
assert(isl_map_has_equal_dim(currentAccessRelation, newAccessRelation)
|
||||
&& "Current and new access function dimensions differ");
|
||||
assert(isl_map_has_equal_space(currentAccessRelation, newAccessRelation)
|
||||
&& "Current and new access function use different spaces");
|
||||
|
||||
if (!newAccessRelation) {
|
||||
Value *newPointer = getOperand(pointer, BBMap);
|
||||
|
@ -1147,10 +1147,11 @@ public:
|
|||
// Calculate a map similar to the identity map, but with the last input
|
||||
// and output dimension not related.
|
||||
// [i0, i1, i2, i3] -> [i0, i1, i2, o0]
|
||||
isl_dim *dim = isl_set_get_dim(loopDomain);
|
||||
dim = isl_dim_drop_outputs(dim, isl_set_n_dim(loopDomain) - 2, 1);
|
||||
dim = isl_dim_map_from_set(dim);
|
||||
isl_map *identity = isl_map_identity(dim);
|
||||
isl_space *Space = isl_set_get_space(loopDomain);
|
||||
Space = isl_space_drop_outputs(Space,
|
||||
isl_set_dim(loopDomain, isl_dim_set) - 2, 1);
|
||||
Space = isl_space_map_from_set(Space);
|
||||
isl_map *identity = isl_map_identity(Space);
|
||||
identity = isl_map_add_dims(identity, isl_dim_in, 1);
|
||||
identity = isl_map_add_dims(identity, isl_dim_out, 1);
|
||||
|
||||
|
|
|
@ -236,7 +236,7 @@ bool JSONImporter::runOnScop(Scop &scop) {
|
|||
continue;
|
||||
Json::Value schedule = jscop["statements"][index]["schedule"];
|
||||
|
||||
isl_map *m = isl_map_read_from_str(S->getCtx(), schedule.asCString(), -1);
|
||||
isl_map *m = isl_map_read_from_str(S->getCtx(), schedule.asCString());
|
||||
NewScattering[*SI] = m;
|
||||
index++;
|
||||
}
|
||||
|
@ -267,9 +267,9 @@ bool JSONImporter::runOnScop(Scop &scop) {
|
|||
Json::Value accesses = jscop["statements"][statementIdx]
|
||||
["accesses"][memoryAccessIdx]["relation"];
|
||||
isl_map *newAccessMap = isl_map_read_from_str(S->getCtx(),
|
||||
accesses.asCString(), -1);
|
||||
accesses.asCString());
|
||||
isl_map *currentAccessMap = (*MI)->getAccessFunction();
|
||||
if (!isl_map_has_equal_dim(currentAccessMap, newAccessMap)) {
|
||||
if (!isl_map_has_equal_space(currentAccessMap, newAccessMap)) {
|
||||
errs() << "JScop file contains access function with incompatible "
|
||||
<< "dimensions\n";
|
||||
isl_map_free(newAccessMap);
|
||||
|
|
|
@ -223,9 +223,9 @@ void OpenScop::print(FILE *F) {
|
|||
int OpenScop::domainToMatrix_constraint(isl_constraint *c, void *user) {
|
||||
openscop_matrix_p m = (openscop_matrix_p) user;
|
||||
|
||||
int nb_params = isl_constraint_dim(c, isl_dim_param);
|
||||
int nb_vars = isl_constraint_dim(c, isl_dim_set);
|
||||
int nb_div = isl_constraint_dim(c, isl_dim_div);
|
||||
int nb_params = isl_constraint_dim(c, isl_space_param);
|
||||
int nb_vars = isl_constraint_dim(c, isl_space_set);
|
||||
int nb_div = isl_constraint_dim(c, isl_space_div);
|
||||
|
||||
assert(!nb_div && "Existentially quantified variables not yet supported");
|
||||
|
||||
|
@ -242,13 +242,13 @@ int OpenScop::domainToMatrix_constraint(isl_constraint *c, void *user) {
|
|||
|
||||
// Assign variables
|
||||
for (int i = 0; i < nb_vars; ++i) {
|
||||
isl_constraint_get_coefficient(c, isl_dim_set, i, &v);
|
||||
isl_constraint_get_coefficient(c, isl_space_set, i, &v);
|
||||
isl_int_set(vec->p[i + 1], v);
|
||||
}
|
||||
|
||||
// Assign parameters
|
||||
for (int i = 0; i < nb_params; ++i) {
|
||||
isl_constraint_get_coefficient(c, isl_dim_param, i, &v);
|
||||
isl_constraint_get_coefficient(c, isl_space_param, i, &v);
|
||||
isl_int_set(vec->p[nb_vars + i + 1], v);
|
||||
}
|
||||
|
||||
|
@ -309,10 +309,10 @@ openscop_matrix_p OpenScop::domainToMatrix(isl_set *PS) {
|
|||
int OpenScop::scatteringToMatrix_constraint(isl_constraint *c, void *user) {
|
||||
openscop_matrix_p m = (openscop_matrix_p) user;
|
||||
|
||||
int nb_params = isl_constraint_dim(c, isl_dim_param);
|
||||
int nb_in = isl_constraint_dim(c, isl_dim_in);
|
||||
int nb_out = isl_constraint_dim(c, isl_dim_out);
|
||||
int nb_div = isl_constraint_dim(c, isl_dim_div);
|
||||
int nb_params = isl_constraint_dim(c, isl_space_param);
|
||||
int nb_in = isl_constraint_dim(c, isl_space_in);
|
||||
int nb_out = isl_constraint_dim(c, isl_space_out);
|
||||
int nb_div = isl_constraint_dim(c, isl_space_div);
|
||||
|
||||
assert(!nb_div && "Existentially quantified variables not yet supported");
|
||||
|
||||
|
@ -330,19 +330,19 @@ int OpenScop::scatteringToMatrix_constraint(isl_constraint *c, void *user) {
|
|||
|
||||
// Assign scattering
|
||||
for (int i = 0; i < nb_out; ++i) {
|
||||
isl_constraint_get_coefficient(c, isl_dim_out, i, &v);
|
||||
isl_constraint_get_coefficient(c, isl_space_out, i, &v);
|
||||
isl_int_set(vec->p[i + 1], v);
|
||||
}
|
||||
|
||||
// Assign variables
|
||||
for (int i = 0; i < nb_in; ++i) {
|
||||
isl_constraint_get_coefficient(c, isl_dim_in, i, &v);
|
||||
isl_constraint_get_coefficient(c, isl_space_in, i, &v);
|
||||
isl_int_set(vec->p[nb_out + i + 1], v);
|
||||
}
|
||||
|
||||
// Assign parameters
|
||||
for (int i = 0; i < nb_params; ++i) {
|
||||
isl_constraint_get_coefficient(c, isl_dim_param, i, &v);
|
||||
isl_constraint_get_coefficient(c, isl_space_param, i, &v);
|
||||
isl_int_set(vec->p[nb_out + nb_in + i + 1], v);
|
||||
}
|
||||
|
||||
|
@ -404,9 +404,9 @@ openscop_matrix_p OpenScop::scatteringToMatrix(isl_map *pmap) {
|
|||
int OpenScop::accessToMatrix_constraint(isl_constraint *c, void *user) {
|
||||
openscop_matrix_p m = (openscop_matrix_p) user;
|
||||
|
||||
int nb_params = isl_constraint_dim(c, isl_dim_param);
|
||||
int nb_in = isl_constraint_dim(c, isl_dim_in);
|
||||
int nb_div = isl_constraint_dim(c, isl_dim_div);
|
||||
int nb_params = isl_constraint_dim(c, isl_space_param);
|
||||
int nb_in = isl_constraint_dim(c, isl_space_in);
|
||||
int nb_div = isl_constraint_dim(c, isl_space_div);
|
||||
|
||||
assert(!nb_div && "Existentially quantified variables not yet supported");
|
||||
|
||||
|
@ -417,13 +417,13 @@ int OpenScop::accessToMatrix_constraint(isl_constraint *c, void *user) {
|
|||
isl_int_init(v);
|
||||
|
||||
// The access dimension has to be one.
|
||||
isl_constraint_get_coefficient(c, isl_dim_out, 0, &v);
|
||||
isl_constraint_get_coefficient(c, isl_space_out, 0, &v);
|
||||
assert(isl_int_is_one(v));
|
||||
bool inverse = true ;
|
||||
|
||||
// Assign variables
|
||||
for (int i = 0; i < nb_in; ++i) {
|
||||
isl_constraint_get_coefficient(c, isl_dim_in, i, &v);
|
||||
isl_constraint_get_coefficient(c, isl_space_in, i, &v);
|
||||
|
||||
if (inverse) isl_int_neg(v,v);
|
||||
|
||||
|
@ -432,7 +432,7 @@ int OpenScop::accessToMatrix_constraint(isl_constraint *c, void *user) {
|
|||
|
||||
// Assign parameters
|
||||
for (int i = 0; i < nb_params; ++i) {
|
||||
isl_constraint_get_coefficient(c, isl_dim_param, i, &v);
|
||||
isl_constraint_get_coefficient(c, isl_space_param, i, &v);
|
||||
|
||||
if (inverse) isl_int_neg(v,v);
|
||||
|
||||
|
|
|
@ -64,31 +64,31 @@ char ScopImporter::ID = 0;
|
|||
/// @brief Create an isl constraint from a row of OpenScop integers.
|
||||
///
|
||||
/// @param row An array of isl/OpenScop integers.
|
||||
/// @param dim An isl dim object, describing how to spilt the dimensions.
|
||||
/// @param Space An isl space object, describing how to spilt the dimensions.
|
||||
///
|
||||
/// @return An isl constraint representing this integer array.
|
||||
isl_constraint *constraintFromMatrixRow(isl_int *row, isl_dim *dim) {
|
||||
isl_constraint *constraintFromMatrixRow(isl_int *row, isl_space *Space) {
|
||||
isl_constraint *c;
|
||||
|
||||
unsigned NbOut = isl_dim_size(dim, isl_dim_out);
|
||||
unsigned NbIn = isl_dim_size(dim, isl_dim_in);
|
||||
unsigned NbParam = isl_dim_size(dim, isl_dim_param);
|
||||
unsigned NbOut = isl_space_size(Space, isl_dim_out);
|
||||
unsigned NbIn = isl_space_size(Space, isl_dim_in);
|
||||
unsigned NbParam = isl_space_size(Space, isl_dim_param);
|
||||
|
||||
if (isl_int_is_zero(row[0]))
|
||||
c = isl_equality_alloc(isl_dim_copy(dim));
|
||||
c = isl_equality_alloc(isl_space_copy(Space));
|
||||
else
|
||||
c = isl_inequality_alloc(isl_dim_copy(dim));
|
||||
c = isl_inequality_alloc(isl_space_copy(Space));
|
||||
|
||||
unsigned current_column = 1;
|
||||
|
||||
for (unsigned j = 0; j < NbOut; ++j)
|
||||
isl_constraint_set_coefficient(c, isl_dim_out, j, row[current_column++]);
|
||||
isl_constraint_set_coefficient(c, isl_space_out, j, row[current_column++]);
|
||||
|
||||
for (unsigned j = 0; j < NbIn; ++j)
|
||||
isl_constraint_set_coefficient(c, isl_dim_in, j, row[current_column++]);
|
||||
isl_constraint_set_coefficient(c, isl_space_in, j, row[current_column++]);
|
||||
|
||||
for (unsigned j = 0; j < NbParam; ++j)
|
||||
isl_constraint_set_coefficient(c, isl_dim_param, j, row[current_column++]);
|
||||
isl_constraint_set_coefficient(c, isl_space_param, j, row[current_column++]);
|
||||
|
||||
isl_constraint_set_constant(c, row[current_column]);
|
||||
|
||||
|
@ -98,16 +98,16 @@ isl_constraint *constraintFromMatrixRow(isl_int *row, isl_dim *dim) {
|
|||
/// @brief Create an isl map from a OpenScop matrix.
|
||||
///
|
||||
/// @param m The OpenScop matrix to translate.
|
||||
/// @param dim The dimensions that are contained in the OpenScop matrix.
|
||||
/// @param Space The dimensions that are contained in the OpenScop matrix.
|
||||
///
|
||||
/// @return An isl map representing m.
|
||||
isl_map *mapFromMatrix(openscop_matrix_p m, isl_dim *dim) {
|
||||
isl_basic_map *bmap = isl_basic_map_universe(isl_dim_copy(dim));
|
||||
isl_map *mapFromMatrix(openscop_matrix_p m, isl_space *Space) {
|
||||
isl_basic_map *bmap = isl_basic_map_universe(isl_space_copy(Space));
|
||||
|
||||
for (unsigned i = 0; i < m->NbRows; ++i) {
|
||||
isl_constraint *c;
|
||||
|
||||
c = constraintFromMatrixRow(m->p[i], dim);
|
||||
c = constraintFromMatrixRow(m->p[i], Space);
|
||||
bmap = isl_basic_map_add_constraint(bmap, c);
|
||||
}
|
||||
|
||||
|
@ -127,11 +127,11 @@ isl_map *scatteringForStmt(openscop_matrix_p m, ScopStmt *PollyStmt) {
|
|||
unsigned NbScattering = m->NbColumns - 2 - NbParam - NbIterators;
|
||||
|
||||
isl_ctx *ctx = PollyStmt->getParent()->getCtx();
|
||||
isl_dim *dim = isl_dim_alloc(ctx, NbParam, NbIterators, NbScattering);
|
||||
dim = isl_dim_set_tuple_name(dim, isl_dim_out, "scattering");
|
||||
dim = isl_dim_set_tuple_name(dim, isl_dim_in, PollyStmt->getBaseName());
|
||||
isl_map *map = mapFromMatrix(m, dim);
|
||||
isl_dim_free(dim);
|
||||
isl_space *Space = isl_dim_alloc(ctx, NbParam, NbIterators, NbScattering);
|
||||
Space = isl_space_set_tuple_name(Space, isl_dim_out, "scattering");
|
||||
Space = isl_space_set_tuple_name(Space, isl_dim_in, PollyStmt->getBaseName());
|
||||
isl_map *map = mapFromMatrix(m, Space);
|
||||
isl_space_free(Space);
|
||||
|
||||
return map;
|
||||
}
|
||||
|
|
|
@ -173,9 +173,9 @@ void ScopLib::print(FILE *F) {
|
|||
int ScopLib::domainToMatrix_constraint(isl_constraint *c, void *user) {
|
||||
scoplib_matrix_p m = (scoplib_matrix_p) user;
|
||||
|
||||
int nb_params = isl_constraint_dim(c, isl_dim_param);
|
||||
int nb_vars = isl_constraint_dim(c, isl_dim_set);
|
||||
int nb_div = isl_constraint_dim(c, isl_dim_div);
|
||||
int nb_params = isl_constraint_dim(c, isl_space_param);
|
||||
int nb_vars = isl_constraint_dim(c, isl_space_set);
|
||||
int nb_div = isl_constraint_dim(c, isl_space_div);
|
||||
|
||||
assert(!nb_div && "Existentially quantified variables not yet supported");
|
||||
|
||||
|
@ -192,13 +192,13 @@ int ScopLib::domainToMatrix_constraint(isl_constraint *c, void *user) {
|
|||
|
||||
// Assign variables
|
||||
for (int i = 0; i < nb_vars; ++i) {
|
||||
isl_constraint_get_coefficient(c, isl_dim_set, i, &v);
|
||||
isl_constraint_get_coefficient(c, isl_space_set, i, &v);
|
||||
isl_int_set(vec->p[i + 1], v);
|
||||
}
|
||||
|
||||
// Assign parameters
|
||||
for (int i = 0; i < nb_params; ++i) {
|
||||
isl_constraint_get_coefficient(c, isl_dim_param, i, &v);
|
||||
isl_constraint_get_coefficient(c, isl_space_param, i, &v);
|
||||
isl_int_set(vec->p[nb_vars + i + 1], v);
|
||||
}
|
||||
|
||||
|
@ -259,9 +259,9 @@ scoplib_matrix_p ScopLib::domainToMatrix(isl_set *PS) {
|
|||
int ScopLib::scatteringToMatrix_constraint(isl_constraint *c, void *user) {
|
||||
scoplib_matrix_p m = (scoplib_matrix_p) user;
|
||||
|
||||
int nb_params = isl_constraint_dim(c, isl_dim_param);
|
||||
int nb_in = isl_constraint_dim(c, isl_dim_in);
|
||||
int nb_div = isl_constraint_dim(c, isl_dim_div);
|
||||
int nb_params = isl_constraint_dim(c, isl_space_param);
|
||||
int nb_in = isl_constraint_dim(c, isl_space_in);
|
||||
int nb_div = isl_constraint_dim(c, isl_space_div);
|
||||
|
||||
assert(!nb_div && "Existentially quantified variables not yet supported");
|
||||
|
||||
|
@ -279,13 +279,13 @@ int ScopLib::scatteringToMatrix_constraint(isl_constraint *c, void *user) {
|
|||
|
||||
// Assign variables
|
||||
for (int i = 0; i < nb_in; ++i) {
|
||||
isl_constraint_get_coefficient(c, isl_dim_in, i, &v);
|
||||
isl_constraint_get_coefficient(c, isl_space_in, i, &v);
|
||||
isl_int_set(vec->p[i + 1], v);
|
||||
}
|
||||
|
||||
// Assign parameters
|
||||
for (int i = 0; i < nb_params; ++i) {
|
||||
isl_constraint_get_coefficient(c, isl_dim_param, i, &v);
|
||||
isl_constraint_get_coefficient(c, isl_space_param, i, &v);
|
||||
isl_int_set(vec->p[nb_in + i + 1], v);
|
||||
}
|
||||
|
||||
|
@ -355,9 +355,9 @@ scoplib_matrix_p ScopLib::scatteringToMatrix(isl_map *pmap) {
|
|||
int ScopLib::accessToMatrix_constraint(isl_constraint *c, void *user) {
|
||||
scoplib_matrix_p m = (scoplib_matrix_p) user;
|
||||
|
||||
int nb_params = isl_constraint_dim(c, isl_dim_param);
|
||||
int nb_in = isl_constraint_dim(c, isl_dim_in);
|
||||
int nb_div = isl_constraint_dim(c, isl_dim_div);
|
||||
int nb_params = isl_constraint_dim(c, isl_space_param);
|
||||
int nb_in = isl_constraint_dim(c, isl_space_in);
|
||||
int nb_div = isl_constraint_dim(c, isl_space_div);
|
||||
|
||||
assert(!nb_div && "Existentially quantified variables not yet supported");
|
||||
|
||||
|
@ -368,13 +368,13 @@ int ScopLib::accessToMatrix_constraint(isl_constraint *c, void *user) {
|
|||
isl_int_init(v);
|
||||
|
||||
// The access dimension has to be one.
|
||||
isl_constraint_get_coefficient(c, isl_dim_out, 0, &v);
|
||||
isl_constraint_get_coefficient(c, isl_space_out, 0, &v);
|
||||
assert(isl_int_is_one(v));
|
||||
bool inverse = true ;
|
||||
|
||||
// Assign variables
|
||||
for (int i = 0; i < nb_in; ++i) {
|
||||
isl_constraint_get_coefficient(c, isl_dim_in, i, &v);
|
||||
isl_constraint_get_coefficient(c, isl_space_in, i, &v);
|
||||
|
||||
if (inverse) isl_int_neg(v,v);
|
||||
|
||||
|
@ -383,7 +383,7 @@ int ScopLib::accessToMatrix_constraint(isl_constraint *c, void *user) {
|
|||
|
||||
// Assign parameters
|
||||
for (int i = 0; i < nb_params; ++i) {
|
||||
isl_constraint_get_coefficient(c, isl_dim_param, i, &v);
|
||||
isl_constraint_get_coefficient(c, isl_space_param, i, &v);
|
||||
|
||||
if (inverse) isl_int_neg(v,v);
|
||||
|
||||
|
@ -482,27 +482,27 @@ ScopLib::~ScopLib() {
|
|||
/// @brief Create an isl constraint from a row of OpenScop integers.
|
||||
///
|
||||
/// @param row An array of isl/OpenScop integers.
|
||||
/// @param dim An isl dim object, describing how to spilt the dimensions.
|
||||
/// @param Space An isl space object, describing how to spilt the dimensions.
|
||||
///
|
||||
/// @return An isl constraint representing this integer array.
|
||||
isl_constraint *constraintFromMatrixRow(isl_int *row, isl_dim *dim) {
|
||||
isl_constraint *constraintFromMatrixRow(isl_int *row, isl_space *Space) {
|
||||
isl_constraint *c;
|
||||
|
||||
unsigned NbIn = isl_dim_size(dim, isl_dim_in);
|
||||
unsigned NbParam = isl_dim_size(dim, isl_dim_param);
|
||||
unsigned NbIn = isl_space_size(Space, isl_dim_in);
|
||||
unsigned NbParam = isl_space_size(Space, isl_dim_param);
|
||||
|
||||
if (isl_int_is_zero(row[0]))
|
||||
c = isl_equality_alloc(isl_dim_copy(dim));
|
||||
c = isl_equality_alloc(isl_space_copy(Space));
|
||||
else
|
||||
c = isl_inequality_alloc(isl_dim_copy(dim));
|
||||
c = isl_inequality_alloc(isl_space_copy(Space));
|
||||
|
||||
unsigned current_column = 1;
|
||||
|
||||
for (unsigned j = 0; j < NbIn; ++j)
|
||||
isl_constraint_set_coefficient(c, isl_dim_in, j, row[current_column++]);
|
||||
isl_constraint_set_coefficient(c, isl_space_in, j, row[current_column++]);
|
||||
|
||||
for (unsigned j = 0; j < NbParam; ++j)
|
||||
isl_constraint_set_coefficient(c, isl_dim_param, j, row[current_column++]);
|
||||
isl_constraint_set_coefficient(c, isl_space_param, j, row[current_column++]);
|
||||
|
||||
isl_constraint_set_constant(c, row[current_column]);
|
||||
|
||||
|
@ -512,22 +512,22 @@ isl_constraint *constraintFromMatrixRow(isl_int *row, isl_dim *dim) {
|
|||
/// @brief Create an isl map from a OpenScop matrix.
|
||||
///
|
||||
/// @param m The OpenScop matrix to translate.
|
||||
/// @param dim The dimensions that are contained in the OpenScop matrix.
|
||||
/// @param Space The dimensions that are contained in the OpenScop matrix.
|
||||
///
|
||||
/// @return An isl map representing m.
|
||||
isl_map *mapFromMatrix(scoplib_matrix_p m, isl_dim *dim,
|
||||
isl_map *mapFromMatrix(scoplib_matrix_p m, isl_space *Space,
|
||||
unsigned scatteringDims) {
|
||||
isl_basic_map *bmap = isl_basic_map_universe(isl_dim_copy(dim));
|
||||
isl_basic_map *bmap = isl_basic_map_universe(isl_space_copy(Space));
|
||||
|
||||
for (unsigned i = 0; i < m->NbRows; ++i) {
|
||||
isl_constraint *c;
|
||||
|
||||
c = constraintFromMatrixRow(m->p[i], dim);
|
||||
c = constraintFromMatrixRow(m->p[i], Space);
|
||||
|
||||
mpz_t minusOne;
|
||||
mpz_init(minusOne);
|
||||
mpz_set_si(minusOne, -1);
|
||||
isl_constraint_set_coefficient(c, isl_dim_out, i, minusOne);
|
||||
isl_constraint_set_coefficient(c, isl_space_out, i, minusOne);
|
||||
|
||||
bmap = isl_basic_map_add_constraint(bmap, c);
|
||||
}
|
||||
|
@ -535,12 +535,12 @@ isl_map *mapFromMatrix(scoplib_matrix_p m, isl_dim *dim,
|
|||
for (unsigned i = m->NbRows; i < scatteringDims; i++) {
|
||||
isl_constraint *c;
|
||||
|
||||
c = isl_equality_alloc(isl_dim_copy(dim));
|
||||
c = isl_equality_alloc(isl_space_copy(Space));
|
||||
|
||||
mpz_t One;
|
||||
mpz_init(One);
|
||||
mpz_set_si(One, 1);
|
||||
isl_constraint_set_coefficient(c, isl_dim_out, i, One);
|
||||
isl_constraint_set_coefficient(c, isl_space_out, i, One);
|
||||
|
||||
bmap = isl_basic_map_add_constraint(bmap, c);
|
||||
}
|
||||
|
@ -550,31 +550,31 @@ isl_map *mapFromMatrix(scoplib_matrix_p m, isl_dim *dim,
|
|||
/// @brief Create an isl constraint from a row of OpenScop integers.
|
||||
///
|
||||
/// @param row An array of isl/OpenScop integers.
|
||||
/// @param dim An isl dim object, describing how to spilt the dimensions.
|
||||
/// @param Space An isl space object, describing how to spilt the dimensions.
|
||||
///
|
||||
/// @return An isl constraint representing this integer array.
|
||||
isl_constraint *constraintFromMatrixRowFull(isl_int *row, isl_dim *dim) {
|
||||
isl_constraint *constraintFromMatrixRowFull(isl_int *row, isl_space *Space) {
|
||||
isl_constraint *c;
|
||||
|
||||
unsigned NbOut = isl_dim_size(dim, isl_dim_out);
|
||||
unsigned NbIn = isl_dim_size(dim, isl_dim_in);
|
||||
unsigned NbParam = isl_dim_size(dim, isl_dim_param);
|
||||
unsigned NbOut = isl_space_size(Space, isl_dim_out);
|
||||
unsigned NbIn = isl_space_size(Space, isl_dim_in);
|
||||
unsigned NbParam = isl_space_size(Space, isl_dim_param);
|
||||
|
||||
if (isl_int_is_zero(row[0]))
|
||||
c = isl_equality_alloc(isl_dim_copy(dim));
|
||||
c = isl_equality_alloc(isl_space_copy(Space));
|
||||
else
|
||||
c = isl_inequality_alloc(isl_dim_copy(dim));
|
||||
c = isl_inequality_alloc(isl_space_copy(Space));
|
||||
|
||||
unsigned current_column = 1;
|
||||
|
||||
for (unsigned j = 0; j < NbOut; ++j)
|
||||
isl_constraint_set_coefficient(c, isl_dim_out, j, row[current_column++]);
|
||||
isl_constraint_set_coefficient(c, isl_space_out, j, row[current_column++]);
|
||||
|
||||
for (unsigned j = 0; j < NbIn; ++j)
|
||||
isl_constraint_set_coefficient(c, isl_dim_in, j, row[current_column++]);
|
||||
isl_constraint_set_coefficient(c, isl_space_in, j, row[current_column++]);
|
||||
|
||||
for (unsigned j = 0; j < NbParam; ++j)
|
||||
isl_constraint_set_coefficient(c, isl_dim_param, j, row[current_column++]);
|
||||
isl_constraint_set_coefficient(c, isl_space_param, j, row[current_column++]);
|
||||
|
||||
isl_constraint_set_constant(c, row[current_column]);
|
||||
|
||||
|
@ -584,16 +584,16 @@ isl_constraint *constraintFromMatrixRowFull(isl_int *row, isl_dim *dim) {
|
|||
/// @brief Create an isl map from a OpenScop matrix.
|
||||
///
|
||||
/// @param m The OpenScop matrix to translate.
|
||||
/// @param dim The dimensions that are contained in the OpenScop matrix.
|
||||
/// @param Space The dimensions that are contained in the OpenScop matrix.
|
||||
///
|
||||
/// @return An isl map representing m.
|
||||
isl_map *mapFromMatrix(scoplib_matrix_p m, isl_dim *dim) {
|
||||
isl_basic_map *bmap = isl_basic_map_universe(isl_dim_copy(dim));
|
||||
isl_map *mapFromMatrix(scoplib_matrix_p m, isl_space *Space) {
|
||||
isl_basic_map *bmap = isl_basic_map_universe(isl_space_copy(Space));
|
||||
|
||||
for (unsigned i = 0; i < m->NbRows; ++i) {
|
||||
isl_constraint *c;
|
||||
|
||||
c = constraintFromMatrixRowFull(m->p[i], dim);
|
||||
c = constraintFromMatrixRowFull(m->p[i], Space);
|
||||
bmap = isl_basic_map_add_constraint(bmap, c);
|
||||
}
|
||||
|
||||
|
@ -619,18 +619,18 @@ isl_map *scatteringForStmt(scoplib_matrix_p m, ScopStmt *PollyStmt,
|
|||
NbScattering = scatteringDims;
|
||||
|
||||
isl_ctx *ctx = PollyStmt->getParent()->getCtx();
|
||||
isl_dim *dim = isl_dim_alloc(ctx, NbParam, NbIterators, NbScattering);
|
||||
dim = isl_dim_set_tuple_name(dim, isl_dim_out, "scattering");
|
||||
dim = isl_dim_set_tuple_name(dim, isl_dim_in, PollyStmt->getBaseName());
|
||||
isl_space *Space = isl_dim_alloc(ctx, NbParam, NbIterators, NbScattering);
|
||||
Space = isl_space_set_tuple_name(Space, isl_dim_out, "scattering");
|
||||
Space = isl_space_set_tuple_name(Space, isl_dim_in, PollyStmt->getBaseName());
|
||||
|
||||
isl_map *map;
|
||||
|
||||
if (scatteringDims == -1)
|
||||
map = mapFromMatrix(m, dim);
|
||||
map = mapFromMatrix(m, Space);
|
||||
else
|
||||
map = mapFromMatrix(m, dim, scatteringDims);
|
||||
map = mapFromMatrix(m, Space, scatteringDims);
|
||||
|
||||
isl_dim_free(dim);
|
||||
isl_space_free(Space);
|
||||
|
||||
return map;
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
|
||||
#include "polly/ScopLib.h"
|
||||
|
||||
#include "isl/dim.h"
|
||||
#include "isl/space.h"
|
||||
#include "isl/map.h"
|
||||
#include "isl/constraint.h"
|
||||
|
||||
|
@ -202,12 +202,12 @@ bool Pocc::runOnScop(Scop &S) {
|
|||
isl_map *scat = (*SI)->getScattering();
|
||||
|
||||
int scatDims = isl_map_n_out(scat);
|
||||
isl_dim *dim = isl_dim_alloc(S.getCtx(), S.getNumParams(), scatDims,
|
||||
scatDims + 1);
|
||||
isl_basic_map *map = isl_basic_map_universe(isl_dim_copy(dim));
|
||||
isl_space *Space= isl_space_alloc(S.getCtx(), S.getNumParams(), scatDims,
|
||||
scatDims + 1);
|
||||
isl_basic_map *map = isl_basic_map_universe(isl_space_copy(Space));
|
||||
|
||||
for (int i = 0; i <= lastLoop - 1; i++) {
|
||||
isl_constraint *c = isl_equality_alloc(isl_dim_copy(dim));
|
||||
isl_constraint *c = isl_equality_alloc(isl_space_copy(Space));
|
||||
|
||||
isl_constraint_set_coefficient_si(c, isl_dim_in, i, 1);
|
||||
isl_constraint_set_coefficient_si(c, isl_dim_out, i, -1);
|
||||
|
@ -216,7 +216,7 @@ bool Pocc::runOnScop(Scop &S) {
|
|||
}
|
||||
|
||||
for (int i = lastLoop; i < scatDims; i++) {
|
||||
isl_constraint *c = isl_equality_alloc(isl_dim_copy(dim));
|
||||
isl_constraint *c = isl_equality_alloc(isl_space_copy(Space));
|
||||
|
||||
isl_constraint_set_coefficient_si(c, isl_dim_in, i, 1);
|
||||
isl_constraint_set_coefficient_si(c, isl_dim_out, i + 1, -1);
|
||||
|
@ -227,12 +227,12 @@ bool Pocc::runOnScop(Scop &S) {
|
|||
isl_constraint *c;
|
||||
|
||||
int vectorWidth = 4;
|
||||
c = isl_inequality_alloc(isl_dim_copy(dim));
|
||||
c = isl_inequality_alloc(isl_space_copy(Space));
|
||||
isl_constraint_set_coefficient_si(c, isl_dim_out, lastLoop, -vectorWidth);
|
||||
isl_constraint_set_coefficient_si(c, isl_dim_out, lastLoop + 1, 1);
|
||||
map = isl_basic_map_add_constraint(map, c);
|
||||
|
||||
c = isl_inequality_alloc(isl_dim_copy(dim));
|
||||
c = isl_inequality_alloc(isl_space_copy(Space));
|
||||
isl_constraint_set_coefficient_si(c, isl_dim_out, lastLoop, vectorWidth);
|
||||
isl_constraint_set_coefficient_si(c, isl_dim_out, lastLoop + 1, -1);
|
||||
isl_constraint_set_constant_si(c, vectorWidth - 1);
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
#include "polly/Dependences.h"
|
||||
#include "polly/ScopInfo.h"
|
||||
|
||||
#include "isl/dim.h"
|
||||
#include "isl/space.h"
|
||||
#include "isl/map.h"
|
||||
#include "isl/constraint.h"
|
||||
#include "isl/schedule.h"
|
||||
|
@ -75,30 +75,31 @@ static void extendScattering(Scop &S, unsigned scatDimensions) {
|
|||
continue;
|
||||
|
||||
isl_map *scattering = stmt->getScattering();
|
||||
isl_dim *dim = isl_dim_alloc(isl_map_get_ctx(scattering),
|
||||
0, isl_map_n_out(scattering),
|
||||
scatDimensions);
|
||||
isl_basic_map *changeScattering = isl_basic_map_universe(isl_dim_copy(dim));
|
||||
isl_space *Space = isl_space_alloc(isl_map_get_ctx(scattering), 0,
|
||||
isl_map_n_out(scattering), scatDimensions);
|
||||
isl_basic_map *changeScattering = isl_basic_map_universe(
|
||||
isl_space_copy(Space));
|
||||
isl_local_space *LocalSpace = isl_local_space_from_space(Space);
|
||||
|
||||
for (unsigned i = 0; i < isl_map_n_out(scattering); i++) {
|
||||
isl_constraint *c = isl_equality_alloc(isl_dim_copy(dim));
|
||||
isl_constraint *c = isl_equality_alloc(isl_local_space_copy(LocalSpace));
|
||||
isl_constraint_set_coefficient_si(c, isl_dim_in, i, 1);
|
||||
isl_constraint_set_coefficient_si(c, isl_dim_out, i, -1);
|
||||
changeScattering = isl_basic_map_add_constraint(changeScattering, c);
|
||||
}
|
||||
|
||||
for (unsigned i = isl_map_n_out(scattering); i < scatDimensions; i++) {
|
||||
isl_constraint *c = isl_equality_alloc(isl_dim_copy(dim));
|
||||
isl_constraint *c = isl_equality_alloc(isl_local_space_copy(LocalSpace));
|
||||
isl_constraint_set_coefficient_si(c, isl_dim_out, i, 1);
|
||||
changeScattering = isl_basic_map_add_constraint(changeScattering, c);
|
||||
}
|
||||
|
||||
isl_map *changeScatteringMap = isl_map_from_basic_map(changeScattering);
|
||||
|
||||
isl_dim *dimModel = isl_map_get_dim(scattering);
|
||||
changeScatteringMap = isl_map_align_params(changeScatteringMap, dimModel);
|
||||
isl_space *SpaceModel = isl_map_get_space(scattering);
|
||||
changeScatteringMap = isl_map_align_params(changeScatteringMap, SpaceModel);
|
||||
stmt->setScattering(isl_map_apply_range(scattering, changeScatteringMap));
|
||||
isl_dim_free(dim);
|
||||
isl_local_space_free(LocalSpace);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -129,7 +130,7 @@ static void extendScattering(Scop &S, unsigned scatDimensions) {
|
|||
// S(i,j)
|
||||
//
|
||||
static isl_basic_map *getTileMap(isl_ctx *ctx, int scheduleDimensions,
|
||||
isl_dim *dimModel, int tileSize = 32) {
|
||||
isl_space *SpaceModel, int tileSize = 32) {
|
||||
// We construct
|
||||
//
|
||||
// tileMap := [p0] -> {[s0, s1] -> [t0, t1, p0, p1, a0, a1]:
|
||||
|
@ -137,9 +138,11 @@ static isl_basic_map *getTileMap(isl_ctx *ctx, int scheduleDimensions,
|
|||
// s1 = a1 * 32 and s1 = p1 and t1 <= p1 < t1 + 32}
|
||||
//
|
||||
// and project out the auxilary dimensions a0 and a1.
|
||||
isl_dim *dim = isl_dim_alloc(ctx, 0, scheduleDimensions,
|
||||
scheduleDimensions * 3);
|
||||
isl_basic_map *tileMap = isl_basic_map_universe(isl_dim_copy(dim));
|
||||
isl_space *Space = isl_space_alloc(ctx, 0, scheduleDimensions,
|
||||
scheduleDimensions * 3);
|
||||
isl_basic_map *tileMap = isl_basic_map_universe(isl_space_copy(Space));
|
||||
|
||||
isl_local_space *LocalSpace = isl_local_space_from_space(Space);
|
||||
|
||||
for (int x = 0; x < scheduleDimensions; x++) {
|
||||
int sX = x;
|
||||
|
@ -150,25 +153,25 @@ static isl_basic_map *getTileMap(isl_ctx *ctx, int scheduleDimensions,
|
|||
isl_constraint *c;
|
||||
|
||||
// sX = aX * tileSize;
|
||||
c = isl_equality_alloc(isl_dim_copy(dim));
|
||||
c = isl_equality_alloc(isl_local_space_copy(LocalSpace));
|
||||
isl_constraint_set_coefficient_si(c, isl_dim_out, sX, 1);
|
||||
isl_constraint_set_coefficient_si(c, isl_dim_out, aX, -tileSize);
|
||||
tileMap = isl_basic_map_add_constraint(tileMap, c);
|
||||
|
||||
// pX = sX;
|
||||
c = isl_equality_alloc(isl_dim_copy(dim));
|
||||
c = isl_equality_alloc(isl_local_space_copy(LocalSpace));
|
||||
isl_constraint_set_coefficient_si(c, isl_dim_out, pX, 1);
|
||||
isl_constraint_set_coefficient_si(c, isl_dim_in, sX, -1);
|
||||
tileMap = isl_basic_map_add_constraint(tileMap, c);
|
||||
|
||||
// tX <= pX
|
||||
c = isl_inequality_alloc(isl_dim_copy(dim));
|
||||
c = isl_inequality_alloc(isl_local_space_copy(LocalSpace));
|
||||
isl_constraint_set_coefficient_si(c, isl_dim_out, pX, 1);
|
||||
isl_constraint_set_coefficient_si(c, isl_dim_out, tX, -1);
|
||||
tileMap = isl_basic_map_add_constraint(tileMap, c);
|
||||
|
||||
// pX <= tX + (tileSize - 1)
|
||||
c = isl_inequality_alloc(isl_dim_copy(dim));
|
||||
c = isl_inequality_alloc(isl_local_space_copy(LocalSpace));
|
||||
isl_constraint_set_coefficient_si(c, isl_dim_out, tX, 1);
|
||||
isl_constraint_set_coefficient_si(c, isl_dim_out, pX, -1);
|
||||
isl_constraint_set_constant_si(c, tileSize - 1);
|
||||
|
@ -183,7 +186,7 @@ static isl_basic_map *getTileMap(isl_ctx *ctx, int scheduleDimensions,
|
|||
tileMap = isl_basic_map_project_out(tileMap, isl_dim_out,
|
||||
2 * scheduleDimensions,
|
||||
scheduleDimensions);
|
||||
isl_dim_free(dim);
|
||||
isl_local_space_free(LocalSpace);
|
||||
return tileMap;
|
||||
}
|
||||
|
||||
|
@ -191,18 +194,18 @@ isl_union_map *getTiledPartialSchedule(isl_band *band) {
|
|||
isl_union_map *partialSchedule;
|
||||
int scheduleDimensions;
|
||||
isl_ctx *ctx;
|
||||
isl_dim *dim;
|
||||
isl_space *Space;
|
||||
isl_basic_map *tileMap;
|
||||
isl_union_map *tileUnionMap;
|
||||
|
||||
partialSchedule = isl_band_get_partial_schedule(band);
|
||||
ctx = isl_union_map_get_ctx(partialSchedule);
|
||||
dim = isl_union_map_get_dim(partialSchedule);
|
||||
Space= isl_union_map_get_space(partialSchedule);
|
||||
scheduleDimensions = isl_band_n_member(band);
|
||||
|
||||
tileMap = getTileMap(ctx, scheduleDimensions, dim);
|
||||
tileMap = getTileMap(ctx, scheduleDimensions, Space);
|
||||
tileUnionMap = isl_union_map_from_map(isl_map_from_basic_map(tileMap));
|
||||
tileUnionMap = isl_union_map_align_params(tileUnionMap, dim);
|
||||
tileUnionMap = isl_union_map_align_params(tileUnionMap, Space);
|
||||
partialSchedule = isl_union_map_apply_range(partialSchedule, tileUnionMap);
|
||||
|
||||
return partialSchedule;
|
||||
|
@ -214,21 +217,23 @@ static isl_map *getPrevectorMap(isl_ctx *ctx, int vectorDimension,
|
|||
int vectorWidth = 4) {
|
||||
assert (0 <= vectorDimension && vectorDimension < scheduleDimensions);
|
||||
|
||||
isl_dim *dim = isl_dim_alloc(ctx, parameterDimensions, scheduleDimensions,
|
||||
scheduleDimensions + 2);
|
||||
isl_basic_map *tilingMap = isl_basic_map_universe(isl_dim_copy(dim));
|
||||
isl_space *Space = isl_space_alloc(ctx, parameterDimensions,
|
||||
scheduleDimensions, scheduleDimensions + 2);
|
||||
isl_basic_map *tilingMap = isl_basic_map_universe(isl_space_copy(Space));
|
||||
|
||||
isl_constraint *c;
|
||||
|
||||
isl_local_space *LocalSpace = isl_local_space_from_space(Space);
|
||||
|
||||
for (int i = 0; i < vectorDimension; i++) {
|
||||
c = isl_equality_alloc(isl_dim_copy(dim));
|
||||
c = isl_equality_alloc(isl_local_space_copy(LocalSpace));
|
||||
isl_constraint_set_coefficient_si(c, isl_dim_in, i, -1);
|
||||
isl_constraint_set_coefficient_si(c, isl_dim_out, i, 1);
|
||||
tilingMap = isl_basic_map_add_constraint(tilingMap, c);
|
||||
}
|
||||
|
||||
for (int i = vectorDimension + 1; i < scheduleDimensions; i++) {
|
||||
c = isl_equality_alloc(isl_dim_copy(dim));
|
||||
c = isl_equality_alloc(isl_local_space_copy(LocalSpace));
|
||||
isl_constraint_set_coefficient_si(c, isl_dim_in, i, -1);
|
||||
isl_constraint_set_coefficient_si(c, isl_dim_out, i, 1);
|
||||
tilingMap = isl_basic_map_add_constraint(tilingMap, c);
|
||||
|
@ -237,23 +242,23 @@ static isl_map *getPrevectorMap(isl_ctx *ctx, int vectorDimension,
|
|||
int stepDimension = scheduleDimensions;
|
||||
int auxilaryDimension = scheduleDimensions + 1;
|
||||
|
||||
c = isl_equality_alloc(isl_dim_copy(dim));
|
||||
c = isl_equality_alloc(isl_local_space_copy(LocalSpace));
|
||||
isl_constraint_set_coefficient_si(c, isl_dim_out, vectorDimension, 1);
|
||||
isl_constraint_set_coefficient_si(c, isl_dim_out, auxilaryDimension,
|
||||
-vectorWidth);
|
||||
tilingMap = isl_basic_map_add_constraint(tilingMap, c);
|
||||
|
||||
c = isl_equality_alloc(isl_dim_copy(dim));
|
||||
c = isl_equality_alloc(isl_local_space_copy(LocalSpace));
|
||||
isl_constraint_set_coefficient_si(c, isl_dim_in, vectorDimension, -1);
|
||||
isl_constraint_set_coefficient_si(c, isl_dim_out, stepDimension, 1);
|
||||
tilingMap = isl_basic_map_add_constraint(tilingMap, c);
|
||||
|
||||
c = isl_inequality_alloc(isl_dim_copy(dim));
|
||||
c = isl_inequality_alloc(isl_local_space_copy(LocalSpace));
|
||||
isl_constraint_set_coefficient_si(c, isl_dim_out, vectorDimension, -1);
|
||||
isl_constraint_set_coefficient_si(c, isl_dim_out, stepDimension, 1);
|
||||
tilingMap = isl_basic_map_add_constraint(tilingMap, c);
|
||||
|
||||
c = isl_inequality_alloc(dim);
|
||||
c = isl_inequality_alloc(LocalSpace);
|
||||
isl_constraint_set_coefficient_si(c, isl_dim_out, vectorDimension, 1);
|
||||
isl_constraint_set_coefficient_si(c, isl_dim_out, stepDimension, -1);
|
||||
isl_constraint_set_constant_si(c, vectorWidth- 1);
|
||||
|
@ -285,7 +290,7 @@ static isl_union_map *tileBandList(isl_band_list *blist) {
|
|||
band = isl_band_list_get_band(blist, i);
|
||||
partialSchedule = getTiledPartialSchedule(band);
|
||||
int scheduleDimensions = isl_band_n_member(band);
|
||||
isl_dim *dim = isl_union_map_get_dim(partialSchedule);
|
||||
isl_space *Space = isl_union_map_get_space(partialSchedule);
|
||||
|
||||
|
||||
if (isl_band_has_children(band)) {
|
||||
|
@ -306,7 +311,7 @@ static isl_union_map *tileBandList(isl_band_list *blist) {
|
|||
scheduleDimensions * 2, 0);
|
||||
tileUnionMap = isl_union_map_from_map(tileMap);
|
||||
tileUnionMap = isl_union_map_align_params(tileUnionMap,
|
||||
isl_dim_copy(dim));
|
||||
isl_space_copy(Space));
|
||||
partialSchedule = isl_union_map_apply_range(partialSchedule,
|
||||
tileUnionMap);
|
||||
break;
|
||||
|
@ -320,7 +325,7 @@ static isl_union_map *tileBandList(isl_band_list *blist) {
|
|||
finalSchedule = partialSchedule;
|
||||
|
||||
isl_band_free(band);
|
||||
isl_dim_free(dim);
|
||||
isl_space_free(Space);
|
||||
}
|
||||
|
||||
return finalSchedule;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#!/bin/sh
|
||||
|
||||
CLOOG_HASH="cloog-0.16.3"
|
||||
ISL_HASH="cd1939ed06617d00159e8e51b72a804b467e98b4"
|
||||
cloog_hash="0c252c88946b27b7b61a1a8d8fd7f94d2461dbfd"
|
||||
isl_hash="56b7d238929980e62218525b4b3be121af386edf"
|
||||
|
||||
check_command_line() {
|
||||
if [ "${1}x" = "x" ] || [ "${2}x" != "x" ]
|
||||
|
|
|
@ -53,9 +53,9 @@ system of your operating system.
|
|||
<h3> CLooG/isl</h3>
|
||||
|
||||
Polly is tested and works with <a href="http://www.cloog.org">CLooG</a> as of
|
||||
commit 225c2ed62fe37a4db22bf4b95c3731dab1a50dde
|
||||
commit 0c252c88946b27b7b61a1a8d8fd7f94d2461dbfd
|
||||
and <a href="http://repo.or.cz/w/isl.git">isl</a> as of
|
||||
commit cd1939ed06617d00159e8e51b72a804b467e98b4. To get and install the
|
||||
commit 56b7d238929980e62218525b4b3be121af386edf. To get and install the
|
||||
relevant cloog version use the following commands:
|
||||
|
||||
<h4>Set the directory layout:</h4>
|
||||
|
|
Loading…
Reference in New Issue