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

Commit 2ab86bb

Browse files
author
Sven Verdoolaege
committed
makeIslAffFromExpr: only accept parametric expressions
All the users have been converted to only pass in parametric expressions. This removes a dependence on the names of set dimensions.
1 parent 8a4d9f1 commit 2ab86bb

File tree

2 files changed

+7
-11
lines changed

2 files changed

+7
-11
lines changed

tc/core/halide2isl.cc

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -174,16 +174,9 @@ std::vector<isl::aff> makeIslAffBoundsFromExpr(
174174
const Max* maxOp = e.as<Max>();
175175

176176
if (const Variable* op = e.as<Variable>()) {
177-
isl::local_space ls = isl::local_space(space);
178-
int pos = space.find_dim_by_name(isl::dim_type::param, op->name);
179-
if (pos >= 0) {
180-
return {isl::aff(ls, isl::dim_type::param, pos)};
181-
} else {
182-
// FIXME: thou shalt not rely upon set dimension names
183-
pos = space.find_dim_by_name(isl::dim_type::set, op->name);
184-
if (pos >= 0) {
185-
return {isl::aff(ls, isl::dim_type::set, pos)};
186-
}
177+
isl::id id(space.get_ctx(), op->name);
178+
if (space.has_param(id)) {
179+
return {isl::aff::param_on_domain_space(space, id)};
187180
}
188181
LOG(FATAL) << "Variable not found in isl::space: " << space << ": " << op
189182
<< ": " << op->name << '\n';

tc/core/halide2isl.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,10 @@ isl::aff makeIslAffFromInt(isl::space space, int64_t i);
5353

5454
// Make an affine function over a space from a Halide Expr. Returns a
5555
// null isl::aff if the expression is not affine. Fails if Variable
56-
// does not correspond to a parameter or set dimension of the space.
56+
// does not correspond to a parameter of the space.
57+
// Note that the input space can be either a parameter space or
58+
// a set space, but the expression can only reference
59+
// the parameters in the space.
5760
isl::aff makeIslAffFromExpr(isl::space space, const Halide::Expr& e);
5861

5962
// Iteration domain information associated to a statement identifier.

0 commit comments

Comments
 (0)