[GitHub] [incubator-tvm] kparzysz-quic commented on a change in pull request #5533: Cache ObjectPtr instead of raw pointers in bound analyzer

2020-05-06 Thread GitBox


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



##
File path: include/tvm/arith/analyzer.h
##
@@ -107,6 +107,7 @@ class ConstIntBound : public ObjectRef {
  */
 class ConstIntBoundAnalyzer {
  public:
+  using BoundMapType = std::unordered_map, 
ConstIntBound, ObjectHash>;

Review comment:
   Using `PrimExpr` worked fine.  I tried `ObjectRef` before, but it failed 
(I guess I missed the ObjectHash/Equal for refs), and I went the way of 
`ObjectPtr`.  This really makes all the remaining  changes unnecessary 
(although I think the default return type of `GetObjectPtr` may be useful).
   
   What do you suggest I do with the rest of the changes?  Should I remove the 
`ObjectPtr` completely?





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:
us...@infra.apache.org




[GitHub] [incubator-tvm] kparzysz-quic commented on a change in pull request #5533: Cache ObjectPtr instead of raw pointers in bound analyzer

2020-05-06 Thread GitBox


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



##
File path: include/tvm/runtime/object.h
##
@@ -350,6 +350,39 @@ inline RelayRefType GetRef(const ObjectType* ptr);
 template 
 inline SubRef Downcast(BaseRef ref);
 
+template  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 ::value, 
int>::type = 0>
+inline ObjectPtr 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 
+inline ObjectPtr GetObjectPtr(ObjectType* ptr);

Review comment:
   How is that unification possible?  If you say `GetObjectPtr(op)`, 
without the explicit `BaseType`, the compiler won't be able to deduce it if 
`GetObjectPtr` is a template with two independent type parameters.





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:
us...@infra.apache.org




[GitHub] [incubator-tvm] kparzysz-quic commented on a change in pull request #5533: Cache ObjectPtr instead of raw pointers in bound analyzer

2020-05-06 Thread GitBox


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



##
File path: include/tvm/arith/analyzer.h
##
@@ -107,6 +107,7 @@ class ConstIntBound : public ObjectRef {
  */
 class ConstIntBoundAnalyzer {
  public:
+  using BoundMapType = std::unordered_map, 
ConstIntBound, ObjectHash>;

Review comment:
   Wait, maybe I misunderstood.  `PrimExpr` instead of `PrimExprNode`?
   
   Edit: `PrimExpr` instead of `ObjectPtr`.  I think I got 
it now... haha





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:
us...@infra.apache.org




[GitHub] [incubator-tvm] kparzysz-quic commented on a change in pull request #5533: Cache ObjectPtr instead of raw pointers in bound analyzer

2020-05-06 Thread GitBox


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



##
File path: include/tvm/arith/analyzer.h
##
@@ -107,6 +107,7 @@ class ConstIntBound : public ObjectRef {
  */
 class ConstIntBoundAnalyzer {
  public:
+  using BoundMapType = std::unordered_map, 
ConstIntBound, ObjectHash>;

Review comment:
   Wait, maybe I misunderstood.  `PrimExpr` instead of `PrimExprNode`?





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:
us...@infra.apache.org




[GitHub] [incubator-tvm] kparzysz-quic commented on a change in pull request #5533: Cache ObjectPtr instead of raw pointers in bound analyzer

2020-05-06 Thread GitBox


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



##
File path: include/tvm/arith/analyzer.h
##
@@ -107,6 +107,7 @@ class ConstIntBound : public ObjectRef {
  */
 class ConstIntBoundAnalyzer {
  public:
+  using BoundMapType = std::unordered_map, 
ConstIntBound, ObjectHash>;

Review comment:
   So, no const?  Then `GetObjectPtr` will need a `const_cast`, e.g.
   ```
   auto op = GetElementPtr(const_cast(expr.as()));
   ```
   
   Do you also want to remove the first commit?





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:
us...@infra.apache.org