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

Function create_program_from_mlir

test/gpu/mlir.cpp:90–109  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

88}
89
90static 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
111static migraphx::parameter_map generate_params(const migraphx::program& p)
112{

Callers 1

verify_mlirFunction · 0.85

Calls 15

compile_mlirFunction · 0.85
create_mlir_submoduleFunction · 0.85
insert_mlirFunction · 0.85
get_main_moduleMethod · 0.80
add_parameterMethod · 0.80
frontMethod · 0.80
transformFunction · 0.50
sortFunction · 0.50
byFunction · 0.50
to_stringFunction · 0.50
to_shapesFunction · 0.50
get_parameter_namesMethod · 0.45

Tested by

no test coverage detected