Skip to content

Commit

Permalink
Merge pull request PaddlePaddle#43 from Superjomn/remove/placeholder-…
Browse files Browse the repository at this point in the history
…in-schedule

remove placeholder in schedule
  • Loading branch information
Superjomn committed Feb 27, 2020
2 parents 83439e8 + a162473 commit 1033f4f
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
2 changes: 1 addition & 1 deletion cinn/lang/lower.cc
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ std::vector<LoweredFunc> Lower(const std::string& name, const std::vector<Tensor
}

Expr group_expr = LowerGroup(group, tuple_to_expr);
VLOG(3) << "group expr: " << group_expr;
VLOG(3) << "group expr:\n" << group_expr;
exprs.push_back(group_expr);
}

Expand Down
23 changes: 22 additions & 1 deletion cinn/lang/lower_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ TEST(lower, basic) {

LOG(INFO) << "lower_size " << lower_funcs.size();

#define TEST_SOUTPUT(x, out) LOG(INFO) << "\n" << x; \
#define TEST_SOUTPUT(x, out) \
LOG(INFO) << "\n" << x; \
EXPECT_EQ(utils::GetStreamCnt(x), utils::Trim(out));

auto out = R"ROC(
Expand All @@ -40,5 +41,25 @@ TEST(lower, basic) {
TEST_SOUTPUT(lower_funcs.front().body, out);
}

TEST(lower, more_complex) {
const int M = 100;
const int N = 15;
const int K = 200;

Placeholder<float> A("A", {Expr(M), Expr(N)});
Placeholder<float> B("B", {Expr(N), Expr(K)});

auto C = Compute(
{M, N, K}, [=](Var i, Var j, Var k) -> Expr { return A(i, j) * B(j, k); }, "C");

auto lower_funcs = Lower("cal_C", {A, B, C});

LOG(INFO) << "lower_size " << lower_funcs.size();

#define TEST_SOUTPUT(x, out) \
LOG(INFO) << "\n" << x; \
EXPECT_EQ(utils::GetStreamCnt(x), utils::Trim(out));
}

} // namespace lang
} // namespace cinn

0 comments on commit 1033f4f

Please sign in to comment.