Commit 4c6391ca authored by Paul's avatar Paul
Browse files

Add a test for overscheduling

parent 8af9cf93
......@@ -240,4 +240,34 @@ TEST_CASE(four_weights)
check_conflicts(p, {c1, c2, c3, {i1}});
}
TEST_CASE(five_weights)
{
instruction_map stream;
migraphx::program p;
auto one = p.add_literal(1);
auto c1 = chain(p, 5, unary_op{}, one);
auto c2 = chain(p, 4, unary_op{}, one);
auto c3 = chain(p, 3, unary_op{}, one);
auto c4 = chain(p, 2, unary_op{}, one);
auto i1 = p.add_instruction(unary_op{}, one);
auto binary = p.add_instruction(nary_op{}, i1, c1.back(), c2.back(), c3.back(), c4.back());
p.compile(schedule_target{&stream});
EXPECT(stream.count(one) == 0);
EXPECT(stream.at(i1) == 3);
for(auto ins : c1)
EXPECT(stream.at(ins) == 0);
for(auto ins : c2)
EXPECT(stream.at(ins) == 1);
for(auto ins : c3)
EXPECT(stream.at(ins) == 2);
for(auto ins : c4)
EXPECT(stream.at(ins) == 3);
EXPECT(stream.at(binary) == 0);
EXPECT(get_wait_for(binary) ==
get_wait_for(stream[binary],
{stream[c1.back()], stream[c2.back()], stream[c3.back()], stream[i1]}));
check_conflicts(p, {c1, c2, c3, c4});
check_conflicts(p, {c1, c2, c3, {i1}});
}
int main(int argc, const char* argv[]) { test::run(argc, argv); }
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment