slyubomirsky commented on code in PR #15689: URL: https://github.com/apache/tvm/pull/15689#discussion_r1393366763
########## include/tvm/relax/dataflow_analysis.h: ########## @@ -0,0 +1,198 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/*! + * \file tvm/relax/dataflow_analysis.h + * \brief A reusable framework for dataflow analysis in Relax. + * Based on Adrian Sampson's course material: + * https://www.cs.cornell.edu/courses/cs6120/2020fa/lesson/4/ + * Do not confuse with dataflow pattern matching (does not use this machinery) + */ + +#ifndef TVM_RELAX_DATAFLOW_ANALYSIS_H_ +#define TVM_RELAX_DATAFLOW_ANALYSIS_H_ + +#include <tvm/relax/analysis.h> +#include <tvm/relax/expr.h> +#include <tvm/runtime/object.h> + +#include <utility> + +namespace tvm { +namespace relax { + +/*! \brief For dataflow analysis, we need to have a control flow graph. + * We will organize this graphs by bindings, which allows analyses to + * state their results for each binding in a SeqExpr. + * + * There are a few cases that have to be handled: + * 1. A normal binding (most common)ICHECK + * 2. The condition expression in an If node (a "split" point) + * 3. A merge point (the variable to which an If node is bound: it is a "merge" between + * the SeqExprs in the true and false branches) + * 4. The body expression in a SeqExpr (not actually bound) Review Comment: Yes, the expectation is for expressions to be normalized first. -- 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]
