diff --git a/include/onnxruntime/core/framework/execution_provider.h b/include/onnxruntime/core/framework/execution_provider.h index c1113e9fe7..08c4ef2aea 100644 --- a/include/onnxruntime/core/framework/execution_provider.h +++ b/include/onnxruntime/core/framework/execution_provider.h @@ -140,8 +140,6 @@ class IExecutionProvider { const IKernelLookup& kernel_lookup, const onnxruntime::GraphTransformerManager& graph_transformer_mgr) const; - virtual bool RequestCustomizedGraphOptimizationForEP() const { return false; } - /** Get kernel registry per execution provider type. The KernelRegistry share pointer returned is shared across sessions. diff --git a/onnxruntime/core/framework/compute_capability.h b/onnxruntime/core/framework/compute_capability.h index 34f315878d..2d1d4e0e01 100644 --- a/onnxruntime/core/framework/compute_capability.h +++ b/onnxruntime/core/framework/compute_capability.h @@ -25,9 +25,9 @@ struct ComputeCapability { ComputeCapability(std::unique_ptr t_sub_graph) : sub_graph(std::move(t_sub_graph)) {} - // optional function to optimize this ComputeCapability - // this will be called by ORT once the ComputeCapability is assigned to the EP - // Optimization: std::function + // Optional function to optimize this ComputeCapability. + // This will be called by ORT once the ComputeCapability is assigned to the EP + // Optimization: std::function std::function optimization_func; // optional ComputeCapability instances for sets of nodes within this ComputeCapability that should be optimized. diff --git a/onnxruntime/core/framework/graph_partitioner.cc b/onnxruntime/core/framework/graph_partitioner.cc index bc84e9ab92..a8f33ff819 100644 --- a/onnxruntime/core/framework/graph_partitioner.cc +++ b/onnxruntime/core/framework/graph_partitioner.cc @@ -141,13 +141,6 @@ auto get_capabilities = [](const IExecutionProvider& ep, const onnxruntime::GraphTransformerManager& graph_transformer_manager) { std::vector> capabilities; capabilities = ep.GetCapability(graph_viewer, kernel_lookup, graph_transformer_manager); - /* - if (ep.RequestCustomizedGraphOptimizationForEP()) { - capabilities = ep.GetCapability(graph_viewer, kernel_lookup, graph_transformer_manager); - } else { - //capabilities = ep.GetCapability(graph_viewer, kernel_lookup); - } - */ // In theory an EP could return an empty capability. Remove those. capabilities.erase(std::remove_if(capabilities.begin(), capabilities.end(), @@ -452,13 +445,13 @@ static Status PartitionOnnxFormatModelImpl(Graph& graph, FuncManager& func_mgr, bool subgraph_assigned_to_ep = false; Node* n = PlaceNode(graph, *capability->sub_graph, fusion_style, type, mode, fused_node_unique_id, &subgraph_assigned_to_ep); - // If the subgraph is assigned to the ep and the ComputeCapability has nodes_to_optimize, - // run EP related optimizations and update compute capability (cc). + // If the subgraph is assigned to the EP and the ComputeCapability has nodes_to_optimize, + // run EP related optimizations and update ComputeCapability. if (subgraph_assigned_to_ep && !capability->nodes_to_optimize.empty()) { for (auto& optimization_cc : capability->nodes_to_optimize) { if (optimization_cc->optimization_func) { optimization_cc->optimization_func(graph, *optimization_cc, *capability); - // #TODO: Handle nested optimization func? + // #TODO: Handle nested optimization ComputeCapability } } }