janetsc commented on code in PR #13028:
URL: https://github.com/apache/tvm/pull/13028#discussion_r993652802
##########
src/runtime/hexagon/hexagon_device_api.cc:
##########
@@ -137,7 +166,7 @@ void* HexagonDeviceAPI::AllocWorkspace(Device dev, size_t
size, DLDataType type_
void HexagonDeviceAPI::FreeWorkspace(Device dev, void* data) {
CHECK(IsValidDevice(dev)) << "dev.device_type: " << dev.device_type;
- CHECK(mgr->count(data) != 0)
+ CHECK(runtime_hexbuffs == nullptr || runtime_hexbuffs->count(data) != 0)
Review Comment:
Decided to check runtime_hexbuffs separately, as this should not be called
outside of a session. (In other words, Acquire must first be called.)
##########
src/runtime/hexagon/hexagon_buffer_manager.h:
##########
@@ -85,6 +86,18 @@ class HexagonBufferManager {
return hexagon_buffer_map_.empty();
}
+ //! \brief Returns a list of allocated pointers.
+ // Note - this should only be used by the device API to keep track of what
+ // was in the manager when HexagonDeviceAPI::ReleaseResources is called.
+ std::vector<void*> vector() {
+ std::vector<void*> allocated;
+ std::lock_guard<std::mutex> lock(map_mutex_);
+ for (auto it = hexagon_buffer_map_.begin(); it !=
hexagon_buffer_map_.end(); it++) {
Review Comment:
I like that much better, thanks!
--
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]