├── .clang-format ├── .github ├── CODEOWNERS ├── ISSUE_TEMPLATE.md └── PULL_REQUEST_TEMPLATE.md ├── .gitignore ├── .gitmodules ├── 3rdparty ├── bfloat16 │ └── bfloat16.cc ├── cma │ ├── Makefile │ ├── cma.c │ ├── cma.h │ └── settings.mk └── compiler-rt │ └── builtin_fp16.h ├── CMakeLists.txt ├── CONTRIBUTORS.md ├── Jenkinsfile ├── LICENSE ├── Makefile ├── NEWS.md ├── NOTICE ├── README.md ├── SECURITY.md ├── apps ├── README.md ├── android_deploy │ ├── .gitignore │ ├── README.md │ ├── app │ │ ├── .gitignore │ │ ├── build.gradle │ │ ├── download-models.gradle │ │ └── src │ │ │ └── main │ │ │ ├── AndroidManifest.xml │ │ │ ├── java │ │ │ └── ml │ │ │ │ └── dmlc │ │ │ │ └── tvm │ │ │ │ └── android │ │ │ │ └── demo │ │ │ │ └── MainActivity.java │ │ │ ├── jni │ │ │ ├── Android.mk │ │ │ ├── Application.mk │ │ │ ├── build.sh │ │ │ ├── make │ │ │ │ └── config.mk │ │ │ └── tvm_runtime.h │ │ │ └── res │ │ │ ├── layout │ │ │ ├── activity_main.xml │ │ │ └── content_main.xml │ │ │ ├── values │ │ │ ├── colors.xml │ │ │ ├── strings.xml │ │ │ └── styles.xml │ │ │ └── xml │ │ │ └── provider_paths.xml │ ├── build.gradle │ ├── dev_tools │ │ ├── gen_keystore.sh │ │ └── sign_apk.sh │ └── settings.gradle ├── android_rpc │ ├── .gitignore │ ├── README.md │ ├── app │ │ ├── .gitignore │ │ ├── build.gradle │ │ └── src │ │ │ └── main │ │ │ ├── AndroidManifest.xml │ │ │ ├── java │ │ │ └── ml │ │ │ │ └── dmlc │ │ │ │ └── tvm │ │ │ │ └── tvmrpc │ │ │ │ ├── MainActivity.java │ │ │ │ ├── RPCActivity.java │ │ │ │ └── RPCProcessor.java │ │ │ ├── jni │ │ │ ├── Android.mk │ │ │ ├── Application.mk │ │ │ ├── build.sh │ │ │ ├── make │ │ │ │ └── config.mk │ │ │ └── tvm_runtime.h │ │ │ └── res │ │ │ ├── layout │ │ │ ├── activity_main.xml │ │ │ ├── activity_rpc.xml │ │ │ ├── content_main.xml │ │ │ └── content_rpc.xml │ │ │ ├── mipmap-hdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-mdpi │ │ │ └── ic_launcher.png │ │ │ └── values │ │ │ ├── colors.xml │ │ │ ├── strings.xml │ │ │ └── styles.xml │ ├── build.gradle │ ├── dev_tools │ │ ├── gen_keystore.sh │ │ └── sign_apk.sh │ ├── settings.gradle │ └── tests │ │ └── android_rpc_test.py ├── benchmark │ ├── README.md │ ├── arm_cpu_imagenet_bench.py │ ├── gpu_imagenet_bench.py │ ├── mobile_gpu_imagenet_bench.py │ └── util.py ├── bundle_deploy │ ├── Makefile │ ├── README.md │ ├── build_model.py │ ├── bundle.cc │ ├── demo.cc │ └── runtime.cc ├── extension │ ├── .gitignore │ ├── Makefile │ ├── README.md │ ├── python │ │ └── tvm_ext │ │ │ └── __init__.py │ ├── src │ │ └── tvm_ext.cc │ └── tests │ │ └── test_ext.py ├── howto_deploy │ ├── Makefile │ ├── README.md │ ├── cpp_deploy.cc │ ├── prepare_test_libs.py │ ├── run_example.sh │ └── tvm_runtime_pack.cc ├── ios_rpc │ ├── .gitignore │ ├── README.md │ ├── init_proj.py │ ├── tests │ │ └── ios_rpc_test.py │ ├── tvmrpc.xcodeproj │ │ ├── project.pbxproj │ │ └── project.xcworkspace │ │ │ └── contents.xcworkspacedata │ ├── tvmrpc │ │ ├── AppDelegate.h │ │ ├── AppDelegate.m │ │ ├── Assets.xcassets │ │ │ └── AppIcon.appiconset │ │ │ │ └── Contents.json │ │ ├── Base.lproj │ │ │ ├── LaunchScreen.storyboard │ │ │ └── Main.storyboard │ │ ├── Info.plist │ │ ├── TVMRuntime.h │ │ ├── TVMRuntime.mm │ │ ├── ViewController.h │ │ ├── ViewController.mm │ │ └── main.m │ └── tvmrpcLauncher │ │ ├── Info.plist │ │ └── tvmrpcLauncher.mm ├── rocm_rpc │ ├── Makefile │ ├── README.md │ ├── rocm_runtime_pack.cc │ └── start_rpc_server.sh ├── sgx │ ├── .gitignore │ ├── Makefile │ ├── README.md │ ├── enclave │ │ ├── .rustfmt.toml │ │ ├── Cargo.toml │ │ ├── Makefile │ │ ├── Xargo.toml │ │ ├── build.rs │ │ ├── enclave.lds │ │ ├── enclave_config.xml.in │ │ ├── sgx-deps.diff │ │ ├── src │ │ │ ├── build_model.py │ │ │ └── lib.rs │ │ └── x86_64-unknown-linux-sgx.json │ ├── run_example.sh │ └── run_model.py └── vta_rpc │ ├── start_rpc_server.sh │ └── start_rpc_server_to_tracker.py ├── cmake ├── config.cmake ├── modules │ ├── ANTLR.cmake │ ├── CUDA.cmake │ ├── LLVM.cmake │ ├── Metal.cmake │ ├── Micro.cmake │ ├── OpenCL.cmake │ ├── OpenGL.cmake │ ├── ROCM.cmake │ ├── SGX.cmake │ ├── VTA.cmake │ ├── Vulkan.cmake │ └── contrib │ │ ├── BLAS.cmake │ │ ├── HybridDump.cmake │ │ ├── NNPack.cmake │ │ ├── Random.cmake │ │ └── Sort.cmake └── util │ ├── FindCUDA.cmake │ ├── FindLLVM.cmake │ ├── FindROCM.cmake │ ├── FindVulkan.cmake │ └── Util.cmake ├── conda ├── Dockerfile.template ├── build_cpu.sh ├── build_cuda.sh ├── conda_build_config.yaml ├── cross-linux.cmake ├── render_cuda.py ├── tvm-libs │ ├── build.sh │ └── meta.yaml └── tvm │ ├── build.sh │ └── meta.yaml ├── docker ├── Dockerfile.ci_cpu ├── Dockerfile.ci_emscripten ├── Dockerfile.ci_gpu ├── Dockerfile.ci_i386 ├── Dockerfile.ci_jekyll ├── Dockerfile.ci_lint ├── Dockerfile.conda_cpu ├── Dockerfile.conda_cuda100 ├── Dockerfile.conda_cuda90 ├── Dockerfile.demo_android ├── Dockerfile.demo_cpu ├── Dockerfile.demo_gpu ├── Dockerfile.demo_opencl ├── README.md ├── bash.sh ├── build.sh ├── install │ ├── install_tvm_cpu.sh │ ├── install_tvm_gpu.sh │ ├── ubuntu_install_androidsdk.sh │ ├── ubuntu_install_antlr.sh │ ├── ubuntu_install_caffe2.sh │ ├── ubuntu_install_chisel.sh │ ├── ubuntu_install_core.sh │ ├── ubuntu_install_coreml.sh │ ├── ubuntu_install_darknet.sh │ ├── ubuntu_install_dgl.sh │ ├── ubuntu_install_emscripten.sh │ ├── ubuntu_install_gluoncv.sh │ ├── ubuntu_install_golang.sh │ ├── ubuntu_install_gradle.sh │ ├── ubuntu_install_iverilog.sh │ ├── ubuntu_install_java.sh │ ├── ubuntu_install_llvm.sh │ ├── ubuntu_install_mxnet.sh │ ├── ubuntu_install_nnpack.sh │ ├── ubuntu_install_nodejs.sh │ ├── ubuntu_install_onnx.sh │ ├── ubuntu_install_opencl.sh │ ├── ubuntu_install_opengl.sh │ ├── ubuntu_install_python.sh │ ├── ubuntu_install_python_package.sh │ ├── ubuntu_install_rat.sh │ ├── ubuntu_install_redis.sh │ ├── ubuntu_install_rocm.sh │ ├── ubuntu_install_rust.sh │ ├── ubuntu_install_sgx.sh │ ├── ubuntu_install_sphinx.sh │ ├── ubuntu_install_tensorflow.sh │ ├── ubuntu_install_tflite.sh │ └── ubuntu_install_vulkan.sh └── with_the_same_user ├── docs ├── .gitignore ├── Doxyfile ├── Makefile ├── README.txt ├── _static │ ├── css │ │ └── tvm_theme.css │ └── img │ │ ├── README │ │ ├── tvm-logo-small.png │ │ └── tvm-logo-square.png ├── api │ └── python │ │ ├── autotvm.rst │ │ ├── bridge.rst │ │ ├── build.rst │ │ ├── container.rst │ │ ├── contrib.rst │ │ ├── dev.rst │ │ ├── error.rst │ │ ├── function.rst │ │ ├── graph_runtime.rst │ │ ├── hybrid.rst │ │ ├── index.rst │ │ ├── intrin.rst │ │ ├── module.rst │ │ ├── ndarray.rst │ │ ├── nnvm │ │ ├── compiler.rst │ │ ├── frontend.rst │ │ ├── graph.rst │ │ ├── index.rst │ │ ├── symbol.rst │ │ ├── testing.rst │ │ ├── testing_new_ops.rst │ │ └── top.rst │ │ ├── relay │ │ ├── backend.rst │ │ ├── base.rst │ │ ├── build_module.rst │ │ ├── expr.rst │ │ ├── frontend.rst │ │ ├── image.rst │ │ ├── index.rst │ │ ├── module.rst │ │ ├── nn.rst │ │ ├── op.rst │ │ ├── scope_builder.rst │ │ ├── transform.rst │ │ ├── ty.rst │ │ └── vision.rst │ │ ├── rpc.rst │ │ ├── schedule.rst │ │ ├── target.rst │ │ ├── tensor.rst │ │ ├── topi.rst │ │ ├── tvm.rst │ │ └── vta │ │ └── index.rst ├── api_links.rst ├── conf.py ├── contribute │ ├── code_guide.rst │ ├── code_review.rst │ ├── committer_guide.rst │ ├── community.rst │ ├── document.rst │ ├── error_handling.rst │ ├── git_howto.md │ ├── index.rst │ └── pull_request.rst ├── deploy │ ├── android.md │ ├── aocl_fpga.md │ ├── aws_fpga.md │ ├── cpp_deploy.md │ ├── index.rst │ ├── integrate.md │ └── nnvm.md ├── dev │ ├── codebase_walkthrough.rst │ ├── debugger.rst │ ├── hybrid_script.rst │ ├── index.rst │ ├── inferbound.rst │ ├── nnvm_json_spec.rst │ ├── nnvm_overview.md │ ├── relay_add_op.rst │ ├── relay_add_pass.rst │ ├── relay_intro.rst │ ├── relay_pass_infra.rst │ ├── runtime.rst │ └── virtual_machine.rst ├── faq.md ├── frontend │ └── tensorflow.md ├── genindex.rst ├── index.rst ├── install │ ├── docker.rst │ ├── from_source.rst │ ├── index.rst │ └── nnpack.md ├── langref │ ├── hybrid_script.rst │ ├── index.rst │ ├── relay_adt.rst │ ├── relay_expr.rst │ ├── relay_op.rst │ └── relay_type.rst ├── nnvm_top.rst └── vta │ ├── .gitignore │ ├── dev │ ├── config.rst │ ├── hardware.rst │ └── index.rst │ ├── hardware.rst │ ├── index.rst │ └── install.md ├── golang ├── Makefile ├── README.md ├── sample │ ├── Makefile │ ├── complex.go │ ├── deploy.py │ ├── pack_func_closure_arg.go │ ├── pack_func_closure_return.go │ ├── pack_func_convert.go │ ├── pack_func_handle_arg.go │ ├── pack_func_register.go │ └── simple.go └── src │ ├── array_test.go │ ├── bytearray.go │ ├── bytearray_test.go │ ├── context.go │ ├── error.go │ ├── error_test.go │ ├── function.go │ ├── function_test.go │ ├── gotvm.cc │ ├── gotvm.go │ ├── gotvm.h │ ├── gotvm_test.go │ ├── module.go │ ├── module_test.go │ ├── ndarray.go │ ├── tvm_runtime_pack.cc │ ├── type.go │ ├── util.go │ ├── value.go │ └── value_test.go ├── include └── tvm │ ├── api_registry.h │ ├── arithmetic.h │ ├── attrs.h │ ├── base.h │ ├── buffer.h │ ├── build_module.h │ ├── c_dsl_api.h │ ├── channel.h │ ├── codegen.h │ ├── data_layout.h │ ├── dtype.h │ ├── expr.h │ ├── expr_operator.h │ ├── ir.h │ ├── ir_functor_ext.h │ ├── ir_mutator.h │ ├── ir_pass.h │ ├── ir_visitor.h │ ├── logging.h │ ├── lowered_func.h │ ├── node │ ├── container.h │ ├── ir_functor.h │ ├── memory.h │ └── node.h │ ├── operation.h │ ├── packed_func_ext.h │ ├── relay │ ├── adt.h │ ├── analysis.h │ ├── attrs │ │ ├── algorithm.h │ │ ├── annotation.h │ │ ├── bitserial.h │ │ ├── debug.h │ │ ├── device_copy.h │ │ ├── image.h │ │ ├── nn.h │ │ ├── reduce.h │ │ ├── transform.h │ │ └── vision.h │ ├── base.h │ ├── error.h │ ├── expr.h │ ├── expr_functor.h │ ├── feature.h │ ├── interpreter.h │ ├── module.h │ ├── op.h │ ├── op_attr_types.h │ ├── pattern_functor.h │ ├── qnn │ │ └── attrs.h │ ├── transform.h │ └── type.h │ ├── runtime │ ├── c_backend_api.h │ ├── c_runtime_api.h │ ├── device_api.h │ ├── module.h │ ├── ndarray.h │ ├── node_base.h │ ├── object.h │ ├── packed_func.h │ ├── registry.h │ ├── serializer.h │ ├── threading_backend.h │ ├── util.h │ └── vm.h │ ├── schedule.h │ ├── schedule_pass.h │ ├── target_info.h │ ├── tensor.h │ └── tensor_intrin.h ├── jvm ├── README.md ├── assembly │ ├── linux-x86_64 │ │ ├── pom.xml │ │ └── src │ │ │ └── main │ │ │ └── assembly │ │ │ └── assembly.xml │ ├── osx-x86_64 │ │ ├── pom.xml │ │ └── src │ │ │ └── main │ │ │ └── assembly │ │ │ └── assembly.xml │ └── pom.xml ├── conf │ ├── google_checks.xml │ └── log4j.properties ├── core │ ├── pom.xml │ └── src │ │ ├── main │ │ └── java │ │ │ └── ml │ │ │ └── dmlc │ │ │ └── tvm │ │ │ ├── API.java │ │ │ ├── APIInternal.java │ │ │ ├── Base.java │ │ │ ├── Function.java │ │ │ ├── LibInfo.java │ │ │ ├── Module.java │ │ │ ├── NDArray.java │ │ │ ├── NDArrayBase.java │ │ │ ├── NativeLibraryLoader.java │ │ │ ├── TVMContext.java │ │ │ ├── TVMType.java │ │ │ ├── TVMValue.java │ │ │ ├── TVMValueBytes.java │ │ │ ├── TVMValueDouble.java │ │ │ ├── TVMValueHandle.java │ │ │ ├── TVMValueLong.java │ │ │ ├── TVMValueNull.java │ │ │ ├── TVMValueString.java │ │ │ ├── TypeCode.java │ │ │ ├── contrib │ │ │ ├── GraphModule.java │ │ │ └── GraphRuntime.java │ │ │ └── rpc │ │ │ ├── Client.java │ │ │ ├── ConnectProxyServerProcessor.java │ │ │ ├── ConnectTrackerServerProcessor.java │ │ │ ├── NativeServerLoop.java │ │ │ ├── RPC.java │ │ │ ├── RPCSession.java │ │ │ ├── RPCWatchdog.java │ │ │ ├── Server.java │ │ │ ├── ServerProcessor.java │ │ │ ├── SocketFileDescriptorGetter.java │ │ │ ├── StandaloneServerProcessor.java │ │ │ ├── TVMRemoteContext.java │ │ │ └── Utils.java │ │ └── test │ │ ├── java │ │ └── ml │ │ │ └── dmlc │ │ │ └── tvm │ │ │ ├── FunctionTest.java │ │ │ ├── ModuleTest.java │ │ │ ├── NDArrayTest.java │ │ │ ├── TestUtils.java │ │ │ ├── contrib │ │ │ └── GraphRuntimeTest.java │ │ │ └── rpc │ │ │ └── RPCTest.java │ │ └── scripts │ │ ├── test_add_cpu.py │ │ ├── test_add_gpu.py │ │ ├── test_graph_runtime.py │ │ └── test_rpc_proxy_server.py ├── native │ ├── linux-x86_64 │ │ └── pom.xml │ ├── osx-x86_64 │ │ └── pom.xml │ ├── pom.xml │ └── src │ │ └── main │ │ └── native │ │ ├── jni_helper_func.h │ │ └── ml_dmlc_tvm_native_c_api.cc └── pom.xml ├── nnvm ├── Makefile ├── README.md ├── amalgamation │ ├── .gitignore │ ├── Makefile │ ├── README │ ├── amalgamation.py │ └── generate.py ├── include │ └── nnvm │ │ ├── base.h │ │ ├── c_api.h │ │ ├── compiler │ │ ├── op_attr_types.h │ │ ├── packed_func_ext.h │ │ └── util.h │ │ ├── graph.h │ │ ├── graph_attr_types.h │ │ ├── layout.h │ │ ├── node.h │ │ ├── op.h │ │ ├── op_attr_types.h │ │ ├── pass.h │ │ ├── pass_functions.h │ │ ├── symbolic.h │ │ ├── top │ │ ├── README │ │ ├── nn.h │ │ └── tensor.h │ │ └── tuple.h ├── make │ └── config.mk ├── python │ ├── .gitignore │ ├── nnvm │ │ ├── __init__.py │ │ ├── _base.py │ │ ├── _ctypes │ │ │ ├── README │ │ │ ├── __init__.py │ │ │ └── symbol.py │ │ ├── _cy2 │ │ │ ├── README │ │ │ └── __init__.py │ │ ├── _cy3 │ │ │ ├── README │ │ │ └── __init__.py │ │ ├── _symbol_internal.py │ │ ├── attribute.py │ │ ├── compiler │ │ │ ├── __init__.py │ │ │ ├── build_module.py │ │ │ ├── compile_engine.py │ │ │ ├── graph_attr.py │ │ │ ├── graph_pass.py │ │ │ ├── graph_util.py │ │ │ ├── lr_scheduler.py │ │ │ ├── optimizer.py │ │ │ └── param_dict.py │ │ ├── contrib.py │ │ ├── cython │ │ │ ├── README │ │ │ ├── base.pyi │ │ │ └── symbol.pyx │ │ ├── frontend │ │ │ ├── __init__.py │ │ │ ├── caffe2.py │ │ │ ├── common.py │ │ │ ├── coreml.py │ │ │ ├── darknet.py │ │ │ ├── keras.py │ │ │ ├── mxnet.py │ │ │ ├── onnx.py │ │ │ ├── onnx_caffe2_utils.py │ │ │ └── tensorflow.py │ │ ├── graph.py │ │ ├── libinfo.py │ │ ├── name.py │ │ ├── symbol.py │ │ ├── testing │ │ │ ├── __init__.py │ │ │ ├── check_computation.py │ │ │ ├── config.py │ │ │ ├── dcgan.py │ │ │ ├── densenet.py │ │ │ ├── dqn.py │ │ │ ├── inception_v3.py │ │ │ ├── init.py │ │ │ ├── mlp.py │ │ │ ├── mobilenet.py │ │ │ ├── mobilenet_v2.py │ │ │ ├── resnet.py │ │ │ ├── squeezenet.py │ │ │ ├── utils.py │ │ │ └── vgg.py │ │ ├── to_relay.py │ │ └── top │ │ │ ├── __init__.py │ │ │ ├── attr_dict.py │ │ │ ├── image.py │ │ │ ├── nn.py │ │ │ ├── reduction.py │ │ │ ├── registry.py │ │ │ ├── tensor.py │ │ │ ├── transform.py │ │ │ └── vision.py │ └── setup.py ├── src │ ├── README.md │ ├── c_api │ │ ├── c_api_common.h │ │ ├── c_api_error.cc │ │ ├── c_api_graph.cc │ │ └── c_api_symbolic.cc │ ├── compiler │ │ ├── alter_op_layout.cc │ │ ├── compile_engine.cc │ │ ├── compile_engine.h │ │ ├── fold_scale_axis.cc │ │ ├── graph_compile.cc │ │ ├── graph_fuse.cc │ │ ├── graph_fuse.h │ │ ├── graph_hash.cc │ │ ├── graph_hash.h │ │ ├── graph_runtime.cc │ │ ├── graph_runtime.h │ │ ├── graph_transform.h │ │ ├── node_attr.h │ │ ├── packed_func_ext.cc │ │ ├── pattern_util.h │ │ ├── precompute_prune.cc │ │ └── simplify_inference.cc │ ├── core │ │ ├── graph.cc │ │ ├── node.cc │ │ ├── op.cc │ │ ├── pass.cc │ │ └── symbolic.cc │ ├── pass │ │ ├── correct_layout.cc │ │ ├── gradient.cc │ │ ├── graph_algorithm.h │ │ ├── infer_shape_type.cc │ │ ├── order_mutation.cc │ │ ├── place_device.cc │ │ ├── plan_memory.cc │ │ ├── print_graph_ir.cc │ │ └── saveload_json.cc │ └── top │ │ ├── elemwise_op_common.h │ │ ├── image │ │ ├── resize.cc │ │ └── resize.h │ │ ├── nn │ │ ├── convolution.cc │ │ ├── nn.cc │ │ ├── nn_common.h │ │ ├── pooling.cc │ │ └── upsampling.cc │ │ ├── op_common.h │ │ ├── tensor │ │ ├── broadcast.cc │ │ ├── elemwise.cc │ │ ├── matrix_op.cc │ │ ├── reduce.cc │ │ ├── state_op.cc │ │ └── transform.cc │ │ └── vision │ │ ├── nms.cc │ │ ├── ssd │ │ └── mutibox_op.cc │ │ └── yolo │ │ ├── reorg.cc │ │ └── reorg.h ├── tests │ ├── cpp │ │ ├── .gitignore │ │ ├── op_test.cc │ │ ├── tuple_test.cc │ │ └── unittest.mk │ ├── lint │ │ └── pylintrc │ └── python │ │ ├── compiler │ │ ├── test_alter_op_layout.py │ │ ├── test_autotvm_task_extraction.py │ │ ├── test_build.py │ │ ├── test_compiler_cache.py │ │ ├── test_fold_axis.py │ │ ├── test_graph_pass.py │ │ ├── test_nhwc_layout.py │ │ ├── test_op_fusion.py │ │ ├── test_optimizer.py │ │ ├── test_param_dict.py │ │ ├── test_rpc_exec.py │ │ ├── test_simplify_inference.py │ │ ├── test_to_relay.py │ │ ├── test_top_assign.py │ │ ├── test_top_level1.py │ │ ├── test_top_level2.py │ │ ├── test_top_level3.py │ │ └── test_top_level4.py │ │ ├── frontend │ │ ├── caffe2 │ │ │ ├── model_zoo │ │ │ │ ├── __init__.py │ │ │ │ └── squeezenet.py │ │ │ ├── test_forward.py │ │ │ └── test_graph.py │ │ ├── coreml │ │ │ ├── model_zoo │ │ │ │ ├── .gitignore │ │ │ │ └── __init__.py │ │ │ └── test_forward.py │ │ ├── darknet │ │ │ └── test_forward.py │ │ ├── keras │ │ │ └── test_forward.py │ │ ├── mxnet │ │ │ ├── model_zoo │ │ │ │ ├── __init__.py │ │ │ │ ├── dcgan.py │ │ │ │ ├── dqn.py │ │ │ │ ├── inception_v3.py │ │ │ │ ├── mlp.py │ │ │ │ ├── resnet.py │ │ │ │ ├── squeezenet.py │ │ │ │ └── vgg.py │ │ │ ├── test_forward.py │ │ │ └── test_graph.py │ │ ├── onnx │ │ │ ├── model_zoo │ │ │ │ ├── __init__.py │ │ │ │ ├── squeezenet.py │ │ │ │ └── super_resolution.py │ │ │ └── test_forward.py │ │ └── tensorflow │ │ │ └── test_forward.py │ │ └── unittest │ │ ├── test_correct_layout.py │ │ ├── test_graph.py │ │ ├── test_graph_gradient.py │ │ ├── test_infer_shape.py │ │ ├── test_pass_saveload_json.py │ │ ├── test_symbol.py │ │ ├── test_top_level1.py │ │ ├── test_top_level2.py │ │ ├── test_top_level3.py │ │ └── test_top_level4.py └── tutorials │ ├── .gitignore │ ├── README.txt │ ├── deploy_model_on_mali_gpu.py │ ├── deploy_model_on_rasp.py │ ├── deploy_ssd_mxnet.py │ ├── from_coreml.py │ ├── from_darknet.py │ ├── from_mxnet.py │ ├── from_mxnet_to_webgl.py │ ├── from_onnx.py │ ├── from_tensorflow.py │ ├── get_started.py │ ├── nlp │ ├── from_darknet_rnn.py │ └── keras_s2s_translate.py │ ├── tune_nnvm_arm.py │ ├── tune_nnvm_cuda.py │ ├── tune_nnvm_mobile_gpu.py │ ├── tune_nnvm_x86.py │ ├── using_external_lib.py │ └── web │ └── resnet.html ├── python ├── .gitignore ├── setup.py └── tvm │ ├── __init__.py │ ├── _api_internal.py │ ├── _ffi │ ├── __init__.py │ ├── _ctypes │ │ ├── __init__.py │ │ ├── function.py │ │ ├── ndarray.py │ │ ├── node.py │ │ ├── types.py │ │ └── vmobj.py │ ├── _cy2 │ │ └── __init__.py │ ├── _cy3 │ │ └── __init__.py │ ├── _cython │ │ ├── base.pxi │ │ ├── core.pyx │ │ ├── function.pxi │ │ ├── ndarray.pxi │ │ ├── node.pxi │ │ └── vmobj.pxi │ ├── base.py │ ├── function.py │ ├── libinfo.py │ ├── ndarray.py │ ├── node.py │ ├── node_generic.py │ ├── runtime_ctypes.py │ └── vmobj.py │ ├── _pyversion.py │ ├── api.py │ ├── arith.py │ ├── attrs.py │ ├── autotvm │ ├── __init__.py │ ├── database.py │ ├── env.py │ ├── feature.py │ ├── graph_tuner │ │ ├── __init__.py │ │ ├── _base.py │ │ ├── base_graph_tuner.py │ │ ├── dynamic_programming_stage.py │ │ ├── dynamic_programming_tuner.py │ │ ├── pbqp_tuner.py │ │ └── utils │ │ │ ├── __init__.py │ │ │ ├── traverse_graph.py │ │ │ └── utils.py │ ├── measure │ │ ├── __init__.py │ │ ├── executor.py │ │ ├── local_executor.py │ │ ├── measure.py │ │ └── measure_methods.py │ ├── record.py │ ├── task │ │ ├── __init__.py │ │ ├── code_hash.py │ │ ├── dispatcher.py │ │ ├── nnvm_integration.py │ │ ├── relay_integration.py │ │ ├── space.py │ │ ├── task.py │ │ └── topi_integration.py │ ├── tophub.py │ ├── tuner │ │ ├── __init__.py │ │ ├── callback.py │ │ ├── ga_tuner.py │ │ ├── gridsearch_tuner.py │ │ ├── metric.py │ │ ├── model_based_tuner.py │ │ ├── sa_model_optimizer.py │ │ ├── tuner.py │ │ ├── xgboost_cost_model.py │ │ └── xgboost_tuner.py │ └── util.py │ ├── build_module.py │ ├── codegen.py │ ├── container.py │ ├── contrib │ ├── __init__.py │ ├── binutil.py │ ├── cblas.py │ ├── cc.py │ ├── clang.py │ ├── cublas.py │ ├── cudnn.py │ ├── debugger │ │ ├── __init__.py │ │ ├── debug_result.py │ │ └── debug_runtime.py │ ├── dlpack.py │ ├── download.py │ ├── emscripten.py │ ├── graph_runtime.py │ ├── miopen.py │ ├── mps.py │ ├── mxnet.py │ ├── ndk.py │ ├── nnpack.py │ ├── nvcc.py │ ├── peak.py │ ├── pickle_memoize.py │ ├── random.py │ ├── rocblas.py │ ├── rocm.py │ ├── rpc.py │ ├── sdaccel.py │ ├── sparse.py │ ├── spirv.py │ ├── tar.py │ ├── util.py │ ├── verilog.py │ └── xcode.py │ ├── datatype.py │ ├── error.py │ ├── exec │ ├── __init__.py │ ├── autotvm_log_editor.py │ ├── measure_peak.py │ ├── query_rpc_tracker.py │ ├── rpc_proxy.py │ ├── rpc_server.py │ └── rpc_tracker.py │ ├── expr.py │ ├── generic.py │ ├── hybrid │ ├── __init__.py │ ├── calls.py │ ├── module.py │ ├── parser.py │ ├── preprocessor.py │ ├── runtime.py │ └── util.py │ ├── intrin.py │ ├── ir_builder.py │ ├── ir_pass.py │ ├── make.py │ ├── micro │ ├── __init__.py │ └── base.py │ ├── module.py │ ├── ndarray.py │ ├── node.py │ ├── relay │ ├── __init__.py │ ├── _analysis.py │ ├── _base.py │ ├── _build_module.py │ ├── _expr.py │ ├── _make.py │ ├── _module.py │ ├── _module.pyi │ ├── _parser.py │ ├── _transform.py │ ├── adt.py │ ├── analysis.py │ ├── annotation.py │ ├── backend │ │ ├── __init__.py │ │ ├── _backend.py │ │ ├── _vm.py │ │ ├── _vmobj.py │ │ ├── compile_engine.py │ │ ├── deserializer.py │ │ ├── graph_runtime_codegen.py │ │ ├── interpreter.py │ │ ├── profiler_vm.py │ │ ├── serializer.py │ │ ├── vm.py │ │ └── vmobj.py │ ├── base.py │ ├── build_module.py │ ├── contrib.py │ ├── debug.py │ ├── expr.py │ ├── expr.pyi │ ├── expr_functor.py │ ├── feature.py │ ├── frontend │ │ ├── __init__.py │ │ ├── caffe2.py │ │ ├── common.py │ │ ├── coreml.py │ │ ├── darknet.py │ │ ├── keras.py │ │ ├── mxnet.py │ │ ├── nnvm_common.py │ │ ├── onnx.py │ │ ├── tensorflow.py │ │ ├── tensorflow_parser.py │ │ └── tflite.py │ ├── grammar │ │ ├── .gitignore │ │ ├── Relay.g4 │ │ ├── __init__.py │ │ └── py3 │ │ │ ├── .gitattributes │ │ │ ├── RelayLexer.py │ │ │ ├── RelayParser.py │ │ │ └── RelayVisitor.py │ ├── image.py │ ├── loops.py │ ├── module.py │ ├── nn.py │ ├── op │ │ ├── __init__.py │ │ ├── _algorithm.py │ │ ├── _make.py │ │ ├── _reduce.py │ │ ├── _tensor.py │ │ ├── _tensor_grad.py │ │ ├── _transform.py │ │ ├── algorithm.py │ │ ├── annotation │ │ │ ├── __init__.py │ │ │ ├── _make.py │ │ │ └── annotation.py │ │ ├── contrib │ │ │ ├── __init__.py │ │ │ ├── _contrib.py │ │ │ ├── _make.py │ │ │ └── contrib.py │ │ ├── image │ │ │ ├── __init__.py │ │ │ ├── _image.py │ │ │ ├── _make.py │ │ │ └── image.py │ │ ├── nn │ │ │ ├── __init__.py │ │ │ ├── _make.py │ │ │ ├── _nn.py │ │ │ └── nn.py │ │ ├── op.py │ │ ├── op_attrs.py │ │ ├── reduce.py │ │ ├── tensor.py │ │ ├── transform.py │ │ └── vision │ │ │ ├── __init__.py │ │ │ ├── _make.py │ │ │ ├── _rcnn.py │ │ │ ├── _vision.py │ │ │ ├── _yolo.py │ │ │ ├── multibox.py │ │ │ ├── nms.py │ │ │ ├── rcnn.py │ │ │ └── yolo.py │ ├── param_dict.py │ ├── parser.py │ ├── prelude.py │ ├── qnn │ │ ├── __init__.py │ │ ├── op │ │ │ ├── __init__.py │ │ │ ├── _make.py │ │ │ ├── op.py │ │ │ └── qnn.py │ │ └── transform.py │ ├── quantize │ │ ├── __init__.py │ │ ├── _annotate.py │ │ ├── _partition.py │ │ ├── _quantize.py │ │ ├── kl_divergence.py │ │ └── quantize.py │ ├── scope_builder.py │ ├── std │ │ └── prelude.rly │ ├── testing │ │ ├── __init__.py │ │ ├── config.py │ │ ├── darknet.py │ │ ├── dcgan.py │ │ ├── densenet.py │ │ ├── dqn.py │ │ ├── inception_v3.py │ │ ├── init.py │ │ ├── layers.py │ │ ├── lstm.py │ │ ├── mlp.py │ │ ├── mobilenet.py │ │ ├── nat.py │ │ ├── py_converter.py │ │ ├── resnet.py │ │ ├── squeezenet.py │ │ ├── tf.py │ │ ├── vgg.py │ │ └── yolo_detection.py │ ├── transform.py │ ├── transform.pyi │ ├── ty.py │ ├── ty.pyi │ └── vision.py │ ├── rpc │ ├── __init__.py │ ├── base.py │ ├── client.py │ ├── proxy.py │ ├── server.py │ ├── tornado_util.py │ └── tracker.py │ ├── schedule.py │ ├── stmt.py │ ├── tag.py │ ├── target.py │ ├── tensor.py │ ├── tensor_intrin.py │ └── testing.py ├── rust ├── .gitignore ├── .rustfmt.toml ├── Cargo.toml ├── common │ ├── Cargo.toml │ ├── build.rs │ └── src │ │ ├── array.rs │ │ ├── errors.rs │ │ ├── lib.rs │ │ ├── packed_func.rs │ │ └── value.rs ├── frontend │ ├── .gitignore │ ├── .travis.yml │ ├── Cargo.toml │ ├── README.md │ ├── examples │ │ └── resnet │ │ │ ├── Cargo.toml │ │ │ ├── README.md │ │ │ ├── build.rs │ │ │ └── src │ │ │ ├── build_resnet.py │ │ │ └── main.rs │ ├── src │ │ ├── context.rs │ │ ├── errors.rs │ │ ├── function.rs │ │ ├── lib.rs │ │ ├── module.rs │ │ ├── ndarray.rs │ │ └── value.rs │ └── tests │ │ ├── basics │ │ ├── .gitignore │ │ ├── Cargo.toml │ │ ├── build.rs │ │ └── src │ │ │ ├── main.rs │ │ │ └── tvm_add.py │ │ └── callback │ │ ├── Cargo.toml │ │ └── src │ │ └── bin │ │ ├── array.rs │ │ ├── error.rs │ │ ├── float.rs │ │ ├── int.rs │ │ └── string.rs ├── macros │ ├── Cargo.toml │ └── src │ │ └── lib.rs └── runtime │ ├── .travis.yml │ ├── Cargo.toml │ ├── src │ ├── allocator.rs │ ├── array.rs │ ├── errors.rs │ ├── graph.rs │ ├── lib.rs │ ├── module │ │ ├── dso.rs │ │ ├── mod.rs │ │ └── syslib.rs │ ├── sgx.rs │ ├── threading.rs │ └── workspace.rs │ └── tests │ ├── .gitignore │ ├── build_model.py │ ├── test_graph_serde.rs │ ├── test_nnvm │ ├── Cargo.toml │ ├── build.rs │ └── src │ │ ├── build_test_graph.py │ │ └── main.rs │ ├── test_tvm_basic │ ├── Cargo.toml │ ├── build.rs │ └── src │ │ ├── build_test_lib.py │ │ └── main.rs │ └── test_tvm_dso │ ├── Cargo.toml │ ├── build.rs │ └── src │ ├── build_test_lib.py │ └── main.rs ├── src ├── README.md ├── api │ ├── api_arith.cc │ ├── api_base.cc │ ├── api_codegen.cc │ ├── api_ir.cc │ ├── api_lang.cc │ ├── api_pass.cc │ ├── api_schedule.cc │ ├── api_test.cc │ └── dsl_api.cc ├── arithmetic │ ├── analyzer.cc │ ├── bound_deducer.cc │ ├── canonical_simplify.cc │ ├── compute_expr.h │ ├── const_fold.h │ ├── const_int_bound.cc │ ├── detect_linear_equation.cc │ ├── domain_touched.cc │ ├── int_operator.h │ ├── int_set.cc │ ├── int_set.h │ ├── modular_set.cc │ ├── pattern_match.h │ ├── rewrite_simplify.cc │ ├── rewrite_simplify.h │ └── stmt_simplify.cc ├── autotvm │ ├── feature_visitor.cc │ ├── feature_visitor.h │ ├── touch_extractor.cc │ └── touch_extractor.h ├── codegen │ ├── build_common.h │ ├── build_module.cc │ ├── codegen.cc │ ├── codegen_aocl.cc │ ├── codegen_c.cc │ ├── codegen_c.h │ ├── codegen_c_host.cc │ ├── codegen_c_host.h │ ├── codegen_cuda.cc │ ├── codegen_cuda.h │ ├── codegen_metal.cc │ ├── codegen_metal.h │ ├── codegen_opencl.cc │ ├── codegen_opencl.h │ ├── codegen_opengl.cc │ ├── codegen_opengl.h │ ├── codegen_source_base.cc │ ├── codegen_source_base.h │ ├── codegen_vhls.cc │ ├── codegen_vhls.h │ ├── datatype │ │ ├── registry.cc │ │ └── registry.h │ ├── intrin_rule.cc │ ├── intrin_rule.h │ ├── intrin_rule_aocl.cc │ ├── intrin_rule_cuda.cc │ ├── intrin_rule_metal.cc │ ├── intrin_rule_opencl.cc │ ├── intrin_rule_opengl.cc │ ├── intrin_rule_vhls.cc │ ├── llvm │ │ ├── codegen_amdgpu.cc │ │ ├── codegen_arm.cc │ │ ├── codegen_cpu.cc │ │ ├── codegen_cpu.h │ │ ├── codegen_llvm.cc │ │ ├── codegen_llvm.h │ │ ├── codegen_nvptx.cc │ │ ├── codegen_x86_64.cc │ │ ├── intrin_rule_llvm.cc │ │ ├── intrin_rule_llvm.h │ │ ├── intrin_rule_nvptx.cc │ │ ├── intrin_rule_rocm.cc │ │ ├── llvm_common.cc │ │ ├── llvm_common.h │ │ └── llvm_module.cc │ ├── opt │ │ ├── README │ │ ├── build_aocl_off.cc │ │ ├── build_cuda_off.cc │ │ ├── build_cuda_on.cc │ │ ├── build_metal_off.cc │ │ ├── build_opencl_off.cc │ │ ├── build_opengl_off.cc │ │ ├── build_rocm_off.cc │ │ └── build_sdaccel_off.cc │ ├── source_module.cc │ ├── spirv │ │ ├── build_vulkan.cc │ │ ├── codegen_spirv.cc │ │ ├── codegen_spirv.h │ │ ├── intrin_rule_spirv.cc │ │ ├── ir_builder.cc │ │ └── ir_builder.h │ └── stackvm │ │ ├── codegen_stackvm.cc │ │ └── codegen_stackvm.h ├── common │ ├── arena.h │ ├── base64.h │ ├── pipe.h │ ├── ring_buffer.h │ └── socket.h ├── contrib │ ├── cblas │ │ ├── cblas.cc │ │ └── gemm_common.h │ ├── cublas │ │ ├── cublas.cc │ │ ├── cublas_utils.cc │ │ └── cublas_utils.h │ ├── cudnn │ │ ├── conv_forward.cc │ │ ├── cudnn_utils.cc │ │ └── cudnn_utils.h │ ├── hybrid │ │ ├── codegen_hybrid.cc │ │ └── codegen_hybrid.h │ ├── miopen │ │ ├── conv_forward.cc │ │ ├── miopen_utils.cc │ │ └── miopen_utils.h │ ├── mps │ │ ├── conv.mm │ │ ├── gemm.mm │ │ ├── mps_utils.h │ │ └── mps_utils.mm │ ├── nnpack │ │ ├── convolution.cc │ │ ├── fully_connected.cc │ │ ├── nnpack_utils.cc │ │ └── nnpack_utils.h │ ├── random │ │ ├── mt_random_engine.cc │ │ ├── random.cc │ │ └── sgx_random_engine.cc │ ├── rocblas │ │ └── rocblas.cc │ └── sort │ │ └── sort.cc ├── lang │ ├── api_registry.cc │ ├── attr_functor.h │ ├── attrs.cc │ ├── buffer.cc │ ├── channel.cc │ ├── data_layout.cc │ ├── expr.cc │ ├── expr_operator.cc │ ├── ir.cc │ ├── lowered_func.cc │ ├── reflection.cc │ ├── target_info.cc │ └── tensor.cc ├── node │ └── node.cc ├── op │ ├── compute_op.cc │ ├── compute_op.h │ ├── cross_thread_reduction.cc │ ├── extern_op.cc │ ├── hybrid_op.cc │ ├── hybrid_op.h │ ├── op_util.cc │ ├── op_util.h │ ├── placeholder_op.cc │ ├── scan_op.cc │ ├── tensor_compute_op.cc │ └── tensorize.cc ├── pass │ ├── arg_binder.cc │ ├── arg_binder.h │ ├── bound_checker.cc │ ├── combine_context_call.cc │ ├── coproc_sync.cc │ ├── detect_device.cc │ ├── inject_copy_intrin.cc │ ├── inject_double_buffer.cc │ ├── inject_prefetch.cc │ ├── inject_virtual_thread.cc │ ├── inline.cc │ ├── ir_deep_compare.cc │ ├── ir_mutator.cc │ ├── ir_util.cc │ ├── ir_util.h │ ├── ir_visitor.cc │ ├── lift_attr_scope.cc │ ├── loop_partition.cc │ ├── lower_custom_datatypes.cc │ ├── lower_intrin.cc │ ├── lower_thread_allreduce.cc │ ├── lower_tvm_builtin.cc │ ├── lower_warp_memory.cc │ ├── make_api.cc │ ├── narrow_channel_access.cc │ ├── remap_thread_axis.cc │ ├── remove_no_op.cc │ ├── rewrite_unsafe_select.cc │ ├── simple_passes.cc │ ├── split_host_device.cc │ ├── split_pipeline.cc │ ├── ssa.cc │ ├── storage_access.cc │ ├── storage_access.h │ ├── storage_flatten.cc │ ├── storage_rewrite.cc │ ├── storage_sync.cc │ ├── unroll_loop.cc │ ├── vectorize_loop.cc │ ├── verify_gpu_code.cc │ └── verify_memory.cc ├── relay │ ├── backend │ │ ├── build_module.cc │ │ ├── compile_engine.cc │ │ ├── compile_engine.h │ │ ├── graph_plan_memory.cc │ │ ├── graph_runtime_codegen.cc │ │ ├── interpreter.cc │ │ ├── param_dict.cc │ │ ├── param_dict.h │ │ ├── utils.h │ │ └── vm │ │ │ ├── compiler.cc │ │ │ ├── compiler.h │ │ │ ├── deserializer.cc │ │ │ ├── deserializer.h │ │ │ ├── inline_primitives.cc │ │ │ ├── lambda_lift.cc │ │ │ ├── profiler │ │ │ └── compiler.cc │ │ │ ├── serialize_util.h │ │ │ ├── serializer.cc │ │ │ └── serializer.h │ ├── ir │ │ ├── adt.cc │ │ ├── alpha_equal.cc │ │ ├── base.cc │ │ ├── doc.cc │ │ ├── doc.h │ │ ├── error.cc │ │ ├── expr.cc │ │ ├── expr_functor.cc │ │ ├── hash.cc │ │ ├── module.cc │ │ ├── op.cc │ │ ├── pattern_functor.cc │ │ ├── pretty_printer.cc │ │ ├── type.cc │ │ ├── type_functor.cc │ │ └── type_functor.h │ ├── op │ │ ├── algorithm │ │ │ ├── argsort.cc │ │ │ └── topk.cc │ │ ├── annotation │ │ │ └── annotation.cc │ │ ├── debug.cc │ │ ├── device_copy.cc │ │ ├── image │ │ │ └── resize.cc │ │ ├── nn │ │ │ ├── bitserial.cc │ │ │ ├── convolution.cc │ │ │ ├── convolution.h │ │ │ ├── nn.cc │ │ │ ├── nn.h │ │ │ ├── pad.cc │ │ │ ├── pooling.cc │ │ │ ├── sparse.cc │ │ │ └── upsampling.cc │ │ ├── op_common.h │ │ ├── tensor │ │ │ ├── binary.cc │ │ │ ├── reduce.cc │ │ │ ├── transform.cc │ │ │ ├── transform.h │ │ │ └── unary.cc │ │ ├── type_relations.cc │ │ ├── type_relations.h │ │ └── vision │ │ │ ├── multibox_op.cc │ │ │ ├── nms.cc │ │ │ ├── rcnn_op.cc │ │ │ └── yolo.cc │ ├── pass │ │ ├── alter_op_layout.cc │ │ ├── alter_op_layout.h │ │ ├── canonicalize_cast.cc │ │ ├── canonicalize_ops.cc │ │ ├── combine_parallel_conv2d.cc │ │ ├── de_duplicate.cc │ │ ├── dead_code.cc │ │ ├── dependency_graph.cc │ │ ├── dependency_graph.h │ │ ├── device_annotation.cc │ │ ├── eliminate_common_subexpr.cc │ │ ├── eta_expand.cc │ │ ├── expr_subst.cc │ │ ├── expr_subst.h │ │ ├── feature.cc │ │ ├── fold_constant.cc │ │ ├── fold_scale_axis.cc │ │ ├── forward_rewrite.cc │ │ ├── fuse_ops.cc │ │ ├── gradient.cc │ │ ├── kind_check.cc │ │ ├── legalize.cc │ │ ├── let_list.h │ │ ├── mac_count.cc │ │ ├── match_exhaustion.cc │ │ ├── partial_eval.cc │ │ ├── pass_manager.cc │ │ ├── pass_util.h │ │ ├── pattern_util.h │ │ ├── print_ir.cc │ │ ├── quantize │ │ │ ├── annotate.cc │ │ │ ├── calibrate.cc │ │ │ ├── partition.cc │ │ │ ├── quantize.cc │ │ │ ├── quantize.h │ │ │ └── realize.cc │ │ ├── simplify_inference.cc │ │ ├── to_a_normal_form.cc │ │ ├── to_cps.cc │ │ ├── to_graph_normal_form.cc │ │ ├── type_infer.cc │ │ ├── type_solver.cc │ │ ├── type_solver.h │ │ ├── util.cc │ │ └── well_formed.cc │ └── qnn │ │ ├── op │ │ ├── add.cc │ │ ├── concatenate.cc │ │ ├── convolution.cc │ │ ├── dequantize.cc │ │ ├── op_common.h │ │ ├── quantize.cc │ │ └── requantize.cc │ │ └── util.h ├── runtime │ ├── builtin_fp16.cc │ ├── c_dsl_api.cc │ ├── c_runtime_api.cc │ ├── cpu_device_api.cc │ ├── cuda │ │ ├── cuda_common.h │ │ ├── cuda_device_api.cc │ │ ├── cuda_module.cc │ │ └── cuda_module.h │ ├── dsl_api.h │ ├── dso_module.cc │ ├── file_util.cc │ ├── file_util.h │ ├── graph │ │ ├── debug │ │ │ └── graph_runtime_debug.cc │ │ ├── graph_runtime.cc │ │ └── graph_runtime.h │ ├── meta_data.h │ ├── metal │ │ ├── metal_common.h │ │ ├── metal_device_api.mm │ │ ├── metal_module.h │ │ └── metal_module.mm │ ├── micro │ │ ├── device │ │ │ ├── utvm_device_dylib_redirect.c │ │ │ ├── utvm_runtime.c │ │ │ └── utvm_runtime.h │ │ ├── host_low_level_device.cc │ │ ├── low_level_device.h │ │ ├── micro_common.cc │ │ ├── micro_common.h │ │ ├── micro_device_api.cc │ │ ├── micro_module.cc │ │ ├── micro_section_allocator.h │ │ ├── micro_session.cc │ │ ├── micro_session.h │ │ ├── openocd_low_level_device.cc │ │ ├── target_data_layout_encoder.h │ │ ├── tcl_socket.cc │ │ └── tcl_socket.h │ ├── module.cc │ ├── module_util.cc │ ├── module_util.h │ ├── ndarray.cc │ ├── opencl │ │ ├── aocl │ │ │ ├── aocl_common.h │ │ │ ├── aocl_device_api.cc │ │ │ ├── aocl_module.cc │ │ │ └── aocl_module.h │ │ ├── opencl_common.h │ │ ├── opencl_device_api.cc │ │ ├── opencl_module.cc │ │ ├── opencl_module.h │ │ └── sdaccel │ │ │ ├── sdaccel_common.h │ │ │ ├── sdaccel_device_api.cc │ │ │ ├── sdaccel_module.cc │ │ │ └── sdaccel_module.h │ ├── opengl │ │ ├── opengl_common.h │ │ ├── opengl_device_api.cc │ │ ├── opengl_module.cc │ │ └── opengl_module.h │ ├── pack_args.h │ ├── registry.cc │ ├── rocm │ │ ├── rocm_common.h │ │ ├── rocm_device_api.cc │ │ ├── rocm_module.cc │ │ └── rocm_module.h │ ├── rpc │ │ ├── rpc_device_api.cc │ │ ├── rpc_event_impl.cc │ │ ├── rpc_module.cc │ │ ├── rpc_server_env.cc │ │ ├── rpc_session.cc │ │ ├── rpc_session.h │ │ └── rpc_socket_impl.cc │ ├── runtime_base.h │ ├── sgx │ │ ├── common.h │ │ ├── trusted │ │ │ ├── ecall_registry.h │ │ │ ├── runtime.cc │ │ │ ├── runtime.h │ │ │ └── threading_backend.cc │ │ ├── tvm.edl │ │ └── untrusted │ │ │ └── sgx_module.cc │ ├── stackvm │ │ ├── stackvm.cc │ │ ├── stackvm.h │ │ ├── stackvm_module.cc │ │ └── stackvm_module.h │ ├── system_lib_module.cc │ ├── thread_pool.cc │ ├── thread_storage_scope.h │ ├── threading_backend.cc │ ├── vm │ │ ├── memory_manager.cc │ │ ├── memory_manager.h │ │ ├── naive_allocator.h │ │ ├── object.cc │ │ ├── pooled_allocator.h │ │ ├── profiler │ │ │ ├── vm.cc │ │ │ └── vm.h │ │ └── vm.cc │ ├── vulkan │ │ ├── vulkan_common.h │ │ ├── vulkan_device_api.cc │ │ ├── vulkan_module.cc │ │ └── vulkan_module.h │ ├── workspace_pool.cc │ └── workspace_pool.h └── schedule │ ├── auto_inline_elem_wise.cc │ ├── bound.cc │ ├── graph.cc │ ├── graph.h │ ├── message_passing.cc │ ├── message_passing.h │ ├── schedule_dataflow_rewrite.cc │ ├── schedule_lang.cc │ └── schedule_ops.cc ├── tests ├── azure-pipelines │ └── main.yml ├── cpp │ ├── .gitignore │ ├── attrs_test.cc │ ├── build_module_test.cc │ ├── container_test.cc │ ├── expr_test.cc │ ├── ir_functor_test.cc │ ├── ir_mutator_test.cc │ ├── ir_simplify_test.cc │ ├── ir_ssa_test.cc │ ├── ir_visitor_test.cc │ ├── packed_func_test.cc │ ├── pattern_match_test.cc │ ├── relay_build_module_test.cc │ ├── relay_pass_type_infer_test.cc │ ├── relay_transform_sequential.cc │ ├── simple_passes_test.cc │ ├── tensor_test.cc │ ├── threading_backend_test.cc │ └── topi_ewise_test.cc ├── lint │ ├── add_asf_header.py │ ├── check_file_type.py │ ├── pylintrc │ └── rat-excludes ├── python │ ├── contrib │ │ ├── test_binutil.py │ │ ├── test_cblas.py │ │ ├── test_cublas.py │ │ ├── test_cudnn.py │ │ ├── test_dlpack.py │ │ ├── test_gemm_acc16.py │ │ ├── test_miopen.py │ │ ├── test_mps.py │ │ ├── test_mxnet_bridge.py │ │ ├── test_nnpack.py │ │ ├── test_random.py │ │ ├── test_rocblas.py │ │ ├── test_rpc_proxy.py │ │ ├── test_rpc_tracker.py │ │ ├── test_sort.py │ │ └── test_sparse.py │ ├── frontend │ │ ├── caffe2 │ │ │ ├── model_zoo │ │ │ │ ├── __init__.py │ │ │ │ └── squeezenet.py │ │ │ ├── test_forward.py │ │ │ └── test_graph.py │ │ ├── coreml │ │ │ ├── model_zoo │ │ │ │ └── __init__.py │ │ │ └── test_forward.py │ │ ├── darknet │ │ │ └── test_forward.py │ │ ├── keras │ │ │ └── test_forward.py │ │ ├── mxnet │ │ │ ├── model_zoo │ │ │ │ ├── __init__.py │ │ │ │ ├── dcgan.py │ │ │ │ ├── dqn.py │ │ │ │ ├── inception_v3.py │ │ │ │ ├── mlp.py │ │ │ │ ├── resnet.py │ │ │ │ ├── squeezenet.py │ │ │ │ └── vgg.py │ │ │ ├── test_forward.py │ │ │ └── test_graph.py │ │ ├── nnvm_to_relay │ │ │ ├── test_alter_conv2d.py │ │ │ └── test_forward.py │ │ ├── onnx │ │ │ └── test_forward.py │ │ ├── tensorflow │ │ │ ├── test_control_flow.py │ │ │ └── test_forward.py │ │ └── tflite │ │ │ └── test_forward.py │ ├── integration │ │ ├── test_dot.py │ │ ├── test_ewise.py │ │ ├── test_ewise_fpga.py │ │ ├── test_gemm.py │ │ ├── test_reduce.py │ │ ├── test_scan.py │ │ ├── test_tuning.py │ │ └── test_winograd_nnpack.py │ ├── nightly │ │ └── quantization │ │ │ └── test_quantization_accuracy.py │ ├── relay │ │ ├── benchmarking │ │ │ └── benchmark_vm.py │ │ ├── test_adt.py │ │ ├── test_any.py │ │ ├── test_autotvm_task_extraction.py │ │ ├── test_backend_compile_engine.py │ │ ├── test_backend_graph_runtime.py │ │ ├── test_backend_interpreter.py │ │ ├── test_change_batch.py │ │ ├── test_cmp_op.py │ │ ├── test_cpp_build_module.py │ │ ├── test_debug.py │ │ ├── test_error_reporting.py │ │ ├── test_expr_functor.py │ │ ├── test_feature.py │ │ ├── test_ir_bind.py │ │ ├── test_ir_module.py │ │ ├── test_ir_nodes.py │ │ ├── test_ir_op.py │ │ ├── test_ir_parser.py │ │ ├── test_ir_text_printer.py │ │ ├── test_ir_well_formed.py │ │ ├── test_op_grad_level1.py │ │ ├── test_op_grad_level2.py │ │ ├── test_op_grad_level3.py │ │ ├── test_op_grad_level4.py │ │ ├── test_op_level1.py │ │ ├── test_op_level10.py │ │ ├── test_op_level2.py │ │ ├── test_op_level3.py │ │ ├── test_op_level4.py │ │ ├── test_op_level5.py │ │ ├── test_op_level6.py │ │ ├── test_param_dict.py │ │ ├── test_pass_alpha_equal.py │ │ ├── test_pass_alter_op_layout.py │ │ ├── test_pass_annotation.py │ │ ├── test_pass_canonicalize_cast.py │ │ ├── test_pass_check_kind.py │ │ ├── test_pass_combine_parallel_conv2d.py │ │ ├── test_pass_dead_code_elimination.py │ │ ├── test_pass_eliminate_common_subexpr.py │ │ ├── test_pass_eta_expand.py │ │ ├── test_pass_fold_constant.py │ │ ├── test_pass_fold_scale_axis.py │ │ ├── test_pass_fuse_ops.py │ │ ├── test_pass_gradient.py │ │ ├── test_pass_legalize.py │ │ ├── test_pass_mac_count.py │ │ ├── test_pass_manager.py │ │ ├── test_pass_partial_eval.py │ │ ├── test_pass_qnn_legalize.py │ │ ├── test_pass_simplify_inference.py │ │ ├── test_pass_to_a_normal_form.py │ │ ├── test_pass_to_cps.py │ │ ├── test_pass_to_graph_normal_form.py │ │ ├── test_pass_unmatched_cases.py │ │ ├── test_pass_vars.py │ │ ├── test_py_converter.py │ │ ├── test_qnn_add.py │ │ ├── test_qnn_concatenate.py │ │ ├── test_qnn_conv2d.py │ │ ├── test_qnn_dequantize.py │ │ ├── test_qnn_quantize.py │ │ ├── test_qnn_requantize.py │ │ ├── test_type_infer.py │ │ ├── test_type_solver.py │ │ ├── test_typecall.py │ │ ├── test_vm.py │ │ └── test_vm_serialization.py │ └── unittest │ │ ├── test_arith_canonical_simplify.py │ │ ├── test_arith_const_int_bound.py │ │ ├── test_arith_deduce_bound.py │ │ ├── test_arith_detect_clip_bound.py │ │ ├── test_arith_detect_linear_equation.py │ │ ├── test_arith_domain_touched.py │ │ ├── test_arith_intset.py │ │ ├── test_arith_modular_set.py │ │ ├── test_arith_rewrite_simplify.py │ │ ├── test_arith_stmt_simplify.py │ │ ├── test_autotvm_common.py │ │ ├── test_autotvm_database.py │ │ ├── test_autotvm_dispatch_context.py │ │ ├── test_autotvm_executor.py │ │ ├── test_autotvm_feature.py │ │ ├── test_autotvm_flop_calculator.py │ │ ├── test_autotvm_measure.py │ │ ├── test_autotvm_record.py │ │ ├── test_autotvm_space.py │ │ ├── test_autotvm_xgboost_model.py │ │ ├── test_build_lower.py │ │ ├── test_codegen_arm.py │ │ ├── test_codegen_bool.py │ │ ├── test_codegen_c_host.py │ │ ├── test_codegen_cross_llvm.py │ │ ├── test_codegen_cuda.py │ │ ├── test_codegen_device.py │ │ ├── test_codegen_extern.py │ │ ├── test_codegen_llvm.py │ │ ├── test_codegen_opencl.py │ │ ├── test_codegen_static_init.py │ │ ├── test_codegen_vm_basic.py │ │ ├── test_codegen_vulkan.py │ │ ├── test_codegen_x86.py │ │ ├── test_custom_datatypes_mybfloat16.py │ │ ├── test_graph_tuner_core.py │ │ ├── test_graph_tuner_utils.py │ │ ├── test_hybrid_script.py │ │ ├── test_ir_builder.py │ │ ├── test_lang_basic.py │ │ ├── test_lang_buffer.py │ │ ├── test_lang_constructor.py │ │ ├── test_lang_container.py │ │ ├── test_lang_data_layout.py │ │ ├── test_lang_group.py │ │ ├── test_lang_operator.py │ │ ├── test_lang_reflection.py │ │ ├── test_lang_schedule.py │ │ ├── test_lang_tag.py │ │ ├── test_lang_target.py │ │ ├── test_lang_tensor.py │ │ ├── test_lang_tensor_overload_op.py │ │ ├── test_lang_verify_compute.py │ │ ├── test_module_load.py │ │ ├── test_pass_attrs_hash_equal.py │ │ ├── test_pass_basic.py │ │ ├── test_pass_bound_checkers.py │ │ ├── test_pass_combine_context_call.py │ │ ├── test_pass_decorate_device_scope.py │ │ ├── test_pass_equal.py │ │ ├── test_pass_inject_copy_intrin.py │ │ ├── test_pass_inject_double_buffer.py │ │ ├── test_pass_inject_vthread.py │ │ ├── test_pass_inline.py │ │ ├── test_pass_ir_transform.py │ │ ├── test_pass_lift_attr_scope.py │ │ ├── test_pass_loop_partition.py │ │ ├── test_pass_lower_warp_memory.py │ │ ├── test_pass_makeapi.py │ │ ├── test_pass_remove_no_op.py │ │ ├── test_pass_rewrite_unsafe_select.py │ │ ├── test_pass_split_host_device.py │ │ ├── test_pass_split_pipeline.py │ │ ├── test_pass_storage_flatten.py │ │ ├── test_pass_storage_rewrite.py │ │ ├── test_pass_storage_sync.py │ │ ├── test_pass_unroll.py │ │ ├── test_pass_vectorize.py │ │ ├── test_pass_verify_gpu_code.py │ │ ├── test_pass_verify_memory.py │ │ ├── test_pass_virtual_thread.py │ │ ├── test_runtime_error.py │ │ ├── test_runtime_extension.py │ │ ├── test_runtime_graph.py │ │ ├── test_runtime_graph_debug.py │ │ ├── test_runtime_heterogeneous.py │ │ ├── test_runtime_measure.py │ │ ├── test_runtime_micro.py │ │ ├── test_runtime_ndarray.py │ │ ├── test_runtime_packed_func.py │ │ ├── test_runtime_rpc.py │ │ ├── test_runtime_vm_profiler.py │ │ ├── test_schedule_bound_inference.py │ │ ├── test_schedule_graph.py │ │ ├── test_schedule_lstm.py │ │ ├── test_schedule_schedule_ops.py │ │ ├── test_schedule_tensorize.py │ │ └── test_testing.py ├── scripts │ ├── packages.mk │ ├── task_build.sh │ ├── task_clean.sh │ ├── task_cpp_unittest.sh │ ├── task_golang.sh │ ├── task_java_unittest.sh │ ├── task_lint.sh │ ├── task_python_docs.sh │ ├── task_python_frontend.sh │ ├── task_python_integration.sh │ ├── task_python_legacy.sh │ ├── task_python_nightly.sh │ ├── task_python_topi.sh │ ├── task_python_unittest.sh │ ├── task_python_vta.sh │ ├── task_rust.sh │ ├── task_verilog_test.sh │ ├── task_web_build.sh │ └── task_web_test.sh ├── travis │ ├── run_test.sh │ ├── setup.sh │ └── travis_after_failure.sh ├── web │ ├── prepare_test_libs.py │ ├── test_basic.js │ ├── test_module_load.js │ ├── test_packed_func.js │ └── websock_rpc_test.py └── webgl │ ├── README.md │ ├── test_local_gemm.py │ ├── test_local_multi_stage.py │ ├── test_local_save_load.py │ ├── test_local_topi_conv2d_nchw.py │ ├── test_local_topi_dense.py │ ├── test_local_topi_pooling.py │ ├── test_local_topi_softmax.py │ ├── test_remote_save_load.py │ ├── test_static_webgl_library.html │ └── test_static_webgl_library.py ├── topi ├── README.md ├── include │ └── topi │ │ ├── broadcast.h │ │ ├── contrib │ │ ├── cublas.h │ │ └── rocblas.h │ │ ├── cuda │ │ ├── dense.h │ │ ├── extern.h │ │ ├── injective.h │ │ ├── normalization.h │ │ ├── pooling.h │ │ ├── reduction.h │ │ └── softmax.h │ │ ├── detail │ │ ├── array_utils.h │ │ ├── broadcast.h │ │ ├── constant_utils.h │ │ ├── extern.h │ │ ├── fuse.h │ │ ├── pad_utils.h │ │ └── ravel_unravel.h │ │ ├── elemwise.h │ │ ├── generic │ │ ├── default.h │ │ ├── extern.h │ │ └── injective.h │ │ ├── image │ │ └── resize.h │ │ ├── nn.h │ │ ├── nn │ │ ├── batch_matmul.h │ │ ├── bias_add.h │ │ ├── bnn.h │ │ ├── dense.h │ │ ├── dilate.h │ │ ├── flatten.h │ │ ├── l2_normalize.h │ │ ├── local_response_norm.h │ │ ├── mapping.h │ │ ├── pooling.h │ │ ├── softmax.h │ │ └── upsampling.h │ │ ├── reduction.h │ │ ├── rocm │ │ ├── dense.h │ │ └── normalization.h │ │ ├── tags.h │ │ ├── transform.h │ │ ├── vision │ │ └── reorg.h │ │ └── x86 │ │ ├── bnn.h │ │ ├── default.h │ │ └── injective.h ├── python │ ├── setup.py │ └── topi │ │ ├── __init__.py │ │ ├── arm_cpu │ │ ├── __init__.py │ │ ├── bitserial_conv2d.py │ │ ├── bitserial_dense.py │ │ ├── conv2d.py │ │ ├── conv2d_transpose.py │ │ ├── depthwise_conv2d.py │ │ └── injective.py │ │ ├── broadcast.py │ │ ├── cpp.py │ │ ├── cuda │ │ ├── __init__.py │ │ ├── batch_matmul.py │ │ ├── conv2d.py │ │ ├── conv2d_direct.py │ │ ├── conv2d_hwcn.py │ │ ├── conv2d_int8.py │ │ ├── conv2d_transpose_nchw.py │ │ ├── conv2d_winograd.py │ │ ├── deformable_conv2d.py │ │ ├── dense.py │ │ ├── depthwise_conv2d.py │ │ ├── extern.py │ │ ├── group_conv2d_nchw.py │ │ ├── injective.py │ │ ├── nms.py │ │ ├── nn.py │ │ ├── pooling.py │ │ ├── rcnn │ │ │ ├── __init__.py │ │ │ └── proposal.py │ │ ├── reduction.py │ │ ├── softmax.py │ │ ├── sort.py │ │ ├── ssd │ │ │ ├── __init__.py │ │ │ └── multibox.py │ │ ├── tensor_intrin.py │ │ └── vision.py │ │ ├── generic │ │ ├── __init__.py │ │ ├── extern.py │ │ ├── injective.py │ │ ├── nn.py │ │ ├── sort.py │ │ └── vision.py │ │ ├── generic_op_impl.py │ │ ├── hls │ │ ├── __init__.py │ │ ├── injective.py │ │ └── nn.py │ │ ├── image │ │ ├── __init__.py │ │ └── resize.py │ │ ├── intel_graphics │ │ ├── __init__.py │ │ ├── conv2d.py │ │ └── depthwise_conv2d.py │ │ ├── mali │ │ ├── __init__.py │ │ ├── conv2d.py │ │ ├── dense.py │ │ └── depthwise_conv2d.py │ │ ├── math.py │ │ ├── nn │ │ ├── __init__.py │ │ ├── batch_matmul.py │ │ ├── bitserial_conv2d.py │ │ ├── bitserial_dense.py │ │ ├── bitserial_util.py │ │ ├── bnn.py │ │ ├── conv2d.py │ │ ├── conv2d_transpose.py │ │ ├── deformable_conv2d.py │ │ ├── dense.py │ │ ├── depthwise_conv2d.py │ │ ├── dilate.py │ │ ├── elemwise.py │ │ ├── flatten.py │ │ ├── l2_normalize.py │ │ ├── local_response_norm.py │ │ ├── mapping.py │ │ ├── pad.py │ │ ├── pooling.py │ │ ├── softmax.py │ │ ├── sparse.py │ │ ├── upsampling.py │ │ ├── util.py │ │ └── winograd_util.py │ │ ├── opengl │ │ ├── __init__.py │ │ ├── conv2d_nchw.py │ │ ├── dense.py │ │ ├── injective.py │ │ ├── pooling.py │ │ └── softmax.py │ │ ├── reduction.py │ │ ├── rocm │ │ ├── __init__.py │ │ ├── conv2d.py │ │ ├── dense.py │ │ └── nn.py │ │ ├── sort.py │ │ ├── sparse │ │ ├── __init__.py │ │ ├── csrmm.py │ │ ├── csrmv.py │ │ └── dense.py │ │ ├── tag.py │ │ ├── tensor.py │ │ ├── testing │ │ ├── __init__.py │ │ ├── batch_matmul.py │ │ ├── bilinear_resize_python.py │ │ ├── conv2d_hwcn_python.py │ │ ├── conv2d_nchw_python.py │ │ ├── conv2d_nhwc_python.py │ │ ├── conv2d_transpose_nchw_python.py │ │ ├── deformable_conv2d_nchw_python.py │ │ ├── depthwise_conv2d_python.py │ │ ├── dilate_python.py │ │ ├── gather_nd_python.py │ │ ├── l2_normalize_python.py │ │ ├── lrn_python.py │ │ ├── one_hot.py │ │ ├── pool_grad_python.py │ │ ├── reorg_python.py │ │ ├── roi_align_python.py │ │ ├── roi_pool_python.py │ │ ├── sequence_mask_python.py │ │ ├── slice_axis_python.py │ │ ├── softmax_python.py │ │ ├── strided_slice_python.py │ │ └── upsampling_python.py │ │ ├── transform.py │ │ ├── util.py │ │ ├── vision │ │ ├── __init__.py │ │ ├── nms.py │ │ ├── rcnn │ │ │ ├── __init__.py │ │ │ ├── proposal.py │ │ │ ├── roi_align.py │ │ │ └── roi_pool.py │ │ ├── reorg.py │ │ └── ssd │ │ │ ├── __init__.py │ │ │ └── multibox.py │ │ └── x86 │ │ ├── __init__.py │ │ ├── batch_matmul.py │ │ ├── binarize_pack.py │ │ ├── binary_dense.py │ │ ├── bitserial_conv2d.py │ │ ├── bitserial_dense.py │ │ ├── conv2d.py │ │ ├── conv2d_avx_1x1.py │ │ ├── conv2d_avx_common.py │ │ ├── conv2d_transpose.py │ │ ├── dense.py │ │ ├── depthwise_conv2d.py │ │ ├── injective.py │ │ ├── nn.py │ │ ├── pooling.py │ │ ├── roi_align.py │ │ ├── sparse.py │ │ ├── tensor_intrin.py │ │ └── util.py ├── recipe │ ├── broadcast │ │ └── test_broadcast_map.py │ ├── conv │ │ ├── depthwise_conv2d_test.py │ │ ├── test_conv2d_hwcn_map.py │ │ └── test_conv_int8_intel.py │ ├── gemm │ │ ├── android_gemm_square.py │ │ ├── cuda_gemm_square.py │ │ └── gemm_int8.py │ ├── reduce │ │ └── test_reduce_map.py │ └── rnn │ │ ├── lstm.py │ │ └── matexp.py ├── src │ └── topi.cc └── tests │ └── python │ ├── common.py │ ├── test_topi_basic.py │ ├── test_topi_batch_matmul.py │ ├── test_topi_bitserial_conv2d.py │ ├── test_topi_bitserial_conv2d_rasp.py │ ├── test_topi_bitserial_dense.py │ ├── test_topi_bnn.py │ ├── test_topi_broadcast.py │ ├── test_topi_clip.py │ ├── test_topi_conv2d_NCHWc.py │ ├── test_topi_conv2d_hwcn.py │ ├── test_topi_conv2d_int8.py │ ├── test_topi_conv2d_nchw.py │ ├── test_topi_conv2d_nhwc.py │ ├── test_topi_conv2d_nhwc_pack_int8.py │ ├── test_topi_conv2d_transpose_nchw.py │ ├── test_topi_conv2d_winograd.py │ ├── test_topi_deformable_conv2d.py │ ├── test_topi_dense.py │ ├── test_topi_depthwise_conv2d.py │ ├── test_topi_depthwise_conv2d_back_input.py │ ├── test_topi_depthwise_conv2d_back_weight.py │ ├── test_topi_dilate.py │ ├── test_topi_group_conv2d.py │ ├── test_topi_group_conv2d_NCHWc_int8.py │ ├── test_topi_l2norm.py │ ├── test_topi_lrn.py │ ├── test_topi_math.py │ ├── test_topi_matmul.py │ ├── test_topi_pooling.py │ ├── test_topi_reduce.py │ ├── test_topi_relu.py │ ├── test_topi_reorg.py │ ├── test_topi_resize.py │ ├── test_topi_softmax.py │ ├── test_topi_sort.py │ ├── test_topi_sparse.py │ ├── test_topi_tensor.py │ ├── test_topi_transform.py │ ├── test_topi_upsampling.py │ ├── test_topi_util.py │ └── test_topi_vision.py ├── tutorials ├── README.txt ├── autotvm │ ├── README.txt │ ├── tune_conv2d_cuda.py │ ├── tune_relay_arm.py │ ├── tune_relay_cuda.py │ ├── tune_relay_mobile_gpu.py │ ├── tune_relay_x86.py │ └── tune_simple_template.py ├── cross_compilation_and_rpc.py ├── dev │ ├── README.txt │ └── low_level_custom_pass.py ├── frontend │ ├── README.txt │ ├── build_gcn.py │ ├── deploy_model_on_android.py │ ├── deploy_model_on_rasp.py │ ├── deploy_ssd_gluoncv.py │ ├── from_caffe2.py │ ├── from_coreml.py │ ├── from_darknet.py │ ├── from_keras.py │ ├── from_mxnet.py │ ├── from_onnx.py │ ├── from_tensorflow.py │ ├── from_tflite.py │ └── using_external_lib.py ├── language │ ├── README.txt │ ├── extern_op.py │ ├── intrin_math.py │ ├── reduction.py │ ├── scan.py │ ├── schedule_primitives.py │ ├── tensorize.py │ └── tuple_inputs.py ├── optimize │ ├── README.txt │ ├── opt_conv_cuda.py │ └── opt_gemm.py ├── relay_quick_start.py ├── tensor_expr_get_started.py └── topi │ ├── README.txt │ └── intro_topi.py ├── version.py ├── vta ├── README.md ├── apps │ └── tsim_example │ │ ├── CMakeLists.txt │ │ ├── Makefile │ │ ├── README.md │ │ ├── hardware │ │ ├── chisel │ │ │ ├── .scalafmt.conf │ │ │ ├── Makefile │ │ │ ├── build.sbt │ │ │ ├── project │ │ │ │ ├── build.properties │ │ │ │ └── plugins.sbt │ │ │ └── src │ │ │ │ ├── main │ │ │ │ └── scala │ │ │ │ │ └── accel │ │ │ │ │ ├── Accel.scala │ │ │ │ │ ├── Compute.scala │ │ │ │ │ └── RegFile.scala │ │ │ │ └── test │ │ │ │ └── scala │ │ │ │ └── dut │ │ │ │ └── TestAccel.scala │ │ └── verilog │ │ │ ├── Makefile │ │ │ └── src │ │ │ ├── Accel.v │ │ │ ├── Compute.v │ │ │ ├── RegFile.v │ │ │ └── TestAccel.v │ │ ├── python │ │ ├── __init__.py │ │ └── tsim.py │ │ ├── src │ │ └── driver.cc │ │ └── tests │ │ └── python │ │ ├── chisel_accel.py │ │ └── verilog_accel.py ├── config │ ├── README.md │ ├── de10nano_sample.json │ ├── fsim_sample.json │ ├── pynq_sample.json │ ├── tsim_sample.json │ ├── ultra96_sample.json │ ├── vta_config.json │ └── vta_config.py ├── hardware │ ├── chisel │ │ ├── .gitignore │ │ ├── .scalafmt.conf │ │ ├── Makefile │ │ ├── README.md │ │ ├── build.sbt │ │ ├── project │ │ │ ├── build.properties │ │ │ └── plugins.sbt │ │ └── src │ │ │ ├── main │ │ │ ├── resources │ │ │ │ └── verilog │ │ │ │ │ ├── VTAHostDPI.v │ │ │ │ │ ├── VTAMemDPI.v │ │ │ │ │ └── VTASimDPI.v │ │ │ └── scala │ │ │ │ ├── core │ │ │ │ ├── Compute.scala │ │ │ │ ├── Configs.scala │ │ │ │ ├── Core.scala │ │ │ │ ├── Decode.scala │ │ │ │ ├── EventCounters.scala │ │ │ │ ├── Fetch.scala │ │ │ │ ├── ISA.scala │ │ │ │ ├── Load.scala │ │ │ │ ├── LoadUop.scala │ │ │ │ ├── Semaphore.scala │ │ │ │ ├── Store.scala │ │ │ │ ├── TensorAlu.scala │ │ │ │ ├── TensorGemm.scala │ │ │ │ ├── TensorLoad.scala │ │ │ │ ├── TensorStore.scala │ │ │ │ ├── TensorUtil.scala │ │ │ │ └── package.scala │ │ │ │ ├── dpi │ │ │ │ ├── VTAHostDPI.scala │ │ │ │ ├── VTAMemDPI.scala │ │ │ │ └── VTASimDPI.scala │ │ │ │ ├── interface │ │ │ │ └── axi │ │ │ │ │ └── AXI.scala │ │ │ │ ├── shell │ │ │ │ ├── Configs.scala │ │ │ │ ├── IntelShell.scala │ │ │ │ ├── SimShell.scala │ │ │ │ ├── VCR.scala │ │ │ │ ├── VME.scala │ │ │ │ ├── VTAShell.scala │ │ │ │ └── XilinxShell.scala │ │ │ │ ├── test │ │ │ │ └── Test.scala │ │ │ │ ├── util │ │ │ │ ├── Config.scala │ │ │ │ └── GenericParameterizedBundle.scala │ │ │ │ └── vta │ │ │ │ └── Configs.scala │ │ │ └── test │ │ │ └── scala │ │ │ └── unittest │ │ │ ├── AluTest.scala │ │ │ ├── Launcher.scala │ │ │ ├── MvmTest.scala │ │ │ └── utils │ │ │ ├── Helper.scala │ │ │ ├── RandomArray.scala │ │ │ └── TestRunner.scala │ ├── dpi │ │ └── tsim_device.cc │ ├── intel │ │ ├── Makefile │ │ ├── README.md │ │ └── scripts │ │ │ ├── compile_design.tcl │ │ │ ├── de10_nano_top.v │ │ │ ├── ip │ │ │ └── vta │ │ │ │ └── vta_hw.tcl │ │ │ ├── set_attrs.py │ │ │ ├── set_clocks.sdc │ │ │ └── soc_system.tcl │ └── xilinx │ │ ├── .gitignore │ │ ├── Makefile │ │ ├── README.md │ │ ├── scripts │ │ ├── hls.tcl │ │ ├── hsi.tcl │ │ └── vivado.tcl │ │ ├── sim │ │ └── vta_test.cc │ │ └── src │ │ ├── vta.cc │ │ └── vta.h ├── include │ └── vta │ │ ├── dpi │ │ ├── module.h │ │ └── tsim.h │ │ ├── driver.h │ │ ├── hw_spec.h │ │ ├── runtime.h │ │ └── sim_tlpp.h ├── python │ └── vta │ │ ├── __init__.py │ │ ├── bitstream.py │ │ ├── build_module.py │ │ ├── environment.py │ │ ├── exec │ │ ├── __init__.py │ │ └── rpc_server.py │ │ ├── graph.py │ │ ├── intrin.py │ │ ├── ir_pass.py │ │ ├── libinfo.py │ │ ├── pkg_config.py │ │ ├── program_bitstream.py │ │ ├── rpc_client.py │ │ ├── testing │ │ ├── __init__.py │ │ ├── simulator.py │ │ └── util.py │ │ └── top │ │ ├── __init__.py │ │ ├── bitpack.py │ │ ├── graphpack.py │ │ ├── nnvm_bitpack.py │ │ ├── nnvm_graphpack.py │ │ ├── nnvm_op.py │ │ ├── op.py │ │ ├── util.py │ │ ├── vta_conv2d.py │ │ ├── vta_conv2d_transpose.py │ │ └── vta_dense.py ├── scripts │ ├── tune_conv2d.py │ ├── tune_conv2d_transpose.py │ ├── tune_dense.py │ ├── tune_resnet.py │ └── tune_resnet_nnvm.py ├── src │ ├── de10nano │ │ ├── cma_api.cc │ │ ├── cma_api.h │ │ ├── de10nano_driver.cc │ │ └── de10nano_driver.h │ ├── device_api.cc │ ├── dpi │ │ └── module.cc │ ├── pynq │ │ ├── pynq_driver.cc │ │ └── pynq_driver.h │ ├── runtime.cc │ ├── sim │ │ ├── sim_driver.cc │ │ └── sim_tlpp.cc │ ├── tsim │ │ └── tsim_driver.cc │ └── vmem │ │ ├── virtual_memory.cc │ │ └── virtual_memory.h ├── tests │ ├── hardware │ │ ├── common │ │ │ ├── test_lib.cc │ │ │ └── test_lib.h │ │ └── metal_test │ │ │ ├── Makefile │ │ │ └── metal_test.cc │ └── python │ │ ├── integration │ │ ├── test_benchmark_gemm.py │ │ ├── test_benchmark_topi_conv2d.py │ │ ├── test_benchmark_topi_conv2d_transpose.py │ │ └── test_benchmark_topi_dense.py │ │ ├── pynq │ │ └── test_program_rpc.py │ │ └── unittest │ │ ├── test_environment.py │ │ └── test_vta_insn.py └── tutorials │ ├── README.txt │ ├── autotvm │ ├── README.txt │ └── tune_relay_vta.py │ ├── frontend │ ├── README.txt │ └── deploy_vision_on_vta.py │ ├── matrix_multiply.py │ ├── optimize │ ├── README.txt │ ├── convolution_opt.py │ └── matrix_multiply_opt.py │ └── vta_get_started.py └── web ├── .eslintrc.js ├── README.md ├── example_rpc.html ├── example_rpc_node.js ├── tvm_runtime.js └── web_runtime.cc /.clang-format: -------------------------------------------------------------------------------- 1 | # Run the following command to reformat a file: 2 | # clang-format -i -style=Google 3 | # Or use clang-format-diff to only reformat the changed lines: 4 | # https://clang.llvm.org/docs/ClangFormat.html 5 | BasedOnStyle: Google 6 | DerivePointerAlignment: false 7 | ColumnLimit: 100 8 | PointerAlignment: Left 9 | -------------------------------------------------------------------------------- /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | # Github owner file 2 | # List of code reviewers for TVM modules 3 | 4 | # Global reviewers 5 | * @dmlc/tvm-committers 6 | 7 | # LLVM backends 8 | src/codegen/llvm/* @aatluri 9 | 10 | # ROCM runtime 11 | src/runtime/rocm/* @aatluri 12 | 13 | # SGX support 14 | src/runtime/sgx/* @nhynes 15 | apps/sgx/* @nhynes 16 | 17 | # JVM language 18 | jvm/* @yzhliu 19 | 20 | # WebGL backends 21 | src/runtime/opengl/* @phisiart 22 | src/codegen/*opengl* @phisiart 23 | 24 | # TOPI 25 | topi/python/topi/* @Laurawly @Huyuwei 26 | 27 | 28 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | Thanks for participating in the TVM community! We use https://discuss.tvm.ai for any general usage questions and discussions. The issue tracker is used for actionable items such as feature proposals discussion, roadmaps, and bug tracking. You are always welcomed to post on the forum first :) 2 | 3 | Issues that are inactive for a period of time may get closed. We adopt this policy so that we won't lose track of actionable issues that may fall at the bottom of the pile. Feel free to reopen a new one if you feel there is an additional problem that needs attention when an old one gets closed. 4 | 5 | For bug reports, to help the developer act on the issues, please include a description of your environment, preferably a minimum script to reproduce the problem. 6 | 7 | For feature proposals, list clear, small actionable items so we can track the progress of the change. 8 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | Thanks for contributing to TVM! Please refer to guideline https://docs.tvm.ai/contribute/ for useful information and tips. After the pull request is submitted, please request code reviews from [Reviewers](https://github.com/dmlc/tvm/blob/master/CONTRIBUTORS.md#reviewers). 2 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "dmlc-core"] 2 | path = 3rdparty/dmlc-core 3 | url = https://github.com/dmlc/dmlc-core 4 | [submodule "dlpack"] 5 | path = 3rdparty/dlpack 6 | url = https://github.com/dmlc/dlpack 7 | [submodule "3rdparty/rang"] 8 | path = 3rdparty/rang 9 | url = https://github.com/agauniyal/rang 10 | -------------------------------------------------------------------------------- /3rdparty/cma/settings.mk: -------------------------------------------------------------------------------- 1 | # ==================== COMPILATION RELATED SETTINGS ==================== 2 | # Path to the kernel sources (from "./driver", if relative path is used) 3 | KSOURCE_DIR=/opt/intel/linux-socfpga-rel_socfpga-4.9.78-ltsi_18.08.02_pr 4 | 5 | # Cross compiler "prepend" string 6 | CROSS_COMPILE=arm-linux-gnueabihf- 7 | 8 | # Architecture 9 | ARCH=arm 10 | 11 | # Compile with debug information 12 | CMA_DEBUG?=0 13 | 14 | # ==================== DRIVER RELATED SETTINGS ==================== 15 | # Node name used in "/dev" folder 16 | DRIVER_NODE_NAME="cma" 17 | 18 | # Unique (across system) ioctl magic number. Every ioctl interface should have one. 19 | CMA_IOC_MAGIC=0xf2 20 | -------------------------------------------------------------------------------- /NOTICE: -------------------------------------------------------------------------------- 1 | TVM End to End Deep Learning Compiler Stack: https://tvm.ai/ 2 | -------------------------------------------------------------------------------- /apps/android_deploy/.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/workspace.xml 5 | /.idea/libraries 6 | .DS_Store 7 | /build 8 | /captures 9 | .externalNativeBuild 10 | -------------------------------------------------------------------------------- /apps/android_deploy/app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /apps/android_deploy/app/src/main/jni/Android.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH := $(call my-dir) 2 | MY_PATH := $(LOCAL_PATH) 3 | 4 | include $(CLEAR_VARS) 5 | 6 | LOCAL_PATH := $(MY_PATH) 7 | ROOT_PATH := $(MY_PATH)/../../../../../.. 8 | 9 | ifndef config 10 | ifneq ("$(wildcard ./config.mk)","") 11 | config ?= config.mk 12 | else 13 | config ?= make/config.mk 14 | endif 15 | endif 16 | 17 | include $(config) 18 | 19 | LOCAL_SRC_FILES := ml_dmlc_tvm_native_c_api.cc 20 | LOCAL_LDFLAGS := -L$(SYSROOT)/usr/lib/ -llog 21 | 22 | LOCAL_C_INCLUDES := $(ROOT_PATH)/include \ 23 | $(ROOT_PATH)/3rdparty/dlpack/include \ 24 | $(ROOT_PATH)/3rdparty/dmlc-core/include \ 25 | $(ROOT_PATH)/3rdparty/HalideIR/src \ 26 | $(ROOT_PATH)/topi/include 27 | 28 | LOCAL_MODULE = tvm4j_runtime_packed 29 | 30 | LOCAL_CPP_FEATURES += exceptions 31 | LOCAL_LDLIBS += -latomic 32 | LOCAL_ARM_MODE := arm 33 | 34 | ifdef ADD_C_INCLUDES 35 | LOCAL_C_INCLUDES += $(ADD_C_INCLUDES) 36 | endif 37 | 38 | ifdef ADD_LDLIBS 39 | LOCAL_LDLIBS += $(ADD_LDLIBS) 40 | endif 41 | 42 | include $(BUILD_SHARED_LIBRARY) 43 | -------------------------------------------------------------------------------- /apps/android_deploy/app/src/main/jni/Application.mk: -------------------------------------------------------------------------------- 1 | ifndef config 2 | ifneq ("$(wildcard ./config.mk)","") 3 | config ?= config.mk 4 | else 5 | config ?= make/config.mk 6 | endif 7 | endif 8 | 9 | include $(config) 10 | 11 | APP_STL := c++_static 12 | 13 | APP_CPPFLAGS += -DDMLC_LOG_STACK_TRACE=0 -DTVM4J_ANDROID=1 -std=c++11 -Oz -frtti 14 | ifeq ($(USE_OPENCL), 1) 15 | APP_CPPFLAGS += -DTVM_OPENCL_RUNTIME=1 16 | endif 17 | -------------------------------------------------------------------------------- /apps/android_deploy/app/src/main/jni/make/config.mk: -------------------------------------------------------------------------------- 1 | #------------------------------------------------------------------------------- 2 | # Template configuration for compiling 3 | # 4 | # If you want to change the configuration, please use the following 5 | # steps. Assume you are on the root directory. First copy the this 6 | # file so that any local changes will be ignored by git 7 | # 8 | # cp make/config.mk . 9 | # 10 | # Next modify the according entries, and then compile by 11 | # 12 | # ./build.sh 13 | # 14 | #------------------------------------------------------------------------------- 15 | APP_ABI = all 16 | 17 | APP_PLATFORM = android-17 18 | 19 | # whether enable OpenCL during compile 20 | USE_OPENCL = 0 21 | 22 | # the additional include headers you want to add, e.g., SDK_PATH/adrenosdk/Development/Inc 23 | ADD_C_INCLUDES = 24 | 25 | # the additional link libs you want to add, e.g., ANDROID_LIB_PATH/libOpenCL.so 26 | ADD_LDLIBS = 27 | -------------------------------------------------------------------------------- /apps/android_deploy/app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 21 | 22 | 23 | #3F51B5 24 | #303F9F 25 | #06d467 26 | 27 | -------------------------------------------------------------------------------- /apps/android_deploy/app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 20 | 21 | 22 | TVM Android Demo 23 | 24 | -------------------------------------------------------------------------------- /apps/android_deploy/app/src/main/res/xml/provider_paths.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /apps/android_deploy/dev_tools/gen_keystore.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Licensed to the Apache Software Foundation (ASF) under one 3 | # or more contributor license agreements. See the NOTICE file 4 | # distributed with this work for additional information 5 | # regarding copyright ownership. The ASF licenses this file 6 | # to you under the Apache License, Version 2.0 (the 7 | # "License"); you may not use this file except in compliance 8 | # with the License. You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, 13 | # software distributed under the License is distributed on an 14 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | # KIND, either express or implied. See the License for the 16 | # specific language governing permissions and limitations 17 | # under the License. 18 | CURR_DIR=$(cd `dirname $0`; pwd) 19 | keytool -genkey -keystore $CURR_DIR/tvmdemo.keystore -alias tvmdemo -keyalg RSA -validity 10000 20 | -------------------------------------------------------------------------------- /apps/android_deploy/dev_tools/sign_apk.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Licensed to the Apache Software Foundation (ASF) under one 3 | # or more contributor license agreements. See the NOTICE file 4 | # distributed with this work for additional information 5 | # regarding copyright ownership. The ASF licenses this file 6 | # to you under the Apache License, Version 2.0 (the 7 | # "License"); you may not use this file except in compliance 8 | # with the License. You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, 13 | # software distributed under the License is distributed on an 14 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | # KIND, either express or implied. See the License for the 16 | # specific language governing permissions and limitations 17 | # under the License. 18 | CURR_DIR=$(cd `dirname $0`; pwd) 19 | APK_DIR=$CURR_DIR/../app/build/outputs/apk/release 20 | UNSIGNED_APK=$APK_DIR/app-release-unsigned.apk 21 | SIGNED_APK=$APK_DIR/tvmdemo-release.apk 22 | jarsigner -verbose -keystore $CURR_DIR/tvmdemo.keystore -signedjar $SIGNED_APK $UNSIGNED_APK 'tvmdemo' 23 | echo $SIGNED_APK 24 | -------------------------------------------------------------------------------- /apps/android_deploy/settings.gradle: -------------------------------------------------------------------------------- 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 ':app' 19 | -------------------------------------------------------------------------------- /apps/android_rpc/.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/workspace.xml 5 | /.idea/libraries 6 | .DS_Store 7 | /build 8 | /captures 9 | .externalNativeBuild 10 | -------------------------------------------------------------------------------- /apps/android_rpc/app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /apps/android_rpc/app/src/main/jni/Android.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH := $(call my-dir) 2 | MY_PATH := $(LOCAL_PATH) 3 | 4 | include $(CLEAR_VARS) 5 | 6 | LOCAL_PATH := $(MY_PATH) 7 | ROOT_PATH := $(MY_PATH)/../../../../../.. 8 | 9 | ifndef config 10 | ifneq ("$(wildcard ./config.mk)","") 11 | config ?= config.mk 12 | else 13 | config ?= make/config.mk 14 | endif 15 | endif 16 | 17 | include $(config) 18 | 19 | LOCAL_SRC_FILES := ml_dmlc_tvm_native_c_api.cc 20 | LOCAL_LDFLAGS := -L$(SYSROOT)/usr/lib/ -llog 21 | 22 | LOCAL_C_INCLUDES := $(ROOT_PATH)/include \ 23 | $(ROOT_PATH)/3rdparty/dlpack/include \ 24 | $(ROOT_PATH)/3rdparty/dmlc-core/include \ 25 | $(ROOT_PATH)/3rdparty/HalideIR/src \ 26 | $(ROOT_PATH)/topi/include 27 | 28 | LOCAL_MODULE = tvm4j_runtime_packed 29 | 30 | LOCAL_CPP_FEATURES += exceptions 31 | LOCAL_LDLIBS += -latomic 32 | LOCAL_ARM_MODE := arm 33 | 34 | ifdef ADD_C_INCLUDES 35 | LOCAL_C_INCLUDES += $(ADD_C_INCLUDES) 36 | endif 37 | 38 | ifdef ADD_LDLIBS 39 | LOCAL_LDLIBS += $(ADD_LDLIBS) 40 | endif 41 | 42 | include $(BUILD_SHARED_LIBRARY) 43 | -------------------------------------------------------------------------------- /apps/android_rpc/app/src/main/jni/Application.mk: -------------------------------------------------------------------------------- 1 | ifndef config 2 | ifneq ("$(wildcard ./config.mk)","") 3 | config ?= config.mk 4 | else 5 | config ?= make/config.mk 6 | endif 7 | endif 8 | 9 | include $(config) 10 | 11 | # We target every architecture except armeabi here, for two reasons: 12 | # 1) armeabi is deprecated in NDK r16 and removed in r17 13 | # 2) vulkan is not supported in armeabi 14 | APP_ABI ?= armeabi-v7a arm64-v8a x86 x86_64 mips 15 | APP_STL := c++_shared 16 | 17 | APP_CPPFLAGS += -DDMLC_LOG_STACK_TRACE=0 -DTVM4J_ANDROID=1 -std=c++11 -Oz -frtti 18 | ifeq ($(USE_OPENCL), 1) 19 | APP_CPPFLAGS += -DTVM_OPENCL_RUNTIME=1 20 | endif 21 | 22 | ifeq ($(USE_VULKAN), 1) 23 | APP_CPPFLAGS += -DTVM_VULKAN_RUNTIME=1 24 | APP_LDFLAGS += -lvulkan 25 | endif 26 | 27 | ifeq ($(USE_SORT), 1) 28 | APP_CPPFLAGS += -DUSE_SORT=1 29 | endif 30 | -------------------------------------------------------------------------------- /apps/android_rpc/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/onnxruntime-tvm/984dc1b111aeb02c8a8c68e9724ecff814db11ff/apps/android_rpc/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /apps/android_rpc/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/onnxruntime-tvm/984dc1b111aeb02c8a8c68e9724ecff814db11ff/apps/android_rpc/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /apps/android_rpc/app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 21 | 22 | 23 | #3F51B5 24 | #303F9F 25 | #06d467 26 | 27 | -------------------------------------------------------------------------------- /apps/android_rpc/dev_tools/gen_keystore.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Licensed to the Apache Software Foundation (ASF) under one 3 | # or more contributor license agreements. See the NOTICE file 4 | # distributed with this work for additional information 5 | # regarding copyright ownership. The ASF licenses this file 6 | # to you under the Apache License, Version 2.0 (the 7 | # "License"); you may not use this file except in compliance 8 | # with the License. You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, 13 | # software distributed under the License is distributed on an 14 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | # KIND, either express or implied. See the License for the 16 | # specific language governing permissions and limitations 17 | # under the License. 18 | CURR_DIR=$(cd `dirname $0`; pwd) 19 | keytool -genkey -keystore $CURR_DIR/tvmrpc.keystore -alias tvmrpc -keyalg RSA -validity 10000 20 | -------------------------------------------------------------------------------- /apps/android_rpc/dev_tools/sign_apk.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Licensed to the Apache Software Foundation (ASF) under one 3 | # or more contributor license agreements. See the NOTICE file 4 | # distributed with this work for additional information 5 | # regarding copyright ownership. The ASF licenses this file 6 | # to you under the Apache License, Version 2.0 (the 7 | # "License"); you may not use this file except in compliance 8 | # with the License. You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, 13 | # software distributed under the License is distributed on an 14 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | # KIND, either express or implied. See the License for the 16 | # specific language governing permissions and limitations 17 | # under the License. 18 | CURR_DIR=$(cd `dirname $0`; pwd) 19 | APK_DIR=$CURR_DIR/../app/build/outputs/apk/release 20 | UNSIGNED_APK=$APK_DIR/app-release-unsigned.apk 21 | SIGNED_APK=$APK_DIR/tvmrpc-release.apk 22 | jarsigner -verbose -keystore $CURR_DIR/tvmrpc.keystore -signedjar $SIGNED_APK $UNSIGNED_APK 'tvmrpc' 23 | echo $SIGNED_APK 24 | -------------------------------------------------------------------------------- /apps/android_rpc/settings.gradle: -------------------------------------------------------------------------------- 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 ':app' 19 | -------------------------------------------------------------------------------- /apps/extension/.gitignore: -------------------------------------------------------------------------------- 1 | lib 2 | -------------------------------------------------------------------------------- /apps/ios_rpc/.gitignore: -------------------------------------------------------------------------------- 1 | rpc_config.txt 2 | 3 | -------------------------------------------------------------------------------- /apps/ios_rpc/tvmrpc.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /apps/ios_rpc/tvmrpc/AppDelegate.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | /*! 21 | * Copyright (c) 2017 by Contributors 22 | * \file AppDelegate.h 23 | */ 24 | 25 | #import 26 | 27 | @interface AppDelegate : UIResponder 28 | 29 | @property (strong, nonatomic) UIWindow *window; 30 | 31 | 32 | @end 33 | -------------------------------------------------------------------------------- /apps/ios_rpc/tvmrpc/main.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | /*! 21 | * Copyright (c) 2017 by Contributors 22 | * \file main.m 23 | */ 24 | 25 | #import 26 | #import "AppDelegate.h" 27 | 28 | int main(int argc, char * argv[]) { 29 | @autoreleasepool { 30 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /apps/ios_rpc/tvmrpcLauncher/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /apps/rocm_rpc/start_rpc_server.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Licensed to the Apache Software Foundation (ASF) under one 3 | # or more contributor license agreements. See the NOTICE file 4 | # distributed with this work for additional information 5 | # regarding copyright ownership. The ASF licenses this file 6 | # to you under the Apache License, Version 2.0 (the 7 | # "License"); you may not use this file except in compliance 8 | # with the License. You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, 13 | # software distributed under the License is distributed on an 14 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | # KIND, either express or implied. See the License for the 16 | # specific language governing permissions and limitations 17 | # under the License. 18 | 19 | PROJ_ROOT=$(realpath $(dirname "$0")/../..) 20 | export PYTHONPATH=${PROJ_ROOT}/python:${PYTHONPATH} 21 | 22 | python -m tvm.exec.rpc_server "$@" --load-library=${PROJ_ROOT}/apps/rocm_rpc/lib/libtvm_runtime_rocm.so 23 | -------------------------------------------------------------------------------- /apps/sgx/.gitignore: -------------------------------------------------------------------------------- 1 | lib/ 2 | -------------------------------------------------------------------------------- /apps/sgx/enclave/.rustfmt.toml: -------------------------------------------------------------------------------- 1 | ../../../rust/.rustfmt.toml -------------------------------------------------------------------------------- /apps/sgx/enclave/Cargo.toml: -------------------------------------------------------------------------------- 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 | [package] 19 | name = "model-enclave" 20 | version = "0.1.0" 21 | authors = ["Nick Hynes "] 22 | 23 | [lib] 24 | crate-type = ["staticlib"] 25 | 26 | [dependencies] 27 | lazy_static = "1.1.0" 28 | tvm = { path = "../../../rust", default-features = false, features = ["sgx"] } 29 | 30 | [profile.release] 31 | lto = true 32 | opt-level = 3 33 | -------------------------------------------------------------------------------- /apps/sgx/enclave/Xargo.toml: -------------------------------------------------------------------------------- 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 | [dependencies] 19 | alloc = {} 20 | panic_unwind = {} 21 | panic_abort = {} 22 | 23 | [dependencies.std] 24 | path = "/opt/rust-sgx-sdk/xargo/sgx_tstd" 25 | features = ["backtrace", "stdio", "untrusted_time"] 26 | stage = 2 27 | 28 | [dependencies.xargo_sgx_rand] 29 | path = "/opt/rust-sgx-sdk/xargo/sgx_rand" 30 | stage = 3 31 | -------------------------------------------------------------------------------- /apps/sgx/enclave/build.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | use std::env; 21 | 22 | fn main() { 23 | println!( 24 | "cargo:rustc-link-search=native={}", 25 | env::var("BUILD_DIR").unwrap() 26 | ); 27 | println!("cargo:rustc-link-lib=static=model"); 28 | } 29 | -------------------------------------------------------------------------------- /apps/sgx/enclave/enclave.lds: -------------------------------------------------------------------------------- 1 | enclave.so 2 | { 3 | global: 4 | g_global_data_sim; 5 | g_global_data; 6 | enclave_entry; 7 | local: 8 | *; 9 | }; 10 | -------------------------------------------------------------------------------- /apps/sgx/enclave/enclave_config.xml.in: -------------------------------------------------------------------------------- 1 | 2 | 0 3 | 0 4 | 0xf0000 5 | 0xf000000 6 | NUM_THREADS 7 | 0 8 | 0 9 | 0 10 | 0xFFFFFFFF 11 | 12 | -------------------------------------------------------------------------------- /apps/sgx/enclave/sgx-deps.diff: -------------------------------------------------------------------------------- 1 | diff --git a/rust/Cargo.toml b/rust/Cargo.toml 2 | index 0819e0c7..e56f4ef2 100644 3 | --- a/rust/Cargo.toml 4 | +++ b/rust/Cargo.toml 5 | @@ -14,7 +14,7 @@ default = ["nom/std"] 6 | sgx = ["nom/alloc"] 7 | 8 | [dependencies] 9 | -bounded-spsc-queue = "0.4.0" 10 | +bounded-spsc-queue = { git = "https://github.com/nhynes/bounded-spsc-queue", branch = "sgx" } 11 | error-chain = { version = "0.12.0", default-features = false } 12 | itertools = "0.7.8" 13 | lazy_static = "1.1.0" 14 | -------------------------------------------------------------------------------- /apps/sgx/enclave/x86_64-unknown-linux-sgx.json: -------------------------------------------------------------------------------- 1 | { 2 | "arch": "x86_64", 3 | "cpu": "x86-64", 4 | "data-layout": "e-m:e-i64:64-f80:128-n8:16:32:64-S128", 5 | "dynamic-linking": true, 6 | "env": "sgx", 7 | "exe-allocation-crate": "alloc_system", 8 | "executables": true, 9 | "has-elf-tls": true, 10 | "has-rpath": true, 11 | "linker-flavor": "gcc", 12 | "linker-is-gnu": true, 13 | "llvm-target": "x86_64-unknown-linux-gnu", 14 | "max-atomic-width": 64, 15 | "os": "linux", 16 | "position-independent-executables": true, 17 | "pre-link-args": { 18 | "gcc": [ 19 | "-Wl,--as-needed", 20 | "-Wl,-z,noexecstack", 21 | "-m64" 22 | ] 23 | }, 24 | "relro-level": "full", 25 | "stack-probes": true, 26 | "target-c-int-width": "32", 27 | "target-endian": "little", 28 | "target-family": "unix", 29 | "target-pointer-width": "64", 30 | "vendor": "unknown" 31 | } 32 | -------------------------------------------------------------------------------- /apps/sgx/run_example.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Licensed to the Apache Software Foundation (ASF) under one 3 | # or more contributor license agreements. See the NOTICE file 4 | # distributed with this work for additional information 5 | # regarding copyright ownership. The ASF licenses this file 6 | # to you under the Apache License, Version 2.0 (the 7 | # "License"); you may not use this file except in compliance 8 | # with the License. You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, 13 | # software distributed under the License is distributed on an 14 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | # KIND, either express or implied. See the License for the 16 | # specific language governing permissions and limitations 17 | # under the License. 18 | 19 | sgx_sdk=${SGX_SDK:=/opt/sgxsdk} 20 | 21 | export LD_LIBRARY_PATH="$sgx_sdk/lib64":${LD_LIBRARY_PATH} 22 | export CC=clang-6.0 23 | export AR=llvm-ar-6.0 24 | export TVM_CACHE_DIR=/tmp 25 | 26 | make && printf "\n" && python3 run_model.py 27 | -------------------------------------------------------------------------------- /apps/vta_rpc/start_rpc_server.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Licensed to the Apache Software Foundation (ASF) under one 3 | # or more contributor license agreements. See the NOTICE file 4 | # distributed with this work for additional information 5 | # regarding copyright ownership. The ASF licenses this file 6 | # to you under the Apache License, Version 2.0 (the 7 | # "License"); you may not use this file except in compliance 8 | # with the License. You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, 13 | # software distributed under the License is distributed on an 14 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | # KIND, either express or implied. See the License for the 16 | # specific language governing permissions and limitations 17 | # under the License. 18 | PROJROOT="$( cd "$( dirname "${BASH_SOURCE[0]}" )/../../" && pwd )" 19 | 20 | export PYTHONPATH=${PYTHONPATH}:${PROJROOT}/python:${PROJROOT}/vta/python 21 | export PYTHONPATH=${PYTHONPATH}:/home/xilinx/pynq 22 | python3 -m vta.exec.rpc_server 23 | -------------------------------------------------------------------------------- /cmake/modules/Micro.cmake: -------------------------------------------------------------------------------- 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 | if(USE_MICRO) 19 | message(STATUS "Build with Micro support") 20 | file(GLOB RUNTIME_MICRO_SRCS src/runtime/micro/*.cc) 21 | list(APPEND RUNTIME_SRCS ${RUNTIME_MICRO_SRCS}) 22 | endif(USE_MICRO) 23 | -------------------------------------------------------------------------------- /cmake/modules/contrib/HybridDump.cmake: -------------------------------------------------------------------------------- 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 | message(STATUS "Build with contrib.hybriddump") 19 | file(GLOB HYBRID_CONTRIB_SRC src/contrib/hybrid/*.cc) 20 | list(APPEND COMPILER_SRCS ${HYBRID_CONTRIB_SRC}) 21 | -------------------------------------------------------------------------------- /cmake/modules/contrib/Random.cmake: -------------------------------------------------------------------------------- 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 | if(USE_RANDOM) 19 | message(STATUS "Build with contrib.random") 20 | file(GLOB RANDOM_CONTRIB_SRC src/contrib/random/random.cc) 21 | list(APPEND RUNTIME_SRCS ${RANDOM_CONTRIB_SRC}) 22 | endif(USE_RANDOM) 23 | -------------------------------------------------------------------------------- /cmake/modules/contrib/Sort.cmake: -------------------------------------------------------------------------------- 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 | if(USE_SORT) 19 | message(STATUS "Build with contrib.sort") 20 | file(GLOB SORT_CONTRIB_SRC src/contrib/sort/*.cc) 21 | list(APPEND RUNTIME_SRCS ${SORT_CONTRIB_SRC}) 22 | endif(USE_SORT) 23 | -------------------------------------------------------------------------------- /conda/conda_build_config.yaml: -------------------------------------------------------------------------------- 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 | python: 19 | - 3.5 20 | - 3.6 21 | - 3.7 22 | 23 | cuda: 24 | - False 25 | -------------------------------------------------------------------------------- /docker/Dockerfile.ci_jekyll: -------------------------------------------------------------------------------- 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 | # CI docker Jekyll env for building website 19 | # tag: v0.50 20 | FROM ubuntu:16.04 21 | 22 | RUN apt-get update && apt-get install -y sudo wget 23 | RUN apt-get update && apt-get install -y ruby-full build-essential zlib1g-dev 24 | RUN gem install jekyll bundler 25 | -------------------------------------------------------------------------------- /docker/install/ubuntu_install_antlr.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Licensed to the Apache Software Foundation (ASF) under one 3 | # or more contributor license agreements. See the NOTICE file 4 | # distributed with this work for additional information 5 | # regarding copyright ownership. The ASF licenses this file 6 | # to you under the Apache License, Version 2.0 (the 7 | # "License"); you may not use this file except in compliance 8 | # with the License. You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, 13 | # software distributed under the License is distributed on an 14 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | # KIND, either express or implied. See the License for the 16 | # specific language governing permissions and limitations 17 | # under the License. 18 | 19 | set -e 20 | set -u 21 | set -o pipefail 22 | 23 | cd /usr/local/lib 24 | wget -q https://www.antlr.org/download/antlr-4.7.1-complete.jar 25 | cd - 26 | -------------------------------------------------------------------------------- /docker/install/ubuntu_install_caffe2.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Licensed to the Apache Software Foundation (ASF) under one 3 | # or more contributor license agreements. See the NOTICE file 4 | # distributed with this work for additional information 5 | # regarding copyright ownership. The ASF licenses this file 6 | # to you under the Apache License, Version 2.0 (the 7 | # "License"); you may not use this file except in compliance 8 | # with the License. You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, 13 | # software distributed under the License is distributed on an 14 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | # KIND, either express or implied. See the License for the 16 | # specific language governing permissions and limitations 17 | # under the License. 18 | 19 | set -e 20 | set -u 21 | set -o pipefail 22 | 23 | python3 -m caffe2.python.models.download -i -f squeezenet 24 | python3 -m caffe2.python.models.download -i -f resnet50 25 | python3 -m caffe2.python.models.download -i -f vgg19 26 | -------------------------------------------------------------------------------- /docker/install/ubuntu_install_coreml.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Licensed to the Apache Software Foundation (ASF) under one 3 | # or more contributor license agreements. See the NOTICE file 4 | # distributed with this work for additional information 5 | # regarding copyright ownership. The ASF licenses this file 6 | # to you under the Apache License, Version 2.0 (the 7 | # "License"); you may not use this file except in compliance 8 | # with the License. You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, 13 | # software distributed under the License is distributed on an 14 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | # KIND, either express or implied. See the License for the 16 | # specific language governing permissions and limitations 17 | # under the License. 18 | 19 | set -e 20 | set -u 21 | set -o pipefail 22 | 23 | pip3 install coremltools 24 | -------------------------------------------------------------------------------- /docker/install/ubuntu_install_darknet.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Licensed to the Apache Software Foundation (ASF) under one 3 | # or more contributor license agreements. See the NOTICE file 4 | # distributed with this work for additional information 5 | # regarding copyright ownership. The ASF licenses this file 6 | # to you under the Apache License, Version 2.0 (the 7 | # "License"); you may not use this file except in compliance 8 | # with the License. You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, 13 | # software distributed under the License is distributed on an 14 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | # KIND, either express or implied. See the License for the 16 | # specific language governing permissions and limitations 17 | # under the License. 18 | 19 | set -e 20 | set -u 21 | set -o pipefail 22 | 23 | #install the necessary dependancies, cffi, opencv 24 | wget -q 'https://github.com/siju-samuel/darknet/blob/master/lib/libdarknet.so?raw=true' -O libdarknet.so 25 | pip2 install opencv-python cffi 26 | pip3 install opencv-python cffi 27 | -------------------------------------------------------------------------------- /docker/install/ubuntu_install_dgl.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Licensed to the Apache Software Foundation (ASF) under one 3 | # or more contributor license agreements. See the NOTICE file 4 | # distributed with this work for additional information 5 | # regarding copyright ownership. The ASF licenses this file 6 | # to you under the Apache License, Version 2.0 (the 7 | # "License"); you may not use this file except in compliance 8 | # with the License. You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, 13 | # software distributed under the License is distributed on an 14 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | # KIND, either express or implied. See the License for the 16 | # specific language governing permissions and limitations 17 | # under the License. 18 | 19 | set -e 20 | set -u 21 | set -o pipefail 22 | 23 | pip3 install dgl 24 | -------------------------------------------------------------------------------- /docker/install/ubuntu_install_gluoncv.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Licensed to the Apache Software Foundation (ASF) under one 3 | # or more contributor license agreements. See the NOTICE file 4 | # distributed with this work for additional information 5 | # regarding copyright ownership. The ASF licenses this file 6 | # to you under the Apache License, Version 2.0 (the 7 | # "License"); you may not use this file except in compliance 8 | # with the License. You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, 13 | # software distributed under the License is distributed on an 14 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | # KIND, either express or implied. See the License for the 16 | # specific language governing permissions and limitations 17 | # under the License. 18 | 19 | set -e 20 | set -u 21 | set -o pipefail 22 | 23 | pip3 install gluoncv 24 | -------------------------------------------------------------------------------- /docker/install/ubuntu_install_golang.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Licensed to the Apache Software Foundation (ASF) under one 3 | # or more contributor license agreements. See the NOTICE file 4 | # distributed with this work for additional information 5 | # regarding copyright ownership. The ASF licenses this file 6 | # to you under the Apache License, Version 2.0 (the 7 | # "License"); you may not use this file except in compliance 8 | # with the License. You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, 13 | # software distributed under the License is distributed on an 14 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | # KIND, either express or implied. See the License for the 16 | # specific language governing permissions and limitations 17 | # under the License. 18 | 19 | set -e 20 | set -u 21 | set -o pipefail 22 | 23 | #install the necessary dependancies for golang build 24 | apt-get update 25 | apt-get install -y golang-1.10-go 26 | apt-get install -y golang-1.10-doc 27 | apt-get install -y golint 28 | -------------------------------------------------------------------------------- /docker/install/ubuntu_install_iverilog.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Licensed to the Apache Software Foundation (ASF) under one 3 | # or more contributor license agreements. See the NOTICE file 4 | # distributed with this work for additional information 5 | # regarding copyright ownership. The ASF licenses this file 6 | # to you under the Apache License, Version 2.0 (the 7 | # "License"); you may not use this file except in compliance 8 | # with the License. You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, 13 | # software distributed under the License is distributed on an 14 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | # KIND, either express or implied. See the License for the 16 | # specific language governing permissions and limitations 17 | # under the License. 18 | 19 | set -e 20 | set -u 21 | set -o pipefail 22 | 23 | apt-get install -y --no-install-recommends make bison flex 24 | wget -q ftp://icarus.com/pub/eda/verilog/v10/verilog-10.1.tar.gz 25 | tar xf verilog-10.1.tar.gz 26 | cd verilog-10.1 27 | ./configure --prefix=/usr 28 | make install -j8 29 | cd .. 30 | rm -rf verilog-10.1 verilog-10.1.tar.gz 31 | -------------------------------------------------------------------------------- /docker/install/ubuntu_install_mxnet.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Licensed to the Apache Software Foundation (ASF) under one 3 | # or more contributor license agreements. See the NOTICE file 4 | # distributed with this work for additional information 5 | # regarding copyright ownership. The ASF licenses this file 6 | # to you under the Apache License, Version 2.0 (the 7 | # "License"); you may not use this file except in compliance 8 | # with the License. You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, 13 | # software distributed under the License is distributed on an 14 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | # KIND, either express or implied. See the License for the 16 | # specific language governing permissions and limitations 17 | # under the License. 18 | 19 | set -e 20 | set -u 21 | set -o pipefail 22 | 23 | pip3 install mxnet==1.5.0 24 | -------------------------------------------------------------------------------- /docker/install/ubuntu_install_onnx.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Licensed to the Apache Software Foundation (ASF) under one 3 | # or more contributor license agreements. See the NOTICE file 4 | # distributed with this work for additional information 5 | # regarding copyright ownership. The ASF licenses this file 6 | # to you under the Apache License, Version 2.0 (the 7 | # "License"); you may not use this file except in compliance 8 | # with the License. You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, 13 | # software distributed under the License is distributed on an 14 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | # KIND, either express or implied. See the License for the 16 | # specific language governing permissions and limitations 17 | # under the License. 18 | 19 | set -e 20 | set -u 21 | set -o pipefail 22 | 23 | # fix to certain version for now 24 | pip3 install onnx==1.5.0 25 | 26 | pip3 install https://download.pytorch.org/whl/cu80/torch-1.0.1.post2-cp36-cp36m-linux_x86_64.whl 27 | pip3 install torchvision 28 | -------------------------------------------------------------------------------- /docker/install/ubuntu_install_opengl.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Licensed to the Apache Software Foundation (ASF) under one 3 | # or more contributor license agreements. See the NOTICE file 4 | # distributed with this work for additional information 5 | # regarding copyright ownership. The ASF licenses this file 6 | # to you under the Apache License, Version 2.0 (the 7 | # "License"); you may not use this file except in compliance 8 | # with the License. You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, 13 | # software distributed under the License is distributed on an 14 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | # KIND, either express or implied. See the License for the 16 | # specific language governing permissions and limitations 17 | # under the License. 18 | 19 | set -e 20 | set -u 21 | set -o pipefail 22 | 23 | apt-get update --fix-missing 24 | 25 | apt-get install -y --no-install-recommends \ 26 | libgl1-mesa-dev libglfw3-dev 27 | -------------------------------------------------------------------------------- /docker/install/ubuntu_install_python_package.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Licensed to the Apache Software Foundation (ASF) under one 3 | # or more contributor license agreements. See the NOTICE file 4 | # distributed with this work for additional information 5 | # regarding copyright ownership. The ASF licenses this file 6 | # to you under the Apache License, Version 2.0 (the 7 | # "License"); you may not use this file except in compliance 8 | # with the License. You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, 13 | # software distributed under the License is distributed on an 14 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | # KIND, either express or implied. See the License for the 16 | # specific language governing permissions and limitations 17 | # under the License. 18 | 19 | set -e 20 | set -u 21 | set -o pipefail 22 | 23 | # install libraries for python package on ubuntu 24 | pip3 install pylint==1.9.4 six numpy pytest cython decorator scipy tornado typed_ast pytest mypy orderedset antlr4-python3-runtime attrs requests Pillow packaging 25 | -------------------------------------------------------------------------------- /docker/install/ubuntu_install_rat.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Licensed to the Apache Software Foundation (ASF) under one 3 | # or more contributor license agreements. See the NOTICE file 4 | # distributed with this work for additional information 5 | # regarding copyright ownership. The ASF licenses this file 6 | # to you under the Apache License, Version 2.0 (the 7 | # "License"); you may not use this file except in compliance 8 | # with the License. You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, 13 | # software distributed under the License is distributed on an 14 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | # KIND, either express or implied. See the License for the 16 | # specific language governing permissions and limitations 17 | # under the License. 18 | 19 | set -e 20 | set -u 21 | set -o pipefail 22 | 23 | cd /tmp 24 | wget -q https://archive.apache.org/dist/creadur/apache-rat-0.12/apache-rat-0.12-bin.tar.gz 25 | tar xf apache-rat-0.12-bin.tar.gz 26 | mv apache-rat-0.12/apache-rat-0.12.jar /bin/apache-rat.jar 27 | rm -rf apache-rat-0.12-bin.tar.gz apache-rat-0.12 28 | -------------------------------------------------------------------------------- /docker/install/ubuntu_install_redis.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Licensed to the Apache Software Foundation (ASF) under one 3 | # or more contributor license agreements. See the NOTICE file 4 | # distributed with this work for additional information 5 | # regarding copyright ownership. The ASF licenses this file 6 | # to you under the Apache License, Version 2.0 (the 7 | # "License"); you may not use this file except in compliance 8 | # with the License. You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, 13 | # software distributed under the License is distributed on an 14 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | # KIND, either express or implied. See the License for the 16 | # specific language governing permissions and limitations 17 | # under the License. 18 | 19 | set -e 20 | set -u 21 | set -o pipefail 22 | 23 | apt-get update && apt-get install -y redis-server 24 | pip2 install xgboost psutil 25 | pip3 install xgboost psutil 26 | -------------------------------------------------------------------------------- /docker/install/ubuntu_install_rocm.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Licensed to the Apache Software Foundation (ASF) under one 3 | # or more contributor license agreements. See the NOTICE file 4 | # distributed with this work for additional information 5 | # regarding copyright ownership. The ASF licenses this file 6 | # to you under the Apache License, Version 2.0 (the 7 | # "License"); you may not use this file except in compliance 8 | # with the License. You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, 13 | # software distributed under the License is distributed on an 14 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | # KIND, either express or implied. See the License for the 16 | # specific language governing permissions and limitations 17 | # under the License. 18 | 19 | set -e 20 | set -u 21 | set -o pipefail 22 | 23 | # Install ROCm cross compilation toolchain. 24 | wget -qO - http://repo.radeon.com/rocm/apt/debian/rocm.gpg.key | sudo apt-key add - 25 | echo deb [arch=amd64] http://repo.radeon.com/rocm/apt/debian/ xenial main > /etc/apt/sources.list.d/rocm.list 26 | apt-get update && apt-get install -y rocm-dev 27 | -------------------------------------------------------------------------------- /docker/install/ubuntu_install_sphinx.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Licensed to the Apache Software Foundation (ASF) under one 3 | # or more contributor license agreements. See the NOTICE file 4 | # distributed with this work for additional information 5 | # regarding copyright ownership. The ASF licenses this file 6 | # to you under the Apache License, Version 2.0 (the 7 | # "License"); you may not use this file except in compliance 8 | # with the License. You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, 13 | # software distributed under the License is distributed on an 14 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | # KIND, either express or implied. See the License for the 16 | # specific language governing permissions and limitations 17 | # under the License. 18 | 19 | set -e 20 | set -u 21 | set -o pipefail 22 | 23 | pip3 install sphinx sphinx-gallery sphinx_rtd_theme sphinx_autodoc_annotation matplotlib Image commonmark>=0.7.3 docutils>=0.11 24 | -------------------------------------------------------------------------------- /docker/install/ubuntu_install_tensorflow.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Licensed to the Apache Software Foundation (ASF) under one 3 | # or more contributor license agreements. See the NOTICE file 4 | # distributed with this work for additional information 5 | # regarding copyright ownership. The ASF licenses this file 6 | # to you under the Apache License, Version 2.0 (the 7 | # "License"); you may not use this file except in compliance 8 | # with the License. You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, 13 | # software distributed under the License is distributed on an 14 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | # KIND, either express or implied. See the License for the 16 | # specific language governing permissions and limitations 17 | # under the License. 18 | 19 | set -e 20 | set -u 21 | set -o pipefail 22 | 23 | pip3 install tensorflow==1.13.1 keras h5py 24 | -------------------------------------------------------------------------------- /docker/install/ubuntu_install_vulkan.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Licensed to the Apache Software Foundation (ASF) under one 3 | # or more contributor license agreements. See the NOTICE file 4 | # distributed with this work for additional information 5 | # regarding copyright ownership. The ASF licenses this file 6 | # to you under the Apache License, Version 2.0 (the 7 | # "License"); you may not use this file except in compliance 8 | # with the License. You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, 13 | # software distributed under the License is distributed on an 14 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | # KIND, either express or implied. See the License for the 16 | # specific language governing permissions and limitations 17 | # under the License. 18 | 19 | set -e 20 | set -u 21 | set -o pipefail 22 | 23 | wget -q https://sdk.lunarg.com/sdk/download/1.0.65.0/linux/vulkansdk-linux-x86_64-1.0.65.0.run 24 | 25 | bash vulkansdk-linux-x86_64-1.0.65.0.run 26 | mv VulkanSDK /usr/local/VulkanSDK 27 | cd /usr/local/VulkanSDK/1.0.65.0 28 | ./build_tools.sh 29 | ./build_samples.sh 30 | -------------------------------------------------------------------------------- /docs/.gitignore: -------------------------------------------------------------------------------- 1 | doxygen 2 | modules 3 | tutorials 4 | -------------------------------------------------------------------------------- /docs/README.txt: -------------------------------------------------------------------------------- 1 | TVM Documentations 2 | ================== 3 | This folder contains the source of TVM documents 4 | 5 | - A hosted version of doc is at http://docs.tvm.ai 6 | - pip install sphinx>=1.5.5 sphinx-gallery sphinx_rtd_theme matplotlib Image recommonmark Pillow 7 | - Build tvm first in the root folder. 8 | - To build locally, you need to enable USE_CUDA, USE_OPENCL, LLVM_CONFIG in config.mk and then type "make html" in this folder. 9 | 10 | Only Execute Specified Tutorials 11 | -------------------------------- 12 | The document build process will execute all the tutorials in the sphinx gallery. 13 | This will cause failure in some cases when certain machines do not have necessary 14 | environment. You can set ```TVM_TUTORIAL_EXEC_PATTERN``` to only execute 15 | the path that matches the regular expression pattern. 16 | 17 | For example, to only build tutorials under /vta/tutorials, run 18 | 19 | ```bash 20 | TVM_TUTORIAL_EXEC_PATTERN=/vta/tutorials make html 21 | ``` 22 | 23 | To only build one specific file, do 24 | 25 | ```bash 26 | # The slash \ is used to get . in regular expression 27 | TVM_TUTORIAL_EXEC_PATTERN=file_name\.py make html 28 | ``` 29 | -------------------------------------------------------------------------------- /docs/_static/css/tvm_theme.css: -------------------------------------------------------------------------------- 1 | .rst-content .hidden-section { 2 | display: none; 3 | } 4 | 5 | .rst-toc .hidden-section { 6 | display: none; 7 | } 8 | 9 | nav .hidden-section { 10 | display: inherit; 11 | } 12 | 13 | .wy-side-nav-search { 14 | background-color: #fff; 15 | color: #333; 16 | } 17 | 18 | .version{ 19 | color: #404040 !important; 20 | } 21 | 22 | -------------------------------------------------------------------------------- /docs/_static/img/README: -------------------------------------------------------------------------------- 1 | The logo file in this repo is an exception due to the need of sphinx. 2 | By default we avoid to put large binary blobs into this repo. -------------------------------------------------------------------------------- /docs/_static/img/tvm-logo-small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/onnxruntime-tvm/984dc1b111aeb02c8a8c68e9724ecff814db11ff/docs/_static/img/tvm-logo-small.png -------------------------------------------------------------------------------- /docs/_static/img/tvm-logo-square.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/onnxruntime-tvm/984dc1b111aeb02c8a8c68e9724ecff814db11ff/docs/_static/img/tvm-logo-square.png -------------------------------------------------------------------------------- /docs/api/python/bridge.rst: -------------------------------------------------------------------------------- 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 | Framework Bridge APIs 19 | --------------------- 20 | 21 | tvm.contrib.mxnet 22 | ~~~~~~~~~~~~~~~~~ 23 | .. automodule:: tvm.contrib.mxnet 24 | :members: 25 | -------------------------------------------------------------------------------- /docs/api/python/build.rst: -------------------------------------------------------------------------------- 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 | tvm.build 19 | --------- 20 | .. autofunction:: tvm.lower 21 | 22 | .. autofunction:: tvm.build 23 | 24 | .. autofunction:: tvm.build_config 25 | -------------------------------------------------------------------------------- /docs/api/python/container.rst: -------------------------------------------------------------------------------- 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 | tvm.container 19 | ------------- 20 | .. automodule:: tvm.container 21 | :members: 22 | -------------------------------------------------------------------------------- /docs/api/python/error.rst: -------------------------------------------------------------------------------- 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 | tvm.error 19 | --------- 20 | .. automodule:: tvm.error 21 | :members: 22 | :imported-members: 23 | -------------------------------------------------------------------------------- /docs/api/python/function.rst: -------------------------------------------------------------------------------- 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 | tvm.Function 19 | ------------ 20 | .. autoclass:: tvm.Function 21 | 22 | .. autofunction:: tvm.register_func 23 | 24 | .. autofunction:: tvm.get_global_func 25 | -------------------------------------------------------------------------------- /docs/api/python/graph_runtime.rst: -------------------------------------------------------------------------------- 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 | tvm.contrib.graph_runtime 19 | ------------------------- 20 | .. automodule:: tvm.contrib.graph_runtime 21 | :members: 22 | -------------------------------------------------------------------------------- /docs/api/python/hybrid.rst: -------------------------------------------------------------------------------- 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 | tvm.hybrid 19 | ---------- 20 | .. automodule:: tvm.hybrid 21 | 22 | .. autosummary:: 23 | 24 | tvm.hybrid.parse 25 | tvm.hybrid.script 26 | 27 | .. autofunction:: tvm.hybrid.parse 28 | .. autofunction:: tvm.hybrid.script 29 | -------------------------------------------------------------------------------- /docs/api/python/module.rst: -------------------------------------------------------------------------------- 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 | tvm.module 19 | ---------- 20 | .. automodule:: tvm.module 21 | :members: 22 | -------------------------------------------------------------------------------- /docs/api/python/nnvm/graph.rst: -------------------------------------------------------------------------------- 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 | nnvm.graph 19 | ---------- 20 | .. automodule:: nnvm.graph 21 | 22 | .. autofunction:: nnvm.graph.create 23 | 24 | .. autoclass:: nnvm.graph.Graph 25 | :members: 26 | -------------------------------------------------------------------------------- /docs/api/python/nnvm/index.rst: -------------------------------------------------------------------------------- 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 | NNVM API 19 | ======== 20 | 21 | This document contains the python API to NNVM compiler toolchain. 22 | 23 | .. toctree:: 24 | :maxdepth: 2 25 | 26 | compiler 27 | frontend 28 | symbol 29 | graph 30 | top 31 | testing 32 | -------------------------------------------------------------------------------- /docs/api/python/nnvm/symbol.rst: -------------------------------------------------------------------------------- 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 | nnvm.symbol 19 | ----------- 20 | .. automodule:: nnvm.symbol 21 | 22 | .. autoclass:: nnvm.symbol.Symbol 23 | :members: 24 | 25 | .. autoclass:: nnvm.symbol.Variable 26 | 27 | .. autofunction:: nnvm.symbol.Group 28 | -------------------------------------------------------------------------------- /docs/api/python/nnvm/testing.rst: -------------------------------------------------------------------------------- 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 | nnvm.testing 19 | ------------ 20 | 21 | .. automodule:: nnvm.testing 22 | 23 | .. autofunction:: nnvm.testing.ctx_list 24 | 25 | nnvm.testing.check_computation 26 | ------------------------------ 27 | 28 | .. automodule:: nnvm.testing.check_computation 29 | :members: 30 | 31 | .. include:: testing_new_ops.rst 32 | -------------------------------------------------------------------------------- /docs/api/python/nnvm/top.rst: -------------------------------------------------------------------------------- 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 | nnvm.top 19 | -------- 20 | .. automodule:: nnvm.top 21 | 22 | .. autofunction:: register_compute 23 | 24 | .. autofunction:: register_schedule 25 | 26 | .. autofunction:: register_pattern 27 | 28 | 29 | .. autoclass:: nnvm.top.AttrDict 30 | :members: 31 | -------------------------------------------------------------------------------- /docs/api/python/relay/backend.rst: -------------------------------------------------------------------------------- 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 | tvm.relay.backend 19 | ----------------- 20 | 21 | .. automodule:: tvm.relay.backend 22 | 23 | .. automodule:: tvm.relay.backend.interpreter 24 | :members: 25 | 26 | .. automodule:: tvm.relay.backend.compile_engine 27 | :members: 28 | 29 | .. automodule:: tvm.relay.backend.graph_runtime_codegen 30 | :members: 31 | -------------------------------------------------------------------------------- /docs/api/python/relay/image.rst: -------------------------------------------------------------------------------- 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 | 19 | tvm.relay.image 20 | --------------- 21 | 22 | .. automodule:: tvm.relay.image 23 | :members: 24 | 25 | .. automodule:: tvm.relay.op.image 26 | :members: 27 | -------------------------------------------------------------------------------- /docs/api/python/relay/module.rst: -------------------------------------------------------------------------------- 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 | tvm.relay.module 19 | ---------------- 20 | 21 | .. automodule:: tvm.relay.module 22 | 23 | .. autoclass:: tvm.relay.module.Module 24 | :members: 25 | -------------------------------------------------------------------------------- /docs/api/python/relay/nn.rst: -------------------------------------------------------------------------------- 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 | tvm.relay.nn 19 | ------------ 20 | .. automodule:: tvm.relay.nn 21 | :members: 22 | 23 | .. automodule:: tvm.relay.op.nn.nn 24 | :members: 25 | -------------------------------------------------------------------------------- /docs/api/python/relay/scope_builder.rst: -------------------------------------------------------------------------------- 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 | tvm.relay.scope_builder 19 | ----------------------- 20 | 21 | .. automodule:: tvm.relay.scope_builder 22 | 23 | .. autoclass:: tvm.relay.scope_builder.ScopeBuilder 24 | :members: 25 | -------------------------------------------------------------------------------- /docs/api/python/relay/vision.rst: -------------------------------------------------------------------------------- 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 | 19 | tvm.relay.vision 20 | ---------------- 21 | 22 | .. automodule:: tvm.relay.vision 23 | :members: 24 | 25 | .. automodule:: tvm.relay.op.vision.multibox 26 | :members: 27 | 28 | .. automodule:: tvm.relay.op.vision.nms 29 | :members: 30 | -------------------------------------------------------------------------------- /docs/api/python/target.rst: -------------------------------------------------------------------------------- 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 | tvm.target 19 | ---------- 20 | .. automodule:: tvm.target 21 | :members: 22 | -------------------------------------------------------------------------------- /docs/api_links.rst: -------------------------------------------------------------------------------- 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 | Links to API References 19 | ================================== 20 | 21 | This page contains links to API references that are build with different doc build system. 22 | 23 | * `C++ doyxgen API `_ 24 | * `Javascript jsdoc API `_ 25 | * `Java Javadoc API `_ 26 | -------------------------------------------------------------------------------- /docs/genindex.rst: -------------------------------------------------------------------------------- 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 | Index 19 | ===== 20 | -------------------------------------------------------------------------------- /docs/vta/.gitignore: -------------------------------------------------------------------------------- 1 | tutorials -------------------------------------------------------------------------------- /docs/vta/hardware.rst: -------------------------------------------------------------------------------- 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 | VTA Hardware Design Overview 19 | ============================ 20 | -------------------------------------------------------------------------------- /jvm/conf/log4j.properties: -------------------------------------------------------------------------------- 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 | # for development debugging 19 | log4j.rootLogger = info, stdout 20 | 21 | log4j.appender.stdout = org.apache.log4j.ConsoleAppender 22 | log4j.appender.stdout.Target = System.out 23 | log4j.appender.stdout.layout = org.apache.log4j.PatternLayout 24 | log4j.appender.stdout.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss,SSS} [%t] [%c] [%p] - %m%n 25 | -------------------------------------------------------------------------------- /jvm/core/src/main/java/ml/dmlc/tvm/TVMValueBytes.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * 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, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package ml.dmlc.tvm; 19 | 20 | public class TVMValueBytes extends TVMValue { 21 | public final byte[] value; 22 | 23 | public TVMValueBytes(byte[] value) { 24 | super(TypeCode.BYTES); 25 | this.value = value; 26 | } 27 | 28 | @Override public byte[] asBytes() { 29 | return value; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /jvm/core/src/main/java/ml/dmlc/tvm/TVMValueDouble.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * 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, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package ml.dmlc.tvm; 19 | 20 | public class TVMValueDouble extends TVMValue { 21 | public final double value; 22 | 23 | public TVMValueDouble(double value) { 24 | super(TypeCode.FLOAT); 25 | this.value = value; 26 | } 27 | 28 | @Override public double asDouble() { 29 | return value; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /jvm/core/src/main/java/ml/dmlc/tvm/TVMValueLong.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * 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, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package ml.dmlc.tvm; 19 | 20 | public class TVMValueLong extends TVMValue { 21 | public final long value; 22 | 23 | public TVMValueLong(long value) { 24 | super(TypeCode.INT); 25 | this.value = value; 26 | } 27 | 28 | @Override public long asLong() { 29 | return value; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /jvm/core/src/main/java/ml/dmlc/tvm/TVMValueNull.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * 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, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package ml.dmlc.tvm; 19 | 20 | public class TVMValueNull extends TVMValue { 21 | public TVMValueNull() { 22 | super(TypeCode.NULL); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /jvm/core/src/main/java/ml/dmlc/tvm/TVMValueString.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * 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, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package ml.dmlc.tvm; 19 | 20 | public class TVMValueString extends TVMValue { 21 | public final String value; 22 | 23 | public TVMValueString(String value) { 24 | super(TypeCode.STR); 25 | this.value = value; 26 | } 27 | 28 | @Override public String asString() { 29 | return value; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /jvm/core/src/main/java/ml/dmlc/tvm/rpc/ServerProcessor.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * 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, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package ml.dmlc.tvm.rpc; 19 | 20 | /** 21 | * Abstract runnable class for RPC server process. 22 | */ 23 | public interface ServerProcessor extends Runnable { 24 | public void terminate(); 25 | } 26 | -------------------------------------------------------------------------------- /nnvm/amalgamation/.gitignore: -------------------------------------------------------------------------------- 1 | nnvm.d 2 | nnvm.cc 3 | -------------------------------------------------------------------------------- /nnvm/amalgamation/README: -------------------------------------------------------------------------------- 1 | This folder is deprecated and will be deleted in the future. -------------------------------------------------------------------------------- /nnvm/include/nnvm/top/README: -------------------------------------------------------------------------------- 1 | NNVM Core Operator and Compiler 2 | -------------------------------------------------------------------------------- /nnvm/python/.gitignore: -------------------------------------------------------------------------------- 1 | *.c 2 | *.cpp 3 | -------------------------------------------------------------------------------- /nnvm/python/nnvm/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # coding: utf-8 3 | """NNVM python API for ease of use and help new framework establish python API. """ 4 | from __future__ import absolute_import as _abs 5 | 6 | from . import _base 7 | from . import symbol as sym 8 | from . import symbol 9 | from ._base import NNVMError 10 | from . import frontend 11 | 12 | __version__ = _base.__version__ 13 | -------------------------------------------------------------------------------- /nnvm/python/nnvm/_ctypes/README: -------------------------------------------------------------------------------- 1 | Ctypes specific implementation of certain modules -------------------------------------------------------------------------------- /nnvm/python/nnvm/_ctypes/__init__.py: -------------------------------------------------------------------------------- 1 | """"ctypes implementation of the Symbol""" 2 | -------------------------------------------------------------------------------- /nnvm/python/nnvm/_cy2/README: -------------------------------------------------------------------------------- 1 | This folder is by default empty and will hold DLLs generated by cython. 2 | -------------------------------------------------------------------------------- /nnvm/python/nnvm/_cy2/__init__.py: -------------------------------------------------------------------------------- 1 | """Namespace for cython generated modules for python2""" 2 | -------------------------------------------------------------------------------- /nnvm/python/nnvm/_cy3/README: -------------------------------------------------------------------------------- 1 | This folder is by default empty and will hold DLLs generated by cython. -------------------------------------------------------------------------------- /nnvm/python/nnvm/_cy3/__init__.py: -------------------------------------------------------------------------------- 1 | """Cython generated modules""" 2 | -------------------------------------------------------------------------------- /nnvm/python/nnvm/_symbol_internal.py: -------------------------------------------------------------------------------- 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 | """Module space to register internal functions. Leave empty""" 18 | -------------------------------------------------------------------------------- /nnvm/python/nnvm/compiler/__init__.py: -------------------------------------------------------------------------------- 1 | """NNVM compiler toolchain. 2 | 3 | User only need to use :any:`build` and :any:`build_config` to do the compilation, 4 | and :any:`save_param_dict` to save the parameters into bytes. 5 | The other APIs are for more advanced interaction with the compiler toolchain. 6 | """ 7 | from __future__ import absolute_import 8 | 9 | import tvm 10 | 11 | from . import build_module 12 | from . build_module import build, optimize, build_config 13 | from . compile_engine import engine, graph_key 14 | from . param_dict import save_param_dict, load_param_dict 15 | 16 | from .. import symbol as _symbol 17 | from .. import graph as _graph 18 | 19 | from .. import top as _top 20 | 21 | 22 | tvm.register_extension(_symbol.Symbol, _symbol.Symbol) 23 | tvm.register_extension(_graph.Graph, _graph.Graph) 24 | -------------------------------------------------------------------------------- /nnvm/python/nnvm/compiler/graph_pass.py: -------------------------------------------------------------------------------- 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 | # pylint: disable=invalid-name 18 | """Namespace of graph pass. 19 | 20 | Principle: 21 | - Graph in, graph out: always takes in graph as first argument and returns a graph 22 | - Composable API: break graph transformation pass as segments of small transformations. 23 | """ 24 | from __future__ import absolute_import as _abs 25 | -------------------------------------------------------------------------------- /nnvm/python/nnvm/contrib.py: -------------------------------------------------------------------------------- 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 | """Module space to register contrib functions. Leave empty""" 18 | -------------------------------------------------------------------------------- /nnvm/python/nnvm/cython/README: -------------------------------------------------------------------------------- 1 | Cython specific implementation of certain modules -------------------------------------------------------------------------------- /nnvm/python/nnvm/frontend/__init__.py: -------------------------------------------------------------------------------- 1 | """NNVM frontends.""" 2 | from __future__ import absolute_import 3 | from .mxnet import from_mxnet 4 | from .onnx import from_onnx 5 | from .coreml import from_coreml 6 | from .keras import from_keras 7 | from .darknet import from_darknet 8 | from .tensorflow import from_tensorflow 9 | from .caffe2 import from_caffe2 10 | -------------------------------------------------------------------------------- /nnvm/python/nnvm/testing/__init__.py: -------------------------------------------------------------------------------- 1 | """Utilities for testing and benchmarks""" 2 | from __future__ import absolute_import as _abs 3 | 4 | from .config import ctx_list 5 | from .utils import create_workload 6 | from . import mobilenet 7 | from . import mobilenet_v2 8 | from . import mlp 9 | from . import resnet 10 | from . import vgg 11 | from . import densenet 12 | from . import squeezenet 13 | from . import inception_v3 14 | from . import dcgan 15 | from . import dqn 16 | from . import check_computation 17 | -------------------------------------------------------------------------------- /nnvm/python/nnvm/top/__init__.py: -------------------------------------------------------------------------------- 1 | """Tensor operator property registry 2 | 3 | Provide information to lower and schedule tensor operators. 4 | """ 5 | from .attr_dict import AttrDict 6 | from . import tensor 7 | from . import nn 8 | from . import transform 9 | from . import reduction 10 | from . import vision 11 | from . import image 12 | 13 | from .registry import OpPattern 14 | from .registry import register_compute, register_schedule, register_pattern 15 | -------------------------------------------------------------------------------- /nnvm/tests/cpp/.gitignore: -------------------------------------------------------------------------------- 1 | unittest 2 | *.d 3 | *_test 4 | -------------------------------------------------------------------------------- /nnvm/tests/cpp/unittest.mk: -------------------------------------------------------------------------------- 1 | GTEST_LIB=$(GTEST_PATH)/lib/ 2 | GTEST_INC=$(GTEST_PATH)/include/ 3 | 4 | TEST_SRC = $(wildcard tests/cpp/*_test.cc) 5 | TEST = $(patsubst tests/cpp/%_test.cc, tests/cpp/%_test, $(TEST_SRC)) 6 | 7 | tests/cpp/%_test: tests/cpp/%_test.cc lib/libnnvm.a 8 | $(CXX) -std=c++11 $(CFLAGS) -MM -MT tests/cpp/$* $< >tests/cpp/$*.d 9 | $(CXX) -std=c++11 $(CFLAGS) -I$(GTEST_INC) -o $@ $(filter %.cc %.a, $^) \ 10 | -L$(GTEST_LIB) $(LDFLAGS) -lgtest 11 | 12 | -include tests/cpp/*.d 13 | -------------------------------------------------------------------------------- /nnvm/tests/python/frontend/caffe2/model_zoo/__init__.py: -------------------------------------------------------------------------------- 1 | """Store for caffe2 examples and common models.""" 2 | from __future__ import absolute_import as _abs 3 | import os 4 | import importlib 5 | 6 | models = [ 7 | 'squeezenet', 8 | 'resnet50', 9 | 'vgg19', 10 | ] 11 | 12 | # skip download if model exist 13 | for model in models: 14 | try: 15 | locals()['c2_' + model] = importlib.import_module('caffe2.python.models.' + model) 16 | except ImportError: 17 | os.system("python -m caffe2.python.models.download -i -f " + model) 18 | locals()['c2_' + model] = importlib.import_module('caffe2.python.models.' + model) 19 | -------------------------------------------------------------------------------- /nnvm/tests/python/frontend/coreml/model_zoo/.gitignore: -------------------------------------------------------------------------------- 1 | *.mlmodel 2 | *.jpg 3 | *.png 4 | -------------------------------------------------------------------------------- /nnvm/tests/python/frontend/coreml/model_zoo/__init__.py: -------------------------------------------------------------------------------- 1 | import os 2 | from PIL import Image 3 | import numpy as np 4 | from tvm.contrib.download import download_testdata 5 | 6 | def get_mobilenet(): 7 | url = 'https://docs-assets.developer.apple.com/coreml/models/MobileNet.mlmodel' 8 | dst = 'mobilenet.mlmodel' 9 | real_dst = download_testdata(url, dst, module='coreml') 10 | return real_dst 11 | 12 | def get_resnet50(): 13 | url = 'https://docs-assets.developer.apple.com/coreml/models/Resnet50.mlmodel' 14 | dst = 'resnet50.mlmodel' 15 | real_dst = download_testdata(url, dst, module='coreml') 16 | return real_dst 17 | 18 | def get_cat_image(): 19 | url = 'https://gist.githubusercontent.com/zhreshold/bcda4716699ac97ea44f791c24310193/raw/fa7ef0e9c9a5daea686d6473a62aacd1a5885849/cat.png' 20 | dst = 'cat.png' 21 | real_dst = download_testdata(url, dst, module='data') 22 | img = Image.open(real_dst).resize((224, 224)) 23 | img = np.transpose(img, (2, 0, 1))[np.newaxis, :] 24 | return np.asarray(img) 25 | -------------------------------------------------------------------------------- /nnvm/tutorials/.gitignore: -------------------------------------------------------------------------------- 1 | *.pb 2 | *.mlmodel 3 | *.ttf 4 | *.txt 5 | *synset*txt 6 | *.cfg 7 | ssd_model 8 | *.names 9 | *.jpg 10 | *.pbtxt 11 | *.weights 12 | -------------------------------------------------------------------------------- /nnvm/tutorials/README.txt: -------------------------------------------------------------------------------- 1 | .. _tutorial-nnvm: 2 | 3 | NNVM Compiler Tutorials 4 | ----------------------- 5 | -------------------------------------------------------------------------------- /python/.gitignore: -------------------------------------------------------------------------------- 1 | build 2 | dist 3 | *.cpp 4 | -------------------------------------------------------------------------------- /python/tvm/_ffi/_ctypes/__init__.py: -------------------------------------------------------------------------------- 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 | """ctypes specific implementation of FFI""" 18 | -------------------------------------------------------------------------------- /python/tvm/_ffi/_cy2/__init__.py: -------------------------------------------------------------------------------- 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 | """cython2 namespace""" 18 | -------------------------------------------------------------------------------- /python/tvm/_ffi/_cy3/__init__.py: -------------------------------------------------------------------------------- 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 | """cython3 namespace""" 18 | -------------------------------------------------------------------------------- /python/tvm/_ffi/_cython/core.pyx: -------------------------------------------------------------------------------- 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 "./base.pxi" 19 | include "./node.pxi" 20 | include "./function.pxi" 21 | include "./ndarray.pxi" 22 | include "./vmobj.pxi" 23 | -------------------------------------------------------------------------------- /python/tvm/_pyversion.py: -------------------------------------------------------------------------------- 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 | """Python2 version check 18 | """ 19 | import sys 20 | 21 | if not (sys.version_info[0] >= 3 and sys.version_info[1] >= 5): 22 | PY3STATEMENT = """TVM project proudly dropped support of Python2. 23 | The minimal Python requirement is Python 3.5 24 | """ 25 | raise Exception(PY3STATEMENT) 26 | -------------------------------------------------------------------------------- /python/tvm/autotvm/graph_tuner/__init__.py: -------------------------------------------------------------------------------- 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 | """Autotvm graph tuner API.""" 18 | from __future__ import absolute_import as _abs 19 | 20 | from . import _base 21 | from . import base_graph_tuner 22 | 23 | from .base_graph_tuner import BaseGraphTuner 24 | from .dynamic_programming_tuner import DPTuner 25 | from .pbqp_tuner import PBQPTuner 26 | -------------------------------------------------------------------------------- /python/tvm/autotvm/graph_tuner/_base.py: -------------------------------------------------------------------------------- 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 | # pylint: disable=invalid-name 18 | """Helper functions and global data""" 19 | 20 | 21 | # We set a large time to represent an invalid layout-transformation. 22 | # This number is set to be 10e9 seconds to align with autotvm. 23 | INVALID_LAYOUT_TIME = 10e9 24 | 25 | MAX_OUTPUT_NODES = 16 26 | -------------------------------------------------------------------------------- /python/tvm/autotvm/measure/__init__.py: -------------------------------------------------------------------------------- 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 | """Distributed executor infrastructure to scale up the tuning""" 18 | 19 | from .measure import MeasureInput, MeasureResult, MeasureErrorNo, measure_option, \ 20 | create_measure_batch 21 | from .measure_methods import LocalBuilder, LocalRunner, RPCRunner, request_remote 22 | from .executor import Executor 23 | from .local_executor import LocalExecutor 24 | -------------------------------------------------------------------------------- /python/tvm/contrib/__init__.py: -------------------------------------------------------------------------------- 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 | """Contrib APIs of TVM python package. 18 | 19 | Contrib API provides many useful not core features. 20 | Some of these are useful utilities to interact with 21 | thirdparty libraries and tools. 22 | """ 23 | -------------------------------------------------------------------------------- /python/tvm/contrib/debugger/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/onnxruntime-tvm/984dc1b111aeb02c8a8c68e9724ecff814db11ff/python/tvm/contrib/debugger/__init__.py -------------------------------------------------------------------------------- /python/tvm/exec/__init__.py: -------------------------------------------------------------------------------- 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 | """Namespace of executables python files that directly run throw cmd""" 18 | -------------------------------------------------------------------------------- /python/tvm/micro/__init__.py: -------------------------------------------------------------------------------- 1 | """uTVM module for bare-metal backends. 2 | 3 | uTVM (or the micro backend) enables provides support for bare-metal devices. 4 | Its targets currently include a host-emulated device which is used for testing, 5 | and JTAG-based openocd device which allows actual interfacing with microdevices. 6 | """ 7 | 8 | from ..contrib import binutil 9 | from .base import Session, cross_compiler, create_micro_lib 10 | -------------------------------------------------------------------------------- /python/tvm/node.py: -------------------------------------------------------------------------------- 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 | """Node is the base class of all TVM AST. 18 | 19 | Normally user do not need to touch this api. 20 | """ 21 | # pylint: disable=unused-import 22 | from __future__ import absolute_import as _abs 23 | from ._ffi.node import NodeBase, register_node 24 | 25 | Node = NodeBase 26 | -------------------------------------------------------------------------------- /python/tvm/relay/_analysis.py: -------------------------------------------------------------------------------- 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 | """FFI exposing the passes for Relay program analysis.""" 18 | 19 | from tvm._ffi.function import _init_api 20 | 21 | _init_api("relay._analysis", __name__) 22 | -------------------------------------------------------------------------------- /python/tvm/relay/_base.py: -------------------------------------------------------------------------------- 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 | # pylint: disable=no-else-return, unidiomatic-typecheck, undefined-variable 18 | """The interface of expr function exposed from C++.""" 19 | from tvm._ffi.function import _init_api 20 | 21 | _init_api("relay._base", __name__) 22 | -------------------------------------------------------------------------------- /python/tvm/relay/_build_module.py: -------------------------------------------------------------------------------- 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 | # pylint: disable=no-else-return, unidiomatic-typecheck, undefined-variable 18 | """The interface for building Relay functions exposed from C++.""" 19 | from tvm._ffi.function import _init_api 20 | 21 | _init_api("relay.build_module", __name__) 22 | -------------------------------------------------------------------------------- /python/tvm/relay/_expr.py: -------------------------------------------------------------------------------- 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 | # pylint: disable=no-else-return, unidiomatic-typecheck, undefined-variable 18 | """The interface of expr function exposed from C++.""" 19 | from tvm._ffi.function import _init_api 20 | 21 | _init_api("relay._expr", __name__) 22 | -------------------------------------------------------------------------------- /python/tvm/relay/_make.py: -------------------------------------------------------------------------------- 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 | The constructors for all Relay AST nodes exposed from C++. 19 | 20 | This module includes MyPy type signatures for all of the 21 | exposed modules. 22 | """ 23 | from .._ffi.function import _init_api 24 | 25 | _init_api("relay._make", __name__) 26 | -------------------------------------------------------------------------------- /python/tvm/relay/_module.py: -------------------------------------------------------------------------------- 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 | # pylint: disable=no-else-return, unidiomatic-typecheck, undefined-variable 18 | """The interface to the Module exposed from C++.""" 19 | from tvm._ffi.function import _init_api 20 | 21 | _init_api("relay._module", __name__) 22 | -------------------------------------------------------------------------------- /python/tvm/relay/_module.pyi: -------------------------------------------------------------------------------- 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 | from typing import Union, Tuple, Dict, List 19 | from relay.ir import GlobalId, OperatorId, Item, NodeBase, Span, FileId 20 | from relay.ir import ShapeExtension, Operator, Defn 21 | 22 | class Module(NodeBase): ... 23 | -------------------------------------------------------------------------------- /python/tvm/relay/_transform.py: -------------------------------------------------------------------------------- 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 | """FFI exposing the Relay type inference and checking.""" 18 | 19 | from tvm._ffi.function import _init_api 20 | 21 | _init_api("relay._transform", __name__) 22 | -------------------------------------------------------------------------------- /python/tvm/relay/annotation.py: -------------------------------------------------------------------------------- 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 | # pylint: disable=wildcard-import, unused-import, unused-wildcard-import 19 | """Annotation related operators.""" 20 | # Re-export in a specific file name so that autodoc can pick it up 21 | from .op.annotation import * 22 | -------------------------------------------------------------------------------- /python/tvm/relay/backend/__init__.py: -------------------------------------------------------------------------------- 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 | """Backend codege modules for relay.""" 18 | from . import compile_engine 19 | -------------------------------------------------------------------------------- /python/tvm/relay/backend/_vm.py: -------------------------------------------------------------------------------- 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 | """The Relay virtual machine FFI namespace. 18 | """ 19 | from tvm._ffi.function import _init_api 20 | 21 | _init_api("relay._vm", __name__) 22 | -------------------------------------------------------------------------------- /python/tvm/relay/backend/_vmobj.py: -------------------------------------------------------------------------------- 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 | """The VM Object FFI namespace.""" 18 | from tvm._ffi.function import _init_api 19 | 20 | _init_api("_vmobj", __name__) 21 | -------------------------------------------------------------------------------- /python/tvm/relay/contrib.py: -------------------------------------------------------------------------------- 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 | # pylint: disable=wildcard-import, unused-import, unused-wildcard-import 18 | """Contrib operators.""" 19 | # Re-export in a specific file name so that autodoc can pick it up 20 | from .op.contrib import * 21 | -------------------------------------------------------------------------------- /python/tvm/relay/grammar/.gitignore: -------------------------------------------------------------------------------- 1 | /.antlr/ 2 | -------------------------------------------------------------------------------- /python/tvm/relay/grammar/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/onnxruntime-tvm/984dc1b111aeb02c8a8c68e9724ecff814db11ff/python/tvm/relay/grammar/__init__.py -------------------------------------------------------------------------------- /python/tvm/relay/grammar/py3/.gitattributes: -------------------------------------------------------------------------------- 1 | Relay* binary 2 | Relay* linguist-generated=true 3 | Relay* linguist-detectable=false 4 | -------------------------------------------------------------------------------- /python/tvm/relay/image.py: -------------------------------------------------------------------------------- 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 | # pylint: disable=wildcard-import, unused-import, unused-wildcard-import 18 | """Image network related operators.""" 19 | # Re-export in a specific file name so that autodoc can pick it up 20 | from .op.image import * 21 | -------------------------------------------------------------------------------- /python/tvm/relay/nn.py: -------------------------------------------------------------------------------- 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 | # pylint: disable=wildcard-import, unused-import, unused-wildcard-import 18 | """Neural network related operators.""" 19 | # Re-export in a specific file name so that autodoc can pick it up 20 | from .op.nn import * 21 | -------------------------------------------------------------------------------- /python/tvm/relay/op/_make.py: -------------------------------------------------------------------------------- 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 | """Constructor APIs""" 18 | from ..._ffi.function import _init_api 19 | 20 | _init_api("relay.op._make", __name__) 21 | -------------------------------------------------------------------------------- /python/tvm/relay/op/annotation/__init__.py: -------------------------------------------------------------------------------- 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 | # pylint: disable=wildcard-import 18 | """Annotation related operators.""" 19 | from __future__ import absolute_import as _abs 20 | from .annotation import * 21 | -------------------------------------------------------------------------------- /python/tvm/relay/op/annotation/_make.py: -------------------------------------------------------------------------------- 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 | """Constructor APIs""" 18 | from ...._ffi.function import _init_api 19 | 20 | _init_api("relay.op.annotation._make", __name__) 21 | -------------------------------------------------------------------------------- /python/tvm/relay/op/contrib/__init__.py: -------------------------------------------------------------------------------- 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 | # pylint: disable=wildcard-import 18 | """Neural network related operators.""" 19 | from __future__ import absolute_import as _abs 20 | from .contrib import * 21 | from . import _contrib 22 | -------------------------------------------------------------------------------- /python/tvm/relay/op/contrib/_make.py: -------------------------------------------------------------------------------- 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 | """Constructor APIs""" 18 | from ...._ffi.function import _init_api 19 | 20 | _init_api("relay.op.contrib._make", __name__) 21 | -------------------------------------------------------------------------------- /python/tvm/relay/op/image/__init__.py: -------------------------------------------------------------------------------- 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 | # pylint: disable=wildcard-import 18 | """Image network related operators.""" 19 | from __future__ import absolute_import as _abs 20 | from .image import * 21 | from ._image import * 22 | -------------------------------------------------------------------------------- /python/tvm/relay/op/image/_make.py: -------------------------------------------------------------------------------- 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 | """Constructor APIs""" 18 | from ...._ffi.function import _init_api 19 | 20 | _init_api("relay.op.image._make", __name__) 21 | -------------------------------------------------------------------------------- /python/tvm/relay/op/nn/__init__.py: -------------------------------------------------------------------------------- 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 | # pylint: disable=wildcard-import 18 | """Neural network related operators.""" 19 | from __future__ import absolute_import as _abs 20 | from .nn import * 21 | from . import _nn 22 | -------------------------------------------------------------------------------- /python/tvm/relay/op/nn/_make.py: -------------------------------------------------------------------------------- 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 | """Constructor APIs""" 18 | from ...._ffi.function import _init_api 19 | 20 | _init_api("relay.op.nn._make", __name__) 21 | -------------------------------------------------------------------------------- /python/tvm/relay/op/vision/__init__.py: -------------------------------------------------------------------------------- 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 | # pylint: disable=wildcard-import 18 | """Vision network related operators.""" 19 | from __future__ import absolute_import as _abs 20 | 21 | from .multibox import * 22 | from .nms import * 23 | from .rcnn import * 24 | from .yolo import * 25 | from . import _rcnn 26 | from . import _yolo 27 | from . import _vision 28 | -------------------------------------------------------------------------------- /python/tvm/relay/op/vision/_make.py: -------------------------------------------------------------------------------- 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 | """Constructor APIs""" 18 | from ...._ffi.function import _init_api 19 | 20 | _init_api("relay.op.vision._make", __name__) 21 | -------------------------------------------------------------------------------- /python/tvm/relay/qnn/__init__.py: -------------------------------------------------------------------------------- 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 | # pylint: disable=wildcard-import 18 | """QNN dialect operators and IR passes.""" 19 | from __future__ import absolute_import as _abs 20 | from . import op 21 | from . import transform 22 | -------------------------------------------------------------------------------- /python/tvm/relay/qnn/op/__init__.py: -------------------------------------------------------------------------------- 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 | # pylint: disable=wildcard-import 18 | """QNN dialect related operators.""" 19 | from __future__ import absolute_import as _abs 20 | from .qnn import * 21 | from .op import register_qnn_legalize 22 | -------------------------------------------------------------------------------- /python/tvm/relay/qnn/op/_make.py: -------------------------------------------------------------------------------- 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 | """Constructor APIs""" 18 | from ...._ffi.function import _init_api 19 | 20 | _init_api("relay.qnn.op._make", __name__) 21 | -------------------------------------------------------------------------------- /python/tvm/relay/quantize/__init__.py: -------------------------------------------------------------------------------- 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 | #pylint: disable=wildcard-import, redefined-builtin 18 | """Automatic quantization utilities.""" 19 | from __future__ import absolute_import as _abs 20 | 21 | from .quantize import * 22 | from ._partition import register_partition_function 23 | from ._annotate import register_annotate_function 24 | from .kl_divergence import kl_divergence_scale 25 | -------------------------------------------------------------------------------- /python/tvm/relay/quantize/_quantize.py: -------------------------------------------------------------------------------- 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 | #pylint: disable=unused-argument 18 | """Internal module for quantization.""" 19 | from __future__ import absolute_import 20 | from tvm._ffi.function import _init_api 21 | 22 | _init_api("relay._quantize", __name__) 23 | -------------------------------------------------------------------------------- /python/tvm/relay/std/prelude.rly: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | v0.0.4 20 | 21 | def @id[a](%x: a) -> a { 22 | %x 23 | } 24 | 25 | def @compose[a, b, c](%f: fn(b) -> c, %g: fn(a) -> b) { 26 | fn (%x: a) -> c { 27 | %f(%g(%x)) 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /python/tvm/relay/vision.py: -------------------------------------------------------------------------------- 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 | # pylint: disable=wildcard-import, unused-import, unused-wildcard-import 18 | """Vision network related operators.""" 19 | # Re-export in a specific file name so that autodoc can pick it up 20 | from .op.vision import * 21 | -------------------------------------------------------------------------------- /rust/.gitignore: -------------------------------------------------------------------------------- 1 | target/ 2 | *.rs.bk 3 | Cargo.lock 4 | c_runtime_api.rs 5 | -------------------------------------------------------------------------------- /rust/Cargo.toml: -------------------------------------------------------------------------------- 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 | [workspace] 19 | members = [ 20 | "common", 21 | "macros", 22 | "runtime", 23 | "runtime/tests/test_tvm_basic", 24 | "runtime/tests/test_tvm_dso", 25 | "runtime/tests/test_nnvm", 26 | "frontend", 27 | "frontend/tests/basics", 28 | "frontend/tests/callback", 29 | "frontend/examples/resnet" 30 | ] 31 | -------------------------------------------------------------------------------- /rust/common/Cargo.toml: -------------------------------------------------------------------------------- 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 | [package] 19 | name = "tvm-common" 20 | version = "0.1.0" 21 | authors = ["TVM Contributors"] 22 | license = "Apache-2.0" 23 | edition = "2018" 24 | 25 | [features] 26 | bindings = [] 27 | 28 | [dependencies] 29 | failure = "0.1.5" 30 | ndarray = "0.12.1" 31 | 32 | [build-dependencies] 33 | bindgen = "0.37.4" 34 | -------------------------------------------------------------------------------- /rust/frontend/.gitignore: -------------------------------------------------------------------------------- 1 | target 2 | **/*.rs.bk 3 | Cargo.lock 4 | /tests/basics/add_* 5 | /examples/resnet/deploy_* 6 | /examples/resnet/*.png 7 | /examples/resnet/synset.* 8 | -------------------------------------------------------------------------------- /rust/frontend/.travis.yml: -------------------------------------------------------------------------------- 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 | language: rust 19 | rust: 20 | - nightly 21 | matrix: 22 | fast_finish: true 23 | -------------------------------------------------------------------------------- /rust/frontend/examples/resnet/Cargo.toml: -------------------------------------------------------------------------------- 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 | [package] 19 | name = "resnet" 20 | version = "0.0.0" 21 | authors = ["TVM Contributors"] 22 | license = "Apache-2.0" 23 | build = "build.rs" 24 | 25 | [dependencies] 26 | ndarray = "0.12.1" 27 | tvm-frontend = { path = "../../" } 28 | image = "0.20.1" 29 | csv = "1" 30 | -------------------------------------------------------------------------------- /rust/frontend/tests/basics/.gitignore: -------------------------------------------------------------------------------- 1 | /target 2 | **/*.rs.bk 3 | Cargo.lock 4 | *.o 5 | *.so 6 | *.ptx 7 | *.json 8 | -------------------------------------------------------------------------------- /rust/frontend/tests/basics/Cargo.toml: -------------------------------------------------------------------------------- 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 | [package] 19 | name = "basics" 20 | version = "0.0.0" 21 | authors = ["TVM Contributors"] 22 | license = "Apache-2.0" 23 | build = "build.rs" 24 | 25 | [dependencies] 26 | ndarray = "0.12.1" 27 | tvm-frontend = { path = "../../" } 28 | 29 | [features] 30 | default = ["cpu"] 31 | cpu = [] 32 | gpu = [] 33 | -------------------------------------------------------------------------------- /rust/frontend/tests/callback/Cargo.toml: -------------------------------------------------------------------------------- 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 | [package] 19 | name = "callback" 20 | version = "0.0.0" 21 | authors = ["TVM Contributors"] 22 | 23 | [dependencies] 24 | ndarray = "0.12.1" 25 | tvm-frontend = { path = "../../" } 26 | -------------------------------------------------------------------------------- /rust/runtime/.travis.yml: -------------------------------------------------------------------------------- 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 | language: rust 19 | rust: 20 | - nightly 21 | matrix: 22 | fast_finish: true 23 | -------------------------------------------------------------------------------- /rust/runtime/tests/.gitignore: -------------------------------------------------------------------------------- 1 | *.json 2 | *.params 3 | *.o 4 | -------------------------------------------------------------------------------- /rust/runtime/tests/test_nnvm/Cargo.toml: -------------------------------------------------------------------------------- 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 | [package] 19 | name = "test-nnvm" 20 | version = "0.0.0" 21 | license = "Apache-2.0" 22 | authors = ["TVM Contributors"] 23 | 24 | [dependencies] 25 | ndarray="0.12.1" 26 | serde = "1.0.59" 27 | serde_json = "1.0.17" 28 | tvm-runtime = { path = "../../" } 29 | 30 | [build-dependencies] 31 | ar = "0.6.0" 32 | -------------------------------------------------------------------------------- /rust/runtime/tests/test_tvm_basic/Cargo.toml: -------------------------------------------------------------------------------- 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 | [package] 19 | name = "test-tvm-basic" 20 | version = "0.0.0" 21 | license = "Apache-2.0" 22 | authors = ["TVM Contributors"] 23 | 24 | [dependencies] 25 | ndarray="0.12.1" 26 | tvm-runtime = { path = "../../" } 27 | 28 | [build-dependencies] 29 | ar = "0.6.0" 30 | -------------------------------------------------------------------------------- /rust/runtime/tests/test_tvm_dso/Cargo.toml: -------------------------------------------------------------------------------- 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 | [package] 19 | name = "test-tvm-dso" 20 | version = "0.0.0" 21 | license = "Apache-2.0" 22 | authors = ["TVM Contributors"] 23 | 24 | [dependencies] 25 | ndarray="0.12" 26 | tvm-runtime = { path = "../../" } 27 | -------------------------------------------------------------------------------- /src/codegen/opt/README: -------------------------------------------------------------------------------- 1 | This folder contains optional builds for codegen depending on compilation options. 2 | -------------------------------------------------------------------------------- /tests/cpp/.gitignore: -------------------------------------------------------------------------------- 1 | unittest 2 | *.d 3 | *_test 4 | -------------------------------------------------------------------------------- /tests/lint/rat-excludes: -------------------------------------------------------------------------------- 1 | # subdirectories 2 | 3rdparty 3 | .github 4 | jvm 5 | tutorials 6 | 7 | # Binary or data files 8 | .*\.css 9 | .*\.ipynb 10 | .*\.html 11 | .*\.pyc 12 | .*\.so 13 | .*\.json 14 | .*\.txt 15 | .*\.svg 16 | .*\.lst 17 | .*\.xcodeproj 18 | .*\.lproj 19 | .*\.plist 20 | .*\.lds 21 | .*\.in 22 | .*\.diff 23 | .*\.edl 24 | .*\.md5 25 | .*\.csv 26 | .*\.mk 27 | .*\.log 28 | .*\.interp 29 | .*\.tokens 30 | 31 | # Generated modules 32 | .*\.egg-info 33 | .*gen_modules 34 | .*doxygen 35 | core.cpp 36 | build 37 | _static 38 | _build 39 | .*~ 40 | \#..*\# 41 | \.#.* 42 | 43 | # Relay parser 44 | RelayLexer.py 45 | RelayParser.py 46 | RelayVisitor.py 47 | 48 | # Specific files 49 | package-list 50 | MANIFEST 51 | .gitignore 52 | .gitattributes 53 | .gitmodules 54 | .clang-format 55 | .bash_history 56 | rat-excludes 57 | __init__.py 58 | pylintrc 59 | config.cmake 60 | Cargo.lock 61 | -------------------------------------------------------------------------------- /tests/python/frontend/caffe2/model_zoo/__init__.py: -------------------------------------------------------------------------------- 1 | """Store for caffe2 examples and common models.""" 2 | from __future__ import absolute_import as _abs 3 | import os 4 | import sys 5 | import importlib 6 | from . import squeezenet 7 | from caffe2.python.models.download import ModelDownloader 8 | 9 | models = [ 10 | 'squeezenet', 11 | 'resnet50', 12 | 'vgg19', 13 | ] 14 | 15 | mf = ModelDownloader() 16 | 17 | class Model: 18 | def __init__(self, model_name): 19 | self.init_net, self.predict_net, self.value_info = mf.get_c2_model(model_name) 20 | 21 | for model in models: 22 | try: 23 | locals()['c2_' + model] = importlib.import_module('caffe2.python.models.' + model) 24 | except ImportError: 25 | locals()['c2_' + model] = Model(model) 26 | 27 | # squeezenet 28 | def relay_squeezenet(): 29 | return squeezenet.get_workload() 30 | -------------------------------------------------------------------------------- /tests/python/frontend/coreml/model_zoo/__init__.py: -------------------------------------------------------------------------------- 1 | import os 2 | from PIL import Image 3 | import numpy as np 4 | from tvm.contrib.download import download_testdata 5 | 6 | def get_mobilenet(): 7 | url = 'https://docs-assets.developer.apple.com/coreml/models/MobileNet.mlmodel' 8 | dst = 'mobilenet.mlmodel' 9 | real_dst = download_testdata(url, dst, module='coreml') 10 | return os.path.abspath(real_dst) 11 | 12 | def get_resnet50(): 13 | url = 'https://docs-assets.developer.apple.com/coreml/models/Resnet50.mlmodel' 14 | dst = 'resnet50.mlmodel' 15 | real_dst = download_testdata(url, dst, module='coreml') 16 | return os.path.abspath(real_dst) 17 | 18 | def get_cat_image(): 19 | url = 'https://gist.githubusercontent.com/zhreshold/bcda4716699ac97ea44f791c24310193/raw/fa7ef0e9c9a5daea686d6473a62aacd1a5885849/cat.png' 20 | dst = 'cat.png' 21 | real_dst = download_testdata(url, dst, module='data') 22 | img = Image.open(real_dst).resize((224, 224)) 23 | # CoreML's standard model image format is BGR 24 | img_bgr = np.array(img)[:, :, ::-1] 25 | img = np.transpose(img_bgr, (2, 0, 1))[np.newaxis, :] 26 | return np.asarray(img) -------------------------------------------------------------------------------- /tests/scripts/packages.mk: -------------------------------------------------------------------------------- 1 | # rules for gtest 2 | .PHONY: iverilog 3 | 4 | iverilog: | ${CACHE_PREFIX}/bin/vvp 5 | 6 | ${CACHE_PREFIX}/bin/vvp: 7 | rm -rf verilog-10.1.tar.gz verilog-10.1 8 | wget ftp://icarus.com/pub/eda/verilog/v10/verilog-10.1.tar.gz 9 | tar xf verilog-10.1.tar.gz 10 | cd verilog-10.1;./configure --prefix=${CACHE_PREFIX}; make install 11 | -------------------------------------------------------------------------------- /tests/scripts/task_build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Licensed to the Apache Software Foundation (ASF) under one 3 | # or more contributor license agreements. See the NOTICE file 4 | # distributed with this work for additional information 5 | # regarding copyright ownership. The ASF licenses this file 6 | # to you under the Apache License, Version 2.0 (the 7 | # "License"); you may not use this file except in compliance 8 | # with the License. You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, 13 | # software distributed under the License is distributed on an 14 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | # KIND, either express or implied. See the License for the 16 | # specific language governing permissions and limitations 17 | # under the License. 18 | cd $1 && cmake .. && make $2 && cd .. 19 | -------------------------------------------------------------------------------- /tests/scripts/task_clean.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Licensed to the Apache Software Foundation (ASF) under one 3 | # or more contributor license agreements. See the NOTICE file 4 | # distributed with this work for additional information 5 | # regarding copyright ownership. The ASF licenses this file 6 | # to you under the Apache License, Version 2.0 (the 7 | # "License"); you may not use this file except in compliance 8 | # with the License. You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, 13 | # software distributed under the License is distributed on an 14 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | # KIND, either express or implied. See the License for the 16 | # specific language governing permissions and limitations 17 | # under the License. 18 | echo "Cleanup data..." 19 | cd $1 && rm -rf Cmake* && cd .. 20 | -------------------------------------------------------------------------------- /tests/scripts/task_cpp_unittest.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Licensed to the Apache Software Foundation (ASF) under one 3 | # or more contributor license agreements. See the NOTICE file 4 | # distributed with this work for additional information 5 | # regarding copyright ownership. The ASF licenses this file 6 | # to you under the Apache License, Version 2.0 (the 7 | # "License"); you may not use this file except in compliance 8 | # with the License. You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, 13 | # software distributed under the License is distributed on an 14 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | # KIND, either express or implied. See the License for the 16 | # specific language governing permissions and limitations 17 | # under the License. 18 | 19 | set -e 20 | set -u 21 | 22 | export LD_LIBRARY_PATH="lib:${LD_LIBRARY_PATH:-}" 23 | 24 | make cpptest -j8 25 | for test in build/*_test; do 26 | ./$test 27 | done 28 | -------------------------------------------------------------------------------- /tests/scripts/task_golang.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Licensed to the Apache Software Foundation (ASF) under one 3 | # or more contributor license agreements. See the NOTICE file 4 | # distributed with this work for additional information 5 | # regarding copyright ownership. The ASF licenses this file 6 | # to you under the Apache License, Version 2.0 (the 7 | # "License"); you may not use this file except in compliance 8 | # with the License. You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, 13 | # software distributed under the License is distributed on an 14 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | # KIND, either express or implied. See the License for the 16 | # specific language governing permissions and limitations 17 | # under the License. 18 | 19 | set -e 20 | set -u 21 | 22 | export LD_LIBRARY_PATH="lib:${LD_LIBRARY_PATH:-}" 23 | 24 | tvm_root="$(git rev-parse --show-toplevel)" 25 | export PYTHONPATH="$tvm_root/python":"$tvm_root/nnvm/python":"$tvm_root/topi/python" 26 | 27 | # Golang tests 28 | make -C golang tests 29 | -------------------------------------------------------------------------------- /tests/scripts/task_python_unittest.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Licensed to the Apache Software Foundation (ASF) under one 3 | # or more contributor license agreements. See the NOTICE file 4 | # distributed with this work for additional information 5 | # regarding copyright ownership. The ASF licenses this file 6 | # to you under the Apache License, Version 2.0 (the 7 | # "License"); you may not use this file except in compliance 8 | # with the License. You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, 13 | # software distributed under the License is distributed on an 14 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | # KIND, either express or implied. See the License for the 16 | # specific language governing permissions and limitations 17 | # under the License. 18 | 19 | set -e 20 | set -u 21 | 22 | export PYTHONPATH=python:topi/python 23 | 24 | rm -rf python/tvm/*.pyc python/tvm/*/*.pyc python/tvm/*/*/*.pyc 25 | 26 | TVM_FFI=ctypes python3 -m pytest -v tests/python/unittest 27 | make cython3 28 | TVM_FFI=cython python3 -m pytest -v tests/python/unittest 29 | -------------------------------------------------------------------------------- /tests/scripts/task_verilog_test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Licensed to the Apache Software Foundation (ASF) under one 3 | # or more contributor license agreements. See the NOTICE file 4 | # distributed with this work for additional information 5 | # regarding copyright ownership. The ASF licenses this file 6 | # to you under the Apache License, Version 2.0 (the 7 | # "License"); you may not use this file except in compliance 8 | # with the License. You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, 13 | # software distributed under the License is distributed on an 14 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | # KIND, either express or implied. See the License for the 16 | # specific language governing permissions and limitations 17 | # under the License. 18 | 19 | set -e 20 | set -u 21 | 22 | export PYTHONPATH=python 23 | make verilog 24 | python3 -m pytest -v tests/verilog/unittest 25 | python3 -m pytest -v tests/verilog/integration 26 | -------------------------------------------------------------------------------- /tests/scripts/task_web_build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Licensed to the Apache Software Foundation (ASF) under one 3 | # or more contributor license agreements. See the NOTICE file 4 | # distributed with this work for additional information 5 | # regarding copyright ownership. The ASF licenses this file 6 | # to you under the Apache License, Version 2.0 (the 7 | # "License"); you may not use this file except in compliance 8 | # with the License. You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, 13 | # software distributed under the License is distributed on an 14 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | # KIND, either express or implied. See the License for the 16 | # specific language governing permissions and limitations 17 | # under the License. 18 | cp /emsdk-portable/.emscripten ~/.emscripten 19 | source /emsdk-portable/emsdk_env.sh 20 | make -j4 21 | -------------------------------------------------------------------------------- /tests/travis/travis_after_failure.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Licensed to the Apache Software Foundation (ASF) under one 3 | # or more contributor license agreements. See the NOTICE file 4 | # distributed with this work for additional information 5 | # regarding copyright ownership. The ASF licenses this file 6 | # to you under the Apache License, Version 2.0 (the 7 | # "License"); you may not use this file except in compliance 8 | # with the License. You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, 13 | # software distributed under the License is distributed on an 14 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | # KIND, either express or implied. See the License for the 16 | # specific language governing permissions and limitations 17 | # under the License. 18 | -------------------------------------------------------------------------------- /topi/python/topi/arm_cpu/__init__.py: -------------------------------------------------------------------------------- 1 | """Schedule for ARM CPU""" 2 | 3 | from . import conv2d 4 | from . import depthwise_conv2d 5 | from . import conv2d_transpose 6 | from . import bitserial_conv2d 7 | from . import bitserial_dense 8 | from . import injective 9 | -------------------------------------------------------------------------------- /topi/python/topi/cuda/__init__.py: -------------------------------------------------------------------------------- 1 | # pylint: disable=redefined-builtin, wildcard-import 2 | """CUDA specific declaration and schedules.""" 3 | from __future__ import absolute_import as _abs 4 | 5 | from . import conv2d, depthwise_conv2d, conv2d_transpose_nchw, deformable_conv2d, \ 6 | group_conv2d_nchw, dense 7 | from .conv2d_hwcn import schedule_conv2d_hwcn 8 | from .depthwise_conv2d import schedule_depthwise_conv2d_backward_input_nhwc 9 | from .depthwise_conv2d import schedule_depthwise_conv2d_backward_weight_nhwc 10 | from .group_conv2d_nchw import schedule_conv2d_nchw_cuda 11 | from .reduction import schedule_reduce 12 | from .softmax import schedule_softmax 13 | from .injective import schedule_injective, schedule_elemwise, schedule_broadcast 14 | from .dense import schedule_dense 15 | from .pooling import schedule_pool, schedule_adaptive_pool 16 | from .extern import schedule_extern 17 | from .nn import schedule_lrn, schedule_l2_normalize 18 | from .batch_matmul import schedule_batch_matmul 19 | from .vision import * 20 | from . import ssd 21 | from .ssd import * 22 | from .nms import * 23 | from .rcnn import * 24 | from .sort import * 25 | -------------------------------------------------------------------------------- /topi/python/topi/cuda/rcnn/__init__.py: -------------------------------------------------------------------------------- 1 | # pylint: disable=wildcard-import 2 | """Faster R-CNN and Mask R-CNN operators""" 3 | from .proposal import * 4 | -------------------------------------------------------------------------------- /topi/python/topi/cuda/ssd/__init__.py: -------------------------------------------------------------------------------- 1 | # pylint: disable=wildcard-import 2 | """VISION network operators""" 3 | from __future__ import absolute_import as _abs 4 | 5 | from .multibox import * 6 | -------------------------------------------------------------------------------- /topi/python/topi/generic/__init__.py: -------------------------------------------------------------------------------- 1 | # pylint: disable=wildcard-import 2 | """Generic declaration and schedules. 3 | 4 | This is a recommended way of using TOPI API. 5 | To use the generic schedule function, user must set 6 | the current target scope using with block. See also :any:`tvm.target` 7 | 8 | Example 9 | ------- 10 | .. code-block:: python 11 | 12 | # create schedule that dispatches to topi.cuda.schedule_injective 13 | with tvm.target.create("cuda"): 14 | s = tvm.generic.schedule_injective(outs) 15 | """ 16 | from __future__ import absolute_import as _abs 17 | 18 | from .nn import * 19 | from .injective import * 20 | from .extern import * 21 | from .vision import * 22 | from .sort import * 23 | -------------------------------------------------------------------------------- /topi/python/topi/hls/__init__.py: -------------------------------------------------------------------------------- 1 | # pylint: disable=redefined-builtin, wildcard-import 2 | """HLS specific declaration and schedules.""" 3 | from __future__ import absolute_import as _abs 4 | 5 | from .injective import schedule_injective, schedule_elemwise, schedule_broadcast 6 | from .nn import * 7 | -------------------------------------------------------------------------------- /topi/python/topi/image/__init__.py: -------------------------------------------------------------------------------- 1 | # pylint: disable=wildcard-import 2 | """IMAGE network operators""" 3 | from __future__ import absolute_import as _abs 4 | 5 | from .resize import * 6 | -------------------------------------------------------------------------------- /topi/python/topi/intel_graphics/__init__.py: -------------------------------------------------------------------------------- 1 | # pylint: disable=redefined-builtin, wildcard-import 2 | """Intel Gen9 GPU specific declaration and schedules.""" 3 | from __future__ import absolute_import as _abs 4 | 5 | from .conv2d import * 6 | -------------------------------------------------------------------------------- /topi/python/topi/mali/__init__.py: -------------------------------------------------------------------------------- 1 | # pylint: disable=redefined-builtin, wildcard-import 2 | """ARM Mali GPU specific declaration and schedules.""" 3 | from __future__ import absolute_import as _abs 4 | 5 | from .conv2d import * 6 | from .depthwise_conv2d import * 7 | from .dense import * 8 | -------------------------------------------------------------------------------- /topi/python/topi/nn/__init__.py: -------------------------------------------------------------------------------- 1 | # pylint: disable=wildcard-import 2 | """Neural network operators""" 3 | from __future__ import absolute_import as _abs 4 | 5 | from .conv2d import * 6 | from .deformable_conv2d import * 7 | from .depthwise_conv2d import * 8 | from .elemwise import * 9 | from .dilate import * 10 | from .flatten import * 11 | from .dense import * 12 | from .mapping import * 13 | from .pooling import * 14 | from .softmax import * 15 | from .conv2d_transpose import * 16 | from .bnn import * 17 | from .upsampling import * 18 | from .local_response_norm import * 19 | from .bitserial_conv2d import * 20 | from .bitserial_dense import * 21 | from .l2_normalize import * 22 | from .batch_matmul import * 23 | from .sparse import * 24 | from .pad import * 25 | -------------------------------------------------------------------------------- /topi/python/topi/opengl/__init__.py: -------------------------------------------------------------------------------- 1 | # pylint: disable=redefined-builtin, wildcard-import 2 | """CUDA specific declaration and schedules.""" 3 | from __future__ import absolute_import as _abs 4 | 5 | from .conv2d_nchw import schedule_conv2d_nchw 6 | from .injective import schedule_injective, schedule_elemwise, schedule_broadcast 7 | from .softmax import schedule_softmax 8 | from .dense import schedule_dense 9 | from .pooling import schedule_pool, schedule_adaptive_pool 10 | -------------------------------------------------------------------------------- /topi/python/topi/rocm/__init__.py: -------------------------------------------------------------------------------- 1 | # pylint: disable=redefined-builtin, wildcard-import 2 | """rocm specific declaration and schedules.""" 3 | from __future__ import absolute_import as _abs 4 | 5 | from .conv2d import * 6 | from .dense import * 7 | from .nn import * 8 | -------------------------------------------------------------------------------- /topi/python/topi/sparse/__init__.py: -------------------------------------------------------------------------------- 1 | # pylint: disable=wildcard-import 2 | """Sparse operators""" 3 | from __future__ import absolute_import as _abs 4 | 5 | from .csrmv import csrmv 6 | from .csrmm import csrmm 7 | from .dense import dense 8 | -------------------------------------------------------------------------------- /topi/python/topi/vision/__init__.py: -------------------------------------------------------------------------------- 1 | # pylint: disable=wildcard-import 2 | """VISION network operators""" 3 | from __future__ import absolute_import as _abs 4 | 5 | from . import ssd 6 | from .reorg import * 7 | from .nms import * 8 | from .rcnn import * 9 | -------------------------------------------------------------------------------- /topi/python/topi/vision/rcnn/__init__.py: -------------------------------------------------------------------------------- 1 | # pylint: disable=wildcard-import 2 | """Faster R-CNN and Mask R-CNN operators""" 3 | from .roi_align import * 4 | from .roi_pool import * 5 | from .proposal import * 6 | -------------------------------------------------------------------------------- /topi/python/topi/vision/ssd/__init__.py: -------------------------------------------------------------------------------- 1 | # pylint: disable=wildcard-import 2 | """VISION network operators""" 3 | from __future__ import absolute_import as _abs 4 | 5 | from .multibox import * 6 | -------------------------------------------------------------------------------- /topi/python/topi/x86/__init__.py: -------------------------------------------------------------------------------- 1 | # pylint: disable=redefined-builtin, wildcard-import 2 | """x86 specific declaration and schedules.""" 3 | from __future__ import absolute_import as _abs 4 | 5 | from .conv2d import schedule_conv2d, schedule_conv2d_nhwc 6 | from .binarize_pack import schedule_binarize_pack 7 | from .binary_dense import schedule_binary_dense 8 | from .nn import * 9 | from .injective import * 10 | from .pooling import schedule_pool, schedule_adaptive_pool 11 | from .bitserial_conv2d import schedule_bitserial_conv2d 12 | from .bitserial_dense import schedule_bitserial_dense 13 | from .depthwise_conv2d import schedule_depthwise_conv2d_NCHWc 14 | from .dense import _schedule_dense, _schedule_dense_pack, _schedule_dense_nopack 15 | from .batch_matmul import schedule_batch_matmul 16 | from .roi_align import roi_align_nchw 17 | from .conv2d_transpose import schedule_conv2d_transpose 18 | from .sparse import * 19 | -------------------------------------------------------------------------------- /tutorials/README.txt: -------------------------------------------------------------------------------- 1 | Tutorials 2 | ========= 3 | This page contains the tutorials about TVM. 4 | -------------------------------------------------------------------------------- /tutorials/autotvm/README.txt: -------------------------------------------------------------------------------- 1 | Auto tuning 2 | ------------- 3 | 4 | -------------------------------------------------------------------------------- /tutorials/dev/README.txt: -------------------------------------------------------------------------------- 1 | Developer Tutorials 2 | ------------------- 3 | 4 | -------------------------------------------------------------------------------- /tutorials/frontend/README.txt: -------------------------------------------------------------------------------- 1 | .. _tutorial-frontend: 2 | 3 | Compile Deep Learning Models 4 | ---------------------------- 5 | -------------------------------------------------------------------------------- /tutorials/language/README.txt: -------------------------------------------------------------------------------- 1 | Tensor Expression and Schedules 2 | ------------------------------- 3 | -------------------------------------------------------------------------------- /tutorials/optimize/README.txt: -------------------------------------------------------------------------------- 1 | Optimize Tensor Operators 2 | ------------------------- 3 | -------------------------------------------------------------------------------- /tutorials/topi/README.txt: -------------------------------------------------------------------------------- 1 | TOPI: TVM Operator Inventory 2 | ---------------------------- 3 | -------------------------------------------------------------------------------- /vta/apps/tsim_example/hardware/chisel/.scalafmt.conf: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | maxColumn = 100 21 | rewrite.rules = [SortModifiers, SortImports] 22 | -------------------------------------------------------------------------------- /vta/apps/tsim_example/hardware/chisel/project/build.properties: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | sbt.version = 1.1.1 21 | -------------------------------------------------------------------------------- /vta/apps/tsim_example/hardware/chisel/project/plugins.sbt: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | logLevel := Level.Warn 21 | addSbtPlugin("com.geirsson" % "sbt-scalafmt" % "1.5.1") 22 | -------------------------------------------------------------------------------- /vta/apps/tsim_example/python/__init__.py: -------------------------------------------------------------------------------- 1 | from . import tsim 2 | -------------------------------------------------------------------------------- /vta/config/de10nano_sample.json: -------------------------------------------------------------------------------- 1 | { 2 | "TARGET" : "de10nano", 3 | "HW_VER" : "0.0.1", 4 | "LOG_INP_WIDTH" : 3, 5 | "LOG_WGT_WIDTH" : 3, 6 | "LOG_ACC_WIDTH" : 5, 7 | "LOG_BATCH" : 0, 8 | "LOG_BLOCK" : 4, 9 | "LOG_UOP_BUFF_SIZE" : 15, 10 | "LOG_INP_BUFF_SIZE" :15, 11 | "LOG_WGT_BUFF_SIZE" : 18, 12 | "LOG_ACC_BUFF_SIZE" : 17 13 | } 14 | -------------------------------------------------------------------------------- /vta/config/fsim_sample.json: -------------------------------------------------------------------------------- 1 | { 2 | "TARGET" : "sim", 3 | "HW_VER" : "0.0.1", 4 | "LOG_INP_WIDTH" : 3, 5 | "LOG_WGT_WIDTH" : 3, 6 | "LOG_ACC_WIDTH" : 5, 7 | "LOG_BATCH" : 0, 8 | "LOG_BLOCK" : 4, 9 | "LOG_UOP_BUFF_SIZE" : 15, 10 | "LOG_INP_BUFF_SIZE" : 15, 11 | "LOG_WGT_BUFF_SIZE" : 18, 12 | "LOG_ACC_BUFF_SIZE" : 17 13 | } 14 | -------------------------------------------------------------------------------- /vta/config/pynq_sample.json: -------------------------------------------------------------------------------- 1 | { 2 | "TARGET" : "pynq", 3 | "HW_VER" : "0.0.1", 4 | "LOG_INP_WIDTH" : 3, 5 | "LOG_WGT_WIDTH" : 3, 6 | "LOG_ACC_WIDTH" : 5, 7 | "LOG_BATCH" : 0, 8 | "LOG_BLOCK" : 4, 9 | "LOG_UOP_BUFF_SIZE" : 15, 10 | "LOG_INP_BUFF_SIZE" :15, 11 | "LOG_WGT_BUFF_SIZE" : 18, 12 | "LOG_ACC_BUFF_SIZE" : 17 13 | } 14 | -------------------------------------------------------------------------------- /vta/config/tsim_sample.json: -------------------------------------------------------------------------------- 1 | { 2 | "TARGET" : "tsim", 3 | "HW_VER" : "0.0.1", 4 | "LOG_INP_WIDTH" : 3, 5 | "LOG_WGT_WIDTH" : 3, 6 | "LOG_ACC_WIDTH" : 5, 7 | "LOG_BATCH" : 0, 8 | "LOG_BLOCK" : 4, 9 | "LOG_UOP_BUFF_SIZE" : 15, 10 | "LOG_INP_BUFF_SIZE" : 15, 11 | "LOG_WGT_BUFF_SIZE" : 18, 12 | "LOG_ACC_BUFF_SIZE" : 17 13 | } 14 | -------------------------------------------------------------------------------- /vta/config/ultra96_sample.json: -------------------------------------------------------------------------------- 1 | { 2 | "TARGET" : "ultra96", 3 | "HW_VER" : "0.0.1", 4 | "LOG_INP_WIDTH" : 3, 5 | "LOG_WGT_WIDTH" : 3, 6 | "LOG_ACC_WIDTH" : 5, 7 | "LOG_BATCH" : 0, 8 | "LOG_BLOCK" : 4, 9 | "LOG_UOP_BUFF_SIZE" : 15, 10 | "LOG_INP_BUFF_SIZE" :15, 11 | "LOG_WGT_BUFF_SIZE" : 18, 12 | "LOG_ACC_BUFF_SIZE" : 17 13 | } 14 | -------------------------------------------------------------------------------- /vta/config/vta_config.json: -------------------------------------------------------------------------------- 1 | { 2 | "TARGET" : "sim", 3 | "HW_VER" : "0.0.1", 4 | "LOG_INP_WIDTH" : 3, 5 | "LOG_WGT_WIDTH" : 3, 6 | "LOG_ACC_WIDTH" : 5, 7 | "LOG_BATCH" : 0, 8 | "LOG_BLOCK" : 4, 9 | "LOG_UOP_BUFF_SIZE" : 15, 10 | "LOG_INP_BUFF_SIZE" : 15, 11 | "LOG_WGT_BUFF_SIZE" : 18, 12 | "LOG_ACC_BUFF_SIZE" : 17 13 | } 14 | -------------------------------------------------------------------------------- /vta/hardware/chisel/.gitignore: -------------------------------------------------------------------------------- 1 | test_run_dir 2 | -------------------------------------------------------------------------------- /vta/hardware/chisel/.scalafmt.conf: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | maxColumn = 100 21 | rewrite.rules = [SortModifiers, SortImports] 22 | -------------------------------------------------------------------------------- /vta/hardware/chisel/project/build.properties: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | sbt.version = 1.1.1 21 | -------------------------------------------------------------------------------- /vta/hardware/chisel/project/plugins.sbt: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | logLevel := Level.Warn 21 | addSbtPlugin("com.geirsson" % "sbt-scalafmt" % "1.5.1") 22 | -------------------------------------------------------------------------------- /vta/hardware/chisel/src/main/scala/core/package.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | package vta 21 | 22 | /** This trick makes ISAConstants globally available */ 23 | package object core extends vta.core.ISAConstants 24 | -------------------------------------------------------------------------------- /vta/hardware/chisel/src/test/scala/unittest/utils/Helper.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | package unittest.util 21 | 22 | import scala.math.pow 23 | 24 | object helper { 25 | def getMask(bits: Int) : Long = { 26 | if (bits <= 0) throw new IllegalArgumentException ("bits should be greater than 0") 27 | return (pow(2, bits) - 1).toLong 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /vta/hardware/intel/README.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | Complete instructions on how to build custom FPGA hardware designs are available on the [TVM documentation webpage](https://docs.tvm.ai/vta/install.html#vta-fpga-toolchain-installation). 19 | -------------------------------------------------------------------------------- /vta/hardware/xilinx/.gitignore: -------------------------------------------------------------------------------- 1 | build 2 | *.out 3 | *.log 4 | *.sb 5 | -------------------------------------------------------------------------------- /vta/hardware/xilinx/README.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | Complete instructions on how to build custom FPGA hardware designs are available on the [TVM documentation webpage](https://docs.tvm.ai/vta/install.html#vta-fpga-toolchain-installation). -------------------------------------------------------------------------------- /vta/hardware/xilinx/scripts/hsi.tcl: -------------------------------------------------------------------------------- 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 | # Copyright (c) 2018 by Contributors 19 | # file: hsi.tcl 20 | # brief: Driver generation script for ARMv7 driver libraries. 21 | # 22 | 23 | open_hw_design export/vta.hdf 24 | create_sw_design swdesign -proc ps7_cortexa9_0 -os standalone 25 | generate_bsp -dir bsp 26 | 27 | exit 28 | -------------------------------------------------------------------------------- /vta/python/vta/__init__.py: -------------------------------------------------------------------------------- 1 | """VTA Package is a TVM backend extension to support VTA hardwares 2 | 3 | Besides the compiler toolchain. 4 | It also include utility functions to 5 | configure the hardware Environment and access remote through RPC 6 | """ 7 | from __future__ import absolute_import as _abs 8 | 9 | import sys 10 | 11 | from .bitstream import get_bitstream_path, download_bitstream 12 | from .environment import get_env, Environment 13 | from .rpc_client import reconfig_runtime, program_fpga 14 | 15 | __version__ = "0.1.0" 16 | 17 | # do not import nnvm/topi when running vta.exec.rpc_server 18 | # to maintain minimum dependency on the board 19 | if sys.argv[0] not in ("-c", "-m"): 20 | from . import top 21 | from .build_module import build_config, lower, build 22 | from . import graph 23 | -------------------------------------------------------------------------------- /vta/python/vta/exec/__init__.py: -------------------------------------------------------------------------------- 1 | """VTA Command line utils.""" 2 | -------------------------------------------------------------------------------- /vta/python/vta/testing/__init__.py: -------------------------------------------------------------------------------- 1 | """Testing utilities, this namespace is not imported by default.""" 2 | 3 | from . util import run 4 | -------------------------------------------------------------------------------- /vta/python/vta/top/__init__.py: -------------------------------------------------------------------------------- 1 | """TVM TOPI connector, eventually most of these should go to TVM repo""" 2 | 3 | from . import bitpack 4 | from .graphpack import graph_pack 5 | from . import op 6 | from . import vta_conv2d 7 | from . import vta_conv2d_transpose 8 | from . import vta_dense 9 | from . import util 10 | 11 | # NNVM is deprecated for VTA 12 | # from . import nnvm_bitpack 13 | # from .nnvm_graphpack import nnvm_graph_pack 14 | # from . import nnvm_op 15 | -------------------------------------------------------------------------------- /vta/python/vta/top/util.py: -------------------------------------------------------------------------------- 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 | """VTA TOPI Utils.""" 18 | 19 | def is_packed_layout(layout): 20 | """Check if layout is packed layout""" 21 | if layout == "NCHW": 22 | return False 23 | if "n" in layout and "c" in layout: 24 | return True 25 | return False 26 | -------------------------------------------------------------------------------- /vta/tutorials/README.txt: -------------------------------------------------------------------------------- 1 | VTA Tutorials 2 | ============= 3 | This page contains tutorials about VTA and how to use TVM/Relay to target VTA. 4 | -------------------------------------------------------------------------------- /vta/tutorials/autotvm/README.txt: -------------------------------------------------------------------------------- 1 | Auto tuning 2 | ------------- 3 | 4 | -------------------------------------------------------------------------------- /vta/tutorials/frontend/README.txt: -------------------------------------------------------------------------------- 1 | .. _tutorial-frontend: 2 | 3 | Compile Deep Learning Models 4 | ---------------------------- 5 | -------------------------------------------------------------------------------- /vta/tutorials/optimize/README.txt: -------------------------------------------------------------------------------- 1 | Optimize Tensor Operators 2 | ------------------------- 3 | --------------------------------------------------------------------------------