Commit 8af9cf93 authored by Paul's avatar Paul
Browse files

Formatting

parent 644f0bc6
...@@ -531,9 +531,7 @@ void program::dry_run(std::unordered_map<std::string, argument> params) const ...@@ -531,9 +531,7 @@ void program::dry_run(std::unordered_map<std::string, argument> params) const
void program::annotate(std::ostream& os, std::function<void(instruction_ref)> a) const void program::annotate(std::ostream& os, std::function<void(instruction_ref)> a) const
{ {
print_program(os, *this, [&](auto ins, auto&&) { print_program(os, *this, [&](auto ins, auto&&) { a(ins); });
a(ins);
});
} }
bool operator==(const program& x, const program& y) { return to_string(x) == to_string(y); } bool operator==(const program& x, const program& y) { return to_string(x) == to_string(y); }
......
...@@ -229,7 +229,7 @@ void schedule::apply(program& p) const ...@@ -229,7 +229,7 @@ void schedule::apply(program& p) const
p.annotate(std::cout, [&](auto ins) { p.annotate(std::cout, [&](auto ins) {
std::cout << ":"; std::cout << ":";
std::cout << " weight=" << si.weights.at(ins); std::cout << " weight=" << si.weights.at(ins);
if (si.has_stream(ins)) if(si.has_stream(ins))
std::cout << " stream=" << si.get_stream(ins); std::cout << " stream=" << si.get_stream(ins);
}); });
std::cout << std::endl; std::cout << std::endl;
......
...@@ -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