echuraev commented on pull request #9032:
URL: https://github.com/apache/tvm/pull/9032#issuecomment-921787831
> Empty arrays created in timed_rpc_run should be destroy after running the
program in the device.
Who will guarantee that the arrays will be destroyed? We have a global
variable which was passed to the function and in this function new arrays were
created in this global dictionary. When the program was run in the device,
these arrays won't be destroyed due to they are the part of global object. Or
I'm wrong?
I updated this PR with another fix for this problem. I just create a local
copy of the arguments in `_rpc_run` and `_timed_eval_func`. In this case, then
we go out of the function scope the local objects will be destroyed, and it
guarantees to us that the arrays were destroyed.
Another workable fix is to set arguments to `None` after function execution.
For example:
```diff
assert len(args) == len(build_res.args)
+ indices = []
# pylint: disable=consider-using-enumerate
for idx in range(len(args)):
if args[idx] is None:
build_res_arg = build_res.args[idx]
empty_array = ndarray.empty(
get_const_tuple(build_res_arg.shape),
build_res_arg.dtype, dev
)
random_fill(empty_array)
+ indices.append(idx)
args[idx] = empty_array
else:
args[idx] = ndarray.array(args[idx], dev)
dev.sync()
# First run for check that the kernel is correct
func.entry_func(*args)
dev.sync()
costs = time_f(*args).results
+ for idx in indices:
+ args[idx] = None
```
In this case, the arrays also will be destroyed.
What about steps to reproduce this issue:
1. Run rpc_tracker
2. Connect Android or iOS device to the tracker by using AndroidRPC or
ios_rpc applications
3. Run tuning session on this device after several trials the tuning will
hang.
--
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]