You are viewing a plain text version of this content. The canonical link for it is here.
Posted to discuss-archive@tvm.apache.org by Wheest via Apache TVM Discuss <no...@discuss.tvm.ai> on 2021/03/30 19:58:41 UTC
[Apache TVM Discuss] [Questions] [autoscheduler] Print tuned Python
schedule
The documentation lists that as a method of `tvm.auto_scheduler.ComputeDAG` we can get a Python code representation of the schedule with [`print_python_code_from_state()`](https://tvm.apache.org/docs/api/python/auto_scheduler.html?highlight=auto_scheduler#tvm.auto_scheduler.ComputeDAG.print_python_code_from_state).
Described as:
> Print transform steps in the history of a State as TVM’s python schedule code.
>
> This is used to print transformation steps for debugging. Use apply_steps_from_state if you want to get a schedule for code generation.
However, I am trying to figure out to use it. I have a simple model with a single operation, and have loaded it into the two variables: `mod` and `params`.
Additionally, I have performed auto-scheduling, and have a tuned log-file in the `json` format.
From this, how would I get this printed schedule?
If I try building a `tvm.auto_scheduler.ComputeDAG` object by passing `mod` to it I get a `RecursionError: maximum recursion depth exceeded while calling a Python object` error.
Same if I try and get the Ansor workload from it:
```python
tasks, task_weights = auto_scheduler.extract_tasks(
mod["main"], params, device_info['target_string'], device_info['target_host']
)
for i, t in enumerate(tasks):
tgt_dag = str(t.compute_dag)
tvm.auto_scheduler.ComputeDAG(tgt_dag)
```
Even if they did work however, I'm not sure how I'd link it to my auto-schedule `JSON` file.
The file `python/tvm/auto_scheduler/relay_integration.py` has a function `auto_schedule_topi()` instantiates a `ComputeDAG`, though the docstring says:
> Note: This is used internally for relay integration. Do not use this as a general user-facing API.
Any pointers on getting this Python schedule for a tuned model?
---
[Visit Topic](https://discuss.tvm.apache.org/t/autoscheduler-print-tuned-python-schedule/9574/1) 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/60e75e3895fe95397a8bf0e8693db1353ddba25f16afed95278d76d341f5f56f).
[Apache TVM Discuss] [Questions] [autoscheduler] Print tuned Python
schedule
Posted by "Cody H. Yu via Apache TVM Discuss" <no...@discuss.tvm.ai>.
Did you try the API mentioned in this tutorial? Specifically, it uses `print(task.print_best(log_file))`. The API you used is for getting the schedule for compilation, not for printing.
https://tvm.apache.org/docs/tutorials/auto_scheduler/tune_matmul_x86.html#using-the-record-file
---
[Visit Topic](https://discuss.tvm.apache.org/t/autoscheduler-print-tuned-python-schedule/9574/2) 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/56f52013ad5e2101da3b422704a34cd8f87ad200f1657d969643845d1377ab4f).