Skip to content

Commit 7fe9dad

Browse files
Add hook for model_cache_path to use model-cache_dir in provider options
1 parent ee69652 commit 7fe9dad

2 files changed

Lines changed: 13 additions & 1 deletion

File tree

onnxruntime/core/providers/migraphx/migraphx_execution_provider.cc

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,12 @@ MIGraphXExecutionProvider::MIGraphXExecutionProvider(const MIGraphXExecutionProv
200200
GET_ENV(migraphx_env_vars::kINT8CalibrationTableName, int8_calibration_cache_name_);
201201
GET_ENV(migraphx_env_vars::kINT8UseNativeMIGraphXCalibrationTable, int8_use_native_migraphx_calibration_table_);
202202
GET_ENV_STRING(migraphx_env_vars::kCachePath, calibration_cache_path_);
203-
GET_ENV_STRING(migraphx_env_vars::kModelCachePath, model_cache_path_);
203+
204+
// Only consult the env var when the provider option didn't supply a path,
205+
// so an explicit migraphx_model_cache_dir is never silently overridden.
206+
if (model_cache_path_.empty()) {
207+
GET_ENV_STRING(migraphx_env_vars::kModelCachePath, model_cache_path_);
208+
}
204209

205210
// Strip surrounding quotes from cache path.
206211
{

onnxruntime/core/providers/migraphx/migraphx_execution_provider_info.cc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,13 @@ MIGraphXExecutionProviderInfo::MIGraphXExecutionProviderInfo(const OrtMIGraphXPr
9595
bf16_enable{options.migraphx_bf16_enable != 0},
9696
fp8_enable{options.migraphx_fp8_enable != 0},
9797
int8_enable{options.migraphx_int8_enable != 0},
98+
int8_calibration_table_name{options.migraphx_int8_calibration_table_name != nullptr
99+
? options.migraphx_int8_calibration_table_name
100+
: ""},
101+
int8_use_native_calibration_table{options.migraphx_use_native_calibration_table != 0},
102+
model_cache_dir{options.migraphx_cache_dir != nullptr
103+
? ToPathString(std::string{options.migraphx_cache_dir})
104+
: std::filesystem::path{}},
98105
exhaustive_tune{options.migraphx_exhaustive_tune != 0},
99106
mem_limit{options.migraphx_mem_limit},
100107
arena_extend_strategy{options.migraphx_arena_extend_strategy},

0 commit comments

Comments
 (0)