Mousius commented on a change in pull request #28: URL: https://github.com/apache/tvm-rfcs/pull/28#discussion_r714672664
########## File path: rfcs/0028-command-line-registry-composition.md ########## @@ -0,0 +1,153 @@ +- 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. Users coming to TVM should be able to compose these options and get meaningful help when doing that composition with `tvmc`. As an example, using the default `argparse` behaviour, the arguments can be registered as follows: +```python +import argparse +parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter) +parser.add_argument('--target', type=str, help='comma separated target list or target string') + +target_c = parser.add_argument_group('target c') +target_c.add_argument('--target-c-mcpu', type=str, help='target c mcpu string') +target_c.add_argument('--target-c-mattr', type=str, help='target c mattr string') + +target_llvm = parser.add_argument_group('target llvm') +target_llvm.add_argument('--target-llvm-mcpu', type=str, help='target llvm mcpu string') +target_llvm.add_argument('--target-llvm-mattr', type=str, help='target lvm mattr string') + +args = parser.parse_args() +print(args) +``` + +The user can get help for all available target options: +``` +usage: test.py [-h] [--target TARGET] [--target-c-mcpu TARGET_C_MCPU] [--target-c-mattr TARGET_C_MATTR] [--target-llvm-mcpu TARGET_LLVM_MCPU] [--target-llvm-mattr TARGET_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: + --target-c-mcpu TARGET_C_MCPU + target c mcpu string (default: None) Review comment: Given the time it'll take to land this in TVM, I'd rather not make more alternations to registries in this RFC, favouring small focused RFCs which deliver incremental value. I would suggest the concatenated descriptions shown should suffice for an initial implementation? -- 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]
