MCPcopy Create free account
hub / github.com/ROCm/AMDMIGraphX / compile_check

Function compile_check

test/verify/run_verify.cpp:69–106  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

67}
68
69inline 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
108target_info run_verify::get_target_info(const std::string& name) const
109{

Callers 2

run_refMethod · 0.85
run_targetMethod · 0.85

Calls 8

verify_load_saveFunction · 0.85
dynamicMethod · 0.80
lensMethod · 0.80
nameMethod · 0.45
get_output_shapesMethod · 0.45
compileMethod · 0.45
sizeMethod · 0.45
strMethod · 0.45

Tested by

no test coverage detected