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

 ##########
 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:
   @tqchen `fields.size()` is unknown until runtime, so `aligned_storage` won't 
work(it requires the size of memory to be compile time constant) I think. I 
agree with alignment, that's why I left a note of using `aligned_alloc`. But 
our c++ support seems to be c++11. `aligned_alloc` is available after c++17. We 
can have a simple implementation of `aligned_alloc` and switch to it later when 
we have c++17. What do you think?

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


With regards,
Apache Git Services

Reply via email to