Exemple #1
0
void AliasCheckGenerator::printConditions(const isl::Set &ParamContext,
                                          const isl::Set &Acc,
                                          const BoundsMapT &map) const {
  void *np = NULL;
  Set AccA = Acc;

  // Eliminate all but one single dimension and take the min/max.
  unsigned int ndims = AccA.dim(DimType::DTSet);
  AccA = AccA.eliminate(DimType::DTSet, 1, ndims - 1);
  PwAff minA = AccA.dimMin(0);
  PwAff maxA = AccA.dimMax(0);

  AstBuild Builder = AstBuild::fromContext(ParamContext);
  Space A = AccA.getSpace();
  std::string nA = A.getTupleName(DimType::DTSet);
  Id idA = Id::alloc(nA, np);

  AstExpr ExpMinA = Builder.exprFromPwAff(minA);
  AstExpr ExpMaxA = Builder.exprFromPwAff(maxA);
  AstExpr ExpIdA = AstExpr::fromId(idA);

  ExpMinA = ExpIdA.add(ExpMinA);
  ExpMaxA = ExpIdA.add(ExpMaxA);

  for (const isl::Set &s : map) {
    Set AccB = s;
    Space B = AccB.getSpace();

    std::string nB = B.getTupleName(DimType::DTSet);
    Id idB = Id::alloc(nB, np);

    PwAff minB = AccB.dimMin(0);
    PwAff maxB = AccB.dimMax(0);

    AstExpr ExpMinB = Builder.exprFromPwAff(minB);
    AstExpr ExpMaxB = Builder.exprFromPwAff(maxB);
    AstExpr ExpIdB = AstExpr::fromId(idB);

    ExpMinB = ExpIdB.add(ExpMinB);
    ExpMaxB = ExpIdB.add(ExpMaxB);

    dbgs().indent(6) << "[ (" << ExpMinA.toStr(Format::FC) << ")";
    dbgs() << " <=  (" << ExpMaxB.toStr(Format::FC) << ")";
    dbgs() << " && (" << ExpMinB.toStr(Format::FC) << ")";
    dbgs() << " <=  (" << ExpMaxA.toStr(Format::FC) << ") ]\n";
  }
}
Exemple #2
0
Set AliasCheckGenerator::checkPairs(const Set &Cond, const Set &Acc,
                                    const BoundsMapT &map) const {
  Set AccA = Acc;
  Set ResCond = Cond;

  // Eliminate all but one single dimension and take the min/max.
  unsigned int ndims = AccA.dim(DimType::DTSet);
  AccA = AccA.eliminate(DimType::DTSet, 1, ndims - 1);
  PwAff minA = AccA.dimMin(0);
  PwAff maxA = AccA.dimMax(0);

  Space spaceA = AccA.getSpace();
  std::string nA = spaceA.getTupleName(DimType::DTSet);
  Set baseA = Set::readFromStr("[" + nA + "] -> { [" + nA + "] };");
  PwAff bpA = baseA.dimMin(0);

  minA = minA.add(bpA);
  maxA = maxA.add(bpA);

  for (const isl::Set &s : map) {
    Set AccB = s;

    ndims = AccB.dim(DimType::DTSet);
    AccB = AccB.eliminate(DimType::DTSet, 1, ndims - 1);

    Space spaceB = AccB.getSpace();
    std::string nB = spaceB.getTupleName(DimType::DTSet);
    Set baseB = Set::readFromStr("[" + nB + "] -> { [" + nB + "] };");
    PwAff bpB = baseB.dimMin(0);

    PwAff minB = AccB.dimMin(0).add(bpB);
    PwAff maxB = AccB.dimMax(0).add(bpB);

    ResCond = ResCond.intersect(minA.leSet(maxB).intersect(minB.leSet(maxA)));
    ResCond = ResCond.coalesce();
  }
  return ResCond;
}