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

Commit 331eb12

Browse files
author
Sven Verdoolaege
committed
[RFC] use templated isl types tensorElementsSet
Templated isl types require the user to specify the domain and range universes of isl objects, allowing the compiler to check whether it makes sense to combine pairs of objects. This RFC only converts isPromotableToRegistersBelow and some related functions to illustrate the effect. The isPromotableToRegistersBelow was already applying operations correctly, so the code itself did not require any changes. However, one variable was reused to store different types of intermediate result and this one had to be split up into several variables because they now have different types.
1 parent f0fb374 commit 331eb12

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

tc/core/polyhedral/memory_promotion.cc

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -407,25 +407,25 @@ namespace {
407407
// each dimension of the tensor is contrained by the min_aff on the left and
408408
// by the min_aff + extent_aff on the right. Intersect this set with the
409409
// context of the scop.
410-
isl::set tensorElementsSet(const Scop& scop, isl::id tensorId) {
410+
isl::Set<Tensor> tensorElementsSet(const Scop& scop, isl::id tensorId) {
411411
auto halideParameter = scop.findArgument(tensorId).parameter();
412412
auto space = scop.domain().get_space();
413413
auto nDim = halideParameter.dimensions();
414414
auto tensorTuple = constructTensorTuple(space, tensorId, nDim);
415415
auto tensorSpace = tensorTuple.get_space();
416416

417-
auto tensorElements = isl::set::universe(tensorSpace);
418-
auto identity = isl::multi_aff::identity(tensorSpace.map_from_set());
417+
auto tensorElements = isl::Set<Tensor>::universe(tensorSpace);
418+
auto identity = isl::MultiAff<Tensor,Tensor>::identity(tensorSpace.map_from_set());
419419
for (int i = 0; i < nDim; ++i) {
420-
isl::aff minAff = halide2isl::makeIslAffFromExpr(
420+
auto minAff = halide2isl::makeIslAffFromExpr(
421421
space, halideParameter.min_constraint(i));
422-
isl::aff extentAff = halide2isl::makeIslAffFromExpr(
422+
auto extentAff = halide2isl::makeIslAffFromExpr(
423423
space, halideParameter.extent_constraint(i));
424-
minAff = minAff.unbind_params_insert_domain(tensorTuple);
425-
extentAff = extentAff.unbind_params_insert_domain(tensorTuple);
424+
auto minAff2 = minAff.unbind_params_insert_domain(tensorTuple);
425+
auto extentAff2 = extentAff.unbind_params_insert_domain(tensorTuple);
426426
auto aff = identity.get_aff(i);
427-
tensorElements = tensorElements & (minAff <= isl::aff_set(aff)) &
428-
(isl::aff_set(aff) < (minAff + extentAff));
427+
tensorElements = tensorElements & (minAff2.le_set(aff)) &
428+
(aff.lt_set(minAff2 + extentAff2));
429429
}
430430

431431
tensorElements = tensorElements.intersect_params(scop.context());

0 commit comments

Comments
 (0)