Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Print Ref compiled program in verify tests #2530

Merged
merged 1 commit into from
Dec 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 11 additions & 9 deletions test/verify/run_verify.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,16 +136,18 @@ void run_verify::validate(const migraphx::target& t,
ti.validate(p, m);
}

std::vector<migraphx::argument> run_verify::run_ref(migraphx::program p,
migraphx::parameter_map inputs,
const migraphx::compile_options& c_opts) const
std::pair<migraphx::program, std::vector<migraphx::argument>>
run_verify::run_ref(migraphx::program p,
migraphx::parameter_map inputs,
const migraphx::compile_options& c_opts) const
{
migraphx::target t = migraphx::make_target("ref");
auto_print pp{p, t.name()};
auto trace_target = migraphx::string_value_of(MIGRAPHX_TRACE_TEST_COMPILE{});
compile_check(p, t, c_opts, (trace_target == "ref"));
return p.eval(std::move(inputs));
return std::make_pair(std::move(p), p.eval(std::move(inputs)));
}

std::pair<migraphx::program, std::vector<migraphx::argument>>
run_verify::run_target(const migraphx::target& t,
migraphx::program p,
Expand Down Expand Up @@ -226,7 +228,7 @@ void run_verify::verify(const std::string& name,
}
}

auto gold_f = detach_async([=] { return run_ref(p, m, c_opts); });
auto ref_f = detach_async([=] { return run_ref(p, m, c_opts); });
for(const auto& tname : target_names)
{
target_info ti = get_target_info(tname);
Expand All @@ -235,8 +237,8 @@ void run_verify::verify(const std::string& name,
tname, detach_async([=] { return run_target(t, p, m, c_opts); }, ti.parallel));
}

assert(gold_f.valid());
auto gold = gold_f.get();
assert(ref_f.valid());
auto ref_results = ref_f.get();

for(auto&& pp : results)
{
Expand All @@ -245,7 +247,7 @@ void run_verify::verify(const std::string& name,
auto x = pp.second.get();
auto cp = x.first;
auto result = x.second;

auto gold = ref_results.second;
bool passed = true;
passed &= (gold.size() == result.size());
std::size_t num = gold.size();
Expand All @@ -258,7 +260,7 @@ void run_verify::verify(const std::string& name,
if(not passed or migraphx::enabled(MIGRAPHX_TRACE_TEST{}))
{
std::cout << p << std::endl;
std::cout << "ref:\n" << p << std::endl;
std::cout << "ref:\n" << ref_results.first << std::endl;
std::cout << tname << ":\n" << cp << std::endl;
std::cout << std::endl;
}
Expand Down
8 changes: 5 additions & 3 deletions test/verify/run_verify.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,11 @@ struct target_info

struct run_verify
{
std::vector<migraphx::argument> run_ref(migraphx::program p,
migraphx::parameter_map inputs,
const migraphx::compile_options& c_opts) const;
std::pair<migraphx::program, std::vector<migraphx::argument>>
run_ref(migraphx::program p,
migraphx::parameter_map inputs,
const migraphx::compile_options& c_opts) const;

std::pair<migraphx::program, std::vector<migraphx::argument>>
run_target(const migraphx::target& t,
migraphx::program p,
Expand Down
Loading