Skip to content

Commit

Permalink
Merge branch 'apache:main' into pr001
Browse files Browse the repository at this point in the history
  • Loading branch information
jiangjiajun authored Oct 4, 2021
2 parents 4139fb3 + 6a32ac5 commit 2a5e30d
Show file tree
Hide file tree
Showing 282 changed files with 24,360 additions and 7,396 deletions.
16 changes: 14 additions & 2 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ stage('Build') {
make(ci_gpu, 'build', '-j2')
pack_lib('gpu', tvm_multilib)
// compiler test
sh "${docker_run} ${ci_gpu} ./tests/scripts/task_config_build_gpu_vulkan.sh"
sh "${docker_run} ${ci_gpu} ./tests/scripts/task_config_build_gpu_other.sh"
make(ci_gpu, 'build2', '-j2')
}
}
Expand All @@ -224,7 +224,6 @@ stage('Build') {
timeout(time: max_time, unit: 'MINUTES') {
sh "${docker_run} ${ci_cpu} ./tests/scripts/task_ci_setup.sh"
sh "${docker_run} ${ci_cpu} ./tests/scripts/task_python_unittest.sh"
sh "${docker_run} ${ci_cpu} ./tests/scripts/task_python_integration.sh"
sh "${docker_run} ${ci_cpu} ./tests/scripts/task_python_vta_fsim.sh"
sh "${docker_run} ${ci_cpu} ./tests/scripts/task_python_vta_tsim.sh"
// sh "${docker_run} ${ci_cpu} ./tests/scripts/task_golang.sh"
Expand Down Expand Up @@ -300,6 +299,19 @@ stage('Unit Test') {
}
}
},
'python3: CPU': {
node('CPU') {
ws(per_exec_ws("tvm/ut-python-cpu")) {
init_git()
unpack_lib('cpu', tvm_multilib_tsim)
timeout(time: max_time, unit: 'MINUTES') {
sh "${docker_run} ${ci_cpu} ./tests/scripts/task_ci_setup.sh"
sh "${docker_run} ${ci_cpu} ./tests/scripts/task_python_integration.sh"
junit "build/pytest-results/*.xml"
}
}
}
},
'python3: i386': {
node('CPU') {
ws(per_exec_ws("tvm/ut-python-i386")) {
Expand Down
6 changes: 6 additions & 0 deletions apps/microtvm/zephyr/template_project/boards.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
{
"mimxrt1050_evk": {
"board": "mimxrt1050_evk",
"model": "imxrt10xx",
"is_qemu": false,
"fpu": true
},
"mps2_an521": {
"board": "mps2_an521",
"model": "mps2_an521",
Expand Down
12 changes: 9 additions & 3 deletions apps/microtvm/zephyr/template_project/microtvm_api_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ def _get_device_args(options):
"nucleo_l4r5zi": {"idVendor": 0x0483, "idProduct": 0x374B},
"nucleo_f746zg": {"idVendor": 0x0483, "idProduct": 0x374B},
"stm32f746g_disco": {"idVendor": 0x0483, "idProduct": 0x374B},
"mimxrt1050_evk": {"idVendor": 0x1366, "idProduct": 0x0105},
}


Expand Down Expand Up @@ -545,6 +546,10 @@ def _find_openocd_serial_port(cls, options):

return ports[0].device

@classmethod
def _find_jlink_serial_port(cls, options):
return cls._find_openocd_serial_port(options)

@classmethod
def _find_serial_port(cls, options):
flash_runner = _get_flash_runner()
Expand All @@ -555,9 +560,10 @@ def _find_serial_port(cls, options):
if flash_runner == "openocd":
return cls._find_openocd_serial_port(options)

raise FlashRunnerNotSupported(
f"Don't know how to deduce serial port for flash runner {flash_runner}"
)
if flash_runner == "jlink":
return cls._find_jlink_serial_port(options)

raise RuntimeError(f"Don't know how to deduce serial port for flash runner {flash_runner}")

def __init__(self, options):
self._options = options
Expand Down
2 changes: 1 addition & 1 deletion cmake/modules/StandaloneCrt.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ if(USE_MICRO)
# Create the `crttest` target if we can find GTest. If not, we create dummy
# targets that give the user an informative error message.
if(GTEST_INCLUDE_DIR AND GTEST_LIB)
file(GLOB TEST_SRCS ${CMAKE_SOURCE_DIR}/tests/crt/*_test.cc)
file(GLOB TEST_SRCS ${CMAKE_SOURCE_DIR}/tests/crt/*.cc)
add_executable(crttest ${TEST_SRCS})
target_include_directories(crttest SYSTEM PUBLIC ${GTEST_INCLUDE_DIR} ${CMAKE_CURRENT_BINARY_DIR}/standalone_crt/include ${CMAKE_SOURCE_DIR}/src/runtime/micro)
target_link_libraries(crttest PRIVATE ${cmake_crt_libraries} ${GTEST_LIB} gtest_main pthread dl)
Expand Down
4 changes: 4 additions & 0 deletions cmake/utils/FindCUDA.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,16 @@ macro(find_cuda use_cuda use_cudnn)
${CUDA_TOOLKIT_ROOT_DIR}/lib64
${CUDA_TOOLKIT_ROOT_DIR}/lib
NO_DEFAULT_PATH)
# search default path if cannot find cublas in non-default
find_library(CUDA_CUBLAS_LIBRARY cublas)
find_library(CUDA_CUBLASLT_LIBRARY
NAMES cublaslt cublasLt
PATHS
${CUDA_TOOLKIT_ROOT_DIR}/lib64
${CUDA_TOOLKIT_ROOT_DIR}/lib
NO_DEFAULT_PATH)
# search default path if cannot find cublaslt in non-default
find_library(CUDA_CUBLASLT_LIBRARY NAMES cublaslt cublasLt)
endif(MSVC)

# find cuDNN
Expand Down
24 changes: 22 additions & 2 deletions docker/bash.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#
# Usage: docker/bash.sh [-i|--interactive] [--net=host] [-t|--tty]
# [--mount MOUNT_DIR] [--repo-mount-point REPO_MOUNT_POINT]
# [--dry-run]
# [--dry-run] [--name NAME]
# <DOCKER_IMAGE_NAME> [--] [COMMAND]
#
# Usage: docker/bash.sh <CONTAINER_NAME>
Expand All @@ -40,7 +40,7 @@ function show_usage() {
cat <<EOF
Usage: docker/bash.sh [-i|--interactive] [--net=host] [-t|--tty]
[--mount MOUNT_DIR] [--repo-mount-point REPO_MOUNT_POINT]
[--dry-run]
[--dry-run] [--name NAME]
<DOCKER_IMAGE_NAME> [--] [COMMAND]
-h, --help
Expand Down Expand Up @@ -85,6 +85,11 @@ Usage: docker/bash.sh [-i|--interactive] [--net=host] [-t|--tty]
Print the docker command to be run, but do not execute it.
--name
Set the name of the docker container, and the hostname that will
appear inside the container.
DOCKER_IMAGE_NAME
The name of the docker container to be run. This can be an
Expand Down Expand Up @@ -118,6 +123,7 @@ USE_NET_HOST=false
DOCKER_IMAGE_NAME=
COMMAND=bash
MOUNT_DIRS=( )
CONTAINER_NAME=

# TODO(Lunderberg): Remove this if statement and always set to
# "${REPO_DIR}". The consistent directory for Jenkins is currently
Expand Down Expand Up @@ -180,6 +186,15 @@ while (( $# )); do
shift
;;

--name)
if [[ -n "$2" ]]; then
CONTAINER_NAME="$2"
shift 2
else
parse_error 'ERROR: --name requires a non empty argument'
fi
;;

--dry-run)
DRY_RUN=true
shift
Expand Down Expand Up @@ -312,6 +327,11 @@ if ${TTY}; then
DOCKER_FLAGS+=( --tty )
fi

# Setup the docker name and the hostname inside the container
if [[ ! -z "${CONTAINER_NAME}" ]]; then
DOCKER_FLAGS+=( --name ${CONTAINER_NAME} --hostname ${CONTAINER_NAME})
fi

# Expose external directories to the docker container
for MOUNT_DIR in ${MOUNT_DIRS[@]+"${MOUNT_DIRS[@]}"}; do
DOCKER_MOUNT+=( --volume "${MOUNT_DIR}:${MOUNT_DIR}" )
Expand Down
12 changes: 11 additions & 1 deletion docker/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
# Usage: build.sh <CONTAINER_TYPE> [--tag <DOCKER_IMAGE_TAG>]
# [--dockerfile <DOCKERFILE_PATH>] [-it]
# [--net=host] [--cache-from <IMAGE_NAME>]
# [--context-path <CONTEXT_PATH>] [<COMMAND>]
# [--name CONTAINER_NAME] [--context-path <CONTEXT_PATH>]
# [<COMMAND>]
#
# CONTAINER_TYPE: Type of the docker container used the run the build,
# e.g. "ci_cpu", "ci_gpu"
Expand All @@ -38,6 +39,9 @@
# IMAGE_NAME: An image to be as a source for cached layers when building the
# Docker image requested.
#
# CONTAINER_NAME: The name of the docker container, and the hostname that will
# appear inside the container.
#
# CONTEXT_PATH: Path to be used for relative path resolution when building
# the Docker images.
#
Expand Down Expand Up @@ -95,6 +99,12 @@ else
echo "Using default context path: ${DOCKER_CONTEXT_PATH}"
fi

if [[ "$1" == "--name" ]]; then
CI_DOCKER_EXTRA_PARAMS+=("--name ${2} --hostname ${2}")
echo "Using container name ${2}"
shift 2
fi

if [[ ! -f "${DOCKERFILE_PATH}" ]]; then
echo "Invalid Dockerfile path: \"${DOCKERFILE_PATH}\""
exit 1
Expand Down
14 changes: 11 additions & 3 deletions docker/install/ubuntu_install_core.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,17 @@ set -o pipefail

# install libraries for building c++ core on ubuntu
apt-get update && apt-get install -y --no-install-recommends \
git make libgtest-dev cmake wget unzip libtinfo-dev libz-dev\
git make google-mock libgtest-dev cmake wget unzip libtinfo-dev libz-dev \
libcurl4-openssl-dev libssl-dev libopenblas-dev g++ sudo \
apt-transport-https graphviz pkg-config curl


cd /usr/src/gtest && cmake CMakeLists.txt && make && cp *.a /usr/lib
if [[ -d /usr/src/googletest ]]; then
# Single package source (Ubuntu 18.04)
# googletest is installed via libgtest-dev
cd /usr/src/googletest && cmake CMakeLists.txt && make && cp -v {googlemock,googlemock/gtest}/*.a /usr/lib
else
# Split source package (Ubuntu 16.04)
# libgtest-dev and google-mock
cd /usr/src/gtest && cmake CMakeLists.txt && make && cp -v *.a /usr/lib
cd /usr/src/gmock && cmake CMakeLists.txt && make && cp -v *.a /usr/lib
fi
4 changes: 4 additions & 0 deletions docker/install/ubuntu_install_onnx.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ set -o pipefail

# We need to fix the onnx version because changing versions tends to break tests
# TODO(mbrookhart): periodically update

# onnx 1.9 removed onnx optimizer from the main repo (see
# https://github.com/onnx/onnx/pull/2834). When updating the CI image
# to onnx>=1.9, onnxoptimizer should also be installed.
pip3 install \
onnx==1.8.1 \
onnxruntime==1.7.0
Expand Down
2 changes: 1 addition & 1 deletion docker/install/ubuntu_install_python_package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,6 @@ pip3 install \
pytest-xdist \
requests \
scipy \
synr==0.4.0 \
synr==0.4.1 \
six \
tornado
2 changes: 1 addition & 1 deletion docker/install/ubuntu_install_sphinx.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,5 @@ pip3 install \
matplotlib \
sphinx \
sphinx_autodoc_annotation \
sphinx-gallery==0.4.0 \
sphinx-gallery==0.4.1 \
sphinx_rtd_theme
1 change: 1 addition & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,7 @@ def git_describe_version(original_version):
"from_coreml.py",
"from_darknet.py",
"from_caffe2.py",
"from_paddle.py",
],
"language": [
"schedule_primitives.py",
Expand Down
25 changes: 25 additions & 0 deletions include/tvm/ir/attrs.h
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,31 @@ inline TFunc WithAttr(TFunc input, const std::string& attr_key, ObjectRef attr_v
return input;
}

/*!
* \brief Copy the function or module, but overrides the attributes with the entries from \p attrs.
*
* \param input The thing to annotate (BaseFunc or IRModule)
* \param attrs Key/values attributes to add to \p input.
*
* \tparam TFunc The corresponding function or module type.
*
* \returns The new function or module with updated attributes.
*/
template <typename TFunc>
inline TFunc WithAttrs(TFunc input, Map<String, ObjectRef> attrs) {
using TNode = typename TFunc::ContainerType;
static_assert(TNode::_type_final, "Can only operate on the leaf nodes");
TNode* node = input.CopyOnWrite();
if (node->attrs.defined()) {
for (const auto& pair : attrs) {
node->attrs.CopyOnWrite()->dict.Set(pair.first, pair.second);
}
} else {
node->attrs = DictAttrs(std::move(attrs));
}
return input;
}

// Namespace containing detail implementations
namespace detail {
using runtime::TVMArgValue;
Expand Down
21 changes: 21 additions & 0 deletions include/tvm/ir/function.h
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,27 @@ constexpr const char* kTarget = "target";
* Type: String
*/
constexpr const char* kGlobalSymbol = "global_symbol";

/*!
* \brief The device type which will hold each of the functions parameters.
*
* Only supported on Relay \p Functions. Generally added by the \p PlanDevices pass, but
* may be included as an annotation on user programs.
*
* Type: Array<Integer> (but interpreted as Array<DLDeviceType>)
*/
constexpr const char* kParamDeviceTypes = "param_device_types";

/*!
* \brief The device type which will hold the function result.
*
* Only supported on Relay \p Functions. Generally added by the \p PlanDevices pass, but
* may be included as an annotation on user programs.
*
* Type: Integer (but interpreted as DLDeviceType)
*/
constexpr const char* kResultDeviceType = "result_device_type";

} // namespace attr
} // namespace tvm
#endif // TVM_IR_FUNCTION_H_
4 changes: 2 additions & 2 deletions include/tvm/meta_schedule/builder.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
namespace tvm {
namespace meta_schedule {

/*! \brief The builder's input. */
/*! \brief The builder's input, containing an IRModule and the target. */
class BuilderInputNode : public runtime::Object {
public:
/*! \brief The IRModule to be built. */
Expand Down Expand Up @@ -57,7 +57,7 @@ class BuilderInput : public runtime::ObjectRef {
TVM_DEFINE_NOTNULLABLE_OBJECT_REF_METHODS(BuilderInput, runtime::ObjectRef, BuilderInputNode);
};

/*! \brief The builder's output. */
/*! \brief The builder's output, containing the artifact path or error message if any. */
class BuilderResultNode : public runtime::Object {
public:
/*! \brief The path to the built artifact. */
Expand Down
Loading

0 comments on commit 2a5e30d

Please sign in to comment.