Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove temporary VTCM workspace APIs #13681

Merged
merged 1 commit into from
Jan 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 2 additions & 16 deletions src/runtime/hexagon/hexagon_device_api.cc
Original file line number Diff line number Diff line change
Expand Up @@ -157,20 +157,6 @@ void HexagonDeviceAPI::FreeWorkspace(Device dev, void* data) {
dmlc::ThreadLocalStore<HexagonWorkspacePool>::Get()->FreeWorkspace(dev, data);
}

void* HexagonDeviceAPI::AllocVtcmWorkspace(Device dev, int ndim, const int64_t* shape,
DLDataType dtype, Optional<String> mem_scope) {
// must be Hexagon device (not CPU)
CHECK(dev.device_type == kDLHexagon) << "dev.device_type: " << dev.device_type;
CHECK((ndim == 1 || ndim == 2) && "Hexagon Device API supports only 1d and 2d allocations");
return AllocDataSpace(dev, ndim, shape, dtype, mem_scope);
}

void HexagonDeviceAPI::FreeVtcmWorkspace(Device dev, void* ptr) {
// must be Hexagon device (not CPU)
CHECK(dev.device_type == kDLHexagon) << "dev.device_type: " << dev.device_type;
FreeDataSpace(dev, ptr);
}

void HexagonDeviceAPI::CopyDataFromTo(DLTensor* from, DLTensor* to, TVMStreamHandle stream) {
CHECK_EQ(from->byte_offset, 0);
CHECK_EQ(to->byte_offset, 0);
Expand Down Expand Up @@ -268,7 +254,7 @@ TVM_REGISTER_GLOBAL("device_api.hexagon.alloc_nd").set_body([](TVMArgs args, TVM
type_hint.lanes = 1;

HexagonDeviceAPI* hexapi = HexagonDeviceAPI::Global();
*rv = hexapi->AllocVtcmWorkspace(dev, ndim, shape, type_hint, String(scope));
*rv = hexapi->AllocDataSpace(dev, ndim, shape, type_hint, String(scope));
});

TVM_REGISTER_GLOBAL("device_api.hexagon.free_nd").set_body([](TVMArgs args, TVMRetValue* rv) {
Expand All @@ -283,7 +269,7 @@ TVM_REGISTER_GLOBAL("device_api.hexagon.free_nd").set_body([](TVMArgs args, TVMR
dev.device_id = device_id;

HexagonDeviceAPI* hexapi = HexagonDeviceAPI::Global();
hexapi->FreeVtcmWorkspace(dev, ptr);
hexapi->FreeDataSpace(dev, ptr);
*rv = static_cast<int32_t>(0);
});

Expand Down
14 changes: 0 additions & 14 deletions src/runtime/hexagon/hexagon_device_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -138,20 +138,6 @@ class HexagonDeviceAPI final : public DeviceAPI {
void* AllocDataSpace(Device dev, int ndim, const int64_t* shape, DLDataType dtype,
Optional<String> mem_scope) final;

/*!
* \brief Allocate an Nd VTCM workspace.
* \param dev The device to perform the operation.
* \param ndim The number of dimensions of allocated tensor.
* \param shape The shape of allocated tensor.
* \param dtype The element type.
* \return The allocated HexagonBuffer pointer.
*/
void* AllocVtcmWorkspace(Device dev, int ndim, const int64_t* shape, DLDataType dtype,
Optional<String> mem_scope);

//! \brief Free the allocated Nd VTCM workspace.
void FreeVtcmWorkspace(Device dev, void* ptr);

/*!
* \brief Copy data from one storage to another.
* \note This API is designed to support special memory with shape dependent layout.
Expand Down