Skip to content

Commit e803fcb

Browse files
Cleanup to get things to compile before testing
1 parent fafe433 commit e803fcb

File tree

5 files changed

+26
-26
lines changed

5 files changed

+26
-26
lines changed

onnxruntime/core/providers/migraphx/migraphx_execution_provider.cc

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -154,23 +154,23 @@ MIGraphXExecutionProvider::MIGraphXExecutionProvider(const MIGraphXExecutionProv
154154
}
155155

156156
//Save/load migraphx compiled models
157-
const std::string save_comp_model_env = onnxruntime::GetenvironmentVar(migraphx_env_vars::kSaveCompiledModel);
157+
const std::string save_comp_model_env = onnxruntime::GetEnvironmentVar(migraphx_env_vars::kSaveCompiledModel);
158158
if (!save_comp_model_env.empty()) {
159159
save_compiled_model_ = (std::stoi(save_comp_model_env) == 0 ? false : true);
160160
}
161161

162-
const std::string save_model_path_env = onnxruntime::GetenvironmentVar(migraphx_env_vars::ksaveCompiledPath);
162+
const std::string save_model_path_env = onnxruntime::GetEnvironmentVar(migraphx_env_vars::kSavedModelPath);
163163

164164
if (save_compiled_model_ && !save_model_path_env.empty()) {
165165
save_compiled_path_ = save_model_path_env;
166166
}
167167

168-
const std::string load_comp_model_env = onnxruntime::GetenvironmentVar(migraphx_env_vars::kLoadCompiledModel);
168+
const std::string load_comp_model_env = onnxruntime::GetEnvironmentVar(migraphx_env_vars::kLoadCompiledModel);
169169
if (!load_comp_model_env.empty()) {
170170
load_compiled_model_ = (std::stoi(load_comp_model_env) == 0 ? false : true);
171171
}
172172

173-
const std::string load_model_path_env = onnxruntime::GetenvironmentVar(migraphx_env_vars::kLoadCompiledPath);
173+
const std::string load_model_path_env = onnxruntime::GetEnvironmentVar(migraphx_env_vars::kLoadModelPath);
174174
if (load_compiled_model_ && !load_model_path_env.empty()) {
175175
load_compiled_path_ = load_model_path_env;
176176
}
@@ -199,9 +199,9 @@ MIGraphXExecutionProvider::MIGraphXExecutionProvider(const MIGraphXExecutionProv
199199
<< ", int8_calibration_cache_available: " << int8_calibration_cache_available_
200200
<< ", use_native_migraphx_calibration_table: " << int8_use_native_migraphx_calibration_table_
201201
<< ", migraphx_save_compiled_model: " << save_compiled_model_
202-
<< ", migraphx_save_compiled_model_path: " << save_compiled_model_path_
202+
<< ", migraphx_save_compiled_model_path: " << save_compiled_path_
203203
<< ", migraphx_load_compiled_model: " << load_compiled_model_
204-
<< ", migraphx_load_compiled_model_path: " << load_compiled_model_path_;
204+
<< ", migraphx_load_compiled_model_path: " << load_compiled_path_;
205205
}
206206

207207
MIGraphXExecutionProvider::~MIGraphXExecutionProvider() {
@@ -1153,7 +1153,7 @@ Status MIGraphXExecutionProvider::Compile(const std::vector<FusedNodeAndGraph>&
11531153
if (!no_input_shape) {
11541154

11551155

1156-
if(!load_compiled_model)
1156+
if(!load_compiled_model_)
11571157
{
11581158
prog = migraphx::parse_onnx_buffer(onnx_string_buffer, options);
11591159
if (fp16_enable_) {
@@ -1181,16 +1181,16 @@ Status MIGraphXExecutionProvider::Compile(const std::vector<FusedNodeAndGraph>&
11811181
migraphx::compile_options co;
11821182
co.set_fast_math(false);
11831183
prog.compile(t_, co);
1184-
if (save_compiled_mode)
1184+
if (save_compiled_model_)
11851185
{
11861186
migraphx::file_options fo;
11871187
fo.set_file_format("msgpack");
1188-
migraphx::save(prog, save_compiled_path, fo);
1188+
migraphx::save(prog, save_compiled_path_.c_str(), fo);
11891189
}
11901190
}
11911191
else
11921192
{
1193-
prog = migraphx::load(load_compiled_path);
1193+
prog = migraphx::load(load_compiled_path_.c_str());
11941194
}
11951195

11961196
auto prog_output_shapes = prog.get_output_shapes();
@@ -1213,8 +1213,8 @@ Status MIGraphXExecutionProvider::Compile(const std::vector<FusedNodeAndGraph>&
12131213
map_onnx_string_[context->node_name], options, t_, map_input_index_[context->node_name], &mgx_mu_,
12141214
map_no_input_shape_[context->node_name], fp16_enable_, int8_enable_,
12151215
int8_calibration_cache_available_, dynamic_range_map,
1216-
save_compiled_mode_, save_compiled_path_,
1217-
load_compiled_mode_, load_compiled_path_, dump_model_ops_};
1216+
save_compiled_model_, save_compiled_path_,
1217+
load_compiled_model_, load_compiled_path_, dump_model_ops_};
12181218
*state = p.release();
12191219
return 0;
12201220
};
@@ -1288,7 +1288,7 @@ Status MIGraphXExecutionProvider::Compile(const std::vector<FusedNodeAndGraph>&
12881288
// input shapes are different, needs to re-parse onnx and
12891289
// re-compile the program
12901290
if (!input_shape_match) {
1291-
if(!load_compiled_model)
1291+
if(!load_compiled_model_)
12921292
{
12931293
prog = migraphx::parse_onnx_buffer(onnx_string, cmp_options);
12941294
if (fp16_enable) {
@@ -1317,16 +1317,16 @@ Status MIGraphXExecutionProvider::Compile(const std::vector<FusedNodeAndGraph>&
13171317
migraphx::compile_options co;
13181318
co.set_fast_math(false);
13191319
prog.compile(t, co);
1320-
if (save_compiled_mode)
1320+
if (save_compiled_model_)
13211321
{
13221322
migraphx::file_options fo;
13231323
fo.set_file_format("msgpack");
1324-
migraphx::save(prog, save_compiled_path, fo);
1324+
migraphx::save(prog, save_compiled_path_.c_str(), fo);
13251325
}
13261326
}
13271327
else
13281328
{
1329-
prog = migraphx::load(load_compiled_path);
1329+
prog = migraphx::load(load_compiled_path_.c_str());
13301330
}
13311331

13321332
mgx_state->prog = prog;

onnxruntime/core/providers/migraphx/migraphx_execution_provider.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,9 @@ struct MIGraphXFuncState {
5050
bool int8_calibration_cache_available = false;
5151
std::unordered_map<std::string, float> dynamic_range_map;
5252
bool save_compiled_mode = false;
53-
std::string save_compiled_path = false;
53+
std::string save_compiled_path;
5454
bool load_compiled_mode = false;
55-
std::string load_compiled_path = false;
55+
std::string load_compiled_path;
5656
bool dump_model_ops = false;
5757
};
5858

onnxruntime/core/providers/migraphx/migraphx_execution_provider_info.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@ ProviderOptions MIGraphXExecutionProviderInfo::ToProviderOptions(const OrtMIGrap
6767
{migraphx::provider_option_names::kDeviceId, MakeStringWithClassicLocale(info.device_id)},
6868
{migraphx::provider_option_names::kFp16Enable, MakeStringWithClassicLocale(info.migraphx_fp16_enable)},
6969
{migraphx::provider_option_names::kInt8Enable, MakeStringWithClassicLocale(info.migraphx_int8_enable)},
70-
{migraphx::provider_option_names::kSaveCompiledModel, MakeStringWithClassicLocale(info.save_compiled_model)},
71-
{migraphx::provider_option_names::kLoadCompiledModel, MakeStringWithClassicLocale(info.load_compiled_model)},
70+
{migraphx::provider_option_names::kSaveCompiledModel, MakeStringWithClassicLocale(info.migraphx_save_compiled_model)},
71+
{migraphx::provider_option_names::kLoadCompiledModel, MakeStringWithClassicLocale(info.migraphx_load_compiled_model)},
7272
};
7373
return options;
7474
}

onnxruntime/core/providers/migraphx/migraphx_execution_provider_info.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ struct MIGraphXExecutionProviderInfo {
2020
std::string int8_calibration_table_name{""};
2121
bool int8_use_native_calibration_table{false};
2222
bool save_compiled_model{false};
23-
std::string save_model_file("");
23+
std::string save_model_file{""};
2424
bool load_compiled_model{false};
25-
std::string load_model_file("");
25+
std::string load_model_file{""};
2626

2727
static MIGraphXExecutionProviderInfo FromProviderOptions(const ProviderOptions& options);
2828
static ProviderOptions ToProviderOptions(const MIGraphXExecutionProviderInfo& info);

onnxruntime/core/providers/migraphx/migraphx_provider_factory.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,13 @@ struct MIGraphX_Provider : Provider {
5555
info.int8_use_native_calibration_table = options.migraphx_use_native_calibration_table != 0;
5656
info.save_compiled_model = options.migraphx_save_compiled_model;
5757
info.save_model_file = "";
58-
if (options.migraphx_save_compiled_model_path != nullptr) {
59-
info.save_model_file = options.migraphx_save_compiled_model_path;
58+
if (options.migraphx_save_model_path != nullptr) {
59+
info.save_model_file = options.migraphx_save_model_path;
6060
}
6161
info.load_compiled_model = options.migraphx_load_compiled_model;
6262
info.load_model_file = "";
63-
if (options.migraphx_load_compiled_model_path != nullptr) {
64-
info.load_model_file = options.migraphx_load_compiled_model_path;
63+
if (options.migraphx_load_model_path != nullptr) {
64+
info.load_model_file = options.migraphx_load_model_path;
6565
}
6666
return std::make_shared<MIGraphXProviderFactory>(info);
6767
}

0 commit comments

Comments
 (0)