You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by GitBox <gi...@apache.org> on 2021/04/09 17:30:27 UTC

[GitHub] [tvm] leandron commented on a change in pull request #7816: [TVMC] --disable-pass option added to compile mode

leandron commented on a change in pull request #7816:
URL: https://github.com/apache/tvm/pull/7816#discussion_r610794514



##########
File path: python/tvm/driver/tvmc/compiler.py
##########
@@ -95,6 +95,12 @@ def add_compile_parser(subparsers):
         type=common.parse_shape_string,
         default=None,
     )
+    parser.add_argument(
+        "--disabled-pass",
+        help="disable specific passes, comma-separated list of pass names",

Review comment:
       Is there a way to obtain a list of all valid passes so that we can show in the help option, or is it too many?

##########
File path: python/tvm/driver/tvmc/common.py
##########
@@ -333,6 +333,29 @@ def tracker_host_port_from_cli(rpc_tracker_str):
     return rpc_hostname, rpc_port
 
 
+def parse_disabled_pass(input_string):
+    """Parse an input string for disabled passes
+
+    Parameters
+    ----------
+    input_string: str
+        Possibly comma-separated string with the names of disabled passes
+
+    Returns
+    -------
+    list: a list of disabled passes.
+    """
+    if input_string is not None:
+        pass_list = input_string.split(",")
+        nf = [_ for _ in pass_list if tvm.get_global_func("relay._transform." + _, True) is None]
+        if len(nf) > 0:
+            raise argparse.ArgumentTypeError(
+                "Following passes are not registered within tvm: " + str(nf)
+            )
+        return pass_list
+    return None

Review comment:
       Once `if input_string is not None:` is removed, this can be removed as well.




-- 
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:
users@infra.apache.org