Unverified Commit 5d601ad1 authored by Shucai Xiao's avatar Shucai Xiao Committed by GitHub
Browse files

add a flag to disable cpu target in some verification unit tests (#778)



* add a flag to disable cpu target in verification test

* change the way to disable some tests

* clang format

* add a function call to have more code coverage

* fix a build error

* fix review comments

* fix review comments

* clang format
Co-authored-by: default avatarPaul Fultz II <pfultz2@yahoo.com>
Co-authored-by: default avatarmvermeulen <5479696+mvermeulen@users.noreply.github.com>
parent 581d31b0
...@@ -47,5 +47,6 @@ int main(int argc, const char* argv[]) ...@@ -47,5 +47,6 @@ int main(int argc, const char* argv[])
{ {
run_verify rv; run_verify rv;
rv.add_validation_for("gpu", &validate_gpu); rv.add_validation_for("gpu", &validate_gpu);
rv.disable_test_for("cpu", {});
rv.run(argc, argv); rv.run(argc, argv);
} }
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
#include "verify_program.hpp" #include "verify_program.hpp"
#include <migraphx/env.hpp> #include <migraphx/env.hpp>
#include <migraphx/ref/target.hpp> #include <migraphx/ref/target.hpp>
#include <migraphx/ranges.hpp>
#include <migraphx/generate.hpp> #include <migraphx/generate.hpp>
#include <migraphx/verify_args.hpp> #include <migraphx/verify_args.hpp>
#include <set> #include <set>
...@@ -132,6 +133,12 @@ void run_verify::verify(const std::string& name, const migraphx::program& p) con ...@@ -132,6 +133,12 @@ void run_verify::verify(const std::string& name, const migraphx::program& p) con
{ {
if(tname == "ref") if(tname == "ref")
continue; continue;
// if tests disabled, skip running it
target_info ti = get_target_info(tname);
if(migraphx::contains(ti.disabled_tests, name))
continue;
target_names.push_back(tname); target_names.push_back(tname);
} }
if(not target_names.empty()) if(not target_names.empty())
...@@ -201,3 +208,9 @@ void run_verify::add_validation_for(const std::string& name, target_info::valida ...@@ -201,3 +208,9 @@ void run_verify::add_validation_for(const std::string& name, target_info::valida
{ {
info[name].validate = std::move(v); info[name].validate = std::move(v);
} }
void run_verify::disable_test_for(const std::string& name, const std::vector<std::string>& tests)
{
auto& disabled_tests = info[name].disabled_tests;
disabled_tests.insert(disabled_tests.end(), tests.begin(), tests.end());
}
...@@ -11,6 +11,7 @@ struct target_info ...@@ -11,6 +11,7 @@ struct target_info
std::function<void(const migraphx::program& p, const migraphx::parameter_map& m)>; std::function<void(const migraphx::program& p, const migraphx::parameter_map& m)>;
bool parallel = true; bool parallel = true;
validation_function validate; validation_function validate;
std::vector<std::string> disabled_tests;
}; };
struct run_verify struct run_verify
...@@ -30,6 +31,7 @@ struct run_verify ...@@ -30,6 +31,7 @@ struct run_verify
target_info get_target_info(const std::string& name) const; target_info get_target_info(const std::string& name) const;
void disable_parallel_for(const std::string& name); void disable_parallel_for(const std::string& name);
void add_validation_for(const std::string& name, target_info::validation_function v); void add_validation_for(const std::string& name, target_info::validation_function v);
void disable_test_for(const std::string& name, const std::vector<std::string>& tests);
private: private:
std::map<std::string, target_info> info{}; std::map<std::string, target_info> info{};
......
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