@@ -153,6 +153,28 @@ MIGraphXExecutionProvider::MIGraphXExecutionProvider(const MIGraphXExecutionProv
153153 }
154154 }
155155
156+ // Save/load migraphx compiled models
157+ const std::string save_comp_model_env = onnxruntime::GetenvironmentVar (migraphx_env_vars::kSaveCompiledModel );
158+ if (!save_comp_model_env.empty ()) {
159+ save_compiled_model_ = (std::stoi (save_comp_model_env) == 0 ? false : true );
160+ }
161+
162+ const std::string save_model_path_env = onnxruntime::GetenvironmentVar (migraphx_env_vars::ksaveCompiledPath);
163+
164+ if (save_compiled_model_ && !save_model_path_env.empty ()) {
165+ save_compiled_path_ = save_model_path_env;
166+ }
167+
168+ const std::string load_comp_model_env = onnxruntime::GetenvironmentVar (migraphx_env_vars::kLoadCompiledModel );
169+ if (!load_comp_model_env.empty ()) {
170+ load_compiled_model_ = (std::stoi (load_comp_model_env) == 0 ? false : true );
171+ }
172+
173+ const std::string load_model_path_env = onnxruntime::GetenvironmentVar (migraphx_env_vars::kLoadCompiledPath );
174+ if (load_compiled_model_ && !load_model_path_env.empty ()) {
175+ load_compiled_path_ = load_model_path_env;
176+ }
177+
156178 // dump unsupported ops
157179 const std::string dump_model_ops_env = onnxruntime::GetEnvironmentVar (migraphx_env_vars::dumpModelOps);
158180 if (!dump_model_ops_env.empty ()) {
@@ -171,10 +193,15 @@ MIGraphXExecutionProvider::MIGraphXExecutionProvider(const MIGraphXExecutionProv
171193 << " device_id: " << device_id_
172194 << " , migraphx_fp16_enable: " << fp16_enable_
173195 << " , migraphx_int8_enable: " << int8_enable_
196+ << " , migraphx_int8_enable: " << int8_enable_
174197 << " , dump_model_ops: " << dump_model_ops_
175198 << " , migraphx_int8_calibration_cache_name: " << int8_calibration_cache_name_
176199 << " , int8_calibration_cache_available: " << int8_calibration_cache_available_
177- << " , use_native_migraphx_calibration_table: " << int8_use_native_migraphx_calibration_table_;
200+ << " , use_native_migraphx_calibration_table: " << int8_use_native_migraphx_calibration_table_
201+ << " , migraphx_save_compiled_model: " << save_compiled_model_
202+ << " , migraphx_save_compiled_model_path: " << save_compiled_model_path_
203+ << " , migraphx_load_compiled_model: " << load_compiled_model_
204+ << " , migraphx_load_compiled_model_path: " << load_compiled_model_path_;
178205}
179206
180207MIGraphXExecutionProvider::~MIGraphXExecutionProvider () {
0 commit comments