Skip to content

Commit

Permalink
[MIGraphX EP] Set external data path option
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffdaily committed Jul 18, 2024
1 parent af198ba commit 4004369
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include <iterator>
#include <unordered_map>
#include <set>
#include <filesystem>

#include "core/providers/shared_library/provider_api.h"
#define ORT_API_MANUAL_INIT
Expand Down Expand Up @@ -990,6 +991,7 @@ MIGraphXExecutionProvider::GetCapability(const onnxruntime::GraphViewer& graph_v
model_proto->set_ir_version(ONNX_NAMESPACE::Version::IR_VERSION);
std::string onnx_string_buffer;
model_proto->SerializeToString(onnx_string_buffer);
model_path_ = ToUTF8String(graph_viewer.ModelPath().ToPathString());

// dump onnx file if environment var is set
if (dump_model_ops_) {
Expand Down Expand Up @@ -1297,6 +1299,7 @@ Status MIGraphXExecutionProvider::Compile(const std::vector<FusedNodeAndGraph>&
if (!input_shape_match) {
if (!load_precompiled_model(prog, load_compiled_model_, std::string{load_compiled_path_})) {
LOGS_DEFAULT(VERBOSE) << "No Input shapes mismatch detected. Recompiling" << std::endl;
cmp_options.set_external_data_path(model_path_.parent_path().string());
prog = migraphx::parse_onnx_buffer(onnx_string, cmp_options);

// Read in the calibration data and map it to an migraphx paramater map for the calibration ops
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

#include <map>
#include <unordered_map>
#include <filesystem>

namespace onnxruntime {

Expand Down Expand Up @@ -100,6 +101,7 @@ class MIGraphXExecutionProvider : public IExecutionProvider {
migraphx::target t_;
OrtMutex mgx_mu_;
hipStream_t stream_ = nullptr;
mutable std::filesystem::path model_path_;

std::unordered_map<std::string, migraphx::program> map_progs_;
std::unordered_map<std::string, std::string> map_onnx_string_;
Expand Down

0 comments on commit 4004369

Please sign in to comment.