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



##########
File path: src/runtime/hexagon/hexagon/hexagon_device_api_v2.cc
##########
@@ -163,6 +170,63 @@ 
TVM_REGISTER_GLOBAL("device_api.hexagon.mem_copy").set_body([](TVMArgs args, TVM
   *rv = static_cast<int32_t>(0);
 });
 
+std::map<void*, HexagonBuffer*> vtcmallocs;
+
+TVM_REGISTER_GLOBAL("device_api.hexagon.AllocNd").set_body([](TVMArgs args, 
TVMRetValue* rv) {

Review comment:
       This PR creates a separate function called `AllocVtcmWorkspace` in the 
Hexagon Device API that is called from the lambda and which mirrors 
`AllocTextureWorkspace` in the OpenCL device API.  These two APIs are the 
template for a more generalized Device API to "allocate a workspace with 
storage scope" but this should occur in a follow-up PR, in my opinion.
   
   Note that the lambda must construct `Device` and `DLDataType` arguments for 
`AllocVtcmWorkspace` from primitive types passed through the builtin before 
making the call to `AllocVtcmWorkspace`. 
   
   Also note that `set_body` is being used here versus `set_body_type` due to 
the variable number of arguments being passed through the builtin resulting 
from passing a shape with a variable number of dimensions using primitive types.




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