janetsc commented on code in PR #13028:
URL: https://github.com/apache/tvm/pull/13028#discussion_r992948216


##########
src/runtime/hexagon/hexagon_device_api.cc:
##########
@@ -115,13 +120,37 @@ void* HexagonDeviceAPI::AllocDataSpace(Device dev, size_t 
nbytes, size_t alignme
   if (alignment < kHexagonAllocAlignment) {
     alignment = kHexagonAllocAlignment;
   }
-  return mgr->AllocateHexagonBuffer(nbytes, alignment, String("global"));
+  CHECK(runtime_hexbuffs) << "Attempted to allocate Hexagon data with "
+                          << "HexagonDeviceAPI::AllocDataSpace before 
initializing resources.  "
+                          << "Please call HexagonDeviceAPI::AcquireResources";
+  return runtime_hexbuffs->AllocateHexagonBuffer(nbytes, alignment, 
String("global"));
 }
 
 void HexagonDeviceAPI::FreeDataSpace(Device dev, void* ptr) {
   CHECK(ptr) << "buffer pointer is null";
   CHECK(IsValidDevice(dev)) << "dev.device_type: " << dev.device_type;
-  mgr->FreeHexagonBuffer(ptr);
+  if (runtime_hexbuffs) {
+    runtime_hexbuffs->FreeHexagonBuffer(ptr);
+  } else {
+    auto it = std::find(released_runtime_buffers.begin(), 
released_runtime_buffers.end(), ptr);
+    CHECK(it != released_runtime_buffers.end()) << "Attempted to free Hexagon 
data with "
+                                                << 
"HexagonDeviceAPI::FreeDataSpace that was not "
+                                                << "allocated during the 
session.";
+  }
+}
+
+void* HexagonDeviceAPI::AllocRpcBuffer(size_t nbytes, size_t alignment) {
+  CHECK(nbytes) << "number of bytes is zero";
+  CHECK(alignment) << "alignment is zero";

Review Comment:
   Remove - allow 8 bit alignment for RPC data?



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