slyubomirsky commented on code in PR #14394: URL: https://github.com/apache/tvm/pull/14394#discussion_r1163161969
########## include/tvm/relax/utils.h: ########## @@ -81,6 +81,42 @@ TVM_DLL bool IsBoolStructInfo(const StructInfo& sinfo, bool permit_unknown_rank */ TVM_DLL bool IsLeafOrTuple(const Expr& expr); +/*! + * \brief Check if the given Call node is an impure operation. If the callee is a general + * expression, this simply requires checking the purity field of the FuncStructInfo. If it is an Op, + * then this checks the `fPurity` field. + * + * \param call The input call + * + * \return True iff the call is impure (definitely or possibly results in a visible side effect). + * That is, a call is considered pure only if definitely does not result in a visible side effect. + */ +TVM_DLL bool IsImpureCall(const Call& call); + +/*! + * \brief Wrap the Call node in the call_pure op, transferring over the attributes and sinfo_args. + * + * \param call The input call + * + * \return A Call to the call_pure op that wraps the original call. + * + * \note Transfers over StructInfo from the input to the return value. + */ +TVM_DLL Call WrapCallPure(const Call& call); Review Comment: Okay, I'll do it and we'll see if it proves sufficient. -- 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]
