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/09/22 14:40:35 UTC

[GitHub] [tvm-rfcs] Mousius commented on a change in pull request #30: Command Line Configuration Files

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



##########
File path: rfcs/0030-tvmc-comand-line-configuration-files.md
##########
@@ -0,0 +1,119 @@
+- Feature Name: Command Line Configuration Files
+- Start Date: 2021-08-09
+- RFC PR: [apache/tvm-rfcs#30](https://github.com/apache/tvm-rfcs/pull/30)
+- GitHub Issue: [apache/tvm#0000](https://github.com/apache/tvm/issues/0000)
+
+# Summary
+[summary]: #summary
+
+Collecting common configurations for users of TVM and exposing them gracefully in `tvmc` using a `--config` option.
+
+# Motivation
+[motivation]: #motivation
+
+When a user first approaches TVM, choosing an appropriate configuration can be difficult, this is increasingly true in embedded systems where the configuration is not only a collection of devices but also how those devices are interfaced (see [Arm&reg; Corstone&trade;-300 reference package](https://developer.arm.com/ip-products/subsystem/corstone/corstone-300)). Trying to specify all of this in a target string or via command line arguments would be error prone and tedious. Predefining these in a common format allows users to get started and take the configurations for their own use cases easily.
+
+# Guide-level explanation
+[guide-level-explanation]: #guide-level-explanation
+
+## TVM Hosted Configurations
+Configurations will be stored as [JSON5](https://json5.org/) at `configs/<TYPE>/<NAME>.json`, this top level directory will enable other tooling to load configurations just as easily a `tvmc` and provide easy sign posting for users looking for configurations.
+
+A user coming to `tvmc` will begin with a default configuration which sets sensible defaults, such that `tvmc compile my_model.tflite` works out of the box. This is enabled by a `configs/host/default.json` which is likely to specify:
+
+```
+{
+  targets: [
+    {
+      kind: "llvm"
+    }
+  ]
+}
+```
+
+As a more substantial example, you can imagine an embedded board configuration such as the [Arm&reg; Corstone&trade;-300 reference package](https://developer.arm.com/ip-products/subsystem/corstone/corstone-300), which would exist under `configs/boards/corstone-300.json`:
+
+```json
+{
+  "output_format": "mlf",
+  "executor": {
+    "kind": "aot",
+    "unpacked-api": true
+  },
+  "targets": [
+    {
+      "kind": "ethos-u",
+      "accelerator_config": "ethos-u55-32"
+    },
+    {
+      "kind": "cmsisnn",
+      "mattr": "+fp"
+    },
+    {
+      "kind": "llvm"
+    }
+  ]
+}
+```
+
+This would be used if the user simply specifies `--config=corstone-300`, as in the following example:
+```
+tvmc compile --config=corstone-300 my_model.tflite
+```
+
+## User Provided Configurations
+The default search path, as illustrated above, is to find a matching `<NAME>.json` to an argument `--config=<NAME>`. A user can instead specify a path in the `--config` argument such as:
+
+```bash
+--config=./my.json

Review comment:
       I added some examples, I've specified one `--config` and don't make this more complicated than is necessary. My feeling is we should limit ourselves to one `--config` to make it a simple hierarchy rather than multiple layers of merge-ability.

##########
File path: rfcs/0030-tvmc-comand-line-configuration-files.md
##########
@@ -0,0 +1,119 @@
+- Feature Name: Command Line Configuration Files
+- Start Date: 2021-08-09
+- RFC PR: [apache/tvm-rfcs#30](https://github.com/apache/tvm-rfcs/pull/30)
+- GitHub Issue: [apache/tvm#0000](https://github.com/apache/tvm/issues/0000)
+
+# Summary
+[summary]: #summary
+
+Collecting common configurations for users of TVM and exposing them gracefully in `tvmc` using a `--config` option.
+
+# Motivation
+[motivation]: #motivation
+
+When a user first approaches TVM, choosing an appropriate configuration can be difficult, this is increasingly true in embedded systems where the configuration is not only a collection of devices but also how those devices are interfaced (see [Arm&reg; Corstone&trade;-300 reference package](https://developer.arm.com/ip-products/subsystem/corstone/corstone-300)). Trying to specify all of this in a target string or via command line arguments would be error prone and tedious. Predefining these in a common format allows users to get started and take the configurations for their own use cases easily.
+
+# Guide-level explanation
+[guide-level-explanation]: #guide-level-explanation
+
+## TVM Hosted Configurations
+Configurations will be stored as [JSON5](https://json5.org/) at `configs/<TYPE>/<NAME>.json`, this top level directory will enable other tooling to load configurations just as easily a `tvmc` and provide easy sign posting for users looking for configurations.
+
+A user coming to `tvmc` will begin with a default configuration which sets sensible defaults, such that `tvmc compile my_model.tflite` works out of the box. This is enabled by a `configs/host/default.json` which is likely to specify:
+
+```
+{
+  targets: [
+    {
+      kind: "llvm"
+    }
+  ]
+}
+```
+
+As a more substantial example, you can imagine an embedded board configuration such as the [Arm&reg; Corstone&trade;-300 reference package](https://developer.arm.com/ip-products/subsystem/corstone/corstone-300), which would exist under `configs/boards/corstone-300.json`:
+
+```json
+{
+  "output_format": "mlf",
+  "executor": {
+    "kind": "aot",
+    "unpacked-api": true
+  },
+  "targets": [
+    {
+      "kind": "ethos-u",
+      "accelerator_config": "ethos-u55-32"
+    },
+    {
+      "kind": "cmsisnn",
+      "mattr": "+fp"
+    },
+    {
+      "kind": "llvm"
+    }
+  ]
+}
+```
+
+This would be used if the user simply specifies `--config=corstone-300`, as in the following example:
+```
+tvmc compile --config=corstone-300 my_model.tflite
+```
+
+## User Provided Configurations
+The default search path, as illustrated above, is to find a matching `<NAME>.json` to an argument `--config=<NAME>`. A user can instead specify a path in the `--config` argument such as:
+
+```bash
+--config=./my.json
+--config=/etc/devices/my_secret_board.json
+```
+
+By default, TVM will prefer files explicitly specified as a path instead of hosted files.
+
+## Combination with existing parameters
+In the case of `tvmc`, `--config` will work alongside other arguments. Ideally anything specifiable in JSON will be specifiable in the command line to allow users to make small alterations such as:

Review comment:
       Added:
   ```
   Complex configurations which aren't easily represented well in CLI arguments may exist and can continue to be represented only in JSON.
   ```
   




-- 
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: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org