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

Commit 6f51af4

Browse files
Merge pull request #315 from facebookresearch/pr/involves_param
use isl::*.involves_param()
2 parents 9da7a9c + cac18f0 commit 6f51af4

File tree

5 files changed

+19
-76
lines changed

5 files changed

+19
-76
lines changed

tc/core/polyhedral/cuda/tighten_launch_bounds.cc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,7 @@ std::pair<size_t, size_t> rangeOfMappingParameter(
4848
mapping::MappingId mappingId) {
4949
auto active =
5050
activeDomainPoints(root, node).intersect_params(context).params();
51-
int pos = active.find_dim_by_id(isl::dim_type::param, mappingId);
52-
if (pos < 0) {
51+
if (!active.involves_param(mappingId)) {
5352
return std::make_pair(0, std::numeric_limits<size_t>::max());
5453
}
5554
isl::aff a(isl::aff::param_on_domain_space(active.get_space(), mappingId));

tc/core/polyhedral/schedule_transforms-inl.h

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -62,15 +62,7 @@ inline detail::ScheduleTree* mapToParameterWithExtent(
6262

6363
// Introduce the "mapping" parameter after checking it is not already present
6464
// in the schedule space.
65-
auto space = band->mupa_.get_space();
66-
int idPos = space.find_dim_by_id(isl::dim_type::param, id);
67-
if (idPos != -1) {
68-
for (auto upa : isl::MUPA(band->mupa_)) {
69-
for (auto pa : upa) {
70-
CHECK(not pa.pa.involves_dims(isl::dim_type::param, pos, 1));
71-
}
72-
}
73-
}
65+
CHECK(not band->mupa_.involves_param(id));
7466

7567
// Create mapping filter by equating the newly introduced
7668
// parameter "id" to the "pos"-th schedule dimension modulo its extent.

tc/core/polyhedral/schedule_tree_elem.h

Lines changed: 16 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -152,27 +152,24 @@ struct ScheduleTreeElemMappingFilter : public ScheduleTreeElemFilter {
152152
typename mapping::MappingId::Hash>& ids)
153153
: ScheduleTreeElemFilter(us), mappingIds(ids) {
154154
USING_MAPPING_SHORT_NAMES(BX, BY, BZ, TX, TY, TZ);
155-
for (auto s : us.get_set_list()) {
156-
for (auto id : std::vector<mapping::MappingId>{BX, BY, BZ, TX, TY, TZ}) {
157-
if (mappingIds.count(id) > 0) {
158-
CHECK_EQ(1u, ids.count(id)) << "id: " << id << " mapped >1 times";
159-
CHECK_LE(0, s.find_dim_by_id(isl::dim_type::param, id))
155+
for (auto id : std::vector<mapping::MappingId>{BX, BY, BZ, TX, TY, TZ}) {
156+
if (mappingIds.count(id) > 0) {
157+
CHECK_EQ(1u, ids.count(id)) << "id: " << id << " mapped >1 times";
158+
for (auto s : us.get_set_list()) {
159+
CHECK(s.involves_param(id))
160160
<< "unexpected missing id: " << id << " in filter: " << s;
161-
} else {
162-
auto pos = s.find_dim_by_id(isl::dim_type::param, id);
163-
bool involved =
164-
pos > 0 && s.involves_dims(isl::dim_type::param, pos, 1);
165-
if (involved) {
166-
std::stringstream ss;
167-
for (auto id : ids) {
168-
ss << id.to_str() << " ";
169-
}
170-
// TODO: will need to relax this if we map the same loop
171-
// iteratively without stripmining it beforehand
172-
CHECK(false) << "unexpected involved id: " << id
173-
<< " in filter: " << s
174-
<< " but not present in filter id list: " << ss.str();
161+
}
162+
} else {
163+
if (us.involves_param(id)) {
164+
std::stringstream ss;
165+
for (auto id : ids) {
166+
ss << id.to_str() << " ";
175167
}
168+
// TODO: will need to relax this if we map the same loop
169+
// iteratively without stripmining it beforehand
170+
CHECK(false) << "unexpected involved id: " << id
171+
<< " in filter: " << us
172+
<< " but not present in filter id list: " << ss.str();
176173
}
177174
}
178175
}

tc/external/detail/isl_mu_wrappers.h

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -84,51 +84,6 @@ namespace isl {
8484
// multi_aff is a vector-valued function, but just a plain aff is a
8585
// scalar-valued multivariate function plus parameters everywhere.
8686

87-
// Use the following API as follows:
88-
// isl::MUPA M(mupa);
89-
// cout << "MUPA: " << M.mupa << endl;
90-
// cout << "UPA: " << M[0].upa << endl;
91-
// cout << "PA: " << M[0][0].pa << endl;
92-
// cout << "PA[0] set: " << M[0][0][0].first << endl;
93-
// cout << "PA[0] aff: " << M[0][0][0].second << endl;
94-
//
95-
96-
/* WARNING: this does not allow inplace modifications .. ugh */
97-
struct PA : std::vector<std::pair<isl::set, isl::aff>> {
98-
explicit PA(isl::pw_aff pa_) : pa(pa_) {
99-
this->reserve(pa.n_piece());
100-
auto f = [&](isl::set s, isl::aff a) {
101-
this->push_back(std::make_pair(s, a));
102-
};
103-
pa.foreach_piece(f);
104-
}
105-
isl::pw_aff pa;
106-
};
107-
108-
/* WARNING: this does not allow inplace modifications .. ugh */
109-
struct UPA : std::vector<PA> {
110-
explicit UPA(isl::union_pw_aff upa_) : upa(upa_) {
111-
std::vector<PA> res;
112-
auto f = [&](isl::pw_aff pa) { this->push_back(PA(pa)); };
113-
upa.foreach_pw_aff(f);
114-
}
115-
PA extract(isl::space s) const {
116-
return PA(upa.extract_pw_aff(s));
117-
}
118-
isl::union_pw_aff upa;
119-
};
120-
121-
/* WARNING: this does not allow inplace modifications .. ugh */
122-
struct MUPA : std::vector<UPA> {
123-
explicit MUPA(isl::multi_union_pw_aff mupa_) : mupa(mupa_) {
124-
this->reserve(mupa.dim(isl::dim_type::set));
125-
for (size_t i = 0; i < mupa.dim(isl::dim_type::set); ++i) {
126-
this->push_back(UPA(mupa.get_union_pw_aff(i)));
127-
}
128-
}
129-
isl::multi_union_pw_aff mupa;
130-
};
131-
13287
template <typename T, isl::dim_type DT>
13388
struct DimIds : public std::vector<isl::id> {
13489
DimIds(T s) {

third-party/islpp

Submodule islpp updated from 2622ce2 to 310e910

0 commit comments

Comments
 (0)