Skip to content

Commit

Permalink
[Runtime][RPC] Fix FreeObject in minrpc server (apache#16647)
Browse files Browse the repository at this point in the history
As a followup PR to apache#16635, this PR fixes the FreeObject in minrpc server.
  • Loading branch information
Hzfengsy authored Mar 10, 2024
1 parent c43fad1 commit 86c5df8
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/runtime/crt/common/crt_runtime_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,8 @@ int TVMStreamCreate(int device_type, int device_id, TVMStreamHandle* out) {
return 0;
}

int TVMObjectFree(TVMObjectHandle obj) { return 0; }

int TVMStreamFree(int device_type, int device_id, TVMStreamHandle stream) { return 0; }

int TVMSetStream(int device_type, int device_id, TVMStreamHandle stream) { return 0; }
Expand Down
2 changes: 2 additions & 0 deletions src/runtime/minrpc/minrpc_server.h
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,8 @@ class MinRPCExecute : public MinRPCExecInterface {
call_ecode = TVMArrayFree(static_cast<TVMArrayHandle>(handle));
} else if (type_code == kTVMPackedFuncHandle) {
call_ecode = TVMFuncFree(handle);
} else if (type_code == kTVMObjectHandle) {
call_ecode = TVMObjectFree(handle);
} else {
MINRPC_CHECK(type_code == kTVMModuleHandle);
call_ecode = TVMModFree(handle);
Expand Down
4 changes: 4 additions & 0 deletions tests/python/runtime/test_runtime_rpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,10 @@ def check(client, is_local):
assert get_elem(shape, 0) == 2
assert get_elem(shape, 1) == 3
assert get_size(shape) == 2
# Test free object by assigning to the same variable
shape = make_shape(0)
assert get_size(shape) == 1
assert get_elem(shape, 0) == 0

# start server

Expand Down

0 comments on commit 86c5df8

Please sign in to comment.