mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-07-08 17:17:15 +00:00
* Add Recurse method to GraphTransformer. Move GraphTransformer::Apply to ApplyImpl and make private. Add non-virtual GraphTransformer::Apply method to handle calling Graph::Resolve in a more consistent manner. Create MemcpyTransformer GraphTransformer to handle memcpy operations on subgraphs in a more standard way. * Checkpoint * Make the subgraph insert less verbose * Add graph nesting level to transformer ApplyImpl Tweak cast transformer to recurse nicely and avoid unnecessary Resolve calls by splitting out the duplicate removal into a separate transformer. Decouple memcpy transformer from ExecutionProviders and minimise what's in the header. * Recurse into subgraphs inside GraphPartitioner * Update a couple of new transformers * Check Recurse return value. * Cleanup some memory management in inference session by moving some things into SessionState * Add deleted flag to rewrite rules so we stop processing nodes that are removed. Remove some (most likely) unnecessary Resolve calls. As we always call Resolve for a graph modified by a transformer there's generally no need for the transformer to do it. * Minor cleanups. * Add some extra usage information to the comments in GraphTransformer. * Address PR comments
31 lines
892 B
C++
31 lines
892 B
C++
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
// Licensed under the MIT License.
|
|
|
|
#pragma once
|
|
|
|
#include "core/common/common.h"
|
|
#include "core/graph/graph_viewer.h"
|
|
#include "core/framework/op_kernel.h"
|
|
#include "core/framework/fuse_nodes_funcs.h"
|
|
|
|
namespace onnxruntime {
|
|
|
|
class ExecutionProviders;
|
|
class KernelRegistryManager;
|
|
|
|
class GraphPartitioner {
|
|
public:
|
|
//The order of providers represents the user preference.
|
|
GraphPartitioner(KernelRegistryManager& kernel_registry_mgr, const ExecutionProviders& providers)
|
|
: kernel_registry_mgr_(kernel_registry_mgr),
|
|
providers_(providers) {}
|
|
|
|
Status Partition(Graph& graph, bool export_dll, FuncManager& func_mgr) const;
|
|
|
|
private:
|
|
ORT_DISALLOW_COPY_ASSIGNMENT_AND_MOVE(GraphPartitioner);
|
|
|
|
KernelRegistryManager& kernel_registry_mgr_;
|
|
const ExecutionProviders& providers_;
|
|
};
|
|
} // namespace onnxruntime
|