Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MKL-DNN EP: control flow fix #1740

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -357,8 +357,8 @@ void MKLDNNExecutionProvider::CreateMetaDef(const onnxruntime::GraphViewer& grap
std::vector<std::unique_ptr<ComputeCapability>>& result) const {
std::string graph_fused_nodes;
std::string node_list;
std::string subgraph_id = std::to_string(sub_var.subgraph_index);
sub_var.subgraph_index++;
std::string subgraph_id = std::to_string(subgraph_index_);
subgraph_index_++;

// This is a list of initializers that subgraph considers as constants.
// Example weights, reshape shape etc.
Expand All @@ -378,7 +378,7 @@ void MKLDNNExecutionProvider::CreateMetaDef(const onnxruntime::GraphViewer& grap

auto meta_def = std::make_unique<::onnxruntime::IndexedSubGraph::MetaDef>();
meta_def->attributes["initializers"] = initializers;
meta_def->name = "MkldnnCustomOp" + std::to_string(sub_var.subgraph_index);
meta_def->name = "MkldnnCustomOp" + std::to_string(subgraph_index_);
meta_def->domain = kMSDomain;
meta_def->since_version = 1;
meta_def->status = ONNX_NAMESPACE::EXPERIMENTAL;
Expand Down
2 changes: 2 additions & 0 deletions onnxruntime/core/providers/mkldnn/mkldnn_execution_provider.h
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,8 @@ class MKLDNNExecutionProvider : public IExecutionProvider {
}

private:
mutable int subgraph_index_ = 0;

// supported MklDnn Operators
std::set<std::string> mkldnn_ops_ = {"Conv", "BatchNormalization", "Relu", "Sum",
"AveragePool", "GlobalMaxPool", "GlobalAveragePool", "MaxPool", "LRN"};
Expand Down
6 changes: 1 addition & 5 deletions onnxruntime/core/providers/mkldnn/subgraph/subgraph.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,8 @@ struct Subgraph {
std::vector<std::string> outputs;
std::vector<std::string> outputs_as_input_other_node;
std::vector<onnxruntime::NodeIndex> subgraph_node_indexes;
int subgraph_index = 0;

SubgraphVariables() {
subgraph_index = 0;
}
void Reset() {
void Reset() {
subgraph_node_indexes.clear();
inputs.clear();
outputs.clear();
Expand Down