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

Commit 670c461

Browse files
author
Sven Verdoolaege
committed
use isl::space::named_set_from_params_id
This simplifies the code as it replaces three calls (set_from_params, add_dims, set_tuple_{name,id}) by a single call. Note that the (technically required) add_dims call was missing in some cases. The single call also clarifies the meaning of the code.
1 parent c286946 commit 670c461

File tree

5 files changed

+8
-15
lines changed

5 files changed

+8
-15
lines changed

tc/core/halide2isl.cc

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -258,17 +258,15 @@ isl::map extractAccess(
258258

259259
isl::space domainSpace = domain.get_space();
260260
isl::space paramSpace = domainSpace.params();
261-
262-
isl::space rangeSpace = paramSpace.add_dims(isl::dim_type::set, args.size());
263-
264-
rangeSpace = rangeSpace.set_tuple_name(isl::dim_type::set, tensor);
261+
isl::id tensorID(paramSpace.get_ctx(), tensor);
262+
auto rangeSpace = paramSpace.named_set_from_params_id(tensorID, args.size());
265263

266264
// Add a tag to the domain space so that we can maintain a mapping
267265
// between each access in the IR and the reads/writes maps.
268266
std::string tag = "__tc_ref_" + std::to_string(accesses->size());
269267
isl::id tagID(domain.get_ctx(), tag);
270268
accesses->emplace(op, tagID);
271-
isl::space tagSpace = paramSpace.set_tuple_name(isl::dim_type::set, tag);
269+
isl::space tagSpace = paramSpace.named_set_from_params_id(tagID, 0);
272270
domainSpace = domainSpace.product(tagSpace);
273271

274272
// Start with a totally unconstrained relation - every point in

tc/core/polyhedral/cuda/codegen.cc

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -481,9 +481,8 @@ isl::multi_aff makeMultiAffAccess(
481481
CHECK_NE(subscripts.size(), 0u) << "cannot build subscript aff for a scalar";
482482

483483
auto domainSpace = findDomainSpaceById(context);
484-
auto tensorSpace = domainSpace.params().set_from_params().add_dims(
485-
isl::dim_type::set, subscripts.size());
486-
tensorSpace = tensorSpace.set_tuple_id(isl::dim_type::set, tensorId);
484+
auto tensorSpace = domainSpace.params().named_set_from_params_id(
485+
tensorId, subscripts.size());
487486
auto space = domainSpace.map_from_domain_and_range(tensorSpace);
488487

489488
auto ma = isl::multi_aff::zero(space);

tc/core/polyhedral/memory_promotion.cc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -402,8 +402,7 @@ isl::set tensorElementsSet(const Scop& scop, isl::id tensorId) {
402402
auto halideParameter = scop.findArgument(tensorId).parameter();
403403
auto space = scop.domain().get_space().params();
404404
auto nDim = halideParameter.dimensions();
405-
space = space.add_dims(isl::dim_type::set, nDim)
406-
.set_tuple_id(isl::dim_type::set, tensorId);
405+
space = space.named_set_from_params_id(tensorId, nDim);
407406

408407
auto tensorElements = isl::set::universe(space);
409408
for (int i = 0; i < nDim; ++i) {

tc/core/polyhedral/schedule_transforms.cc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -559,8 +559,7 @@ detail::ScheduleTree* insertEmptyExtensionAbove(
559559
isl::map labelExtension(ScheduleTree* root, ScheduleTree* tree, isl::id id) {
560560
auto prefix = prefixScheduleMupa(root, tree);
561561
auto scheduleSpace = prefix.get_space();
562-
auto space = scheduleSpace.params().set_from_params().set_tuple_id(
563-
isl::dim_type::set, id);
562+
auto space = scheduleSpace.params().named_set_from_params_id(id, 0);
564563
auto extensionSpace = scheduleSpace.map_from_domain_and_range(space);
565564
return isl::map::universe(extensionSpace);
566565
}

tc/core/polyhedral/scop.cc

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -525,15 +525,13 @@ isl::aff Scop::makeIslAffFromStmtExpr(
525525
const Halide::Expr& e) const {
526526
auto ctx = stmtId.get_ctx();
527527
auto iterators = halide.iterators.at(stmtId);
528-
auto space = paramSpace.set_from_params();
529-
space = space.add_dims(isl::dim_type::set, iterators.size());
528+
auto space = paramSpace.named_set_from_params_id(stmtId, iterators.size());
530529
// Set the names of the set dimensions of "space" for use
531530
// by halide2isl::makeIslAffFromExpr.
532531
for (size_t i = 0; i < iterators.size(); ++i) {
533532
isl::id id(ctx, iterators[i]);
534533
space = space.set_dim_id(isl::dim_type::set, i, id);
535534
}
536-
space = space.set_tuple_id(isl::dim_type::set, stmtId);
537535
return halide2isl::makeIslAffFromExpr(space, e);
538536
}
539537

0 commit comments

Comments
 (0)