janetsc commented on code in PR #13028: URL: https://github.com/apache/tvm/pull/13028#discussion_r993978956
########## src/runtime/hexagon/hexagon_device_api.cc: ########## @@ -115,13 +120,34 @@ 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 { Review Comment: My previous reply is related. If there's a manager, I can just use it to call Free. If there isn't (it has been released, or maybe acquire was never called), I can check what I had allocated before Release. If that buffer is in there, I will not throw. -- 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-unsubscr...@tvm.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org