tvm-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [incubator-tvm] tqchen commented on a change in pull request #5533: Cache ObjectPtr<PrimExprNode> instead of raw pointers in bound analyzer
Date Thu, 07 May 2020 01:15:37 GMT

tqchen commented on a change in pull request #5533:
URL: https://github.com/apache/incubator-tvm/pull/5533#discussion_r421182429



##########
File path: include/tvm/runtime/object.h
##########
@@ -350,6 +350,39 @@ inline RelayRefType GetRef(const ObjectType* ptr);
 template <typename SubRef, typename BaseRef>
 inline SubRef Downcast(BaseRef ref);
 
+template <typename T> class ObjectPtr;
+
+/*!
+ * \brief Get an object ptr type from a raw object ptr.
+ *
+ * \param ptr The object pointer
+ * \tparam BaseType The reference type
+ * \tparam ObjectType The object type
+ * \return The corresponding ObjectPtr type
+ */
+template <typename BaseType, typename ObjectType,
+          typename std::enable_if<!std::is_same<BaseType, ObjectType>::value, int>::type
= 0>
+inline ObjectPtr<BaseType> GetObjectPtr(ObjectType* ptr);
+
+/*!
+ * \brief Get an object ptr type from a raw object ptr.
+ *
+ * \param ptr The object pointer
+ * \tparam ObjectType The object type
+ * \return The corresponding ObjectPtr type
+ */
+template <typename ObjectType>
+inline ObjectPtr<ObjectType> GetObjectPtr(ObjectType* ptr);

Review comment:
       That is what I mean, we should  use GetObjectPtr<Object> as it is not a quite
frequently used feature




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



Mime
View raw message