comaniac commented on a change in pull request #7145:
URL: https://github.com/apache/tvm/pull/7145#discussion_r547452564
##########
File path: python/tvm/auto_scheduler/search_task.py
##########
@@ -221,10 +221,6 @@ def __init__(
target_host = Target(target_host)
self.dag = compute_dag
Review comment:
@jcf94 the root cause is we have two ComputeDAG constructors in C++, one
takes `compute` and another takes `schedule`. Since we can only register one
`auto_scheduler.ComputeDAG` symbol to Python, I made a constructor dispatching
as follows. Recall that this is to preserve the stage order if we already have
a schedule and wish to use it to create a ComputeDAG.
```
if (tensors) {
return ComputeDAG(tensors.value());
}
ICHECK(sch) << "Both tensors and schedule are null";
return ComputeDAG(sch.value());
```
It means we need both `tensors` (named `compute` on the Python side) and
`sch` to call the ComputeDAG constructor from Python. If we really want to keep
one, then we should keep `sch` because it has more information than `tensors`.
Since `sch` is not stored in the C++ object so we cannot access it via FFI, the
current workaround is having a Python-side specific attribute `self.sche`.
However, this attribute will be wiped out when mapping to the C++ object, so
the current solution is keeping a Python object.
Another solution would be keeping `sch` in the ComputeDAG C++ object. I made
a new commit for this solution. Please comment which one you prefer.
----------------------------------------------------------------
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:
[email protected]