Skip to content

Commit 0ada22f

Browse files
Jeffrey-SimaJoeyChou-SiMa-ai
authored andcommitted
Merged in develop_pr (pull request apache#39)
Regular update from TVM master Approved-by: Mikael Sevenier Approved-by: Joey Chou Approved-by: Carlos Davila
2 parents fc8849d + 406fc7b commit 0ada22f

File tree

466 files changed

+16248
-4524
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

466 files changed

+16248
-4524
lines changed

3rdparty/dlpack

3rdparty/vta-hw

CMakeLists.txt

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ tvm_option(USE_FALLBACK_STL_MAP "Use TVM's POD compatible Map" OFF)
4949
tvm_option(USE_ETHOSN "Build with Arm Ethos-N" OFF)
5050
tvm_option(INDEX_DEFAULT_I64 "Defaults the index datatype to int64" ON)
5151
tvm_option(USE_LIBBACKTRACE "Build libbacktrace to supply linenumbers on stack traces" AUTO)
52+
tvm_option(BUILD_STATIC_RUNTIME "Build static version of libtvm_runtime" OFF)
5253

5354
# 3rdparty libraries
5455
tvm_option(DLPACK_PATH "Path to DLPACK" "3rdparty/dlpack/include")
@@ -73,6 +74,7 @@ tvm_option(USE_NNPACK "Build with nnpack support" OFF)
7374
tvm_option(USE_RANDOM "Build with random support" ON)
7475
tvm_option(USE_MICRO_STANDALONE_RUNTIME "Build with micro.standalone_runtime support" OFF)
7576
tvm_option(USE_CPP_RPC "Build CPP RPC" OFF)
77+
tvm_option(USE_IOS_RPC "Build iOS RPC" OFF)
7678
tvm_option(USE_TFLITE "Build with tflite support" OFF)
7779
tvm_option(USE_TENSORFLOW_PATH "TensorFlow root path when use TFLite" none)
7880
tvm_option(USE_COREML "Build with coreml support" OFF)
@@ -276,8 +278,18 @@ file(GLOB RUNTIME_SRCS
276278
)
277279

278280
if(BUILD_FOR_HEXAGON)
279-
# Add file implementing posix_memalign.
280-
list(APPEND RUNTIME_SRCS src/runtime/hexagon/hexagon_posix.cc)
281+
# Add file implementing posix_memalign when building the runtime as
282+
# a shared library.
283+
# This function is actually defined in the static libc, but when linking
284+
# a shared library, libc is not linked into it. Some runtime systems
285+
# don't implement posix_runtime, which causes runtime failires.
286+
# To avoid this issue, Hexagon runtime contains an implementation of
287+
# posix_memalign, but it should only be used with the dynamic TVM
288+
# runtime, since it would cause multiple definition errors with the
289+
# static one.
290+
if(NOT BUILD_STATIC_RUNTIME)
291+
list(APPEND RUNTIME_SRCS src/runtime/hexagon/hexagon_posix.cc)
292+
endif()
281293

282294
add_definitions(-D_MACH_I32=int)
283295
endif()
@@ -403,7 +415,17 @@ add_library(tvm_runtime_objs OBJECT ${RUNTIME_SRCS})
403415

404416
add_library(tvm SHARED $<TARGET_OBJECTS:tvm_objs> $<TARGET_OBJECTS:tvm_runtime_objs>)
405417
set_property(TARGET tvm APPEND PROPERTY LINK_OPTIONS "${TVM_VISIBILITY_FLAG}")
406-
add_library(tvm_runtime SHARED $<TARGET_OBJECTS:tvm_runtime_objs>)
418+
if(BUILD_STATIC_RUNTIME)
419+
add_library(tvm_runtime STATIC $<TARGET_OBJECTS:tvm_runtime_objs>)
420+
set(NOTICE_MULTILINE
421+
"You have build static version of the TVM runtime library. Make "
422+
"sure to use --whole-archive when linking it into your project.")
423+
string(CONCAT NOTICE ${NOTICE_MULTILINE})
424+
add_custom_command(TARGET tvm_runtime POST_BUILD
425+
COMMAND ${CMAKE_COMMAND} -E cmake_echo_color --yellow --bold ${NOTICE})
426+
else()
427+
add_library(tvm_runtime SHARED $<TARGET_OBJECTS:tvm_runtime_objs>)
428+
endif()
407429
set_property(TARGET tvm_runtime APPEND PROPERTY LINK_OPTIONS "${TVM_VISIBILITY_FLAG}")
408430
target_compile_definitions(tvm_objs PUBLIC DMLC_USE_LOGGING_LIBRARY=<tvm/runtime/logging.h>)
409431
target_compile_definitions(tvm_runtime_objs PUBLIC DMLC_USE_LOGGING_LIBRARY=<tvm/runtime/logging.h>)
@@ -424,6 +446,10 @@ if(USE_CPP_RPC)
424446
add_subdirectory("apps/cpp_rpc")
425447
endif()
426448

449+
if(USE_IOS_RPC)
450+
add_subdirectory("apps/ios_rpc")
451+
endif()
452+
427453
if(USE_RELAY_DEBUG)
428454
message(STATUS "Building Relay in debug mode...")
429455
target_compile_definitions(tvm_objs PRIVATE "USE_RELAY_DEBUG")

CONTRIBUTORS.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,12 @@ We do encourage everyone to work anything they are interested in.
5555
- [Marisa Kirisame](https://github.com/MarisaKirisame): @MarisaKirisame - relay
5656
- [Wuwei Lin](https://github.com/vinx13): @vinx13 - relay, topi
5757
- [Yizhi Liu](https://github.com/yzhliu) (PMC): @yzhliu - jvm, topi, relay
58+
- [Steven Lyubomirsky](https://github.com/slyubomirsky): @slyubomirsky - relay
5859
- [Hao Lu](https://github.com/hlu1): @hlu1 - nnpack, frontends
5960
- [Masahiro Masuda](https://github.com/masahi) (PMC): @masahi - topi, relay
6061
- [Thierry Moreau](https://github.com/tmoreau89) (PMC): @tmoreau89 - vta
6162
- [Kazutaka Morita](https://github.com/kazum): @kazum - frontends, opencl
63+
- [Leandro Nunes](https://github.com/leandron): @leandron - tvmc
6264
- [Krzysztof Parzyszek](https://github.com/kparzysz-quic): @kparzysz-quic - hexagon, llvm
6365
- [Andrew Reusch](https://github.com/areusch): @areusch - runtime, µTVM
6466
- [Jared Roesch](https://github.com/jroesch) (PMC): @jroesch - relay
@@ -106,11 +108,13 @@ We do encourage everyone to work anything they are interested in.
106108
- [Zhixun Tan](https://github.com/phisiart): @phisiart
107109
- [Xiaoqiang Dan](https://github.com/xqdan): @xqdan
108110
- [Ziheng Jiang](https://github.com/ZihengJiang): @ZihengJiang
111+
- [Manupa Karunaratne](https://github.com/manupa-arm): @manupa-arm
109112
- [Marisa Kirisame](https://github.com/MarisaKirisame): @MarisaKirisame
110113
- [Tristan Konolige](https://github.com/tkonolige): @tkonolige
111114
- [Wuwei Lin](https://github.com/vinx13): @vinx13
112115
- [Andrew Liu](https://github.com/hypercubestart): @hypercubestart
113116
- [Henry Liu](https://github.com/optima2005): @optima2005
117+
- [Xin Liu](https://github.com/Meteorix): @Meteorix
114118
- [Steven Lyubomirsky](https://github.com/slyubomirsky): @slyubomirsky
115119
- [Masahiro Masuda](https://github.com/masahi): @masahi
116120
- [Sergey Mironov](https://github.com/grwlf): @grwlf
@@ -123,6 +127,7 @@ We do encourage everyone to work anything they are interested in.
123127
- [Pariksheet Pinjari](https://github.com/PariksheetPinjari909): @PariksheetPinjari909
124128
- [Josh Pollock](https://github.com/joshpoll): @joshpoll
125129
- [Jared Roesch](https://github.com/jroesch): @jroesch
130+
- [Giuseppe Rossini](https://github.com/giuseros): @giuseros
126131
- [Andrew Reusch](https://github.com/areusch): @areusch
127132
- [Dmitriy Smirnov](https://github.com/d-smirnov): @d-smirnov
128133
- [Siva](https://github.com/srkreddy1238): @srkreddy1238

Jenkinsfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ ci_gpu = "tlcpack/ci-gpu:v0.72"
4949
ci_cpu = "tlcpack/ci-cpu:v0.73"
5050
ci_wasm = "tlcpack/ci-wasm:v0.70"
5151
ci_i386 = "tlcpack/ci-i386:v0.72-t0"
52-
ci_qemu = "tlcpack/ci-qemu:v0.03"
52+
ci_qemu = "tlcpack/ci-qemu:v0.04"
5353
ci_arm = "tlcpack/ci-arm:v0.03"
5454
// <--- End of regex-scanned config.
5555

apps/benchmark/arm_cpu_imagenet_bench.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ def evaluate_network(network, target, target_host, repeat):
9898
help="The model of the test device. If your device is not listed in "
9999
"the choices list, pick the most similar one as argument.",
100100
)
101-
parser.add_argument("--host", type=str, default="localhost")
101+
parser.add_argument("--host", type=str, default="127.0.0.1")
102102
parser.add_argument("--port", type=int, default=9190)
103103
parser.add_argument("--rpc-key", type=str, required=True)
104104
parser.add_argument("--repeat", type=int, default=10)

apps/benchmark/mobile_gpu_imagenet_bench.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ def evaluate_network(network, target, target_host, dtype, repeat):
9898
help="The model of the test device. If your device is not listed in "
9999
"the choices list, pick the most similar one as argument.",
100100
)
101-
parser.add_argument("--host", type=str, default="localhost")
101+
parser.add_argument("--host", type=str, default="127.0.0.1")
102102
parser.add_argument("--port", type=int, default=9190)
103103
parser.add_argument("--rpc-key", type=str, required=True)
104104
parser.add_argument("--repeat", type=int, default=30)

apps/bundle_deploy/bundle.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323
#include <tvm/runtime/c_runtime_api.h>
2424
#include <tvm/runtime/crt/crt.h>
2525
#include <tvm/runtime/crt/graph_executor.h>
26-
#include <tvm/runtime/crt/memory.h>
2726
#include <tvm/runtime/crt/packed_func.h>
27+
#include <tvm/runtime/crt/page_allocator.h>
2828

2929
#ifdef ENABLE_TVM_ABORT_BACKTRACE
3030
#include "backtrace.h"
@@ -64,8 +64,8 @@ TVM_DLL void* tvm_runtime_create(const char* json_data, const char* params_data,
6464
dev.device_id = device_id;
6565

6666
// declare pointers
67-
TVM_CCALL(MemoryManagerCreate(&g_memory_manager, g_crt_memory, sizeof(g_crt_memory),
68-
CRT_MEMORY_PAGE_SIZE_LOG2));
67+
TVM_CCALL(PageMemoryManagerCreate(&g_memory_manager, g_crt_memory, sizeof(g_crt_memory),
68+
CRT_MEMORY_PAGE_SIZE_LOG2));
6969
TVM_CCALL(TVMInitializeRuntime());
7070
TVMPackedFunc pf;
7171
TVMArgs args = TVMArgs_Create(NULL, NULL, 0);

apps/bundle_deploy/bundle_static.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@
2222
#include <stdlib.h>
2323
#include <tvm/runtime/crt/crt.h>
2424
#include <tvm/runtime/crt/graph_executor.h>
25-
#include <tvm/runtime/crt/memory.h>
2625
#include <tvm/runtime/crt/packed_func.h>
26+
#include <tvm/runtime/crt/page_allocator.h>
2727
#include <unistd.h>
2828

2929
#ifdef ENABLE_TVM_PLATFORM_ABORT_BACKTRACE
@@ -64,8 +64,8 @@ TVM_DLL void* tvm_runtime_create(const char* json_data, const char* params_data,
6464
dev.device_id = device_id;
6565

6666
// get pointers
67-
TVM_CCALL(MemoryManagerCreate(&g_memory_manager, g_crt_memory, sizeof(g_crt_memory),
68-
CRT_MEMORY_PAGE_SIZE_LOG2));
67+
TVM_CCALL(PageMemoryManagerCreate(&g_memory_manager, g_crt_memory, sizeof(g_crt_memory),
68+
CRT_MEMORY_PAGE_SIZE_LOG2));
6969
TVM_CCALL(TVMInitializeRuntime());
7070
TVMPackedFunc pf;
7171
TVMArgs args = TVMArgs_Create(NULL, NULL, 0);

apps/ios_rpc/CMakeLists.txt

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
18+
include(ExternalProject)
19+
20+
# Check if xcodebuild tool is available and configured.
21+
# Otherwise will skip all iOS specific targets.
22+
execute_process(COMMAND xcodebuild -version
23+
RESULT_VARIABLE XCBUILD_AVAILABLE
24+
OUTPUT_QUIET
25+
ERROR_QUIET
26+
)
27+
28+
if (NOT XCBUILD_AVAILABLE EQUAL 0)
29+
message(WARNING
30+
"The build tool xcodebuild is not properly configured. Please install Xcode app and specify "
31+
"path to it via DEVELOPER_DIR env var or \"sudo xcode-select -switch <path-to-xcode-dev-dir>\".\n"
32+
"iOS RPC application target is switched off."
33+
)
34+
return()
35+
endif()
36+
37+
38+
# External project with custom mach-o dynamic loader
39+
# It is required to load unsigned shared modules on real iOS devices
40+
ExternalProject_Add(custom_dso_loader
41+
GIT_REPOSITORY https://github.com/octoml/macho-dyld.git
42+
GIT_TAG 48d1e8b5c40c7f5b744cb089634af17dd86125b2
43+
PREFIX custom_dso_loader
44+
LOG_DOWNLOAD TRUE
45+
LOG_CONFIGURE TRUE
46+
CMAKE_ARGS
47+
-DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR> # to install into local build dir
48+
-DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS}
49+
-DCMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME}
50+
-DCMAKE_SYSTEM_VERSION=${CMAKE_SYSTEM_VERSION}
51+
-DCMAKE_OSX_SYSROOT=${CMAKE_OSX_SYSROOT}
52+
-DCMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES}
53+
-DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}
54+
-DCMAKE_BUILD_WITH_INSTALL_NAME_DIR=${CMAKE_BUILD_WITH_INSTALL_NAME_DIR}
55+
)
56+
57+
# iOS RPC Xcode project wrapper to integrate into Cmake
58+
ExternalProject_Add(ios_rpc
59+
PREFIX ios_rpc
60+
DEPENDS custom_dso_loader
61+
SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}
62+
CONFIGURE_COMMAND ""
63+
INSTALL_COMMAND ""
64+
BUILD_COMMAND xcodebuild
65+
-scheme tvmrpc
66+
-configuration ${CMAKE_BUILD_TYPE}
67+
-project <SOURCE_DIR>/tvmrpc.xcodeproj
68+
-derivedDataPath <BINARY_DIR>
69+
-sdk ${CMAKE_OSX_SYSROOT}
70+
-arch ${CMAKE_OSX_ARCHITECTURES}
71+
-hideShellScriptEnvironment
72+
build
73+
IPHONEOS_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}
74+
DEVELOPMENT_TEAM=${CMAKE_XCODE_ATTRIBUTE_DEVELOPMENT_TEAM}
75+
TVM_BUILD_DIR=${CMAKE_BINARY_DIR}
76+
USE_CUSTOM_DSO_LOADER=YES
77+
)

0 commit comments

Comments
 (0)