@Lizhi-Liao 

1. Most computes should be the same. Some compute are different because we may 
slightly tweak them to make them most suitable for different backends. The 
dispatch strategy is defined in relay op strategy 
(https://github.com/apache/tvm/blob/main/python/tvm/relay/op/strategy/cuda.py, 
https://github.com/apache/tvm/blob/main/python/tvm/relay/op/strategy/x86.py), 
which will pick the corresponding TOPI definition.
2. Modify the op strategy files above
3. Yes, the compute should be the same. The input and output should be the 
same, but just with different intermediate layouts.

For your specific problem, I found you used the NCHW layout. This is the reason 
why you get different computes. Ansor favors the NHWC layout, so we only 
optimized this case. For NCHW, the dispatch mechanism in relay will extract 
wrong tasks from autotvm templates.
If you convert your model to NHWC 
(https://github.com/tlc-pack/TLCBench/blob/57eef4850bca6f1d35d1f1fb2ec41caef660f4a2/utils.py#L93),
 you should get  the same tasks.
If you can see the tutorials for CPU and GPU 
(https://tvm.apache.org/docs/tutorials/auto_scheduler/tune_network_x86.html#extract-search-tasks,
 
https://tvm.apache.org/docs/tutorials/auto_scheduler/tune_network_cuda.html#sphx-glr-tutorials-auto-scheduler-tune-network-cuda-py),
 you can find their tasks are the same.





---
[Visit 
Topic](https://discuss.tvm.apache.org/t/ansor-extract-different-workloads-from-the-same-model-between-cpu-and-gpu-target/9795/4)
 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/6794585551188177898c7608dc2cad54917d1672aad7c1a512b2132982689c1c).

Reply via email to