leowang1225 commented on a change in pull request #7185:
URL: https://github.com/apache/tvm/pull/7185#discussion_r551170406



##########
File path: python/tvm/auto_scheduler/measure.py
##########
@@ -624,12 +652,10 @@ def local_build_worker(args):
         The build result of this Builder thread.
     """
     inp, build_func, timeout, verbose = args
-    if build_func == "default":
-        build_func = tar.tar
-    elif build_func == "ndk":
-        build_func = ndk.create_shared
-    else:
-        raise ValueError("Invalid build_func" + build_func)
+    assert build_func == BuildFunc.name, (
+        "BuildFunc.name: " + BuildFunc.name + ", but args is: " + build_func
+    )
+    build_func = BuildFunc.build_func

Review comment:
       @jcf94 
   I try use @tvm._ffi.register_func, but the custom build func is a python 
callable, it is not just function name. we need the whole python callable 
context,  and the callable also have attribute. like cross_compiler, it has 
output_format and get_target_triple attributes.
       use_ndk = True
       build_func = cc.cross_compiler(ndk.create_shared, options=ndk_options)
       tuner = auto_scheduler.TaskScheduler(tasks, task_weights)
       tune_option = auto_scheduler.TuningOptions(
           num_measure_trials=200,  # change this to 20000 to achieve the best 
performance
           builder=auto_scheduler.LocalBuilder(build_func=build_func if use_ndk 
else "default"),
           runner=auto_scheduler.RPCRunner(
               device_key, host=tracker_ip, port=tracker_port, repeat=3, 
timeout=50
           ),
           measure_callbacks=[auto_scheduler.RecordToFile(log_file)],
       )




----------------------------------------------------------------
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:
us...@infra.apache.org


Reply via email to