graph_partition.h#
Proposes disjoint operator groups suitable for local functions with small input/output transfer costs. The native implementation performs graph analysis, conservative byte-size accounting and dynamic-programming interval selection.
-
namespace onnx_light
Alias that makes onnx-light headers compatible with code that references
ONNX_LIGHT_NAMESPACE(the macro used in the standard onnx package).Set to
ONNX_LIGHT_NAMESPACEso both names resolve to the same namespace.Symbol-visibility attribute for the public onnx-light C++ API.
Maps the upstream compatibility macro to onnx-light’s explicit proto ABI annotation. This keeps declarations from vendored ONNX headers visible when
lib_onnx_protouses hidden visibility by default.Namespace alias so that ONNX C++ code (and consumers such as onnxruntime) that refers to the literal
onnxnamespace — rather than theONNX_NAMESPACEmacro — resolves to the onnx-light namespace. The standard onnx package lives innamespace onnx; onnx-light usesonnx_light(via ONNX_LIGHT_NAMESPACE), so this alias keeps onnx-light a true drop-in. It is only introduced when the onnx-light namespace differs fromonnx.-
namespace core
-
namespace graph
Functions
-
OperatorGroupProposal ProposeOperatorGroups(const GraphProto &graph, const OperatorGroupOptions &options = {}, const std::unordered_map<std::string, uint64_t> &value_sizes = {}, const std::set<size_t> &excluded_nodes = {})#
Proposes disjoint intervals of non-Constant operators using dynamic programming.
Minimizes unknown transfers, then known bytes, then ungrouped nodes. Equal scores retain the first discovered partition. Constants and non-overridable initializers remain explicit inputs but cost no bytes. Captures participate in dependencies. Unrepresentable static sizes are unknown; explicit estimates override descriptors. Accepts unknown boundaries by default and reports their transfer_bytes as nullopt. An explicit byte cap requires fully known boundaries within that cap. max_constant_inputs caps distinct constant boundary inputs before internalization. excluded_nodes remain outside groups and split eligible intervals.
Throws std::invalid_argument for invalid limits, invalid dataflow, or an optimal transfer cost exceeding uint64. Does not read tensor payloads or modify the graph. Returns the same OperatorGroupProposal as repeated-layer detection, with groups, explicit interfaces and a dependency-safe replacement schedule.
Proposes extractable groups using the builder’s inferred boundary descriptors. Optionally retains analysis for immediate use by optimizer revalidation.
-
utils::RepeatedProtoField<NodeProto> MakePartitionGroupReplacements(builder::GraphGraph &graph, const std::vector<const NodeProto*> &nodes, const OperatorGroupOptions &options = {})#
Revalidates the interval and builds local-function calls in proposal order.
-
struct OperatorGroupOptions#
- #include <graph_partition.h>
-
OperatorGroupProposal ProposeOperatorGroups(const GraphProto &graph, const OperatorGroupOptions &options = {}, const std::unordered_map<std::string, uint64_t> &value_sizes = {}, const std::set<size_t> &excluded_nodes = {})#
-
namespace graph
-
namespace core