diff --git a/vta/Jenkinsfile b/vta/Jenkinsfile index a1f59206f29c04654f42c5d9e2af7e898cc2beca..775e25fb94a62f9f3693b7280ab4d0c871419d26 100644 --- a/vta/Jenkinsfile +++ b/vta/Jenkinsfile @@ -5,7 +5,7 @@ // nnvm libraries vta_lib = "lib/libvta.so, lib/libvta.so.json" -vta_lib += ", nnvm/tvm/lib/libtvm.so, nnvm/tvm/lib/libtvm_topi.so, nnvm/lib/libnnvm_compiler.so" +vta_lib += ", tvm/build/libtvm.so, tvm/build/libtvm_topi.so, tvm/build/libnnvm_compiler.so" // command to start a docker container diff --git a/vta/Makefile b/vta/Makefile index ead168fafa182deab7cf43ed5c20cb05e0e9e250..c43c49bddaca6b2eb4e47154fabe37483f483047 100644 --- a/vta/Makefile +++ b/vta/Makefile @@ -53,10 +53,10 @@ lib/libvta.so: $(VTA_LIB_OBJ) lint: pylint cpplint cpplint: - python nnvm/dmlc-core/scripts/lint.py vta cpp include src + python3 tvm/dmlc-core/scripts/lint.py vta cpp include src pylint: - pylint python/vta --rcfile=$(ROOTDIR)/tests/lint/pylintrc + python3 -m pylint python/vta --rcfile=$(ROOTDIR)/tests/lint/pylintrc doc: doxygen docs/Doxyfile diff --git a/vta/docs/Makefile b/vta/docs/Makefile index 1e45fb5e3787092527c9a4134e773ee4b7f03298..3a8551525181d4da671dcb6c0d99749d54da7328 100644 --- a/vta/docs/Makefile +++ b/vta/docs/Makefile @@ -3,14 +3,14 @@ # You can set these variables from the command line. SPHINXOPTS = -SPHINXBUILD = sphinx-build +SPHINXBUILD = python3 -m sphinx PAPER = BUILDDIR = _build # User-friendly check for sphinx-build -ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1) -$(error The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don't have Sphinx installed, grab it from http://sphinx-doc.org/) -endif +#ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1) +#$(error The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively# you can add the directory with the executable to your PATH. If you don't have Sphinx installed, grab it from http://sphinx-doc.org/) +#endif # Internal variables. PAPEROPT_a4 = -D latex_paper_size=a4 diff --git a/vta/docs/conf.py b/vta/docs/conf.py index bdc1029223b03b27194e1e674cbb804895f09607..5c4429589129b341a8a2d715bfcd5e941d47e1a0 100644 --- a/vta/docs/conf.py +++ b/vta/docs/conf.py @@ -171,7 +171,7 @@ intersphinx_mapping = { 'numpy': ('http://docs.scipy.org/doc/numpy/', None), 'scipy': ('http://docs.scipy.org/doc/scipy/reference', None), 'matplotlib': ('http://matplotlib.org/', None), - 'tvm': ('http://docs.tvmlang.org/', None), + 'tvm': ('https://docs.tvm.ai/', None), } from sphinx_gallery.sorting import ExplicitOrder @@ -201,7 +201,7 @@ sphinx_gallery_conf = { 'doc_module': ('vta', 'numpy'), 'reference_url': { 'vta': None, - 'tvm': 'http://docs.tvmlang.org', + 'tvm': 'https://docs.tvm.ai', 'matplotlib': 'http://matplotlib.org', 'numpy': 'http://docs.scipy.org/doc/numpy-1.9.1'}, 'examples_dirs': examples_dirs, diff --git a/vta/docs/index.rst b/vta/docs/index.rst index b30eac0840ab08bf9c4191fc739685469254bf6b..5aa1dc72e2d0d3c5413683478ef8b47d788f9ad9 100644 --- a/vta/docs/index.rst +++ b/vta/docs/index.rst @@ -17,4 +17,3 @@ Contents api/python/index dev/index api_links - genindex diff --git a/vta/python/vta/ir_pass.py b/vta/python/vta/ir_pass.py index 07000e2ccf6460e4c4bede41719315a36835cef9..90df67c53278ea6efdf86919e26e89bde5591592 100644 --- a/vta/python/vta/ir_pass.py +++ b/vta/python/vta/ir_pass.py @@ -350,7 +350,7 @@ def inject_dma_intrin(stmt_in): shape = [elem_block] strides = [1] - if (base < ndim + 1 and not util.equal_const_int(buf.strides[ndim - base], elem_block)): + if base < ndim + 1 and not util.equal_const_int(buf.strides[ndim - base], elem_block): shape.append(1) strides.append(elem_block) @@ -628,7 +628,7 @@ def inject_alu_intrin(stmt_in): next_dst = dst_coeff.pop() next_ext = extents.pop() - if (_equal(next_src, vsrc * vext) and _equal(next_dst, vdst * vext)): + if _equal(next_src, vsrc * vext) and _equal(next_dst, vdst * vext): vext = tvm.ir_pass.Simplify(vext * next_ext) else: rev_src_coeff.append(vsrc) diff --git a/vta/python/vta/pkg_config.py b/vta/python/vta/pkg_config.py index f657b2b32fc8e53ba3c72549d69b4db389e9ae1e..3ca5d052277b6fec8ff48f296471914bda657597 100644 --- a/vta/python/vta/pkg_config.py +++ b/vta/python/vta/pkg_config.py @@ -41,9 +41,9 @@ class PkgConfig(object): # include path self.include_path = [ "-I%s/include" % proj_root, - "-I%s/nnvm/tvm/include" % proj_root, - "-I%s/nnvm/tvm/dlpack/include" % proj_root, - "-I%s/nnvm/dmlc-core/include" % proj_root + "-I%s/tvm/include" % proj_root, + "-I%s/tvm/dlpack/include" % proj_root, + "-I%s/tvm/dmlc-core/include" % proj_root ] # List of source files that can be used to build standalone library. self.lib_source = [] diff --git a/vta/src/device_api.cc b/vta/src/device_api.cc index 687ec625a02c75b70a2447ce45fe74c02f383ee6..3f312f94f0dd1ff3e4b31609da713d3729897678 100644 --- a/vta/src/device_api.cc +++ b/vta/src/device_api.cc @@ -8,7 +8,7 @@ #include <dmlc/thread_local.h> #include <vta/runtime.h> -#include "../nnvm/tvm/src/runtime/workspace_pool.h" +#include "../tvm/src/runtime/workspace_pool.h" namespace tvm { @@ -42,6 +42,7 @@ class VTADeviceAPI final : public DeviceAPI { size_t size, TVMContext ctx_from, TVMContext ctx_to, + TVMType type_hint, TVMStreamHandle stream) final { int kind_mask = 0; if (ctx_from.device_type != kDLCPU) { diff --git a/vta/tests/ci_build/Dockerfile.cpu b/vta/tests/ci_build/Dockerfile.cpu index ceb242925476190633df3238526d7d95f26f8f9c..5c7e526f4879c0c4136dbb06a4151ae5dc0eb644 100644 --- a/vta/tests/ci_build/Dockerfile.cpu +++ b/vta/tests/ci_build/Dockerfile.cpu @@ -6,21 +6,31 @@ RUN apt-get update --fix-missing COPY install/ubuntu_install_core.sh /install/ubuntu_install_core.sh RUN bash /install/ubuntu_install_core.sh -COPY install/ubuntu_install_llvm.sh /install/ubuntu_install_llvm.sh -RUN bash /install/ubuntu_install_llvm.sh - COPY install/ubuntu_install_python.sh /install/ubuntu_install_python.sh RUN bash /install/ubuntu_install_python.sh +COPY install/ubuntu_install_iverilog.sh /install/ubuntu_install_iverilog.sh +RUN bash /install/ubuntu_install_iverilog.sh + COPY install/ubuntu_install_python_package.sh /install/ubuntu_install_python_package.sh RUN bash /install/ubuntu_install_python_package.sh +COPY install/ubuntu_install_java.sh /install/ubuntu_install_java.sh +RUN bash /install/ubuntu_install_java.sh + +COPY install/ubuntu_install_llvm.sh /install/ubuntu_install_llvm.sh +RUN bash /install/ubuntu_install_llvm.sh + +COPY install/ubuntu_install_opengl.sh /install/ubuntu_install_opengl.sh +RUN bash /install/ubuntu_install_opengl.sh + + COPY install/ubuntu_install_sphinx.sh /install/ubuntu_install_sphinx.sh RUN bash /install/ubuntu_install_sphinx.sh +# Enable doxygen for c++ doc build +RUN apt-get update && apt-get install -y doxygen graphviz + # Fix recommonmark to latest version RUN git clone https://github.com/rtfd/recommonmark -RUN cd recommonmark; python setup.py install - -# Enable doxygen for c++ doc build -RUN apt-get update && apt-get install -y doxygen graphviz \ No newline at end of file +RUN cd recommonmark; python3 setup.py install diff --git a/vta/tests/ci_build/Dockerfile.lint b/vta/tests/ci_build/Dockerfile.lint index 4ba4ca3be294676d091c7189b26b424adc8e0923..be869d8e9faf8449de91e29f6d163d7de9c47319 100644 --- a/vta/tests/ci_build/Dockerfile.lint +++ b/vta/tests/ci_build/Dockerfile.lint @@ -1,6 +1,8 @@ # For lint test FROM ubuntu:16.04 -RUN apt-get update && apt-get install -y python-pip sudo +RUN apt-get update && apt-get install -y sudo wget +COPY install/ubuntu_install_python.sh /install/ubuntu_install_python.sh +RUN bash /install/ubuntu_install_python.sh RUN apt-get install -y doxygen graphviz -RUN pip install cpplint pylint +RUN pip3 install cpplint pylint diff --git a/vta/tests/ci_build/install/ubuntu_install_iverilog.sh b/vta/tests/ci_build/install/ubuntu_install_iverilog.sh new file mode 100644 index 0000000000000000000000000000000000000000..bf7a0001dc70447129e3587ca415c6e463ad2188 --- /dev/null +++ b/vta/tests/ci_build/install/ubuntu_install_iverilog.sh @@ -0,0 +1,8 @@ +apt-get install -y --no-install-recommends --force-yes make bison flex +wget ftp://icarus.com/pub/eda/verilog/v10/verilog-10.1.tar.gz +tar xf verilog-10.1.tar.gz +cd verilog-10.1 +./configure --prefix=/usr +make install -j8 +cd .. +rm -rf verilog-10.1 verilog-10.1.tar.gz diff --git a/vta/tests/ci_build/install/ubuntu_install_java.sh b/vta/tests/ci_build/install/ubuntu_install_java.sh new file mode 100644 index 0000000000000000000000000000000000000000..ba07b2985efb9352246395c9db71cd53e3e54e4f --- /dev/null +++ b/vta/tests/ci_build/install/ubuntu_install_java.sh @@ -0,0 +1 @@ +apt-get update && apt-get install -y openjdk-8-jdk maven diff --git a/vta/tests/ci_build/install/ubuntu_install_llvm.sh b/vta/tests/ci_build/install/ubuntu_install_llvm.sh index ba0afcd18cc9d6a88749433f2b534feb9411c911..16d0fe150b7ed6b3eb155d02ddc19b796e364a93 100644 --- a/vta/tests/ci_build/install/ubuntu_install_llvm.sh +++ b/vta/tests/ci_build/install/ubuntu_install_llvm.sh @@ -19,4 +19,4 @@ echo deb-src http://apt.llvm.org/xenial/ llvm-toolchain-xenial main\ >> /etc/apt/sources.list.d/llvm.list wget -O - http://apt.llvm.org/llvm-snapshot.gpg.key|sudo apt-key add - -apt-get update && apt-get install -y --force-yes llvm-4.0 llvm-5.0 llvm-6.0 +apt-get update && apt-get install -y --force-yes llvm-4.0 llvm-5.0 llvm-6.0 clang-6.0 diff --git a/vta/tests/ci_build/install/ubuntu_install_opengl.sh b/vta/tests/ci_build/install/ubuntu_install_opengl.sh new file mode 100644 index 0000000000000000000000000000000000000000..f8be6e3515814969478e68df8651d93aa45efe36 --- /dev/null +++ b/vta/tests/ci_build/install/ubuntu_install_opengl.sh @@ -0,0 +1,4 @@ +apt-get update --fix-missing + +apt-get install -y --no-install-recommends --force-yes \ + libgl1-mesa-dev libglfw3-dev \ No newline at end of file diff --git a/vta/tests/ci_build/install/ubuntu_install_python.sh b/vta/tests/ci_build/install/ubuntu_install_python.sh index c6f6f75c564e94cd6d10e382b9c9715e91d655df..a34019e1003e22e44c26a6a0e1553b511c4b15c5 100644 --- a/vta/tests/ci_build/install/ubuntu_install_python.sh +++ b/vta/tests/ci_build/install/ubuntu_install_python.sh @@ -1,5 +1,12 @@ # install python and pip, don't modify this, modify install_python_package.sh -apt-get update && apt-get install -y python-pip python-dev python3-dev +apt-get update && apt-get install -y python-dev -# the version of the pip shipped with ubuntu may be too lower, install a recent version here -cd /tmp && wget https://bootstrap.pypa.io/get-pip.py && python3 get-pip.py && python2 get-pip.py +# python 3.6 +apt-get update && yes | apt-get install software-properties-common +add-apt-repository ppa:jonathonf/python-3.6 &&\ + apt-get update && apt-get install -y python-pip python-dev python3.6 python3.6-dev + +rm -f /usr/bin/python3 && ln -s /usr/bin/python3.6 /usr/bin/python3 + +# Install pip +cd /tmp && wget https://bootstrap.pypa.io/get-pip.py && python2 get-pip.py && python3.6 get-pip.py diff --git a/vta/tests/ci_build/install/ubuntu_install_python_package.sh b/vta/tests/ci_build/install/ubuntu_install_python_package.sh index fbed2e1904cd1c044120b49eb2ed237427f4a22c..4f1518cb1abdbdd76f7aedc73731163bdd9ff634 100644 --- a/vta/tests/ci_build/install/ubuntu_install_python_package.sh +++ b/vta/tests/ci_build/install/ubuntu_install_python_package.sh @@ -1,3 +1,3 @@ # install libraries for python package on ubuntu pip2 install nose pylint numpy nose-timer cython decorator scipy tornado -pip3 install nose pylint numpy nose-timer cython decorator scipy tornado +pip3 install nose pylint numpy nose-timer cython decorator scipy tornado typed_ast diff --git a/vta/tests/ci_build/install/ubuntu_install_sphinx.sh b/vta/tests/ci_build/install/ubuntu_install_sphinx.sh index 30d4596aabf2923490eb222ad6edcbd1991fab28..eabae1aac4fd128245312e5f775c957d243f0c1f 100644 --- a/vta/tests/ci_build/install/ubuntu_install_sphinx.sh +++ b/vta/tests/ci_build/install/ubuntu_install_sphinx.sh @@ -1 +1 @@ -pip install sphinx sphinx-gallery sphinx_rtd_theme matplotlib Image commonmark>=0.7.3 docutils>=0.11 +pip3 install sphinx sphinx-gallery sphinx_rtd_theme matplotlib Image commonmark>=0.7.3 docutils>=0.11 diff --git a/vta/tests/scripts/task_build.sh b/vta/tests/scripts/task_build.sh index 8cf01d46a600aec62aa43018f6cd40a6ed21601e..bffd418fd39315e8dd5e07184aa2545f77620734 100755 --- a/vta/tests/scripts/task_build.sh +++ b/vta/tests/scripts/task_build.sh @@ -1,21 +1,15 @@ #!/bin/bash echo "Build TVM..." -cd nnvm/tvm -cp make/config.mk . -echo USE_CUDA=0 >> config.mk -echo LLVM_CONFIG=llvm-config-4.0 >> config.mk -echo USE_RPC=1 >> config.mk -echo USE_BLAS=openblas >> config.mk -echo USE_GRAPH_RUNTIME=1 >> config.mk +cd tvm +cp cmake/config.cmake . +echo set\(USE_LLVM llvm-config-5.0\) >> config.cmake +echo set\(USE_RPC ON\) >> config.cmake +echo set\(USE_BLAS openblas\) >> config.cmake +echo set\(USE_GRAPH_RUNTIME ON\) >> config.cmake make "$@" make cython make cython3 cd .. -echo "Build NNVM..." -make "$@" - -cd .. - echo "Build VTA..." make "$@" diff --git a/vta/tests/scripts/task_clean.sh b/vta/tests/scripts/task_clean.sh index 60c70fadf459a2f5110cd130f4720486a478dd25..815225341ae148be6665f61a14705d3065c897c7 100755 --- a/vta/tests/scripts/task_clean.sh +++ b/vta/tests/scripts/task_clean.sh @@ -1,10 +1,8 @@ #!/bin/bash echo "Cleanup data..." -cd nnvm -make clean cd tvm make clean -cd ../.. +cd .. make clean diff --git a/vta/tests/scripts/task_python_docs.sh b/vta/tests/scripts/task_python_docs.sh index 7fac9f692c8add4f48864b9c4abada5081cedc2d..fd9d6211b2239455cf114de9e0545733a123788a 100755 --- a/vta/tests/scripts/task_python_docs.sh +++ b/vta/tests/scripts/task_python_docs.sh @@ -1,8 +1,8 @@ #!/bin/bash -cd nnvm/tvm +cd tvm make cython make cython3 -cd ../../ +cd ../ mkdir -p docs/_build/html # C++ doc @@ -11,7 +11,7 @@ make doc rm -rf python/vta/*.pyc python/vta/*/*.pyc cd docs -PYTHONPATH=../python:../nnvm/tvm/python:../nnvm/tvm/topi/python:../nnvm/python make html || exit -1 +PYTHONPATH=../python:../tvm/python:../tvm/topi/python:../tvm/nnvm/python make html || exit -1 cd _build/html tar czf docs.tgz * mv docs.tgz ../../../ diff --git a/vta/tests/scripts/task_python_test.sh b/vta/tests/scripts/task_python_test.sh index d552aae0e87f7a37a0040c41a2db2b8c1016b066..b146d5c9fca947abd04bf5565aba70515fa97f6c 100755 --- a/vta/tests/scripts/task_python_test.sh +++ b/vta/tests/scripts/task_python_test.sh @@ -1,6 +1,6 @@ #!/bin/bash -export PYTHONPATH=python:nnvm/python:nnvm/tvm/python:nnvm/tvm/topi/python +export PYTHONPATH=python:tvm/nnvm/python:tvm/python:tvm/topi/python echo "Running unittest..." python -m nose -v tests/python/unittest || exit -1