Skip to content

Commit

Permalink
Relax AST (apache#2)
Browse files Browse the repository at this point in the history
Co-authored-by: ZihengJiang <ziheng@apache.org>
  • Loading branch information
2 people authored and junrushao committed Feb 9, 2023
1 parent 3bc1ce1 commit 68e15a8
Show file tree
Hide file tree
Showing 19 changed files with 1,181 additions and 8 deletions.
2 changes: 1 addition & 1 deletion 3rdparty/cutlass
Submodule cutlass updated 165 files
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,7 @@ tvm_file_glob(GLOB_RECURSE RELAY_IR_SRCS
tvm_file_glob(GLOB_RECURSE RELAY_QNN_SRCS
src/relay/qnn/*.cc
)

list(APPEND COMPILER_SRCS ${RELAY_OP_SRCS})
list(APPEND COMPILER_SRCS ${RELAY_PASS_SRCS})
list(APPEND COMPILER_SRCS ${RELAY_BACKEND_SRCS})
Expand Down
18 changes: 18 additions & 0 deletions include/tvm/ir/expr.h
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ class PrimExpr : public BaseExpr {
TVM_DLL static PrimExpr FromObject_(ObjectRef ref);
};

class RelayExpr;
/*!
* \brief add operator
*
Expand Down Expand Up @@ -367,10 +368,27 @@ class RelayExprNode : public BaseExprNode {
* This value is discarded during serialization.
*/
mutable Type checked_type_ = Type(nullptr);

/*!
* \brief Stores the result of static shape analysis.
*
* \note The value will be optional if a static shape can not be inferred.
* use .shape() instead to acesss an always defined shape expression.
*/
Optional<Array<PrimExpr>> shape_ = Optional<Array<PrimExpr>>();

/*!
* \return The checked_type
*/
inline const Type& checked_type() const;

/*!
* \return An expression which corresponds to the shape of the expression.
*
* Only valid when the expression's type is a Tensor.
*/
inline RelayExpr shape() const;

/*!
* \brief Check if the inferred(checked) type of the Expr
* is backed by a TTypeNode and return it.
Expand Down
4 changes: 2 additions & 2 deletions include/tvm/node/structural_hash.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* under the License.
*/
/*!
* \file tvm/node/structural_equal.h
* \file tvm/node/structural_hash.h
* \brief Structural hash class.
*/
#ifndef TVM_NODE_STRUCTURAL_HASH_H_
Expand Down Expand Up @@ -174,7 +174,7 @@ class SHashReducer {
/*!
* \brief Push hash of key to the current sequence of hash values.
* \param key The key to be hashed.
* \note This function indicate key could contain var defintions.
* \note This function indicates key could contain variable defintions.
*/
void DefHash(const ObjectRef& key) const { return handler_->SHashReduce(key, true); }
/*!
Expand Down
Loading

0 comments on commit 68e15a8

Please sign in to comment.