tqchen commented on a change in pull request #4346: [Runtime] Make ADTObject 
POD container type
URL: https://github.com/apache/incubator-tvm/pull/4346#discussion_r347062305
 
 

 ##########
 File path: include/tvm/runtime/memory.h
 ##########
 @@ -104,10 +124,22 @@ class SimpleObjAllocator :
       return reinterpret_cast<T*>(data);
     }
 
+    template<typename... Args>
+    static T* NewWithExtraSpace(SimpleObjAllocator*, size_t extra, Args&&... 
args) {
+      // TODO(wweic): use aligned_alloc in the future
+      void* data = std::malloc(sizeof(T) + extra);
 
 Review comment:
   We care about alignment(otherwise it will leads to mysterious segfaults). 
   
   Please use std::aligned_storage, allocate an array of if. Make sure you at 
least get alignof(T), and the requested alignment is dividable by alignof(T)

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to