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 sqchao via Apache TVM Discuss <no...@discuss.tvm.ai> on 2020/11/03 11:25:51 UTC

[Apache TVM Discuss] [Questions] After auto tuning, what other optimizations based on tir will be done?


I am a newer to TVM, from my point, compute + schedule + auto tuning convert the relay IR to Tensor IR.
this process includes many hardware special optimizations related with schedule primitives. After the auto tuning, Tensor IR was generated. 

Q1: Besides the AutoTVM(include schedules),  what are the optimizations based on TIR?These optimizations are the operations in /tir/transform files?   
I did not find any related knowledge about optimizations based on tir in **tvm paper**

Q2:  whether  relay.build()  execute the related call below?

![image|690x400](upload://n8w4DxMzdz3l5jp45D7xbwldeZD.jpeg) 

If there are any mistakes, please help me correct it.
Thanks in advance!





---
[Visit Topic](https://discuss.tvm.apache.org/t/after-auto-tuning-what-other-optimizations-based-on-tir-will-be-done/8360/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/f6dbb11fe21c13654421df9941398bab6bc1c1f8ceafe7ccdc5857454926d468).

[Apache TVM Discuss] [Questions] 【TIR】After auto tuning, what other optimizations based on tir will be done?

Posted by Matt Barrett via Apache TVM Discuss <no...@discuss.tvm.ai>.

I'm no expert with this, but if you take a look in build_module.py, you can see what TIR passes are run after the schedules have been lowered. I'll paste them here for convenience:
```
tvm.tir.transform.InjectPrefetch(),
tvm.tir.transform.StorageFlatten(64, instrument_bound_checkers),
tvm.tir.transform.BF16Legalize(),
tvm.tir.transform.NarrowDataType(32),
tvm.tir.transform.Simplify(),
tvm.tir.transform.LoopPartition(),
tvm.tir.transform.VectorizeLoop(not disable_vectorize),
tvm.tir.transform.InjectVirtualThread(),
tvm.tir.transform.InjectDoubleBuffer(),
tvm.tir.transform.StorageRewrite(),
tvm.tir.transform.UnrollLoop(),
tvm.tir.transform.Simplify(),
tvm.tir.transform.RemoveNoOp(),
tvm.tir.transform.RewriteUnsafeSelect(),
tvm.tir.transform.HoistIfThenElse()
```
I'm only familiar with a few of these, but sometimes to get a better understanding I'll just print the module between passes and see what changed.





---
[Visit Topic](https://discuss.tvm.apache.org/t/tir-after-auto-tuning-what-other-optimizations-based-on-tir-will-be-done/8360/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/5342443c671e257ab1fd63c822fa233da1929e48bc5346a97d4305c0f2a02a90).

[Apache TVM Discuss] [Questions] 【TIR】After auto tuning, what other optimizations based on tir will be done?

Posted by "Cody H. Yu via Apache TVM Discuss" <no...@discuss.tvm.ai>.

What @matt-arm pointed out is correct. In addition, your figure is not exactly correct. relay.build actually goes the same flow as AutoTVM/TE schedule. When calling relay.build, it lowers each operator to TE according to Relay op strategy. The op strategy will select a TE compute/schedule for each Relay op based on certain rules. For example, if you provide the tuning logs like:

```
with ApplyHistoryBest('tune.log'):
  relay.build(mod, target)
```

Then the op strategy will be based on the tuning results. On the other hand, it selects schedules based on the default priority order.





---
[Visit Topic](https://discuss.tvm.apache.org/t/tir-after-auto-tuning-what-other-optimizations-based-on-tir-will-be-done/8360/3) 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/b247b0031049ed599f5049a4b4f10424f97ed2c09caba78c5cf91406779a31a9).