You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by GitBox <gi...@apache.org> on 2021/11/29 23:17:55 UTC

[GitHub] [tvm] adstraw commented on a change in pull request #9525: Add Hexagon VTCM and discontiguous allocation support

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



##########
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:
       Good catch.  I forgot to clean this up / add the 2D case.




-- 
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: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org