operator_groups.h#
Shared operator-group proposals, ordered interfaces and replacement schedules returned by both transfer-aware partitioning and repeated-layer detection. The common consumer validates interval coverage before constructing functions.
-
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 builder
-
namespace graph
Enums
Functions
-
OperatorGroupProposal MakeIntervalGroupProposal(std::vector<OperatorGroup> groups, std::size_t node_count)#
Builds the source-order schedule for disjoint intervals, retaining Constants.
-
bool IsOperatorGroupAnchor(const NodeProto &node, const builder::GraphBuilder &builder, std::size_t &work)#
Detects exact attention/MatMul anchors, including bounded local-function traversal. Shares a cumulative work budget across calls; zero starts a fresh search.
-
std::string MakeOperatorGroupFunctionName(builder::GraphBuilder &source, const utils::RepeatedProtoField<NodeProto> &nodes, const std::string &prefix, std::size_t &suffix)#
Returns prefix_<mainop>_<index>, advancing the caller’s naming counter. Uses the first anchor in source order, or the first operator without anchors. Avoids function, graph-value and registered-operator collisions in ai.rt. Requires ai.rt opset 1 in source; the caller installs the returned name. Throws builder::BuilderError for an empty prefix/body or exhausted indices.
-
std::vector<OperatorGroupInput> FindCommonOperatorGroupInputs(const builder::GraphGraph &graph, std::span<const OperatorGroup> instances)#
Finds common small constants and Shape producers of corresponding boundary inputs. Requires matching Shape attributes and source-input positions across all instances. Loads deferred payloads only after the small-constant size guard; never specializes overridable graph inputs or loads ownerless external references.
-
std::vector<std::string> InlineOperatorGroupInputs(GraphProto &body, const OperatorGroup &group, const std::vector<OperatorGroupInput> &producers)#
Internalizes selected producers in dependency order and returns the remaining arguments.
-
std::string AddOperatorGroupFunction(builder::GraphBuilder &source, GraphProto body, const std::string &prefix, std::size_t &suffix)#
Consumes a closed body to create or reuse a model-local ai.rt function with shared naming.
-
utils::RepeatedProtoField<NodeProto> MakeOperatorGroupReplacements(builder::GraphGraph &graph, const OperatorGroupProposal &proposal, const std::function<NodeProto(std::size_t)> &make_group)#
Validates a freshly rederived proposal before creating any local functions. Copies untouched nodes with shared tensor storage and delegates each body to make_group. The caller must install the result at proposal.first.
-
struct OperatorGroup#
- #include <operator_groups.h>
Describes a function body through source indices and ordered interfaces.
-
class OperatorGroupFunctions#
- #include <operator_groups.h>
Caches and indexes normalized definitions for one append-only extraction operation. Binds the source and prefix explicitly; existing definitions and source opsets must remain unchanged while the cache is used. Tensor payloads remain shared.
Public Functions
-
OperatorGroupFunctions(builder::GraphBuilder &source, std::string prefix)#
-
std::string Find(const GraphProto &body)#
Returns an equivalent function name, using exact comparisons within hash buckets. Returns an empty string when no safely comparable definition matches.
-
std::string Add(GraphProto body, std::size_t &suffix)#
Creates or reuses a function and advances suffix only for newly created names.
-
inline const OperatorGroupFunctionStats &Stats() const noexcept#
Returns cumulative candidate normalization and exact comparison counts.
-
OperatorGroupFunctions(builder::GraphBuilder &source, std::string prefix)#
-
struct OperatorGroupFunctionStats#
- #include <operator_groups.h>
Reports candidate-side work performed by a function index.
-
struct OperatorGroupInput#
- #include <operator_groups.h>
Describes a Constant or Shape producer replacing a formal input.
-
struct OperatorGroupProposal#
- #include <operator_groups.h>
Describes a non-mutating, scheduled operator-group proposal.
Both partitioning and repeated-layer detection return this class. Group node indices are sorted in source order; schedule indices refer either to groups or source nodes. The schedule covers the inclusive [first, last] interval. The proposing algorithm guarantees dependency-safe contraction. Source indices and interfaces are valid only while the source graph is unchanged.
Public Functions
Public Members
-
OperatorGroupStatus status = OperatorGroupStatus::kNoMatch#
-
std::vector<OperatorGroup> groups#
-
std::vector<OperatorGroupStep> schedule#
-
bool capture_analysis_limited = false#
Reports incomplete repeated-layer capture analysis, even when safe groups were found.
-
OperatorGroupStatus status = OperatorGroupStatus::kNoMatch#
-
struct OperatorGroupStep#
- #include <operator_groups.h>
Selects a proposed group or an untouched source node in replacement order.
-
OperatorGroupProposal MakeIntervalGroupProposal(std::vector<OperatorGroup> groups, std::size_t node_count)#
-
namespace builder
-
namespace core