[RFC] Ansor: An Auto-scheduler for TVM (AutoTVM v2.0)

Does auto_scheduler support auto tensor core in fp16 and int8 ? I didnt see in examples

It is not supported currently. We have some experimental examples here. cc @jcf94

I’m wondering if there are any TopHub-like workflows that have been created for Ansor yet? I’m looking at tuning reuse.

E.g. if I look at the tuning config I produce for MobileNetV2 mobilenet-NCHW-B1-llvm.json, I can see entries such as:

{"i": [["[\"0abeaf8a7df88ad015de76910b5779a1\"]", "llvm -keys=cpu -link-params=0 -mcpu=core-avx2", [8, 64, 64, 0, 0, 0, 0, 0], "", 2], [[], [["SP", 2, 0, 1, [1, 1, 1], 1], ["SP", 2, 4, 1000, [25, 2, 4], 1], ["SP", 2, 8, 1280, [16], 1], ["RE", 2, [0, 4, 1, 5, 8, 2, 6, 9, 3, 7]], ["FSP", 4, 0, 0, 2], ["FSP", 4, 3, 1, 2], ["RE", 4, [0, 3, 1, 4, 2, 5]], ["CA", 2, 4, 3], ["FU", 4, [0, 1, 2, 3]], ["AN", 4, 0, 3], ["PR", 2, 0, "auto_unroll_max_step$64"]]]], "r": [[0.000296812, 0.000293744, 0.000262426, 0.000270827, 0.000182757, 0.000185249, 0.000183439, 0.000183809, 0.000186335, 0.000268723], 0, 0.881661, 1611833413], "v": "v0.5"}

Which is somewhat similar to an equivalent entry from the autoTVM logfile for MobileNetV2:

{"input": ["llvm -keys=cpu -link-params=0 -mcpu=core-avx2", "conv2d_NCHWc.x86", [["TENSOR", [1, 320, 7, 7], "float32"], ["TENSOR", [1280, 320, 1, 1], "float32"], [1, 1], [0, 0, 0, 0], [1, 1], "NCHW", "NCHW", "float32"], {}], "config": {"index": 1996, "code_hash": null, "entity": [["tile_ic", "sp", [-1, 32]], ["tile_oc", "sp", [-1, 640]], ["tile_ow", "sp", [-1, 7]], ["tile_oh", "ot", 2]]}, "result": [[1000000000.0], 6, 10, 1611932834.9044788], "version": 0.2, "tvm_version": "0.8.dev0"}

I’m wondering for Ansor, if I had a network which had some layers identical to MobileNetV2, how I would parse the MobileNetV2 Ansor log file to use the tuning parameters for those shared layers.

The Ansor log format doesn’t seem to be canonicalised yet.

Unfortunately, we don’t have TopHub-like pre-tuned schedules for Ansor yet. One reason is that Ansor is still involving and everything could be changed. For example, the log you post is already out-of-date.

What about re-use on a local machine, where the TVM version is fixed?

Is there an established way of reusing schedules between networks?

The schedule reuse mechanism in Ansor is even more powerful than AutoTVM.

You can just ApplyHistoryBest with the tuning log of MobileNet V2 to a new network. All identical workloads will be compiled with the schedule in the log.

Even better, with the latest TVM, you can even try ApplyHistoryBest(log_file, include_compatible=True) to apply schedules in the log file to the compatible workloads. See [AutoScheduler] Separate shapes from DAG hash and enable schedule sharing by comaniac · Pull Request #7317 · apache/tvm · GitHub for details.

1 Like