csullivan commented on a change in pull request #9525:
URL: https://github.com/apache/tvm/pull/9525#discussion_r758693298



##########
File path: src/runtime/hexagon/hexagon/hexagon_device_api_v2.cc
##########
@@ -50,34 +50,54 @@ void HexagonDeviceAPIv2::GetAttr(Device dev, DeviceAttrKind 
kind, TVMRetValue* r
   }
 }
 
+// DataSpace: static allocations for Hexagon
 void* HexagonDeviceAPIv2::AllocDataSpace(Device dev, int ndim, const int64_t* 
shape,
                                          DLDataType dtype, Optional<String> 
mem_scope) {
-  return new HexagonBuffer(ndim, shape, dtype, mem_scope.defined() ? mem_scope 
: String("global"));
+  CHECK(TVMDeviceExtType(dev.device_type) == kDLHexagon);
+  CHECK(ndim == 1 || ndim == 2);
+
+  size_t typesize = (dtype.bits / 8) * dtype.lanes;
+  size_t nbytes = shape[0] * typesize;

Review comment:
       When the allocation is 2d `shape[0]` wil be the number of allocations to 
make, and `shape[1]` will be the allocation size (nbytes). Thus you'll need to 
conditionally calculate the number of bytes based on whether it is a 1 or 2d 
allocation.




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