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

Commit 7bb4101

Browse files
author
Sven Verdoolaege
committed
ScheduleTree::bandTile: drop special casing of 0D tile sizes
For some reason, bandTile refrains from performing a tiling when presented with zero-dimensional tile sizes. This behavior is not documented and was not motivated in the commit that introduced it. Refusing to tile on 0D tile sizes effectively means that 0D band cannot be tiled, which means that callers would have to handle this case specifically if they wanted to make sure that the result consists of two nested bands. This is especially the case in MappedScop::makeWithOuterBlockInnerThreadStrategy, which assumes that after tiling there is at least one band underneath the band mapped to blocks. It seems reasonable to assume that a function called bandTile actually tiles the band. Remove the special case. None of the current calls to bandTile depend on the original behavior. One call is to isolate individual reduction tiles, where the tiling is performed over all threads. Reduction handling is only performed when there is at least one reduction dimension matched to a thread dimension. There is a couple of calls in the tests, which all pass a strictly positive number of tile sizes. The final call is the one in tileOuterBand. This function in turn is also called a couple of times in the tests, again always with a strictly positive number of tile sizes. The other call is the call that depends on the result having two nested calls, so it cannot also depend on the call sometimes not performing a tiling. Test case by Mathieu Fehr. Closes #525.
1 parent fe139b6 commit 7bb4101

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

tc/core/polyhedral/schedule_transforms.cc

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -359,9 +359,6 @@ ScheduleTree* bandTile(
359359
auto eb = st->elemAs<ScheduleTreeElemBand>();
360360
TC_CHECK(eb) << "Not a band: " << *st;
361361

362-
if (tileSizes.size() == 0) {
363-
return st;
364-
}
365362
auto& band = *eb;
366363
TC_CHECK(band.permutable_) << "Can't tile a non-permutable band" << band;
367364

test/test_cuda_mapper.cc

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1151,6 +1151,21 @@ def local_sparse_convolution(float(N, C, H, W) I, float(O, KC, KH, KW) W1) -> (O
11511151
}
11521152
}
11531153

1154+
/*
1155+
* Check that a TC with a single instance gets mapped properly.
1156+
* tightenLaunchBounds (called during codegen) will complain
1157+
* if it is not.
1158+
*/
1159+
TEST_F(PolyhedralMapperTest, SingleInstance) {
1160+
string tc = R"TC(
1161+
def f(float(N) I) -> (a)
1162+
{
1163+
a = 0
1164+
}
1165+
)TC";
1166+
codegenMapped(tc, DefaultOptions());
1167+
}
1168+
11541169
int main(int argc, char** argv) {
11551170
::testing::InitGoogleTest(&argc, argv);
11561171
::gflags::ParseCommandLineFlags(&argc, &argv, true);

0 commit comments

Comments
 (0)