echuraev commented on code in PR #15833:
URL: https://github.com/apache/tvm/pull/15833#discussion_r1341032517
##########
src/runtime/memory/memory_manager.cc:
##########
@@ -154,29 +160,30 @@ Allocator* MemoryManager::GetAllocator(Device dev) {
return it->second.get();
}
-NDArray Allocator::Empty(std::vector<int64_t> shape, DLDataType dtype,
DLDevice dev) {
+NDArray Allocator::Empty(ShapeTuple shape, DLDataType dtype, DLDevice dev,
+ Optional<String> mem_scope) {
VerifyDataType(dtype);
NDArray::Container* container = new NDArray::Container(nullptr, shape,
dtype, dev);
container->SetDeleter(BufferDeleter);
- size_t size = GetDataSize(container->dl_tensor);
+ size_t size = DeviceAPI::Get(dev)->GetDataSize(container->dl_tensor);
size_t alignment = GetDataAlignment(container->dl_tensor);
Buffer* buffer = new Buffer;
- *buffer = this->Alloc(size, alignment, dtype);
+ if (!mem_scope.defined() || mem_scope == "global") {
Review Comment:
Also `mem_scope` can be empty:
```suggestion
if (!mem_scope.defined() || mem_scope.empty() || mem_scope == "global") {
```
--
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]