Skip to content

Commit

Permalink
Merge pull request #5 from dmlc/master
Browse files Browse the repository at this point in the history
Pull
  • Loading branch information
sergei-mironov authored Aug 30, 2018
2 parents 0241fdc + 0c52378 commit a982599
Show file tree
Hide file tree
Showing 390 changed files with 11,316 additions and 3,501 deletions.
12 changes: 11 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ tvm_option(USE_ROCM "Build with ROCM" OFF)
tvm_option(ROCM_PATH "The path to rocm" /opt/rocm)
tvm_option(USE_RPC "Build with RPC" ON)
tvm_option(USE_LLVM "Build with LLVM, can be set to specific llvm-config path" OFF)
tvm_option(USE_STACKVM_RUNTIME "Include stackvm into the runtime" OFF)
tvm_option(USE_GRAPH_RUNTIME "Build with tiny graph runtime" ON)
tvm_option(USE_GRAPH_RUNTIME_DEBUG "Build with tiny graph runtime debug mode" OFF)
tvm_option(USE_RTTI "Build with RTTI" ON)
Expand Down Expand Up @@ -97,7 +98,6 @@ file(GLOB COMPILER_SRCS
src/arithmetic/*.cc
src/autotvm/*.cc
src/codegen/*.cc
src/codegen/stack_vm/*.cc
src/lang/*.cc
src/pass/*.cc
src/op/*.cc
Expand Down Expand Up @@ -135,6 +135,16 @@ if(USE_RPC)
list(APPEND RUNTIME_SRCS ${RUNTIME_RPC_SRCS})
endif(USE_RPC)

file(GLOB STACKVM_RUNTIME_SRCS src/runtime/stackvm/*.cc)
file(GLOB STACKVM_CODEGEN_SRCS src/codegen/stackvm/*.cc)
list(APPEND COMPILER_SRCS ${STACKVM_CODEGEN_SRCS})
if(USE_STACKVM_RUNTIME)
message(STATUS "Build with stackvm support in runtime...")
list(APPEND RUNTIME_SRCS ${STACKVM_RUNTIME_SRCS})
else()
list(APPEND COMPILER_SRCS ${STACKVM_RUNTIME_SRCS})
endif(USE_STACKVM_RUNTIME)

if(USE_GRAPH_RUNTIME)
message(STATUS "Build with Graph runtime support...")
file(GLOB RUNTIME_GRAPH_SRCS src/runtime/graph/*.cc)
Expand Down
7 changes: 3 additions & 4 deletions CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,25 +18,24 @@ See the [community structure document](http://docs.tvm.ai/contribute/community.h
- [Yuwei Hu](https://github.com/Huyuwei) TOPI
- [Zhixun Tan](https://github.com/phisiart) OpenGL/WebGL backend
- [Nick Hynes](https://github.com/nhynes) SGX and secured computing
- [Lianmin Zheng](https://github.com/merrymercy) AutoTVM

## Reviewers
- [Masahiro Masuda](https://github.com/masahi)
- [Kazutaka Morita](https://github.com/kazum)
- [Tatsuya Nishiyama](https://github.com/nishi-t)
- [Pariksheet Pinjari](https://github.com/PariksheetPinjari909)
- [Siva](https://github.com/srkreddy1238)
- [Alex Weaver](https://github.com/alex-weaver)
- [Yao Wang](https://github.com/kevinthesun)
- [Eddie Yan](https://github.com/eqy)
- [Joshua Z. Zhang](https://github.com/zhreshold)
- [Lianmin Zheng](https://github.com/merrymercy)

## List of Contributors
- [Full List of Contributors](https://github.com/dmlc/tvm/graphs/contributors)
- To contributors: please add your name to the list.
- [Qiao Zhang](https://github.com/zhangqiaorjc)
- [Jian Weng](https://github.com/were)
- [Masahiro Masuda](https://github.com/masahi)
- [Haolong Zhang](https://github.com/haolongzhangm)
- [Cody Hao Yu](https://github.com/comaniac)
- [Chris Nuernberger](https://github.com/cnuernber)
- [Tatsuya Nishiyama](https://github.com/nishi-t)
- [Kazutaka Morita](https://github.com/kazum)
2 changes: 1 addition & 1 deletion HalideIR
1 change: 1 addition & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ stage('Build') {
echo set\\(USE_RPC ON\\) >> config.cmake
echo set\\(USE_SORT ON\\) >> config.cmake
echo set\\(USE_GRAPH_RUNTIME ON\\) >> config.cmake
echo set\\(USE_STACKVM_RUNTIME ON\\) >> config.cmake
echo set\\(USE_BLAS openblas\\) >> config.cmake
echo set\\(CMAKE_CXX_COMPILER g++\\) >> config.cmake
echo set\\(CMAKE_CXX_FLAGS -Werror\\) >> config.cmake
Expand Down
63 changes: 63 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,69 @@ Refer to the Roadmap issue for complete list on on-going version features.
If you check in something that is not reflected in Roadmap issue, please reply
to that issue so it can get added.

## 0.4

This release features several major improvements. The high-level graph optimizer is now part of TVM repo. Some of the highlights are: Initial support of AutoTVM for automated optimization; customized accelerator backend VTA.

- Tensor operator primitives
- Introduce attrs field to operator primitives(e.g. compute) to store additional metadata, the attrs can be used as hint for scheduling
- Enable embedding of asm micro-kernels
- Hybrid python programming model
- python AST based IR builder interface
- support GPU programs
- AutoTVM, Automated tuning, and scheduling
- basic autotvm infra
- GPU IR verifier
- basic autotuning tutorial
- topi integration
- ARM support
- winograd support
- initial support of ARM autotuning records
- TOPI Vision
- Generic GPU sort support(useful for vision)
- SSD operator support
- TOPI numpy consistency
- Rename all binary operators for numpy consistecy: broadcast_add-> add, broadcast_sub -> substract, broadcast_mul -> multiply, broadcast_div->divide
- New operators: slice, LRN, equal, not_equal, less, greater
- tutorials on topi
- Initial low-bit operator support support
- Optimized popcount generation on ARM
- general bit-serial convolution and GEMM
- optimized low bit kernels
- parallel optimization
- New topi backend optimization for intel graphics
- Adapt AVX schedules for SSE target
- VTA: customized accelerator backend
- custom hardware backend example
- tutorials on how to use customized accelerator
- Initial experimental support for HLS backend
- Bugfix in SPIRV code generator for vulkan
- libdevice support, enable NVPTX backend
- Introduce NDArrayContainer for managed NDarray
- RPC and Device API
- Support communication between big/small endian machines.
- RPC and device API protocol upgrade (this is a non-backward compatible change) to support big-small endian communication. This is a non-backward compatible change, need to use the latest version of TVM runtime with the RPC
- graduate rpc from contrib, tvm.contrib.rpc->tvm.rpc
-Support tracker in Android RPC, add fault tolerance for AutoTVM
- BIG.LITTLE aware threadpool
- tvm4j graph runtime that runs end to end workload in java
- DLPack support
- Support from_dlpack and to_dlpack
- Enables bridges to pytorch
- Enable link of stackvm in runtime
- Tensorflow graphdef frontend
- Keras frontend
- improved to support reuse layers, add activations
- ONNX
- gather, LRN
- CoreML frontend
- Support C-RNN and activation functions
- Fix grads for sum and expand_like
- Enhanced operator fusion for multiple elemwise branches
- Separate nnvm fusion and compilation pass
- Unified build system to cmake, customizable cmake path for vulkan, rocm, cuda


## 0.3

This release features numerous improvements in TOPI and backends. We make the first step toward object detection support in TOPI, featuring operators necessary for YOLO and SSDs. The topi now supports numpy-style API and operator overloading. RPC is significantly improved to support resource allocation and using a pool of devices. We are adding two new backends: WebGL for running GPUs on the browser, and Vulkan for running on next-generation graphics API.
Expand Down
35 changes: 21 additions & 14 deletions apps/android_rpc/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,11 @@ You are supposed to find a free "android" in the queue status.
...
Queue Status
----------------------------
key free pending
----------------------------
android 1 0
----------------------------
-------------------------------
key total free pending
-------------------------------
android 1 1 0
-------------------------------
```


Expand All @@ -123,18 +123,25 @@ export TVM_NDK_CC=/opt/android-toolchain-arm64/bin/aarch64-linux-android-g++
python android_rpc_test.py
```

This will compile TVM IR to shared libraries (CPU and OpenCL) and run vector addition on your Android device. On my test device, it gives following results.
This will compile TVM IR to shared libraries (CPU, OpenCL and Vulkan) and run vector addition on your Android device. To verify compiled TVM IR shared libraries on OpenCL target set [`'test_opencl = True'`](https://github.com/dmlc/tvm/blob/master/apps/android_rpc/tests/android_rpc_test.py#L25) and on Vulkan target set [`'test_vulkan = False'`](https://github.com/dmlc/tvm/blob/master/apps/android_rpc/tests/android_rpc_test.py#L27) in [tests/android_rpc_test.py](https://github.com/dmlc/tvm/blob/master/apps/android_rpc/tests/android_rpc_test.py), by default on CPU target will execute.
On my test device, it gives following results.

```bash
TVM: Initializing cython mode...
[01:21:43] src/codegen/llvm/codegen_llvm.cc:75: set native vector to be 32 for target aarch64
[01:21:43] src/runtime/opencl/opencl_device_api.cc:194: Initialize OpenCL platform 'Apple'
[01:21:43] src/runtime/opencl/opencl_device_api.cc:214: opencl(0)='Iris' cl_device_id=0x1024500
[01:21:44] src/codegen/llvm/codegen_llvm.cc:75: set native vector to be 32 for target aarch64
Run GPU test ...
0.000155807 secs/op
Run CPU test ...
0.00139824 secs/op
0.000962932 secs/op

Run GPU(OpenCL Flavor) test ...
0.000155807 secs/op

[23:29:34] /home/tvm/src/runtime/vulkan/vulkan_device_api.cc:674: Cannot initialize vulkan: [23:29:34] /home/tvm/src/runtime/vulkan/vulkan_device_api.cc:512: Check failed: __e == VK_SUCCESS Vulan Error, code=-9: VK_ERROR_INCOMPATIBLE_DRIVER

Stack trace returned 10 entries:
[bt] (0) /home/user/.local/lib/python3.6/site-packages/tvm-0.4.0-py3.6-linux-x86_64.egg/tvm/libtvm.so(dmlc::StackTrace[abi:cxx11]()+0x53) [0x7f477f5399f3]
.........

You can still compile vulkan module but cannot run locally
Run GPU(Vulkan Flavor) test ...
0.000225198 secs/op
```

You can define your own TVM operators and test via this RPC app on your Android device to find the most optimized TVM schedule.
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,9 @@


public class MainActivity extends AppCompatActivity {
private boolean skipRelaunch = true;
// wait time before automatic restart of RPC Activity
public static final int HANDLER_RESTART_DELAY = 5000;


private void showDialog(String title, String msg) {
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle(title);
Expand Down Expand Up @@ -91,7 +89,7 @@ private void setupRelaunch() {
final Runnable rPCStarter = new Runnable() {
public void run() {
if (switchPersistent.isChecked()) {
System.err.println("relaunching RPC activity in 5s...");
System.err.println("relaunching RPC activity...");
Intent intent = ((MainActivity) context).updateRPCPrefs();
startActivity(intent);
}
Expand All @@ -116,36 +114,22 @@ public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if (isChecked) {
System.err.println("automatic RPC restart enabled...");
updateRPCPrefs();
setupRelaunch();
} else {
System.err.println("automatic RPC restart disabled...");
updateRPCPrefs();
}
}
});

Button startRPC = findViewById(R.id.button_start_rpc);
startRPC.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
Intent intent = ((MainActivity) context).updateRPCPrefs();
startActivity(intent);
}
});

enableInputView(true);
}

@Override
protected void onResume() {
System.err.println("MainActivity onResume...");
System.err.println("skipRelaunch: " + skipRelaunch);
// if this is the first time onResume is called, do nothing, otherwise we
// may double launch
if (!skipRelaunch) {
enableInputView(true);
setupRelaunch();
} else {
skipRelaunch = false;
}
enableInputView(true);
setupRelaunch();
super.onResume();
}

Expand Down
16 changes: 8 additions & 8 deletions apps/android_rpc/app/src/main/jni/Application.mk
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
ifndef config
ifneq ("$(wildcard ./config.mk)","")
config ?= config.mk
else
config ?= make/config.mk
endif
ifneq ("$(wildcard ./config.mk)","")
config ?= config.mk
else
config ?= make/config.mk
endif
endif

include $(config)
Expand All @@ -16,10 +16,10 @@ APP_STL := c++_static

APP_CPPFLAGS += -DDMLC_LOG_STACK_TRACE=0 -DTVM4J_ANDROID=1 -std=c++11 -Oz -frtti
ifeq ($(USE_OPENCL), 1)
APP_CPPFLAGS += -DTVM_OPENCL_RUNTIME=1
APP_CPPFLAGS += -DTVM_OPENCL_RUNTIME=1
endif

ifeq ($(USE_VULKAN), 1)
APP_CPPFLAGS += -DTVM_VULKAN_RUNTIME=1
APP_LDFLAGS += -lvulkan
APP_CPPFLAGS += -DTVM_VULKAN_RUNTIME=1
APP_LDFLAGS += -lvulkan
endif
13 changes: 2 additions & 11 deletions apps/android_rpc/app/src/main/res/layout/content_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
android:hint="@string/input_address"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="phone"
android:background="@android:drawable/editbox_background"/>
</LinearLayout>

Expand All @@ -37,6 +38,7 @@
android:minWidth="100dip"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="phone"
android:background="@android:drawable/editbox_background"/>
</LinearLayout>

Expand Down Expand Up @@ -76,15 +78,4 @@
android:textOn="@string/switch_on" />
</LinearLayout>

<LinearLayout
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<Button
android:id="@+id/button_start_rpc"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:text="@string/start_rpc" />
</LinearLayout>

</LinearLayout>
3 changes: 1 addition & 2 deletions apps/android_rpc/app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,10 @@
<string name="label_address">Address</string>
<string name="label_port">Port</string>
<string name="label_key">Key</string>
<string name="label_persistent">Keep RPC Alive</string>
<string name="label_persistent">Enable RPC</string>

<string name="switch_on">Enabled</string>
<string name="switch_off">Disabled</string>

<string name="start_rpc">Start RPC</string>
<string name="stop_rpc">Stop RPC</string>
</resources>
Loading

0 comments on commit a982599

Please sign in to comment.