| 174 | } |
| 175 | |
| 176 | void run_verify::verify(const program_info& pi) const |
| 177 | { |
| 178 | const std::string name = pi.name; |
| 179 | const migraphx::program p = pi.get_program(); |
| 180 | using result_future = |
| 181 | std::future<std::pair<migraphx::program, std::vector<migraphx::argument>>>; |
| 182 | auto_print::set_terminate_handler(name); |
| 183 | if(migraphx::enabled(MIGRAPHX_DUMP_TEST{})) |
| 184 | migraphx::save(p, name + ".mxr"); |
| 185 | verify_load_save(p); |
| 186 | std::vector<std::string> target_names; |
| 187 | for(const auto& tname : migraphx::get_targets()) |
| 188 | { |
| 189 | // TODO(varunsh): once verify tests can run, remove fpga |
| 190 | if(tname == "ref" or tname == "fpga") |
| 191 | continue; |
| 192 | |
| 193 | // if tests disabled, skip running it |
| 194 | target_info ti = get_target_info(tname); |
| 195 | if(migraphx::contains(ti.disabled_tests, name)) |
| 196 | continue; |
| 197 | |
| 198 | target_names.push_back(tname); |
| 199 | } |
| 200 | if(not target_names.empty()) |
| 201 | { |
| 202 | std::vector<std::pair<std::string, result_future>> results; |
| 203 | migraphx::parameter_map m; |
| 204 | for(auto&& x : p.get_parameter_shapes()) |
| 205 | { |
| 206 | if(x.second.dynamic()) |
| 207 | { |
| 208 | // create static shape using maximum dimensions |
| 209 | migraphx::shape static_shape{x.second.type(), x.second.max_lens()}; |
| 210 | m[x.first] = migraphx::generate_argument(static_shape, get_hash(x.first)); |
| 211 | } |
| 212 | else |
| 213 | { |
| 214 | m[x.first] = migraphx::generate_argument(x.second, get_hash(x.first)); |
| 215 | } |
| 216 | } |
| 217 | const migraphx::compile_options c_opts = pi.compile_options; |
| 218 | auto ref_f = detach_async([=] { return run_ref(p, m, c_opts); }); |
| 219 | for(const auto& tname : target_names) |
| 220 | { |
| 221 | target_info ti = get_target_info(tname); |
| 222 | auto t = migraphx::make_target(tname); |
| 223 | results.emplace_back( |
| 224 | tname, detach_async([=] { return run_target(t, p, m, c_opts); }, ti.parallel)); |
| 225 | } |
| 226 | |
| 227 | assert(ref_f.valid()); |
| 228 | auto ref_results = ref_f.get(); |
| 229 | |
| 230 | for(auto&& pp : results) |
| 231 | { |
| 232 | assert(pp.second.valid()); |
| 233 | auto tname = pp.first; |
nothing calls this directly
no test coverage detected