Here are some more details about the interface change in this RFC. The new added `use_topi_schedule` flag is propagated from the compile engine to `relay._build`. As a result, this actually doesn't expose to users. The use cases are the following:
1. Use TOPI schedule with fallback values (same as current). ```python with PassContext(opt_level=opt_level): lib = relay.build(mod, target=target, params=params) ``` 2. Use TOPI schedule with AutoTVM tuning logs (same as current). ```python with autotvm.apply_history_best(log_file): with PassContext(opt_level=opt_level): lib = relay.build(mod, target=target, params=params) ``` 3. Extract auto_scheduler tasks. It calls `GraphRuntimeCodegen(use_topi_schedule=False)` to launch the compile engine in order to lower the Relay functions to TE compute DAGs. ```python tasks, task_weights = auto_scheduler.extract_tasks(mod["main"], params, target) ``` In `extract_tasks`: ```python with transform.PassContext(opt_level=3): opt_mod, _ = relay.optimize(mod, target, params) grc = graph_runtime_codegen.GraphRuntimeCodegen(None, target, use_topi_schedule=False) grc.codegen(opt_mod["main"]) ``` 4. Use auto_scheduler tuning logs. In `relay.build`, it invokes `relay._build(use_topi_schedule=False)` because it finds the `auto_scheduler.DispatchContext` is not `None`, meaning that users want to apply the auto_scheduler log. ```python with auto_scheduler.ApplyHistoryBest(log_file): with PassContext(opt_level=opt_level): lib = relay.build(mod, target=target, params=params) ``` As a result, the changes are hid from an end-user's point of view. On the other hand, putting this flag to the `PassContext` results in the change of case 3 and case 4: 3. In `extract_tasks`, we can still add the flag for users. ```python with transform.PassContext(opt_level=3, use_topi_schedule=False): opt_mod, _ = relay.optimize(mod, target, params) grc = graph_runtime_codegen.GraphRuntimeCodegen(None, target) grc.codegen(opt_mod["main"]) ``` 4. Users have to manually add the flag anyways. ```python with auto_scheduler.ApplyHistoryBest(log_file): with PassContext(opt_level=opt_level, use_topi_schedule=False): lib = relay.build(mod, target=target, params=params) ``` IMHO, this changes the interface more than the current solution. --- [Visit Topic](https://discuss.tvm.apache.org/t/rfc-a-general-task-extraction-mechanism-for-auto-scheduler/8444/5) to respond. You are receiving this because you enabled mailing list mode. To unsubscribe from these emails, [click here](https://discuss.tvm.apache.org/email/unsubscribe/7fd1a3f875996b223bc241cc6d432f2789adb884f70db0b6e70b900badb73a44).