From 9db961d2e0fc9b48f47e375c6f4dfa07b2aecd9c Mon Sep 17 00:00:00 2001 From: Andrew Reusch Date: Fri, 22 Jan 2021 17:34:19 -0800 Subject: [PATCH 01/13] Build microTVM using standalone_crt in build tree. --- cmake/modules/StandaloneCrt.cmake | 8 +- pyproject.toml | 93 ++++++++++++ python/tvm/micro/__init__.py | 4 +- python/tvm/micro/build.py | 173 +++++++++++++++------- python/tvm/micro/compiler.py | 3 +- tests/micro/qemu/test_zephyr.py | 3 +- tests/python/unittest/test_crt.py | 12 +- tests/python/unittest/test_link_params.py | 12 +- tutorials/micro/micro_tflite.py | 12 +- 9 files changed, 232 insertions(+), 88 deletions(-) diff --git a/cmake/modules/StandaloneCrt.cmake b/cmake/modules/StandaloneCrt.cmake index 411d0383faf4..dc1b3b2665f2 100644 --- a/cmake/modules/StandaloneCrt.cmake +++ b/cmake/modules/StandaloneCrt.cmake @@ -45,12 +45,14 @@ if(USE_MICRO) "src/runtime/crt/common *.c -> src/runtime/crt/common" "src/runtime/crt/graph_runtime *.c -> src/runtime/crt/graph_runtime" "src/runtime/crt/graph_runtime_module *.c -> src/runtime/crt/graph_runtime_module" - "src/runtime/crt/host crt_config.h -> src/runtime/crt/host" + "src/runtime/crt/host crt_config.h -> template/host" + "src/runtime/crt/host *.cc -> template/host" "src/runtime/crt/memory *.c -> src/runtime/crt/memory" "src/runtime/crt/utvm_rpc_common *.cc -> src/runtime/crt/utvm_rpc_common" "src/runtime/crt/utvm_rpc_server *.cc -> src/runtime/crt/utvm_rpc_server" "src/runtime/minrpc *.h -> src/runtime/minrpc" "src/support generic_arena.h -> src/support" + "src/runtime/crt crt_config-template.h -> template" ) set(standalone_crt_base "${CMAKE_CURRENT_BINARY_DIR}/standalone_crt") @@ -101,9 +103,7 @@ if(USE_MICRO) endforeach() set(make_common_args - "DLPACK_INCLUDE_DIR=${CMAKE_SOURCE_DIR}/3rdparty/dlpack/include" - "TVM_INCLUDE_DIR=${CMAKE_CURRENT_BINARY_DIR}/standalone_crt/include" - "CRT_CONFIG=src/runtime/crt/host/crt_config.h" + "CRT_CONFIG=template/host/crt_config.h" "BUILD_DIR=${host_build_dir_abspath}" "EXTRA_CFLAGS=-fPIC" "EXTRA_CXXFLAGS=-fPIC" diff --git a/pyproject.toml b/pyproject.toml index 5cca711ddbe6..79175f687aa4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -46,3 +46,96 @@ exclude = ''' )/ ) ''' +[tool.poetry] +name = "tvm" +version = "0.1.0" +description = "" +authors = ["Your Name "] +packages = [ + { include = "tvm", from = "python" }, +] + +[tool.poetry.dependencies] +attrs = "^19" +decorator = "^4.4" +numpy = "~1.19" +psutil = "^5" +scipy = "^1.4" +python = "^3.6" +tornado = "^6" +typed_ast = "^1.4" + +# AutoTVM +xgboost = {version = "^1.1", optional = true} + +############# +# Importers # +############# + +# NOTE: Caffe frontend dependency is from torch package. + +# CoreML +coremltools = {version = "^3.3", optional = true} + +# Darknet +opencv-python = {version = "^4.2", optional = true} +cffi = {version = "^1.14", optional = true} + +# NOTE: Keras provided by tensorflow package. +# If TF version conflict, maybe try: keras = "2.3.1" + +# MXNet frontend +mxnet = {version = "^1.6.0", optional = true} + +# ONNX frontend +onnx = {version = "1.6.0", optional = true} +onnxruntime = {version = "1.0.0", optional = true} + +# Pytorch (also used by ONNX) +# NOTE: cannot download this right now due to https://github.com/python-poetry/poetry/issues/2247 +# torch = {url = "https://download.pytorch.org/whl/cu101/torch-1.4.0-cp36-cp36m-manylinux1_x86_64.whl", optional = true} +# torchvision = {version = "0.5.0", optional = true} +# NOTE: torch depends on a number of other packages, but unhelpfully, does not expose that in the +# wheel!!! +future = {version = "*", optional = true} + +# Tensorflow frontend +tensorflow = {version = "^2.1", optional = true} +tensorflow-estimator = {version = "^2.1", optional = true} + +# TFLite frontend +tflite = {version = "2.1.0", optional = true} +wheel = "*" + + +[tool.poetry.extras] +xgboost = ["xgboost"] +importer-caffe2 = ["torch"] +importer-coreml = ["coremltools"] +importer-darknet = ["opencv-python"] +importer-keras = ["tensorflow", "tensorflow-estimator"] +importer-onnx = ["onnx", "onnxruntime", "torch", "torchvision", "future"] +importer-pytorch = ["torch", "torchvision", "future"] +importer-tensorflow = ["tensorflow", "tensorflow-estimator"] +importer-tflite = ["tflite", "tensorflow", "tensorflow-estimator"] + +[tool.poetry.dev-dependencies] +autodocsumm = "^0.1" +black = "^19.10b0" +sphinx = "^3.0" +sphinx-gallery = "^0.8" +sphinx-rtd-theme = "^0.4" +matplotlib = "^3.2" +Image = "^1.5" +recommonmark = "^0.6" +pillow = "< 7" +pyformat = "^0.7" +pylint = "^2.4" +pytest = "^5.4" + +[build-system] +requires = ["poetry>=0.12"] +build-backend = "poetry.masonry.api" + +[tool.autopep8] +max_line_length = 100 diff --git a/python/tvm/micro/__init__.py b/python/tvm/micro/__init__.py index a6e24343e378..299b143eb5de 100644 --- a/python/tvm/micro/__init__.py +++ b/python/tvm/micro/__init__.py @@ -17,8 +17,8 @@ """MicroTVM module for bare-metal backends""" from .artifact import Artifact -from .build import build_static_runtime, default_options, TVM_ROOT_DIR -from .build import CRT_ROOT_DIR, Workspace +from .build import build_static_runtime, default_options, get_standalone_crt_dir +from .build import get_standalone_crt_lib, Workspace from .compiler import Compiler, DefaultCompiler, Flasher from .debugger import GdbRemoteDebugger from .micro_library import MicroLibrary diff --git a/python/tvm/micro/build.py b/python/tvm/micro/build.py index cad385b9b190..bc4ea992ef29 100644 --- a/python/tvm/micro/build.py +++ b/python/tvm/micro/build.py @@ -21,9 +21,11 @@ import logging import os import re +import typing from tvm.contrib import utils from .micro_library import MicroLibrary +from .._ffi import libinfo _LOG = logging.getLogger(__name__) @@ -55,15 +57,62 @@ def path(self): CRT_RUNTIME_LIB_NAMES = ["utvm_rpc_server", "utvm_rpc_common", "common"] -TVM_ROOT_DIR = os.path.realpath(os.path.join(os.path.dirname(__file__), "..", "..", "..")) +STANDALONE_CRT_DIR = None -CRT_ROOT_DIR = os.path.join(TVM_ROOT_DIR, "src", "runtime", "crt") +class CrtNotFoundError(Exception): + """Raised when the standalone CRT dirtree cannot be found.""" -RUNTIME_LIB_SRC_DIRS = [os.path.join(CRT_ROOT_DIR, n) for n in CRT_RUNTIME_LIB_NAMES] + [ - os.path.join(TVM_ROOT_DIR, "3rdparty/libcrc/src") -] +def get_standalone_crt_dir() -> str: + """Find the standalone_crt directory. + + Though the C runtime source lives in the tvm tree, it is intended to be distributed with any + binary build of TVM. This source tree is intended to be integrated into user projects to run + models targeted with --runtime=c. + + Returns + ------- + str : + The path to the standalone_crt + """ + global STANDALONE_CRT_DIR + if STANDALONE_CRT_DIR is None: + for path in libinfo.find_lib_path(): + crt_path = os.path.join(os.path.dirname(path), "standalone_crt") + if os.path.isdir(crt_path): + STANDALONE_CRT_DIR = crt_path + break + + else: + raise CrtNotFoundError() + + return STANDALONE_CRT_DIR + + +def get_standalone_crt_lib(name : str) -> str: + """Find a source library directory in the standalone_crt. + + The standalone C runtime is split into various libraries (one per directory underneath + src/runtime/crt). This convenience function returns the full path to one of those libraries + located in get_standalone_crt_dir(). + + Parameters + ---------- + name : str + Name of the library subdirectory underneath src/runtime/crt. + + Returns + ------- + str : + The full path to the the library. + """ + return os.path.join(get_standalone_crt_dir(), "src", "runtime", "crt", name) + + +def get_runtime_libs() -> str: + """Return abspath to all CRT directories which contain source (i.e. not header) files.""" + return [get_standalone_crt_lib(n) for n in CRT_RUNTIME_LIB_NAMES] RUNTIME_SRC_REGEX = re.compile(r"^.*\.cc?$", re.IGNORECASE) @@ -72,52 +121,73 @@ def path(self): _COMMON_CFLAGS = ["-Wall", "-Werror"] -_CRT_DEFAULT_OPTIONS = { - "cflags": ["-std=c11"] + _COMMON_CFLAGS, - "ccflags": ["-std=c++11"] + _COMMON_CFLAGS, - "ldflags": ["-std=c++11"], - "include_dirs": [ - f"{TVM_ROOT_DIR}/include", - f"{TVM_ROOT_DIR}/3rdparty/dlpack/include", - f"{TVM_ROOT_DIR}/3rdparty/libcrc/include", - f"{TVM_ROOT_DIR}/3rdparty/dmlc-core/include", - f"{CRT_ROOT_DIR}/include", - ], -} +def _build_default_compiler_options(standalone_crt_dir : typing.Optional[str]=None) -> str: + """Return a dict containing base compile flags for the CRT under gcc common to . + Parameters + ---------- + standalone_crt_dir : Optional[str] + If given, the path to the standalone_crt + """ + if standalone_crt_dir is None: + standalone_crt_dir = get_standalone_crt_dir() + return { + "cflags": ["-std=c11"] + _COMMON_CFLAGS, + "ccflags": ["-std=c++11"] + _COMMON_CFLAGS, + "ldflags": ["-std=c++11"], + "include_dirs": [os.path.join(standalone_crt_dir, "include")], + } -_CRT_GENERATED_LIB_OPTIONS = copy.copy(_CRT_DEFAULT_OPTIONS) +def default_options(crt_config_include_dir, standalone_crt_dir=None): + """Return default opts passed to Compile commands. -# Disable due to limitation in the TVM C codegen, which generates lots of local variable -# declarations at the top of generated code without caring whether they're used. -# Example: -# void* arg0 = (((TVMValue*)args)[0].v_handle); -# int32_t arg0_code = ((int32_t*)arg_type_ids)[(0)]; -_CRT_GENERATED_LIB_OPTIONS["cflags"].append("-Wno-unused-variable") -_CRT_GENERATED_LIB_OPTIONS["ccflags"].append("-Wno-unused-variable") + Parameters + ---------- + crt_config_include_dir : str + Path to a directory containing crt_config.h for the target. This will be appended + to the include path for cflags and ccflags. + standalone_crt_dir : Optional[str] + Returns + ------- + Dict : + A dictionary containing 3 subkeys, each whose value is _build_default_compiler_options() + plus additional customization. + - "bin_opts" - passed as "options" to Compiler.binary() when building MicroBinary. + - "lib_opts" - passed as "options" to Compiler.library() when building bundled CRT + libraries (or otherwise, non-generated libraries). + - "generated_lib_opts" - passed as "options" to Compiler.library() when building the + generated library. + """ + bin_opts = _build_default_compiler_options() + bin_opts["include_dirs"].append(crt_config_include_dir) + + lib_opts = _build_default_compiler_options() + lib_opts["cflags"] = ["-Wno-error=incompatible-pointer-types"] + lib_opts["include_dirs"].append(crt_config_include_dir) -# Many TVM-intrinsic operators (i.e. expf, in particular) -_CRT_GENERATED_LIB_OPTIONS["cflags"].append("-fno-builtin") + generated_lib_opts = copy.copy(lib_opts) + # Disable due to limitation in the TVM C codegen, which generates lots of local variable + # declarations at the top of generated code without caring whether they're used. + # Example: + # void* arg0 = (((TVMValue*)args)[0].v_handle); + # int32_t arg0_code = ((int32_t*)arg_type_ids)[(0)]; + generated_lib_opts["cflags"].append("-Wno-unused-variable") + generated_lib_opts["ccflags"].append("-Wno-unused-variable") -def default_options(target_include_dir): - """Return default opts passed to Compile commands.""" - bin_opts = copy.deepcopy(_CRT_DEFAULT_OPTIONS) - bin_opts["include_dirs"].append(target_include_dir) - lib_opts = copy.deepcopy(bin_opts) - lib_opts["cflags"] = ["-Wno-error=incompatible-pointer-types"] - return {"bin_opts": bin_opts, "lib_opts": lib_opts} + # Many TVM-intrinsic operators (i.e. expf, in particular) + generated_lib_opts["cflags"].append("-fno-builtin") + + return {"bin_opts": bin_opts, "lib_opts": lib_opts, "generated_lib_opts": generated_lib_opts} def build_static_runtime( workspace, compiler, module, - lib_opts=None, - bin_opts=None, - generated_lib_opts=None, + compiler_options=None, extra_libs=None, ): """Build the on-device runtime, statically linking the given modules. @@ -130,15 +200,11 @@ def build_static_runtime( module : IRModule Module to statically link. - lib_opts : Optional[dict] - The `options` parameter passed to compiler.library(). - - bin_opts : Optional[dict] - The `options` parameter passed to compiler.binary(). - - generated_lib_opts : Optional[dict] - The `options` parameter passed to compiler.library() when compiling the generated TVM C - source module. + compiler_options : Optional[dict] + The return value of tvm.micro.default_options(), with any keys overridden to inject + compiler options specific to this build. If not given, tvm.micro.default_options() is + used. This dict contains the `options` parameter passed to Compiler.library() and + Compiler.binary() at various stages in the compilation process. extra_libs : Optional[List[MicroLibrary|str]] If specified, extra libraries to be compiled into the binary. If a MicroLibrary, it is @@ -151,18 +217,15 @@ def build_static_runtime( MicroBinary : The compiled runtime. """ - lib_opts = _CRT_DEFAULT_OPTIONS if lib_opts is None else lib_opts - bin_opts = _CRT_DEFAULT_OPTIONS if bin_opts is None else bin_opts - generated_lib_opts = ( - _CRT_GENERATED_LIB_OPTIONS if generated_lib_opts is None else generated_lib_opts - ) + if compiler_options is None: + compiler_options = default_options() mod_build_dir = workspace.relpath(os.path.join("build", "module")) os.makedirs(mod_build_dir) mod_src_dir = workspace.relpath(os.path.join("src", "module")) libs = [] - for mod_or_src_dir in (extra_libs or []) + RUNTIME_LIB_SRC_DIRS: + for mod_or_src_dir in (extra_libs or []) + get_runtime_libs(): if isinstance(mod_or_src_dir, MicroLibrary): libs.append(mod_or_src_dir) continue @@ -177,7 +240,7 @@ def build_static_runtime( if RUNTIME_SRC_REGEX.match(p): lib_srcs.append(os.path.join(lib_src_dir, p)) - libs.append(compiler.library(lib_build_dir, lib_srcs, lib_opts)) + libs.append(compiler.library(lib_build_dir, lib_srcs, compiler_options["lib_opts"])) mod_src_dir = workspace.relpath(os.path.join("src", "module")) os.makedirs(mod_src_dir) @@ -185,10 +248,10 @@ def build_static_runtime( module.export_library( mod_build_dir, workspace_dir=mod_src_dir, - fcompile=lambda bdir, srcs, **kwargs: compiler.library(bdir, srcs, generated_lib_opts), + fcompile=lambda bdir, srcs, **kwargs: compiler.library(bdir, srcs, compiler_options["generated_lib_opts"]), ) ) runtime_build_dir = workspace.relpath(f"build/runtime") os.makedirs(runtime_build_dir) - return compiler.binary(runtime_build_dir, libs, bin_opts) + return compiler.binary(runtime_build_dir, libs, compiler_options["bin_opts"]) diff --git a/python/tvm/micro/compiler.py b/python/tvm/micro/compiler.py index f59ac8dbc4a0..d3b4dc6e4563 100644 --- a/python/tvm/micro/compiler.py +++ b/python/tvm/micro/compiler.py @@ -291,7 +291,8 @@ def binary(self, output, objects, options=None, link_main=True, main_options=Non args.extend(["-g", "-o", output_abspath]) if link_main: - host_main_srcs = glob.glob(os.path.join(build.CRT_ROOT_DIR, "host", "*.cc")) + host_main_srcs = glob.glob(os.path.join( + tvm.micro.get_standalone_crt_dir(), "template", "host", "*.cc")) if main_options: main_lib = self.library(os.path.join(output, "host"), host_main_srcs, main_options) for lib_name in main_lib.library_files: diff --git a/tests/micro/qemu/test_zephyr.py b/tests/micro/qemu/test_zephyr.py index ab3a25d36543..d70bc7c2523c 100644 --- a/tests/micro/qemu/test_zephyr.py +++ b/tests/micro/qemu/test_zephyr.py @@ -91,8 +91,7 @@ def _make_session(model, target, zephyr_board, mod): workspace, compiler, mod, - lib_opts=opts["lib_opts"], - bin_opts=opts["bin_opts"], + compiler_options=opts, ) if os.path.exists(prev_build): os.unlink(prev_build) diff --git a/tests/python/unittest/test_crt.py b/tests/python/unittest/test_crt.py index 659d1908096b..5500bb5cc6d0 100644 --- a/tests/python/unittest/test_crt.py +++ b/tests/python/unittest/test_crt.py @@ -50,18 +50,14 @@ def _make_sess_from_op(workspace, op_name, sched, arg_bufs): def _make_session(workspace, mod): compiler = tvm.micro.DefaultCompiler(target=TARGET) - opts = tvm.micro.default_options(os.path.join(tvm.micro.CRT_ROOT_DIR, "host")) + opts = tvm.micro.default_options(os.path.join( + tvm.micro.get_standalone_crt_dir(), "template", "host")) micro_binary = tvm.micro.build_static_runtime( - # the x86 compiler *expects* you to give the exact same dictionary for both - # lib_opts and bin_opts. so the library compiler is mutating lib_opts and - # the binary compiler is expecting those mutations to be in bin_opts. - # TODO(weberlo) fix this very bizarre behavior workspace, compiler, mod, - lib_opts=opts["bin_opts"], - bin_opts=opts["bin_opts"], - extra_libs=[os.path.join(tvm.micro.build.CRT_ROOT_DIR, "memory")], + compiler_options=opts, + extra_libs=[tvm.micro.get_standalone_crt_lib("memory")], ) flasher_kw = { diff --git a/tests/python/unittest/test_link_params.py b/tests/python/unittest/test_link_params.py index 52d7a27838d7..ca40c424ee71 100644 --- a/tests/python/unittest/test_link_params.py +++ b/tests/python/unittest/test_link_params.py @@ -354,21 +354,17 @@ def test_crt_link_params(): workspace = tvm.micro.Workspace() compiler = tvm.micro.DefaultCompiler(target=target) - opts = tvm.micro.default_options(os.path.join(tvm.micro.CRT_ROOT_DIR, "host")) + opts = tvm.micro.default_options(os.path.join( + tvm.micro.get_standalone_crt_dir(), "template", "host")) opts["bin_opts"]["ldflags"].append("-DTVM_HOST_USE_GRAPH_RUNTIME_MODULE") micro_binary = tvm.micro.build_static_runtime( - # the x86 compiler *expects* you to give the exact same dictionary for both - # lib_opts and bin_opts. so the library compiler is mutating lib_opts and - # the binary compiler is expecting those mutations to be in bin_opts. - # TODO(weberlo) fix this very bizarre behavior workspace, compiler, lib, - lib_opts=opts["bin_opts"], - bin_opts=opts["bin_opts"], + compiler_options=opts, extra_libs=[ - os.path.join(tvm.micro.CRT_ROOT_DIR, m) + tvm.micro.get_standalone_crt_lib(m) for m in ("memory", "graph_runtime_module", "graph_runtime") ], ) diff --git a/tutorials/micro/micro_tflite.py b/tutorials/micro/micro_tflite.py index c28918380265..ad6e8407e28e 100644 --- a/tutorials/micro/micro_tflite.py +++ b/tutorials/micro/micro_tflite.py @@ -207,7 +207,8 @@ # First, compile a static microTVM runtime for the targeted device. In this case, the host simulated # device is used. compiler = tvm.micro.DefaultCompiler(target=TARGET) -opts = tvm.micro.default_options(os.path.join(tvm.micro.CRT_ROOT_DIR, "host")) +opts = tvm.micro.default_options(os.path.join( + tvm.micro.get_standalone_crt_dir(), "template", "host")) # %% # Compiling for physical hardware @@ -230,18 +231,13 @@ workspace = tvm.micro.Workspace() micro_binary = tvm.micro.build_static_runtime( - # the x86 compiler *expects* you to give the exact same dictionary for both - # lib_opts and bin_opts. so the library compiler is mutating lib_opts and - # the binary compiler is expecting those mutations to be in bin_opts. - # TODO(weberlo) fix this very bizarre behavior workspace, compiler, c_mod, - lib_opts=opts["lib_opts"], - bin_opts=opts["bin_opts"], + compiler_options=opts, # Use the microTVM memory manager. If, in your main.cc, you change TVMPlatformMemoryAllocate and # TVMPlatformMemoryFree to use e.g. malloc() and free(), you can omit this extra library. - extra_libs=[os.path.join(tvm.micro.build.CRT_ROOT_DIR, "memory")], + extra_libs=[tvm.micro.get_standalone_crt_lib("memory")], ) From 4ae8dcb3befed2cb0ee2c68f98dd0cf79e8b3ad4 Mon Sep 17 00:00:00 2001 From: Andrew Reusch Date: Fri, 22 Jan 2021 18:42:32 -0800 Subject: [PATCH 02/13] black format --- python/tvm/micro/build.py | 8 +++++--- python/tvm/micro/compiler.py | 5 +++-- tests/python/unittest/test_crt.py | 5 +++-- tests/python/unittest/test_link_params.py | 5 +++-- tutorials/micro/micro_tflite.py | 5 +++-- 5 files changed, 17 insertions(+), 11 deletions(-) diff --git a/python/tvm/micro/build.py b/python/tvm/micro/build.py index bc4ea992ef29..bdac5124c399 100644 --- a/python/tvm/micro/build.py +++ b/python/tvm/micro/build.py @@ -90,7 +90,7 @@ def get_standalone_crt_dir() -> str: return STANDALONE_CRT_DIR -def get_standalone_crt_lib(name : str) -> str: +def get_standalone_crt_lib(name: str) -> str: """Find a source library directory in the standalone_crt. The standalone C runtime is split into various libraries (one per directory underneath @@ -121,7 +121,7 @@ def get_runtime_libs() -> str: _COMMON_CFLAGS = ["-Wall", "-Werror"] -def _build_default_compiler_options(standalone_crt_dir : typing.Optional[str]=None) -> str: +def _build_default_compiler_options(standalone_crt_dir: typing.Optional[str] = None) -> str: """Return a dict containing base compile flags for the CRT under gcc common to . Parameters @@ -248,7 +248,9 @@ def build_static_runtime( module.export_library( mod_build_dir, workspace_dir=mod_src_dir, - fcompile=lambda bdir, srcs, **kwargs: compiler.library(bdir, srcs, compiler_options["generated_lib_opts"]), + fcompile=lambda bdir, srcs, **kwargs: compiler.library( + bdir, srcs, compiler_options["generated_lib_opts"] + ), ) ) diff --git a/python/tvm/micro/compiler.py b/python/tvm/micro/compiler.py index d3b4dc6e4563..e3763289505d 100644 --- a/python/tvm/micro/compiler.py +++ b/python/tvm/micro/compiler.py @@ -291,8 +291,9 @@ def binary(self, output, objects, options=None, link_main=True, main_options=Non args.extend(["-g", "-o", output_abspath]) if link_main: - host_main_srcs = glob.glob(os.path.join( - tvm.micro.get_standalone_crt_dir(), "template", "host", "*.cc")) + host_main_srcs = glob.glob( + os.path.join(tvm.micro.get_standalone_crt_dir(), "template", "host", "*.cc") + ) if main_options: main_lib = self.library(os.path.join(output, "host"), host_main_srcs, main_options) for lib_name in main_lib.library_files: diff --git a/tests/python/unittest/test_crt.py b/tests/python/unittest/test_crt.py index 5500bb5cc6d0..6b892d46f926 100644 --- a/tests/python/unittest/test_crt.py +++ b/tests/python/unittest/test_crt.py @@ -50,8 +50,9 @@ def _make_sess_from_op(workspace, op_name, sched, arg_bufs): def _make_session(workspace, mod): compiler = tvm.micro.DefaultCompiler(target=TARGET) - opts = tvm.micro.default_options(os.path.join( - tvm.micro.get_standalone_crt_dir(), "template", "host")) + opts = tvm.micro.default_options( + os.path.join(tvm.micro.get_standalone_crt_dir(), "template", "host") + ) micro_binary = tvm.micro.build_static_runtime( workspace, compiler, diff --git a/tests/python/unittest/test_link_params.py b/tests/python/unittest/test_link_params.py index ca40c424ee71..80ea11f6d9aa 100644 --- a/tests/python/unittest/test_link_params.py +++ b/tests/python/unittest/test_link_params.py @@ -354,8 +354,9 @@ def test_crt_link_params(): workspace = tvm.micro.Workspace() compiler = tvm.micro.DefaultCompiler(target=target) - opts = tvm.micro.default_options(os.path.join( - tvm.micro.get_standalone_crt_dir(), "template", "host")) + opts = tvm.micro.default_options( + os.path.join(tvm.micro.get_standalone_crt_dir(), "template", "host") + ) opts["bin_opts"]["ldflags"].append("-DTVM_HOST_USE_GRAPH_RUNTIME_MODULE") micro_binary = tvm.micro.build_static_runtime( diff --git a/tutorials/micro/micro_tflite.py b/tutorials/micro/micro_tflite.py index ad6e8407e28e..591db60393e5 100644 --- a/tutorials/micro/micro_tflite.py +++ b/tutorials/micro/micro_tflite.py @@ -207,8 +207,9 @@ # First, compile a static microTVM runtime for the targeted device. In this case, the host simulated # device is used. compiler = tvm.micro.DefaultCompiler(target=TARGET) -opts = tvm.micro.default_options(os.path.join( - tvm.micro.get_standalone_crt_dir(), "template", "host")) +opts = tvm.micro.default_options( + os.path.join(tvm.micro.get_standalone_crt_dir(), "template", "host") +) # %% # Compiling for physical hardware From 09354522d8eb6cf8f9acacb7115e9b3c290197f7 Mon Sep 17 00:00:00 2001 From: Andrew Reusch Date: Mon, 25 Jan 2021 10:07:32 -0800 Subject: [PATCH 03/13] pylint --- python/tvm/micro/build.py | 11 ++++------- python/tvm/micro/compiler.py | 1 - tests/micro/qemu/test_zephyr.py | 2 +- tests/python/unittest/test_crt.py | 2 +- tutorials/micro/micro_tflite.py | 2 +- 5 files changed, 7 insertions(+), 11 deletions(-) diff --git a/python/tvm/micro/build.py b/python/tvm/micro/build.py index bdac5124c399..3837d423f8bd 100644 --- a/python/tvm/micro/build.py +++ b/python/tvm/micro/build.py @@ -160,10 +160,10 @@ def default_options(crt_config_include_dir, standalone_crt_dir=None): - "generated_lib_opts" - passed as "options" to Compiler.library() when building the generated library. """ - bin_opts = _build_default_compiler_options() + bin_opts = _build_default_compiler_options(standalone_crt_dir) bin_opts["include_dirs"].append(crt_config_include_dir) - lib_opts = _build_default_compiler_options() + lib_opts = _build_default_compiler_options(standalone_crt_dir) lib_opts["cflags"] = ["-Wno-error=incompatible-pointer-types"] lib_opts["include_dirs"].append(crt_config_include_dir) @@ -187,7 +187,7 @@ def build_static_runtime( workspace, compiler, module, - compiler_options=None, + compiler_options, extra_libs=None, ): """Build the on-device runtime, statically linking the given modules. @@ -200,7 +200,7 @@ def build_static_runtime( module : IRModule Module to statically link. - compiler_options : Optional[dict] + compiler_options : dict The return value of tvm.micro.default_options(), with any keys overridden to inject compiler options specific to this build. If not given, tvm.micro.default_options() is used. This dict contains the `options` parameter passed to Compiler.library() and @@ -217,9 +217,6 @@ def build_static_runtime( MicroBinary : The compiled runtime. """ - if compiler_options is None: - compiler_options = default_options() - mod_build_dir = workspace.relpath(os.path.join("build", "module")) os.makedirs(mod_build_dir) mod_src_dir = workspace.relpath(os.path.join("src", "module")) diff --git a/python/tvm/micro/compiler.py b/python/tvm/micro/compiler.py index e3763289505d..d0431f42b01d 100644 --- a/python/tvm/micro/compiler.py +++ b/python/tvm/micro/compiler.py @@ -24,7 +24,6 @@ import subprocess import tvm.target -from . import build from . import class_factory from . import debugger from . import transport diff --git a/tests/micro/qemu/test_zephyr.py b/tests/micro/qemu/test_zephyr.py index d70bc7c2523c..822586a9c325 100644 --- a/tests/micro/qemu/test_zephyr.py +++ b/tests/micro/qemu/test_zephyr.py @@ -91,7 +91,7 @@ def _make_session(model, target, zephyr_board, mod): workspace, compiler, mod, - compiler_options=opts, + opts, ) if os.path.exists(prev_build): os.unlink(prev_build) diff --git a/tests/python/unittest/test_crt.py b/tests/python/unittest/test_crt.py index 6b892d46f926..3c68b4090309 100644 --- a/tests/python/unittest/test_crt.py +++ b/tests/python/unittest/test_crt.py @@ -57,7 +57,7 @@ def _make_session(workspace, mod): workspace, compiler, mod, - compiler_options=opts, + opts, extra_libs=[tvm.micro.get_standalone_crt_lib("memory")], ) diff --git a/tutorials/micro/micro_tflite.py b/tutorials/micro/micro_tflite.py index 591db60393e5..15039e2e64e7 100644 --- a/tutorials/micro/micro_tflite.py +++ b/tutorials/micro/micro_tflite.py @@ -235,7 +235,7 @@ workspace, compiler, c_mod, - compiler_options=opts, + opts, # Use the microTVM memory manager. If, in your main.cc, you change TVMPlatformMemoryAllocate and # TVMPlatformMemoryFree to use e.g. malloc() and free(), you can omit this extra library. extra_libs=[tvm.micro.get_standalone_crt_lib("memory")], From 03e2edcd8cb4bf01104b1fd221de3ceb1ccd5163 Mon Sep 17 00:00:00 2001 From: Andrew Reusch Date: Tue, 26 Jan 2021 12:38:00 -0800 Subject: [PATCH 04/13] try stashing entire standalone_crt in hopes it will not upset jenkins --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 67a41cd51430..954373315f59 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -55,7 +55,7 @@ ci_arm = "tlcpack/ci-arm:v0.01" // tvm libraries tvm_runtime = "build/libtvm_runtime.so, build/config.cmake" -tvm_lib = "build/libtvm.so, " + tvm_runtime +tvm_lib = "build/libtvm.so, " + tvm_runtime + ", standalone_crt/**" // LLVM upstream lib tvm_multilib = "build/libtvm.so, " + "build/libvta_tsim.so, " + From fa066e6da1be4156c400cc9ab70480e7dea128d2 Mon Sep 17 00:00:00 2001 From: Andrew Reusch Date: Wed, 27 Jan 2021 10:33:11 -0800 Subject: [PATCH 05/13] Put standalone_crt in correct Jenkinsfile stash bundle --- Jenkinsfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index fa6b0e39275a..0e6c7e8fb834 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -54,8 +54,8 @@ ci_arm = "tlcpack/ci-arm:v0.01" // <--- End of regex-scanned config. // tvm libraries -tvm_runtime = "build/libtvm_runtime.so, build/config.cmake" -tvm_lib = "build/libtvm.so, " + tvm_runtime + ", standalone_crt/**" +tvm_runtime = "build/libtvm_runtime.so, build/config.cmake, standalone_crt/**" +tvm_lib = "build/libtvm.so, " + tvm_runtime // LLVM upstream lib tvm_multilib = "build/libtvm.so, " + "build/libvta_tsim.so, " + From 0c9460423a51de794e826aadb84b20d35bb9b1bf Mon Sep 17 00:00:00 2001 From: Andrew Reusch Date: Wed, 27 Jan 2021 11:14:42 -0800 Subject: [PATCH 06/13] include build prefix --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 0e6c7e8fb834..882335d5ca4a 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -54,7 +54,7 @@ ci_arm = "tlcpack/ci-arm:v0.01" // <--- End of regex-scanned config. // tvm libraries -tvm_runtime = "build/libtvm_runtime.so, build/config.cmake, standalone_crt/**" +tvm_runtime = "build/libtvm_runtime.so, build/config.cmake, build/standalone_crt/**" tvm_lib = "build/libtvm.so, " + tvm_runtime // LLVM upstream lib tvm_multilib = "build/libtvm.so, " + From ae9dcb06e556b80fda99dbd4767dc20ddd40931d Mon Sep 17 00:00:00 2001 From: Andrew Reusch Date: Wed, 27 Jan 2021 13:58:45 -0800 Subject: [PATCH 07/13] switch to python script for expanding globs --- Jenkinsfile | 4 ++-- tests/scripts/print_md5sum.py | 28 ++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 2 deletions(-) create mode 100644 tests/scripts/print_md5sum.py diff --git a/Jenkinsfile b/Jenkinsfile index 882335d5ca4a..73ef1280028a 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -144,7 +144,7 @@ def make(docker_type, path, make_flag) { def pack_lib(name, libs) { sh """ echo "Packing ${libs} into ${name}" - echo ${libs} | sed -e 's/,/ /g' | xargs md5sum + echo ${libs} | python tests/scripts/print_md5sum.py """ stash includes: libs, name: name } @@ -155,7 +155,7 @@ def unpack_lib(name, libs) { unstash name sh """ echo "Unpacked ${libs} from ${name}" - echo ${libs} | sed -e 's/,/ /g' | xargs md5sum + echo ${libs} | python tests/scripts/print_md5sum.py """ } diff --git a/tests/scripts/print_md5sum.py b/tests/scripts/print_md5sum.py new file mode 100644 index 000000000000..b7678befc652 --- /dev/null +++ b/tests/scripts/print_md5sum.py @@ -0,0 +1,28 @@ +# 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. +"""Helper tool to print a list of globbed files for use with Jenkins stash().""" + +import glob +import sys +import subprocess + +to_md5sum = [] +for path in sys.stdin.read().split(","): + path = path.strip() + to_md5sum.extend(glob.iglob(path, recurisve=True)) + +sys.exit(subprocess.run(["md5sum"] + to_md5sum).returncode) From c0f46b6a64c8db4c36f00b61b23ca3b046ade5d5 Mon Sep 17 00:00:00 2001 From: Andrew Reusch Date: Thu, 28 Jan 2021 10:12:36 -0800 Subject: [PATCH 08/13] revert attempt to use globs in pack_libs, switch to building standalone_crt --- Jenkinsfile | 12 +++++++++--- tests/scripts/print_md5sum.py | 28 ---------------------------- 2 files changed, 9 insertions(+), 31 deletions(-) delete mode 100644 tests/scripts/print_md5sum.py diff --git a/Jenkinsfile b/Jenkinsfile index 73ef1280028a..1789177078b3 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -54,7 +54,7 @@ ci_arm = "tlcpack/ci-arm:v0.01" // <--- End of regex-scanned config. // tvm libraries -tvm_runtime = "build/libtvm_runtime.so, build/config.cmake, build/standalone_crt/**" +tvm_runtime = "build/libtvm_runtime.so, build/config.cmake" tvm_lib = "build/libtvm.so, " + tvm_runtime // LLVM upstream lib tvm_multilib = "build/libtvm.so, " + @@ -144,7 +144,7 @@ def make(docker_type, path, make_flag) { def pack_lib(name, libs) { sh """ echo "Packing ${libs} into ${name}" - echo ${libs} | python tests/scripts/print_md5sum.py + echo ${libs} | xargs md5sum """ stash includes: libs, name: name } @@ -155,7 +155,7 @@ def unpack_lib(name, libs) { unstash name sh """ echo "Unpacked ${libs} from ${name}" - echo ${libs} | python tests/scripts/print_md5sum.py + echo ${libs} | xargs md5sum """ } @@ -248,6 +248,8 @@ stage('Unit Test') { unpack_lib('gpu', tvm_multilib) timeout(time: max_time, unit: 'MINUTES') { sh "${docker_run} ${ci_gpu} ./tests/scripts/task_ci_python_setup.sh" + sh "${docker_run} ${ci_gpu} ./tests/scripts/task_config_build_gpu.sh" + sh "${docker_run} ${ci_gpu} ./tests/scripts/task_build.sh build standalone_crt" sh "${docker_run} ${ci_gpu} ./tests/scripts/task_sphinx_precheck.sh" sh "${docker_run} ${ci_gpu} ./tests/scripts/task_python_unittest_gpuonly.sh" sh "${docker_run} ${ci_gpu} ./tests/scripts/task_python_integration_gpuonly.sh" @@ -262,6 +264,8 @@ stage('Unit Test') { unpack_lib('i386', tvm_multilib) timeout(time: max_time, unit: 'MINUTES') { sh "${docker_run} ${ci_i386} ./tests/scripts/task_ci_python_setup.sh" + sh "${docker_run} ${ci_gpu} ./tests/scripts/task_config_build_i386.sh" + sh "${docker_run} ${ci_gpu} ./tests/scripts/task_build.sh build standalone_crt" sh "${docker_run} ${ci_i386} ./tests/scripts/task_python_unittest.sh" sh "${docker_run} ${ci_i386} ./tests/scripts/task_python_integration.sh" sh "${docker_run} ${ci_i386} ./tests/scripts/task_python_vta_fsim.sh" @@ -276,6 +280,8 @@ stage('Unit Test') { unpack_lib('arm', tvm_multilib) timeout(time: max_time, unit: 'MINUTES') { sh "${docker_run} ${ci_arm} ./tests/scripts/task_ci_python_setup.sh" + sh "${docker_run} ${ci_gpu} ./tests/scripts/task_config_build_arm.sh" + sh "${docker_run} ${ci_gpu} ./tests/scripts/task_build.sh build standalone_crt" sh "${docker_run} ${ci_arm} ./tests/scripts/task_python_unittest.sh" // sh "${docker_run} ${ci_arm} ./tests/scripts/task_python_integration.sh" } diff --git a/tests/scripts/print_md5sum.py b/tests/scripts/print_md5sum.py deleted file mode 100644 index b7678befc652..000000000000 --- a/tests/scripts/print_md5sum.py +++ /dev/null @@ -1,28 +0,0 @@ -# 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. -"""Helper tool to print a list of globbed files for use with Jenkins stash().""" - -import glob -import sys -import subprocess - -to_md5sum = [] -for path in sys.stdin.read().split(","): - path = path.strip() - to_md5sum.extend(glob.iglob(path, recurisve=True)) - -sys.exit(subprocess.run(["md5sum"] + to_md5sum).returncode) From e85c94c1ba780e493255384fd32b46916d85a051 Mon Sep 17 00:00:00 2001 From: Andrew Reusch Date: Thu, 28 Jan 2021 12:38:37 -0800 Subject: [PATCH 09/13] properly revert pack_lib changes --- Jenkinsfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 1789177078b3..b4c57ff516bc 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -144,7 +144,7 @@ def make(docker_type, path, make_flag) { def pack_lib(name, libs) { sh """ echo "Packing ${libs} into ${name}" - echo ${libs} | xargs md5sum + echo ${libs} | sed -e 's/,/ /g' | xargs md5sum """ stash includes: libs, name: name } @@ -155,7 +155,7 @@ def unpack_lib(name, libs) { unstash name sh """ echo "Unpacked ${libs} from ${name}" - echo ${libs} | xargs md5sum + echo ${libs} | sed -e 's/,/ /g' | xargs md5sum """ } From d614c0b3663e8fd3702d389a340607dec37ff174 Mon Sep 17 00:00:00 2001 From: Andrew Reusch Date: Fri, 29 Jan 2021 09:57:40 -0800 Subject: [PATCH 10/13] fix typo --- Jenkinsfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index b4c57ff516bc..69d99d9a22ba 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -280,8 +280,8 @@ stage('Unit Test') { unpack_lib('arm', tvm_multilib) timeout(time: max_time, unit: 'MINUTES') { sh "${docker_run} ${ci_arm} ./tests/scripts/task_ci_python_setup.sh" - sh "${docker_run} ${ci_gpu} ./tests/scripts/task_config_build_arm.sh" - sh "${docker_run} ${ci_gpu} ./tests/scripts/task_build.sh build standalone_crt" + sh "${docker_run} ${ci_arm} ./tests/scripts/task_config_build_arm.sh" + sh "${docker_run} ${ci_arm} ./tests/scripts/task_build.sh build standalone_crt" sh "${docker_run} ${ci_arm} ./tests/scripts/task_python_unittest.sh" // sh "${docker_run} ${ci_arm} ./tests/scripts/task_python_integration.sh" } From a41c540e8f33d7d1fdc59bd1c39a5843e897e8e5 Mon Sep 17 00:00:00 2001 From: Andrew Reusch Date: Fri, 29 Jan 2021 16:48:30 -0800 Subject: [PATCH 11/13] retrigger CI From f7c4f8e3cc66c943bcc66017e6e02da5a8a7cfb3 Mon Sep 17 00:00:00 2001 From: Andrew Reusch Date: Mon, 8 Feb 2021 12:13:08 -0800 Subject: [PATCH 12/13] revert pyproject.toml --- pyproject.toml | 93 -------------------------------------------------- 1 file changed, 93 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 79175f687aa4..5cca711ddbe6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -46,96 +46,3 @@ exclude = ''' )/ ) ''' -[tool.poetry] -name = "tvm" -version = "0.1.0" -description = "" -authors = ["Your Name "] -packages = [ - { include = "tvm", from = "python" }, -] - -[tool.poetry.dependencies] -attrs = "^19" -decorator = "^4.4" -numpy = "~1.19" -psutil = "^5" -scipy = "^1.4" -python = "^3.6" -tornado = "^6" -typed_ast = "^1.4" - -# AutoTVM -xgboost = {version = "^1.1", optional = true} - -############# -# Importers # -############# - -# NOTE: Caffe frontend dependency is from torch package. - -# CoreML -coremltools = {version = "^3.3", optional = true} - -# Darknet -opencv-python = {version = "^4.2", optional = true} -cffi = {version = "^1.14", optional = true} - -# NOTE: Keras provided by tensorflow package. -# If TF version conflict, maybe try: keras = "2.3.1" - -# MXNet frontend -mxnet = {version = "^1.6.0", optional = true} - -# ONNX frontend -onnx = {version = "1.6.0", optional = true} -onnxruntime = {version = "1.0.0", optional = true} - -# Pytorch (also used by ONNX) -# NOTE: cannot download this right now due to https://github.com/python-poetry/poetry/issues/2247 -# torch = {url = "https://download.pytorch.org/whl/cu101/torch-1.4.0-cp36-cp36m-manylinux1_x86_64.whl", optional = true} -# torchvision = {version = "0.5.0", optional = true} -# NOTE: torch depends on a number of other packages, but unhelpfully, does not expose that in the -# wheel!!! -future = {version = "*", optional = true} - -# Tensorflow frontend -tensorflow = {version = "^2.1", optional = true} -tensorflow-estimator = {version = "^2.1", optional = true} - -# TFLite frontend -tflite = {version = "2.1.0", optional = true} -wheel = "*" - - -[tool.poetry.extras] -xgboost = ["xgboost"] -importer-caffe2 = ["torch"] -importer-coreml = ["coremltools"] -importer-darknet = ["opencv-python"] -importer-keras = ["tensorflow", "tensorflow-estimator"] -importer-onnx = ["onnx", "onnxruntime", "torch", "torchvision", "future"] -importer-pytorch = ["torch", "torchvision", "future"] -importer-tensorflow = ["tensorflow", "tensorflow-estimator"] -importer-tflite = ["tflite", "tensorflow", "tensorflow-estimator"] - -[tool.poetry.dev-dependencies] -autodocsumm = "^0.1" -black = "^19.10b0" -sphinx = "^3.0" -sphinx-gallery = "^0.8" -sphinx-rtd-theme = "^0.4" -matplotlib = "^3.2" -Image = "^1.5" -recommonmark = "^0.6" -pillow = "< 7" -pyformat = "^0.7" -pylint = "^2.4" -pytest = "^5.4" - -[build-system] -requires = ["poetry>=0.12"] -build-backend = "poetry.masonry.api" - -[tool.autopep8] -max_line_length = 100 From 7ea945b32fde4f87c21aacd46d241dbc8d4188da Mon Sep 17 00:00:00 2001 From: Andrew Reusch Date: Mon, 8 Feb 2021 14:49:41 -0800 Subject: [PATCH 13/13] update Jenkinsfile approach to use task_ci_setup.sh --- Jenkinsfile | 6 ------ tests/scripts/task_ci_setup.sh | 5 +++++ 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 85a276bc43b5..6bf6dcfa966a 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -248,8 +248,6 @@ stage('Unit Test') { unpack_lib('gpu', tvm_multilib) timeout(time: max_time, unit: 'MINUTES') { sh "${docker_run} ${ci_gpu} ./tests/scripts/task_ci_setup.sh" - sh "${docker_run} ${ci_gpu} ./tests/scripts/task_config_build_gpu.sh" - sh "${docker_run} ${ci_gpu} ./tests/scripts/task_build.sh build standalone_crt" sh "${docker_run} ${ci_gpu} ./tests/scripts/task_sphinx_precheck.sh" sh "${docker_run} ${ci_gpu} ./tests/scripts/task_python_unittest_gpuonly.sh" sh "${docker_run} ${ci_gpu} ./tests/scripts/task_python_integration_gpuonly.sh" @@ -264,8 +262,6 @@ stage('Unit Test') { unpack_lib('i386', tvm_multilib) timeout(time: max_time, unit: 'MINUTES') { sh "${docker_run} ${ci_i386} ./tests/scripts/task_ci_setup.sh" - sh "${docker_run} ${ci_gpu} ./tests/scripts/task_config_build_i386.sh" - sh "${docker_run} ${ci_gpu} ./tests/scripts/task_build.sh build standalone_crt" sh "${docker_run} ${ci_i386} ./tests/scripts/task_python_unittest.sh" sh "${docker_run} ${ci_i386} ./tests/scripts/task_python_integration.sh" sh "${docker_run} ${ci_i386} ./tests/scripts/task_python_vta_fsim.sh" @@ -280,8 +276,6 @@ stage('Unit Test') { unpack_lib('arm', tvm_multilib) timeout(time: max_time, unit: 'MINUTES') { sh "${docker_run} ${ci_arm} ./tests/scripts/task_ci_setup.sh" - sh "${docker_run} ${ci_arm} ./tests/scripts/task_config_build_arm.sh" - sh "${docker_run} ${ci_arm} ./tests/scripts/task_build.sh build standalone_crt" sh "${docker_run} ${ci_arm} ./tests/scripts/task_python_unittest.sh" // sh "${docker_run} ${ci_arm} ./tests/scripts/task_python_integration.sh" } diff --git a/tests/scripts/task_ci_setup.sh b/tests/scripts/task_ci_setup.sh index f48ed49a2266..17838c58a83c 100755 --- a/tests/scripts/task_ci_setup.sh +++ b/tests/scripts/task_ci_setup.sh @@ -31,3 +31,8 @@ set -o pipefail echo "Addtiional setup in" ${CI_IMAGE_NAME} python3 -m pip install --user tlcpack-sphinx-addon==0.1.4 synr==0.2.1 + +# Rebuild standalone_crt in build/ tree. This file is not currently archived by pack_lib() in +# Jenkinsfile. We expect config.cmake to be present from pack_lib(). +# TODO(areusch): Make pack_lib() pack all the data dependencies of TVM. +(cd build && cmake .. && make standalone_crt)