This is an automated email from the ASF dual-hosted git repository.
tqchen pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-tvm.git
The following commit(s) were added to refs/heads/master by this push:
new c1627aa [BUILD] Fix VTA build in CI (#5165)
c1627aa is described below
commit c1627aadb6b91e264f4ed0087b80a9043551dd9d
Author: Tianqi Chen <[email protected]>
AuthorDate: Sat Mar 28 22:33:38 2020 -0700
[BUILD] Fix VTA build in CI (#5165)
---
cmake/modules/VTA.cmake | 2 +-
vta/python/vta/environment.py | 2 +-
vta/vta-hw/config/vta_config.py | 18 ++++++++++++++----
3 files changed, 16 insertions(+), 6 deletions(-)
diff --git a/cmake/modules/VTA.cmake b/cmake/modules/VTA.cmake
index c709de4..571f037 100644
--- a/cmake/modules/VTA.cmake
+++ b/cmake/modules/VTA.cmake
@@ -20,7 +20,7 @@ find_program(PYTHON NAMES python python3 python3.6)
# Throw error if VTA_HW_PATH is not set
if(NOT DEFINED ENV{VTA_HW_PATH})
- set(ENV{VTA_HW_PATH} vta/vta-hw)
+ set(ENV{VTA_HW_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/vta/vta-hw)
endif()
if(MSVC)
diff --git a/vta/python/vta/environment.py b/vta/python/vta/environment.py
index 22ae0f9..ddd6b7a 100644
--- a/vta/python/vta/environment.py
+++ b/vta/python/vta/environment.py
@@ -30,7 +30,7 @@ def get_vta_hw_path():
curr_path = os.path.dirname(os.path.abspath(os.path.expanduser(__file__)))
vta_hw_default = os.path.abspath(os.path.join(curr_path, "../../vta-hw"))
VTA_HW_PATH = os.getenv('VTA_HW_PATH', vta_hw_default)
- return VTA_HW_PATH
+ return os.path.abspath(VTA_HW_PATH)
def pkg_config(cfg):
"""Returns PkgConfig pkg config object."""
diff --git a/vta/vta-hw/config/vta_config.py b/vta/vta-hw/config/vta_config.py
index 3b84076..9bb6d7b 100644
--- a/vta/vta-hw/config/vta_config.py
+++ b/vta/vta-hw/config/vta_config.py
@@ -108,11 +108,21 @@ def main():
return
# Path to vta config
- config_path = "vta_config.json"
- if not os.path.exists(config_path):
- raise RuntimeError("Cannot find config in %s" % str(config_path))
- cfg = json.load(open(config_path))
+ curr_path = os.path.dirname(
+ os.path.abspath(os.path.expanduser(__file__)))
+ path_list = [
+ "vta_config.json", os.path.join(curr_path, "vta_config.json")
+ ]
+
+ if args.use_cfg:
+ path_list = [args.use_cfg]
+
+ ok_path_list = [p for p in path_list if os.path.exists(p)]
+ if not ok_path_list:
+ raise RuntimeError("Cannot find config in %s" % str(path_list))
+
+ cfg = json.load(open(ok_path_list[0]))
pkg = pkg_config(cfg)
if args.target: