| 67 | } |
| 68 | |
| 69 | inline static void compile_check(migraphx::program& p, |
| 70 | const migraphx::target& t, |
| 71 | migraphx::compile_options c_opts, |
| 72 | bool show_trace = false) |
| 73 | { |
| 74 | auto name = t.name(); |
| 75 | auto shapes = p.get_output_shapes(); |
| 76 | std::stringstream ss; |
| 77 | if(show_trace) |
| 78 | c_opts.trace = migraphx::tracer{std::cout}; |
| 79 | p.compile(t, c_opts); |
| 80 | if(shapes.size() != p.get_output_shapes().size()) |
| 81 | { |
| 82 | std::cout << ss.str() << std::endl; |
| 83 | throw std::runtime_error("Compiling program with " + name + |
| 84 | " alters its number of outputs"); |
| 85 | } |
| 86 | |
| 87 | auto num = shapes.size(); |
| 88 | for(std::size_t i = 0; i < num; ++i) |
| 89 | { |
| 90 | auto output_shape = p.get_output_shapes()[i]; |
| 91 | // for static output shapes check that the intial parsed shapes are |
| 92 | // the same as the ones after compiling |
| 93 | // no check for dynamic shapes because the shapes can change after compiling |
| 94 | if(not output_shape.dynamic() and not shapes[i].dynamic()) |
| 95 | { |
| 96 | if(output_shape.lens() != shapes[i].lens()) |
| 97 | { |
| 98 | std::cout << ss.str() << std::endl; |
| 99 | throw std::runtime_error("Compiling program with " + name + |
| 100 | " alters its static output dimensions"); |
| 101 | } |
| 102 | } |
| 103 | } |
| 104 | if(t.name() != "ref") |
| 105 | verify_load_save(p); |
| 106 | } |
| 107 | |
| 108 | target_info run_verify::get_target_info(const std::string& name) const |
| 109 | { |
no test coverage detected