src/core/polyhedral/memory_promotion_heuristic.cc
/*
 * Insert map constraints that equate first "nDims" input dimensions to newly
 * introduced parameters.
 */
Insert map constraints that equate first "nDims" input dimensions to newly
introduced parameters.
Insert map constraints that equate first " nDims " input dimensions to newly introduced parameters .
isl::map fixOuterInputDimsAsParameters(isl::map map, int nDims) {
  if (nDims < 0 || nDims > map.dim(isl::dim_type::in)) {
    std::stringstream ss;
    ss << nDims << "  is out of [0, " << map.dim(isl::dim_type::in)
       << ") range";
    throw promotion::OutOfRangeException(ss.str());
  }
  auto fixedMap = map;
  auto localSpace = isl::local_space(map.get_space().domain());
  auto nParams = map.dim(isl::dim_type::param);
  localSpace = localSpace.add_dims(isl::dim_type::param, nDims);
  for (int i = 0; i < nDims; ++i) {
    localSpace = localSpace.set_dim_name(
        isl::dim_type::param,
        nParams + i,
        "__tcFixerParam" + std::to_string(i));
  }
  for (int i = 0; i < nDims; ++i) {
    auto left = isl::aff(localSpace, isl::dim_type::param, nParams + i);
    auto right = isl::aff(localSpace, isl::dim_type::set, i);
    auto dom = isl::aff_set(left) == right;
    fixedMap = fixedMap.intersect_domain(dom);
  }
  return fixedMap;
}
isl :: map fixOuterInputDimsAsParameters ( isl :: map map , int nDims ) { if ( nDims < 0 || nDims > map . dim ( isl :: dim_type :: in ) ) { std :: stringstream ss ; ss << nDims << " " << map . dim ( isl :: dim_type :: in ) << " " ; throw promotion :: OutOfRangeException ( ss . str ( ) ) ; } auto fixedMap = map ; auto localSpace = isl :: local_space ( map . get_space ( ) . domain ( ) ) ; auto nParams = map . dim ( isl :: dim_type :: param ) ; localSpace = localSpace . add_dims ( isl :: dim_type :: param , nDims ) ; for ( int i = 0 ; i < nDims ; ++ i ) { localSpace = localSpace . set_dim_name ( isl :: dim_type :: param , nParams + i , " " + std :: to_string ( i ) ) ; } for ( int i = 0 ; i < nDims ; ++ i ) { auto left = isl :: aff ( localSpace , isl :: dim_type :: param , nParams + i ) ; auto right = isl :: aff ( localSpace , isl :: dim_type :: set , i ) ; auto dom = isl :: aff_set ( left ) == right ; fixedMap = fixedMap . intersect_domain ( dom ) ; } return fixedMap ; }
Insert map constraints that equate first "nDims" input dimensions to newly
 introduced parameters.
Insert map constraints that equate first " nDims " input dimensions to newly introduced parameters .