leeexyz commented on a change in pull request #9817:
URL: https://github.com/apache/tvm/pull/9817#discussion_r778510775



##########
File path: python/tvm/driver/tvmc/common.py
##########
@@ -527,11 +560,44 @@ def get_pass_config_value(name, value, config_type):
             parsed_value = mapping_values.get(value.lower(), None)
 
         if parsed_value is None:
-            raise TVMCException(f"Invalid value '{value}' for configuration 
'{name}'. ")
+            raise TVMCException(f"Invalid value '{value}' for configuration 
'{name}'.")
 
-    if config_type == "runtime.String":
+    elif config_type == "runtime.String":
         parsed_value = value
 
+    elif config_type == "Array":
+        if name == "tir.add_lower_pass":

Review comment:
       @leandron Thanks! What about this simplest one. But the help message is 
kind of messy. It seems argparse has the default width.
   
   ```python
   parser.add_argument(
       "--pass-config",
       action="append",
       metavar=("name=value"),
       help="configurations to be used at compile time. This option can be 
provided multiple "
       "times, each one to set one configuration value, "
       "e.g. '--pass-config relay.backend.use_auto_scheduler=0', "
       "e.g. '--pass-config 
tir.add_lower_pass=opt_level0,tir_pass0,opt_level1,tir_pass1'."
   )
   # help message
   --pass-config name=value
                         configurations to be used at compile time. This option
                         can be provided multiple times, each one to set one
                         configuration value, e.g. '--pass-config
                         relay.backend.use_auto_scheduler=0', e.g. '--pass-
                         config tir.add_lower_pass=opt_level0,tir_pass0,opt_lev
                         el1,tir_pass1'.
   ```
   
   My concern is how we can present the help message usefully and elegantly. 
For `--pass-config`, we want to show it clearly with indents and clarify all 
the usages.
   
   Currently, we have the following configs.
   
   ```python 
   # Relay pass config
   "relay.backend.use_meta_schedule": {"type": "IntImm"}, 
   "relay.fallback_device_type": {"type": "IntImm"}, 
   "relay.FuseOps.max_depth": {"type": "IntImm"}, 
   "relay.backend.use_auto_scheduler": {"type": "IntImm"}
   # TIR pass config
   "tir.detect_global_barrier": {"type": "IntImm"}, 
   "tir.debug_keep_trivial_loop": {"type": "IntImm"}, 
   "tir.disable_vectorize": {"type": "IntImm"}, 
   "tir.noalias": {"type": "IntImm"}, 
   "tir.instrument_bound_checkers": {"type": "IntImm"}, 
   "tir.is_entry_func": {"type": "IntImm"}, 
   "tir.disable_assert": {"type": "IntImm"}, 
   "tir.add_lower_pass": {"type": "Array"}, 
   # Not support yet
   "tir.LoopPartition": {"type": "tir.transform.LoopPartitionConfig"},
   "tir.UnrollLoop": {"type": "tir.transform.UnrollLoopConfig"},
   "tir.HoistIfThenElse": {"type": "tir.transform.HoistIfThenElseConfig"},
   "tir.InjectDoubleBuffer": {"type": 
"tir.transform.InjectDoubleBufferConfig"}, 
   ```




-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to