Mousius commented on a change in pull request #28:
URL: https://github.com/apache/tvm-rfcs/pull/28#discussion_r710375485



##########
File path: rfcs/0028-command-line-registry-composition.md
##########
@@ -0,0 +1,108 @@
+- Feature Name: Command Line Composition from Internal Registry
+- Start Date: 2021-08-24
+- RFC PR: [apache/tvm-rfcs#28](https://github.com/apache/tvm-rfcs/pull/28)
+- GitHub Issue: [apache/tvm#0000](https://github.com/apache/tvm/issues/0000)
+
+# Summary
+[summary]: #summary
+
+Introducing a standardised form for `tvmc` arguments to be populated from 
internal registries in TVM.
+
+# Motivation
+[motivation]: #motivation
+
+Currently, when a user uses `tvmc`, they present a target string:
+```
+tvmc --target="woofles -mcpu=woof, c -mattr=+mwoof"
+```
+
+Using a target string here means that the entire `--target` argument is used 
as an opaque pass-through to the internal `Target` string parser. It'd be great 
for a user to be able to compose these options and get meaningful help when 
building them up in `tvmc`.

Review comment:
       If we register these all with `argparse`, as an example:
   ```python
   import argparse
   parser = 
argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter)
   parser.add_argument('--target', type=str, help='comma separated target list 
or target string')
   parser.add_argument('--target-c-mcpu', type=str, help='target c mcpu string')
   parser.add_argument('--target-c-mattr', type=str, help='target c mattr 
string')
   parser.add_argument('--target-llvm-mcpu', type=str, help='target llvm mcpu 
string')
   parser.add_argument('--values-llvm-mattr', type=str, help='target lvm mattr 
string')
   args = parser.parse_args()
   print(args)
   ```
   
   Using the default `--help` you get a lot more information for the `Target` 
options than with the opaque string passing:
   ```shell
   $ python3 test.py --help
   usage: test.py [-h] [--target TARGET] [--target-c-mcpu TARGET_C_MCPU] 
[--target-c-mattr TARGET_C_MATTR] [--target-llvm-mcpu TARGET_LLVM_MCPU]
                  [--values-llvm-mattr VALUES_LLVM_MATTR]
   
   optional arguments:
     -h, --help            show this help message and exit
     --target TARGET       comma separated target list or target string 
(default: None)
     --target-c-mcpu TARGET_C_MCPU
                           target c mcpu string (default: None)
     --target-c-mattr TARGET_C_MATTR
                           target c mattr string (default: None)
     --target-llvm-mcpu TARGET_LLVM_MCPU
                           target llvm mcpu string (default: None)
     --values-llvm-mattr VALUES_LLVM_MATTR
                           target lvm mattr string (default: None)
   ```
   
   As a user, I can now read all the options and reason about them without 
having to venture into `target_kind.cc`. 
   
   Is this the kind of example you were looking for?




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