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

[Testing] Return BenchmarkResult in local_run and rpc_run #15277

Merged
Merged
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
12 changes: 8 additions & 4 deletions python/tvm/testing/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

if TYPE_CHECKING:
import numpy as np

from tvm.meta_schedule.runner import EvaluatorConfig, RPCConfig
from tvm.runtime import Device, Module, NDArray

Expand All @@ -30,6 +31,7 @@

def _args_to_device(args, device):
import numpy as np

from tvm.runtime.ndarray import NDArray, empty

uploaded_args = []
Expand Down Expand Up @@ -109,6 +111,8 @@ def local_run( # pylint: disable=too-many-arguments,too-many-locals
-------
args : List[Union[np.ndarray, NDArray, int, float]]
The results of running the module.
profile_result : tvm.runtime.BenchmarkResult
The profiling result of running the module.
"""
import os.path as osp
import tempfile
Expand Down Expand Up @@ -137,13 +141,12 @@ def local_run( # pylint: disable=too-many-arguments,too-many-locals
if evaluator_config.enable_cpu_cache_flush
else "",
)(*args)
print(profile_result)
remote_mod(*args)
args = _args_to_numpy(args)
finally:
pass

return args
return args, profile_result


def rpc_run( # pylint: disable=too-many-arguments,too-many-locals
Expand Down Expand Up @@ -188,6 +191,8 @@ def rpc_run( # pylint: disable=too-many-arguments,too-many-locals
-------
args : List[Union[np.ndarray, NDArray, int, float]]
The results of running the module.
profile_result : tvm.runtime.BenchmarkResult
The profiling result of running the module.
"""

import os.path as osp
Expand Down Expand Up @@ -220,12 +225,11 @@ def rpc_run( # pylint: disable=too-many-arguments,too-many-locals
if evaluator_config.enable_cpu_cache_flush
else "",
)(*args)
print(profile_result)
remote_mod(*args)
args = _args_to_numpy(args)
finally:
session.remove(remote_path)
session.remove(remote_path + "." + output_format)
session.remove("")

return args
return args, profile_result