Hi @Dileep - 

There were a couple of problems I was running into:
1. The xcode build process initiated by the  popen_test_rpc() was being 
terminated prematurely when run in the fcompile build_func. 
2. The temp dylib filename with full path was not accessible from the ios rpc 
runner. As a hack to test, I removed the tmp_dir and just created the dylib in 
the local run directory.
3. remote.upload() should not be called because the dylib is built into the app

Following the code in my previous post, making the following changes should be 
all you need to get started. I'm going to look at a real solution that's not 
just a quick hack, but this may get you up and running.

```
def fcompile(*args):
    print("\nCalling fcompile. args[0] = %s" % args[0])
    xcode.create_dylib(*args, arch=arch, sdk=sdk)
    path = args[0]
    xcode.codesign(path)
```


```
diff --git a/python/tvm/autotvm/measure/measure_methods.py 
b/python/tvm/autotvm/measure/measure_methods.py
index 9cef674d3..784184e61 100644
--- a/python/tvm/autotvm/measure/measure_methods.py
+++ b/python/tvm/autotvm/measure/measure_methods.py
@@ -426,8 +426,9 @@ class _WrappedBuildFunc():
         """
         tic = time.time()
         try:
-            filename = os.path.join(tmp_dir, "tmp_func_%0x.%s" % (
-                getrandbits(64), self.build_func.output_format))
+            # filename = os.path.join(tmp_dir, "tmp_func_%0x.%s" % (
+            #     getrandbits(64), self.build_func.output_format))
+            filename = "tmp_func_%0x.%s" % (getrandbits(64), 
self.build_func.output_format)
             # TODO(tvm-team) consider linline _build_func_common
             func, arg_info = _build_func_common(measure_input, **kwargs)
             func.export_library(filename, self.build_func)
@@ -485,6 +486,8 @@ def run_through_rpc(measure_input, build_result,
     errno = MeasureErrorNo.NO_ERROR
     try:
         # upload built module
+        from tvm.contrib import xcode
+        xcode.popen_test_rpc(os.environ["TVM_IOS_RPC_PROXY_HOST"], 9090, 
"iphone", destination=os.environ["TVM_IOS_RPC_DESTINATION"], 
libs=[os.path.split(build_result.filename)[1]])
         remote = request_remote(*remote_args)
         # Program the FPGA every single time when targeting VTA
         if hasattr(measure_input.target, 'device_name') and \
@@ -493,7 +496,7 @@ def run_through_rpc(measure_input, build_result,
             from vta import program_fpga, reconfig_runtime
             program_fpga(remote, None)
             reconfig_runtime(remote)
-        remote.upload(build_result.filename)
+        # remote.upload(build_result.filename)
         func = remote.load_module(os.path.split(build_result.filename)[1])
         ctx = remote.context(str(measure_input.target), 0)

```





---
[Visit 
Topic](https://discuss.tvm.ai/t/auto-tvm-how-to-auto-tune-the-model-on-ios-device/7681/12)
 to respond.

You are receiving this because you enabled mailing list mode.

To unsubscribe from these emails, [click 
here](https://discuss.tvm.ai/email/unsubscribe/63f94793ba7aa57a3195285177f627a7d002003b3872e4d9f0509f96459ba027).

Reply via email to