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

Commit d99941a

Browse files
author
Sven Verdoolaege
committed
reduction_matcher.cc: isAlmostIdentityReduction: directly check isl::pw_aff
There is no need to check that the piecewise expression only has a single cell. Having multiple cells does not affect the nature of being a reduction. The purpose of this change is not to catch more cases since the isl scheduler currently does not produce any piecewise band members, but rather to simplify the code.
1 parent 1361815 commit d99941a

File tree

1 file changed

+6
-12
lines changed

1 file changed

+6
-12
lines changed

src/core/polyhedral/reduction_matcher.cc

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -76,15 +76,15 @@ bool isReductionUpdateId(
7676
* Does "aff" only involve the specified input dimension (and not
7777
* any other input dimensions).
7878
*/
79-
bool affInvolvesOnlyInputDim(isl::aff aff, int redDimIdx) {
80-
auto space = aff.get_space();
79+
bool pwAffInvolvesOnlyInputDim(isl::pw_aff pa, int redDimIdx) {
80+
auto space = pa.get_space();
8181

82-
if (!aff.involves_dims(isl::dim_type::in, redDimIdx, 1)) {
82+
if (!pa.involves_dims(isl::dim_type::in, redDimIdx, 1)) {
8383
return false;
8484
}
8585

86-
if (aff.involves_dims(isl::dim_type::in, 0, redDimIdx) ||
87-
aff.involves_dims(
86+
if (pa.involves_dims(isl::dim_type::in, 0, redDimIdx) ||
87+
pa.involves_dims(
8888
isl::dim_type::in,
8989
redDimIdx + 1,
9090
space.dim(isl::dim_type::in) - redDimIdx - 1)) {
@@ -111,14 +111,8 @@ bool isAlmostIdentityReduction(isl::pw_aff pa, const Scop& scop) {
111111
return false;
112112
}
113113

114-
auto paWrapper = isl::PA(pa);
115-
if (paWrapper.size() != 1) {
116-
return false;
117-
}
118-
119-
auto aff = paWrapper[0].second;
120114
for (auto redDimIdx : reductionDims) {
121-
if (affInvolvesOnlyInputDim(aff, redDimIdx)) {
115+
if (pwAffInvolvesOnlyInputDim(pa, redDimIdx)) {
122116
return true;
123117
}
124118
}

0 commit comments

Comments
 (0)