masahi commented on code in PR #15137:
URL: https://github.com/apache/tvm/pull/15137#discussion_r1269037848
##########
src/relay/analysis/graph_partitioner.h:
##########
@@ -247,6 +266,23 @@ class GraphPartitioner {
void CommitFuse(IndexedForwardGraph::Node* src, IndexedForwardGraph::Node*
sink);
size_t CountNodesUptoSink_(IndexedForwardGraph::Node* src,
IndexedForwardGraph::Node* sink);
+ // Count the number of additional arguments. In the case of dynamic shape,
+ // generated function takes several additional arguments, such as the sizes
of
+ // the dynamic dimensions and strides.
+ // This function calculates the number of such additional arguments.
+ size_t CountAdditionalArgs_(const TensorTypeNode* ttype, bool with_strides =
true);
+ // Calculate the number of arguments for the node.
+ size_t CountArgs_(IndexedForwardGraph::Node* src, const IndexedForwardGraph&
graph,
+ bool update_postpone = true);
+ // Count the actual limit of arguments for a generated function.
+ // max_function_args_ specifies the number of maximum function arguments. But
+ // usually, output tensors are also passed to the function as arguments.
+ // Additionally, in the case of dynamic shape, it is necessary to take into
+ // account the number of parameters which specifies the sizes of the dynamic
+ // dimensions.
+ // This function computes the limit of arguments by the following formula:
Review Comment:
the limit of arguments -> the maximum number of arguments
##########
src/relay/analysis/graph_partitioner.h:
##########
@@ -205,10 +213,21 @@ class GraphPartitioner {
int opt_level_;
/*! \brief The maximum number of operations in one fused function */
size_t max_fuse_depth_;
+ /*! \brief The maximum number of arguments in one fused function */
+ size_t max_function_args_;
/*! \brief The internal groups. */
std::vector<Group*> groups_;
/*! \brief internal field used for deduplication */
std::unordered_set<IndexedForwardGraph::Node*> visited_;
+ /*! \brief The map with nodes which were postponed for fusing. */
+ std::unordered_multimap<const IndexedForwardGraph::Node*,
IndexedForwardGraph::Node*>
+ postponed_fusing_map_;
+ /*!
+ * \brief Fusing of this node should be postponed till all child nodes will
be evaluated.
Review Comment:
till all child nodes **are** evaluated.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]