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

Commit 51bb12f

Browse files
author
Sven Verdoolaege
committed
MapperMemoryPromotionSum2D: do not assume parameters have a fixed position
It doesn't really matter for the use cases in MapperMemoryPromotionSum2D because all parameters get assigned the same value, but it allows this variant of makeSpecializationSet to be removed. Replace it by one that takes an initializer_list.
1 parent ddbe6a9 commit 51bb12f

File tree

2 files changed

+6
-9
lines changed

2 files changed

+6
-9
lines changed

include/tc/external/detail/islpp.h

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -356,18 +356,15 @@ inline isl::set makeSpecializationSet(
356356
return makeSpecializationSet(space, map);
357357
}
358358

359-
// WARNING: this version relies on parameter ordering, be sure you know what
360-
// you are doing.
361359
template <typename T>
362360
inline isl::set makeSpecializationSet(
363361
isl::space space,
364-
const std::vector<T>& paramValues) {
365-
CHECK_EQ(space.dim(isl::dim_type::param), paramValues.size());
366-
std::unordered_map<int, T> paramValuesMap;
367-
for (int i = 0; i < paramValues.size(); ++i) {
368-
paramValuesMap[i] = paramValues[i];
362+
std::initializer_list<std::pair<isl::id, T>> paramValues) {
363+
std::unordered_map<std::string, T> map;
364+
for (auto kvp : paramValues) {
365+
map.emplace(kvp.first.get_name(), kvp.second);
369366
}
370-
return makeSpecializationSet(space, paramValuesMap);
367+
return makeSpecializationSet(space, map);
371368
}
372369

373370
namespace detail {

test/test_mapper_memory_promotion.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ def fun(float(N, M) A, float(N, M) B) -> (C) {
275275
blockSpace = blockSpace.set_dim_id(isl::dim_type::param, 0, BX)
276276
.set_dim_id(isl::dim_type::param, 1, BY);
277277
isl::set blockZero =
278-
makeSpecializationSet(blockSpace, std::vector<int>{{0, 0}});
278+
isl::makeSpecializationSet<int>(blockSpace, {{BX, 0}, {BY, 0}});
279279

280280
// Must have groups for these tensors, in arbitrary order.
281281
unordered_set<string> names{"A", "B", "C"};

0 commit comments

Comments
 (0)