junrushao1994 commented on a change in pull request #10032:
URL: https://github.com/apache/tvm/pull/10032#discussion_r797940938



##########
File path: include/tvm/runtime/packed_func.h
##########
@@ -57,6 +57,74 @@ class TVMMovableArgValueWithContext_;
 class TVMRetValue;
 class TVMArgsSetter;
 
+/*!
+ * \brief Object container class that backs PackedFunc.
+ * \note Do not use this function directly, use PackedFunc.
+ */
+class PackedFuncObj : public Object {
+ public:
+  /*!
+   * \brief Call the function in packed format.
+   * \param args The arguments
+   * \param rv The return value.
+   */
+  TVM_ALWAYS_INLINE void CallPacked(TVMArgs args, TVMRetValue* rv) const;
+
+  /*! \return Whether the packed function is nullptr */
+  bool operator==(std::nullptr_t null) const { return f_call_packed_ == 
nullptr; }
+  /*! \return Whether the packed function is not nullptr */
+  bool operator!=(std::nullptr_t null) const { return f_call_packed_ != 
nullptr; }
+
+  static constexpr const uint32_t _type_index = TypeIndex::kRuntimePackedFunc;
+  static constexpr const char* _type_key = "runtime.PackedFunc";
+  TVM_DECLARE_FINAL_OBJECT_INFO(PackedFuncObj, Object);
+
+ protected:
+  /*!
+   * \brief Internal struct for extracting the callable method from callable 
type.
+   */
+  template <class TPackedFuncSubObj>
+  struct Extractor {
+    /*!
+     * \brief Extracting the callable method from callable type.
+     * \param obj The base packed function object class.
+     * \param args The arguments
+     * \param rv The return value.
+     */
+    static void Call(const PackedFuncObj* obj, TVMArgs args, TVMRetValue* rv);
+  };
+
+  /*! \brief The internal callable function type. */
+  using FCallPacked = void(const PackedFuncObj*, TVMArgs, TVMRetValue*);
+

Review comment:
       to be more bug-proof, let's explicitly delete (although they are already 
deleted)
   * the default constructor
   * `make_object<PackedFuncObj>` specialization




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


Reply via email to