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/21 12:44:52 UTC

[GitHub] [tvm] PENGUINLIONG opened a new pull request #7897: Enable StackVM in AutoTVM

PENGUINLIONG opened a new pull request #7897:
URL: https://github.com/apache/tvm/pull/7897


   It turns out in my edge use case StackVM is rather useful because it's minimum. I think it can help if tuning via StackVM can be officially supported.


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



[GitHub] [tvm] tqchen commented on a change in pull request #7897: Enable StackVM in AutoTVM

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



##########
File path: python/tvm/contrib/stackvm.py
##########
@@ -0,0 +1,48 @@
+# 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.
+
+"""Dummy StackVM build function."""
+# pylint: disable=invalid-name
+from __future__ import absolute_import as _abs
+import os
+import shutil
+import subprocess
+from . import utils
+from .._ffi.base import py_str
+
+
+def stackvm(output, files):

Review comment:
       rename to build




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



[GitHub] [tvm] tqchen merged pull request #7897: Enable StackVM in AutoTVM

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


   


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



[GitHub] [tvm] tqchen commented on a change in pull request #7897: Enable StackVM in AutoTVM

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



##########
File path: python/tvm/contrib/stackvm.py
##########
@@ -0,0 +1,48 @@
+# 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.
+
+"""Dummy StackVM build function."""
+# pylint: disable=invalid-name
+from __future__ import absolute_import as _abs
+import os
+import shutil
+import subprocess
+from . import utils
+from .._ffi.base import py_str
+
+
+def stackvm(output, files):

Review comment:
       rename to build




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



[GitHub] [tvm] PENGUINLIONG commented on a change in pull request #7897: Enable StackVM in AutoTVM

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



##########
File path: python/tvm/autotvm/measure/measure_methods.py
##########
@@ -485,9 +488,8 @@ def __call__(self, measure_input, tmp_dir, **kwargs):
         """
         tic = time.time()
         try:
-            filename = os.path.join(
-                tmp_dir, "tmp_func_%0x.%s" % (getrandbits(64), self.build_func.output_format)
-            )
+            output_format = "stackvm" if self.build_func is None else self.build_func.output_format

Review comment:
       I set the stackvm `build_func` to `None` because I found [this](https://github.com/apache/tvm/blob/83baec30d4418ac1470c696097913aafbfc8ad48/python/tvm/runtime/module.py#L323-L330) in existing code. In that segment of code, stackvm is calling `Module.save()` to dump stackvm binary when the input `build_func` is `None`, while the function further calls a TVM runtime API `ModuleSaveToFile()`. I can certainly make it a `build_func` for it but I'm a bit uncertain whether it's suitable to place it among those `contrib` ones.




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



[GitHub] [tvm] tqchen commented on pull request #7897: Enable StackVM in AutoTVM

Posted by GitBox <gi...@apache.org>.
tqchen commented on pull request #7897:
URL: https://github.com/apache/tvm/pull/7897#issuecomment-826791607


   THanks @PENGUINLIONG !


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



[GitHub] [tvm] tqchen commented on a change in pull request #7897: Enable StackVM in AutoTVM

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



##########
File path: python/tvm/autotvm/measure/measure_methods.py
##########
@@ -485,9 +488,8 @@ def __call__(self, measure_input, tmp_dir, **kwargs):
         """
         tic = time.time()
         try:
-            filename = os.path.join(
-                tmp_dir, "tmp_func_%0x.%s" % (getrandbits(64), self.build_func.output_format)
-            )
+            output_format = "stackvm" if self.build_func is None else self.build_func.output_format

Review comment:
       This seems to to be a really specialized default, can you introduce a stackvm build func instead?




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



[GitHub] [tvm] tqchen commented on a change in pull request #7897: Enable StackVM in AutoTVM

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



##########
File path: python/tvm/autotvm/measure/measure_methods.py
##########
@@ -485,9 +488,8 @@ def __call__(self, measure_input, tmp_dir, **kwargs):
         """
         tic = time.time()
         try:
-            filename = os.path.join(
-                tmp_dir, "tmp_func_%0x.%s" % (getrandbits(64), self.build_func.output_format)
-            )
+            output_format = "stackvm" if self.build_func is None else self.build_func.output_format

Review comment:
       i think making build_func is more consistent than putting the logic inside.




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



[GitHub] [tvm] PENGUINLIONG commented on a change in pull request #7897: Enable StackVM in AutoTVM

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



##########
File path: python/tvm/autotvm/measure/measure_methods.py
##########
@@ -485,9 +488,8 @@ def __call__(self, measure_input, tmp_dir, **kwargs):
         """
         tic = time.time()
         try:
-            filename = os.path.join(
-                tmp_dir, "tmp_func_%0x.%s" % (getrandbits(64), self.build_func.output_format)
-            )
+            output_format = "stackvm" if self.build_func is None else self.build_func.output_format

Review comment:
       I set the stackvm `build_func` to `None` because I found [this](https://github.com/apache/tvm/blob/83baec30d4418ac1470c696097913aafbfc8ad48/python/tvm/runtime/module.py#L323-L330) in existing code. In that segment of code, stackvm is calling `Module.save()` to dump stackvm binary, while the function further called a TVM runtime API `ModuleSaveToFile`. I can certainly make it a `build_func` for it but I'm a bit uncertain whether it's suitable to place it among those `contrib` ones.




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