Relay.build_config optimization level

Hello. i’m a new user of TVM

I have a few questions about Relay.

when i build network with build_config option like below code

with relay.transform.build_config( opt_level = 0 ):
    graph_json , Lib , params = tvm.relay.build_module.build( mod ,target='cuda' )

As you can see from this documentation, I know that the most of Relay.transform.pass optimization does not applied if opt_level = 0. However, to check which pass is applied when i compile network, i modify source code and print relay opt pass when use them. but as shown in below picture.

image

they apply more optimization pass like FuseOps that applied when opt_level = 1. i think few opt level Pass applied in this situtation but does not…

Can someone explain this?

Hi alpha930,

I don’t know whether you have got the answer. It not, hope my reply will help you.

I’m new user of TVM too. After reading source code to understand when optimization passes are applied, I’d like to give my views on your question.

I don’t know where you modified source code, maybe you modified at the wrong position. You can see in the src/relay/backend/build_module.cc file(about #325 line), many passes are pushed back pass_seqs, and a sequential pass is created by pass_seqs. The construction of sequential pass will determine which passes will be reserved according to opt_level. You can see the related codes in src/relay/pass/pass_manager.cc(about 405 line), SequentialNode will traverse all passes to check whether this pass is enabled. You can modify pass_manager.cc to see which passes are allowed.

Hi Jie-Fang

Thank you for answer. The part that you menthioned seems to be the key. I looked up and found something like what you said and am using it as I want. Thank you so much for the answer!