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 2022/04/19 16:35:10 UTC

[GitHub] [tvm] leandron opened a new pull request, #11063: [TVMC] Add configuration json files to the Python package

leandron opened a new pull request, #11063:
URL: https://github.com/apache/tvm/pull/11063

   Add the `configs` directory to be part of the installed version of TVM in the setuptools configuration, and introduce a new function to load the `configs` directory from the right paths both when TVM is locally installed for development, as well as, when it is installed as a package.
   
   This builds on top of https://github.com/apache/tvm/pull/11012, just adding support for the files to be added in the package. More testing needs to be added (planning for that in future patches) to support some system testing of the packaged version of TVM.
   
   cc @Mousius @gromero @areusch for reviews


-- 
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] Mousius commented on pull request #11063: [TVMC] Add configuration json files to the Python package

Posted by GitBox <gi...@apache.org>.
Mousius commented on PR #11063:
URL: https://github.com/apache/tvm/pull/11063#issuecomment-1103926905

   Wheely appreciate the fix @leandron !


-- 
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 diff in pull request #11063: [TVMC] Add configuration json files to the Python package

Posted by GitBox <gi...@apache.org>.
leandron commented on code in PR #11063:
URL: https://github.com/apache/tvm/pull/11063#discussion_r853909424


##########
python/tvm/driver/tvmc/config_options.py:
##########
@@ -21,8 +21,47 @@
 """
 import os
 import json
+
+from tvm._ffi import libinfo
 from tvm.driver.tvmc import TVMCException
 
+CONFIGS_JSON_DIR = None
+
+
+class ConfigsJsonNotFoundError(TVMCException):
+    """Raised when the JSON configs dirtree cannot be found."""
+
+
+def get_configs_json_dir() -> str:
+    """Find the 'configs' directory, containing the JSON files used to configure tvmc
+    with persistent argument settings.
+
+    Returns
+    -------
+    str :
+        The path to the 'configs' directory
+    """
+    global CONFIGS_JSON_DIR
+    if CONFIGS_JSON_DIR is None:
+        candidate_paths = []
+        candidate_paths.extend(libinfo.find_lib_path())
+        # When running from source, the configs directory will be located one directory above the
+        # native libraries, so covering that case.
+        candidate_paths.extend(
+            [os.path.abspath(os.path.join(lib_path, "..")) for lib_path in libinfo.find_lib_path()]
+        )
+        for path in candidate_paths:
+            print(f"{path}")

Review Comment:
   🤦 



-- 
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] Mousius commented on a diff in pull request #11063: [TVMC] Add configuration json files to the Python package

Posted by GitBox <gi...@apache.org>.
Mousius commented on code in PR #11063:
URL: https://github.com/apache/tvm/pull/11063#discussion_r853898658


##########
python/tvm/driver/tvmc/config_options.py:
##########
@@ -21,8 +21,47 @@
 """
 import os
 import json
+
+from tvm._ffi import libinfo
 from tvm.driver.tvmc import TVMCException
 
+CONFIGS_JSON_DIR = None
+
+
+class ConfigsJsonNotFoundError(TVMCException):
+    """Raised when the JSON configs dirtree cannot be found."""
+
+
+def get_configs_json_dir() -> str:
+    """Find the 'configs' directory, containing the JSON files used to configure tvmc
+    with persistent argument settings.
+
+    Returns
+    -------
+    str :
+        The path to the 'configs' directory
+    """
+    global CONFIGS_JSON_DIR
+    if CONFIGS_JSON_DIR is None:
+        candidate_paths = []
+        candidate_paths.extend(libinfo.find_lib_path())
+        # When running from source, the configs directory will be located one directory above the
+        # native libraries, so covering that case.
+        candidate_paths.extend(
+            [os.path.abspath(os.path.join(lib_path, "..")) for lib_path in libinfo.find_lib_path()]
+        )
+        for path in candidate_paths:
+            print(f"{path}")

Review Comment:
   @leandron I just spotted this rogue `print` 👻  can you remove it? I imagine it will always print this path when you run tvmc?



-- 
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] Mousius merged pull request #11063: [TVMC] Add configuration json files to the Python package

Posted by GitBox <gi...@apache.org>.
Mousius merged PR #11063:
URL: https://github.com/apache/tvm/pull/11063


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