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

Method from_value

src/program.cpp:816–865  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

814}
815
816void program::from_value(const value& v)
817{
818 auto version = v.at("version").to<int>();
819 if(version != program_file_version)
820 {
821 MIGRAPHX_THROW(
822 "Error: Program version mismatch. MXR file was created using program file version: " +
823 std::to_string(version) + ", while installed MIGraphX is using program file version: " +
824 std::to_string(program_file_version) +
825 ", Try regenerating MXR file using installed MIGraphX and running again.");
826 }
827
828 auto migx_version = v.at("migraphx_version").to<std::string>();
829 if(migx_version != get_migraphx_version())
830 {
831 std::cerr << "[WARNING]: MXR File was created using MIGraphX version: " << migx_version
832 << ", while installed MIGraphX is at version: " << get_migraphx_version()
833 << ", operators implementation could be mismatched.\n";
834 }
835
836 migraphx::from_value(v.at("targets"), this->impl->targets);
837
838 for(auto i : range(this->impl->targets.size()))
839 {
840 this->impl->contexts.push_back(this->impl->targets[i].get_context());
841 this->impl->contexts.back().from_value(v.at("contexts")[i]);
842 }
843
844 auto module_vals = v.at("modules");
845 for(const auto& vv : module_vals)
846 {
847 const auto& name = vv.get_key();
848 if(name == "main")
849 continue;
850 impl->modules.emplace(name, name);
851 }
852 std::unordered_map<std::string, module_ref> map_mods;
853 std::transform(impl->modules.begin(),
854 impl->modules.end(),
855 std::inserter(map_mods, map_mods.end()),
856 [&](auto&& pp) { return std::make_pair(pp.first, &pp.second); });
857
858 std::unordered_map<std::string, instruction_ref> map_insts;
859 auto* mm = get_main_module();
860 mod_from_val(mm, module_vals, map_insts, map_mods);
861
862 // Finalize a compiled model
863 if(not this->impl->contexts.empty())
864 this->finalize();
865}
866
867static double common_average(const std::vector<double>& v)
868{

Callers 14

migraphx_from_valueFunction · 0.45
TEST_CASEFunction · 0.45
TEST_CASEFunction · 0.45
TEST_CASEFunction · 0.45
make_op_genericFunction · 0.45
update_opFunction · 0.45
applyMethod · 0.45
update_opFunction · 0.45
applyMethod · 0.45
applyMethod · 0.45
applyMethod · 0.45

Calls 15

finalizeMethod · 0.95
get_migraphx_versionFunction · 0.85
from_valueFunction · 0.85
get_main_moduleFunction · 0.85
mod_from_valFunction · 0.85
atMethod · 0.80
backMethod · 0.80
emplaceMethod · 0.80
to_stringFunction · 0.50
rangeFunction · 0.50
transformFunction · 0.50
sizeMethod · 0.45

Tested by

no test coverage detected