| 88 | } |
| 89 | |
| 90 | static migraphx::program create_program_from_mlir(const migraphx::module& mmlir) |
| 91 | { |
| 92 | migraphx::program p; |
| 93 | auto* mm = p.get_main_module(); |
| 94 | auto names = mmlir.get_parameter_names(); |
| 95 | std::vector<migraphx::instruction_ref> inputs; |
| 96 | std::transform(names.begin(), names.end(), std::back_inserter(inputs), [&](const auto& name) { |
| 97 | return mm->add_parameter(name, mmlir.get_parameter_shape(name)); |
| 98 | }); |
| 99 | std::sort(inputs.begin(), inputs.end(), migraphx::by(std::less<>{}, [](auto ins) { |
| 100 | return to_string(ins->get_operator()); |
| 101 | })); |
| 102 | inputs.push_back(mm->add_parameter("output", mmlir.get_output_shapes().front())); |
| 103 | |
| 104 | migraphx::gpu::context ctx; |
| 105 | migraphx::gpu::mlir_code_object mco = |
| 106 | compile_mlir(ctx, create_mlir_submodule(mmlir), to_shapes(inputs), {}); |
| 107 | migraphx::gpu::insert_mlir(*mm, mm->end(), mco.cop, inputs); |
| 108 | return p; |
| 109 | } |
| 110 | |
| 111 | static migraphx::parameter_map generate_params(const migraphx::program& p) |
| 112 | { |
no test coverage detected