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

Commit 34bd0b1

Browse files
committed
add more tests for % to cover breadth
1 parent faad095 commit 34bd0b1

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

test/test_cuda_mapper.cc

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -753,6 +753,38 @@ def perforatedConvolution(float(N, C, H, W) input, float(M, C, KH, KW) weights,
753753
Prepare(tc);
754754
}
755755

756+
TEST_F(PolyhedralMapperTest, ModulusConstantRHS) {
757+
string tc = R"TC(
758+
def fun(float(N) a) -> (b) { b(i) = a(i % 3) where i in 0:N }
759+
)TC";
760+
// This triggers tc2halide conversion and should not throw.
761+
auto scop = Prepare(tc);
762+
for (auto r : scop->reads.range().get_set_list()) {
763+
// skip irrelevant reads, if any
764+
if (r.get_tuple_name() != std::string("a")) {
765+
continue;
766+
}
767+
// EXPECT_EQ(r.get_stride(0), ?);
768+
}
769+
}
770+
771+
TEST_F(PolyhedralMapperTest, ModulusVariableRHS) {
772+
string tc = R"TC(
773+
def local_sparse_convolution(float(N, C, H, W) I, float(O, KC, KH, KW) W1) -> (O1) {
774+
O1(n, o, h, w) +=! I(n, kc % c, h + kh, w + kw) * W1(o, kc, kh, kw) where c in 1:C
775+
}
776+
)TC";
777+
// This triggers tc2halide conversion and should not throw.
778+
auto scop = Prepare(tc);
779+
for (auto r : scop->reads.range().get_set_list()) {
780+
// skip irrelevant reads, if any
781+
if (r.get_tuple_name() != std::string("I")) {
782+
continue;
783+
}
784+
EXPECT_TRUE(r.plain_is_universe());
785+
}
786+
}
787+
756788
int main(int argc, char** argv) {
757789
::testing::InitGoogleTest(&argc, argv);
758790
::gflags::ParseCommandLineFlags(&argc, &argv, true);

0 commit comments

Comments
 (0)