You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by GitBox <gi...@apache.org> on 2020/12/08 21:09:01 UTC

[GitHub] [tvm] merrymercy commented on a change in pull request #7053: [auto_scheduler] buffer support, correctness check

merrymercy commented on a change in pull request #7053:
URL: https://github.com/apache/tvm/pull/7053#discussion_r538808502



##########
File path: python/tvm/auto_scheduler/measure.py
##########
@@ -889,18 +929,43 @@ def _timed_rpc_run(
 
     if error_no == 0:
         try:
-            args = [ndarray.empty(get_const_tuple(x.shape), x.dtype, ctx) for x in build_res.args]
-            try:
-                random_fill = remote.get_function("tvm.contrib.random.random_fill")
-            except AttributeError:
-                raise AttributeError(
-                    "Please make sure USE_RANDOM is ON in the config.cmake " "on the remote devices"
-                )
-            for arg in args:
-                random_fill(arg)
+            if os.path.exists(working_dir):
+                buffer_path = os.path.join(working_dir, "buffer.pkl")
+                if os.path.exists(buffer_path):
+                    with open(buffer_path, "rb") as fi:
+                        buffer = pickle.load(fi)
+                    # force last args to be empty
+                    args = []
+                    for i in range(len(build_res.args) - 1):
+                        args.append(ndarray.array(buffer[build_res.args[i].name], ctx=ctx))
+                    args.append(ndarray.empty(get_const_tuple(build_res.args[-1].shape),\
+                        build_res.args[-1].dtype, ctx))
+                    is_buffer_exist = True
+                else:
+                    args = [ndarray.empty(get_const_tuple(x.shape), x.dtype, ctx) for x in build_res.args]
+                    try:
+                        random_fill = remote.get_function("tvm.contrib.random.random_fill")
+                    except AttributeError:
+                        raise AttributeError(
+                            "Please make sure USE_RANDOM is ON in the config.cmake " "on the remote devices"
+                        )
+                    for arg in args:
+                        random_fill(arg)
             ctx.sync()
 
             costs = time_f(*args).results
+            if is_buffer_exist:
+                # check answer, only support single output for now

Review comment:
       ```suggestion
                   # check answer, only support single output for now
                   # todo(antinucleon): get the output information from `task.compute_dag` to support multiple output
   ```




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org