@@ -61,6 +61,13 @@ struct PolyhedralMapperTest : public ::testing::Test {
6161 joinBandsIterative (scop->scheduleRoot ()->child ({0 }), true );
6262 return scop;
6363 }
64+ std::unique_ptr<Scop> PrepareAndJoinBandsMatMul () {
65+ auto scop = Prepare (makeMatmulTc ());
66+ scop = Scop::makeScheduled (*scop, SchedulerOptions ().view );
67+ auto root = scop->scheduleRoot ();
68+ bandSplit (root, root->child ({0 }), 2 );
69+ return scop;
70+ }
6471
6572 std::unique_ptr<MappedScop> makeUnmapped (std::string tc) {
6673 return MappedScop::makeOneBlockOneThread (Prepare (tc));
@@ -511,7 +518,7 @@ constexpr auto kExpectedMatmul_64_64_64 =
511518)CUDA" ;
512519
513520TEST_F (PolyhedralMapperTest, MergedContexts) {
514- auto scop = PrepareAndJoinBands ( makeMatmulTc () );
521+ auto scop = PrepareAndJoinBandsMatMul ( );
515522
516523 // Unit test claims to use scop->globalParameterContext properly
517524 auto context = scop->makeContext <int >({{" M" , 64 }, {" N" , 64 }, {" K" , 64 }});
@@ -526,16 +533,16 @@ TEST_F(PolyhedralMapperTest, MergedContexts) {
526533}
527534
528535TEST_F (PolyhedralMapperTest, Match1) {
529- auto scop = PrepareAndJoinBands ( makeMatmulTc () );
536+ auto scop = PrepareAndJoinBandsMatMul ( );
530537 auto schedule = scop->scheduleRoot ();
531538
532539 auto mscop = TileAndMapThreads (std::move (scop), {16 , 16 }, {32ul , 8ul });
533540 auto f = match (
534- sequence (
541+ band ( sequence (
535542 filter ([](isl::union_set f) {
536543 return f.get_space ().dim (isl::dim_type::param) == 3 ;
537544 }),
538- filter (band ( ))),
545+ filter ())),
539546 schedule);
540547 EXPECT_EQ (1u , f.size ());
541548}
@@ -553,37 +560,31 @@ def fun(float(M, N) I) -> (O) {
553560}
554561
555562TEST_F (PolyhedralMapperTest, MatmulTC) {
556- string tc = R"TC(
557- def fun(float(M, K) A, float(K, N) B) -> (C) {
558- C(m, n) +=! A(m, r_k) * B(r_k, n)
559- }
560- )TC" ;
561-
562- auto scop = PrepareAndJoinBands (tc);
563+ auto scop = PrepareAndJoinBandsMatMul ();
563564 auto tileOptions = TileOptions::ShiftPointLoops | TileOptions::ScaleTileLoops;
564565 TileAndCheckStructuralEquality (*scop, tileOptions, {3ul , 4ul });
565566}
566567
567568TEST_F (PolyhedralMapperTest, MatmulShiftScale) {
568- auto scop = PrepareAndJoinBands ( makeMatmulTc () );
569+ auto scop = PrepareAndJoinBandsMatMul ( );
569570 auto tileOptions = TileOptions::ShiftPointLoops | TileOptions::ScaleTileLoops;
570571 TileAndCheckStructuralEquality (*scop, tileOptions, {3ul , 4ul });
571572}
572573
573574TEST_F (PolyhedralMapperTest, MatmulShift) {
574- auto scop = PrepareAndJoinBands ( makeMatmulTc () );
575+ auto scop = PrepareAndJoinBandsMatMul ( );
575576 auto tileOptions = TileOptions::ShiftPointLoops;
576577 TileAndCheckStructuralEquality (*scop, tileOptions, {3ul , 4ul });
577578}
578579
579580TEST_F (PolyhedralMapperTest, MatmulScale) {
580- auto scop = PrepareAndJoinBands ( makeMatmulTc () );
581+ auto scop = PrepareAndJoinBandsMatMul ( );
581582 auto tileOptions = TileOptions::ScaleTileLoops;
582583 TileAndCheckStructuralEquality (*scop, tileOptions, {3ul , 4ul });
583584}
584585
585586TEST_F (PolyhedralMapperTest, MatmulNoshiftNoscale) {
586- auto scop = PrepareAndJoinBands ( makeMatmulTc () );
587+ auto scop = PrepareAndJoinBandsMatMul ( );
587588 auto tileOptions = TileOptions ();
588589 TileAndCheckStructuralEquality (*scop, tileOptions, {3ul , 4ul });
589590}
0 commit comments