Commit 0f8c0360 authored by Paul's avatar Paul
Browse files

Formatting

parent b3f1d9d5
...@@ -120,13 +120,14 @@ bool check_conflicts(migraphx::program& p, migraphx::instruction_ref x, migraphx ...@@ -120,13 +120,14 @@ bool check_conflicts(migraphx::program& p, migraphx::instruction_ref x, migraphx
return false; return false;
} }
void check_conflicts(migraphx::program& p, std::vector<std::vector<migraphx::instruction_ref>> conflicts) void check_conflicts(migraphx::program& p,
std::vector<std::vector<migraphx::instruction_ref>> conflicts)
{ {
migraphx::dfor(conflicts.size(), conflicts.size())([&](auto i, auto j) { migraphx::dfor(conflicts.size(), conflicts.size())([&](auto i, auto j) {
if (i == j) if(i == j)
return; return;
for(auto ins1:conflicts[i]) for(auto ins1 : conflicts[i])
for(auto ins2:conflicts[j]) for(auto ins2 : conflicts[j])
CHECK(check_conflicts(p, ins1, ins2)); CHECK(check_conflicts(p, ins1, ins2));
}); });
} }
...@@ -148,11 +149,12 @@ std::vector<std::size_t> get_wait_for(migraphx::instruction_ref ins) ...@@ -148,11 +149,12 @@ std::vector<std::size_t> get_wait_for(migraphx::instruction_ref ins)
return wf; return wf;
} }
template<class T> template <class T>
std::vector<migraphx::instruction_ref> chain(migraphx::program& p, std::size_t n, T x, migraphx::instruction_ref input) std::vector<migraphx::instruction_ref>
chain(migraphx::program& p, std::size_t n, T x, migraphx::instruction_ref input)
{ {
std::vector<migraphx::instruction_ref> result; std::vector<migraphx::instruction_ref> result;
for(std::size_t i = 0;i < n;i++) for(std::size_t i = 0; i < n; i++)
{ {
result.push_back(p.add_instruction(x, input)); result.push_back(p.add_instruction(x, input));
input = result.back(); input = result.back();
...@@ -205,7 +207,7 @@ TEST_CASE(two_weights) ...@@ -205,7 +207,7 @@ TEST_CASE(two_weights)
p.compile(schedule_target{&stream}); p.compile(schedule_target{&stream});
EXPECT(stream.count(one) == 0); EXPECT(stream.count(one) == 0);
EXPECT(stream.at(i1) == 1); EXPECT(stream.at(i1) == 1);
for(auto ins:c1) for(auto ins : c1)
EXPECT(stream.at(ins) == 0); EXPECT(stream.at(ins) == 0);
EXPECT(stream.at(binary) == 0); EXPECT(stream.at(binary) == 0);
EXPECT(get_wait_for(binary) == get_wait_for(stream[binary], {stream[c1.back()], stream[i1]})); EXPECT(get_wait_for(binary) == get_wait_for(stream[binary], {stream[c1.back()], stream[i1]}));
...@@ -225,11 +227,16 @@ TEST_CASE(four_weights) ...@@ -225,11 +227,16 @@ TEST_CASE(four_weights)
p.compile(schedule_target{&stream}); p.compile(schedule_target{&stream});
EXPECT(stream.count(one) == 0); EXPECT(stream.count(one) == 0);
EXPECT(stream.at(i1) == 3); EXPECT(stream.at(i1) == 3);
for(auto ins:c1) EXPECT(stream.at(ins) == 0); for(auto ins : c1)
for(auto ins:c2) EXPECT(stream.at(ins) == 1); EXPECT(stream.at(ins) == 0);
for(auto ins:c3) EXPECT(stream.at(ins) == 2); for(auto ins : c2)
EXPECT(stream.at(ins) == 1);
for(auto ins : c3)
EXPECT(stream.at(ins) == 2);
EXPECT(stream.at(binary) == 0); 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]})); 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, {i1}}); check_conflicts(p, {c1, c2, c3, {i1}});
} }
......
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