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

Commit 811f79f

Browse files
Merge pull request #488 from facebookresearch/pr/strided-access
outputRanges: store strides and offsets directly in ScopedFootprint
2 parents 3abaacc + cd1af0d commit 811f79f

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

tc/core/polyhedral/memory_promotion.cc

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -58,21 +58,18 @@ isl::map removeRangeStrides(
5858
// including the lower bounds, the box sizes, and the strides.
5959
// If the range has strides, remove them first.
6060
ScopedFootprint outputRanges(isl::map access) {
61-
auto ctx = access.get_ctx();
62-
int nSubscripts = access.dim(isl::dim_type::out);
61+
ScopedFootprint footprint;
62+
footprint.strideValues = isl::multi_val::zero(access.get_space().range());
63+
footprint.strideOffsets = isl::multi_aff::zero(access.get_space());
6364

64-
auto strides = isl::val_list(ctx, nSubscripts);
65-
auto strideOffsets = isl::aff_list(ctx, nSubscripts);
65+
int nSubscripts = footprint.strideValues.size();
6666
for (int i = 0; i < nSubscripts; ++i) {
6767
auto si = access.get_range_stride_info(i);
68-
strides = strides.add(si.get_stride());
69-
strideOffsets = strideOffsets.add(si.get_offset());
68+
footprint.strideValues = footprint.strideValues.set_val(i, si.get_stride());
69+
footprint.strideOffsets =
70+
footprint.strideOffsets.set_aff(i, si.get_offset());
7071
}
7172

72-
ScopedFootprint footprint;
73-
footprint.strideValues = isl::multi_val(access.get_space().range(), strides);
74-
footprint.strideOffsets = isl::multi_aff(access.get_space(), strideOffsets);
75-
7673
access = removeRangeStrides(
7774
access, footprint.strideValues, footprint.strideOffsets);
7875

0 commit comments

Comments
 (0)