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/12/06 07:47:39 UTC

[GitHub] [tvm] areusch opened a new pull request #9654: Document Project API server.

areusch opened a new pull request #9654:
URL: https://github.com/apache/tvm/pull/9654


   @gromero @mehrdadh 
   
   #8595 
   


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



[GitHub] [tvm] areusch merged pull request #9654: Document Project API server.

Posted by GitBox <gi...@apache.org>.
areusch merged pull request #9654:
URL: https://github.com/apache/tvm/pull/9654


   


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



[GitHub] [tvm] leandron commented on a change in pull request #9654: Document Project API server.

Posted by GitBox <gi...@apache.org>.
leandron commented on a change in pull request #9654:
URL: https://github.com/apache/tvm/pull/9654#discussion_r763202014



##########
File path: docs/arch/microtvm_project_api.rst
##########
@@ -0,0 +1,151 @@
+..  Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+
+..    http://www.apache.org/licenses/LICENSE-2.0
+
+..  Unless required by applicable law or agreed to in writing,
+    software distributed under the License is distributed on an
+    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    KIND, either express or implied.  See the License for the
+    specific language governing permissions and limitations
+    under the License.
+
+.. _microtvm_project_api:
+
+microTVM Project API
+====================
+
+About microTVM Project API
+--------------------------
+
+The microTVM Project API allows TVM to automatically run models on
+unconventional or embedded platforms. It allows platforms to define a standard
+function to integrate TVM compiler output with boilerplate platform-specific
+code, producing a runnable **Project**. Project API then further defines
+functions to build that project, program compatible devices accessible from the
+TVM machine, and communicate with the running code so that TVM can perform
+host-driven inference and autotuning.
+
+There are many cases where it might be desirable simply to invoke microTVM as a
+tool from your platform's build process. Indeed, for the average firmware
+developer, this is likely to be all they need. However, there are a couple of
+use cases when you may want to teach microTVM how to build firmware using your
+platform's build tool:
+
+1.  To enable AutoTVM and AutoScheduling on your platform. Defining a Project
+    API implementation allows TVM to tune models for peak performance on your
+    platform.
+2.  To enable engineers without firmware expertise to experiment with models on
+    your platform. Defining a Project API implementation allows these engineers
+    to leverage the standard TVM Python workflows to perform host-driven
+    inference on your platform.
+3.  Integration Testing. Defining a Project API implementation allows you to
+    create Continuous Integration Tests which verify model correctness and
+    performance on your platform.
+
+API Definition
+--------------
+
+The full API is the ``abstractmethod`` defined on ``ProjectAPIHandler`` in
+`python/tvm/micro/project_api/server.py <https://github.com/apache/tvm/blob/main/python/tvm/micro/project_api/server.py>`_.
+Rather than duplicate the documentation here, we simply refer you to that class.
+
+How TVM uses Project API
+------------------------
+
+This section explains how the Project API should be used with TVM. Project API
+is defined around the *Project* as the buildable unit of firmware. TVM expects
+to be provided initially with a directory containing a *Template Project*, which
+together with a :ref:`Model Library Format <model_library_format>` file can be
+built into a runnable project.
+
+Inside the Template Directory is (typically) a Python script implementing the
+API server. TVM launches this script in a subprocess and sends commands to the
+server to perform each of the actions outlined above.
+
+The typical usage flow is as follows:
+
+1. Launch Project API server in Template Project.
+2. Verify the API server is version-compatible with TVM, plus read properties
+   of the implementation, by sending ``server_info_query`` command.
+3. Generate a new project by sending command ``generate_project`` to create a
+   new project. The arguments to this command is a Model Library Format and a
+   non-existent directory which should be populated with the generated
+   project. The Template Project API server should copy itself into the
+   newly-generated project.
+4. Terminate the Template Project API server.
+
+4. Launch Project API server in Generated Project.
+5. Verify the API server is version-compatible with TVM, plus read properties
+   of the implementation, by sending ``server_info_query`` command.
+6. Build and flash the projec by sending commands ``build`` and ``flash`` to the
+   API server.
+7. Communicate with the target. Send command ``open_transport`` followed by
+   commands ``write_transport`` and ``read_transport`` to write and read from
+   e.g. a serial port attached to the target. Upon completion,
+   ``close_transport`` is sent.
+8. Terminate Project API server.
+

Review comment:
       ```suggestion
   4. Terminate the Template Project API server.
   5. Launch Project API server in Generated Project.
   6. Verify the API server is version-compatible with TVM, plus read properties
      of the implementation, by sending ``server_info_query`` command.
   7. Build and flash the projec by sending commands ``build`` and ``flash`` to the
      API server.
   8. Communicate with the target. Send command ``open_transport`` followed by
      commands ``write_transport`` and ``read_transport`` to write and read from
      e.g. a serial port attached to the target. Upon completion,
      ``close_transport`` is sent.
   9. Terminate Project API server.
   
   ```




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



[GitHub] [tvm] leandron commented on a change in pull request #9654: Document Project API server.

Posted by GitBox <gi...@apache.org>.
leandron commented on a change in pull request #9654:
URL: https://github.com/apache/tvm/pull/9654#discussion_r763203500



##########
File path: docs/arch/microtvm_project_api.rst
##########
@@ -0,0 +1,151 @@
+..  Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+
+..    http://www.apache.org/licenses/LICENSE-2.0
+
+..  Unless required by applicable law or agreed to in writing,
+    software distributed under the License is distributed on an
+    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    KIND, either express or implied.  See the License for the
+    specific language governing permissions and limitations
+    under the License.
+
+.. _microtvm_project_api:
+
+microTVM Project API
+====================
+
+About microTVM Project API
+--------------------------
+
+The microTVM Project API allows TVM to automatically run models on
+unconventional platforms. It allows platforms to define a standard function to

Review comment:
       ack. It is more clear now.




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



[GitHub] [tvm] leandron commented on a change in pull request #9654: Document Project API server.

Posted by GitBox <gi...@apache.org>.
leandron commented on a change in pull request #9654:
URL: https://github.com/apache/tvm/pull/9654#discussion_r762938670



##########
File path: docs/arch/microtvm_project_api.rst
##########
@@ -0,0 +1,151 @@
+..  Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+
+..    http://www.apache.org/licenses/LICENSE-2.0
+
+..  Unless required by applicable law or agreed to in writing,
+    software distributed under the License is distributed on an
+    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    KIND, either express or implied.  See the License for the
+    specific language governing permissions and limitations
+    under the License.
+
+.. _microtvm_project_api:
+
+microTVM Project API
+====================
+
+About microTVM Project API
+--------------------------
+
+The microTVM Project API allows TVM to automatically run models on
+unconventional platforms. It allows platforms to define a standard function to

Review comment:
       I think the use of `unconventional` here makes this sentence a bit vague, perhaps we could just say _embedded_ (?), given the paragraph goes towards producing a _firmware_, which then makes everything more specific.




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



[GitHub] [tvm] areusch commented on a change in pull request #9654: Document Project API server.

Posted by GitBox <gi...@apache.org>.
areusch commented on a change in pull request #9654:
URL: https://github.com/apache/tvm/pull/9654#discussion_r763200681



##########
File path: docs/arch/microtvm_project_api.rst
##########
@@ -0,0 +1,151 @@
+..  Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+
+..    http://www.apache.org/licenses/LICENSE-2.0
+
+..  Unless required by applicable law or agreed to in writing,
+    software distributed under the License is distributed on an
+    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    KIND, either express or implied.  See the License for the
+    specific language governing permissions and limitations
+    under the License.
+
+.. _microtvm_project_api:
+
+microTVM Project API
+====================
+
+About microTVM Project API
+--------------------------
+
+The microTVM Project API allows TVM to automatically run models on
+unconventional platforms. It allows platforms to define a standard function to

Review comment:
       added "unconventional or embedded," maybe that helps. agree unconventional is a bit vague but given the example make flow i do think it's a bit limiting. the concept i want to convey here is "deploy in scenarios where you have to build code using an external build tool."




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