diff --git a/Makefile b/Makefile deleted file mode 100644 index d4fa129e5d7c..000000000000 --- a/Makefile +++ /dev/null @@ -1,151 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - - -.PHONY: all \ - runtime cpptest crttest \ - lint pylint cpplint \ - cppdoc docs \ - web webclean \ - clean - -.SECONDEXPANSION: - -# Remember the root directory, to be usable by submake invocation. -ROOTDIR = $(CURDIR) - -# Specify an alternate output directory relative to ROOTDIR. Defaults -# to "build". Can also be a space-separated list of build -# directories, each with a different configuration. -TVM_BUILD_PATH ?= build -TVM_BUILD_PATH := $(abspath $(TVM_BUILD_PATH)) - -# Allow environment variables for 3rd-party libraries, default to -# packaged version. -DLPACK_PATH ?= $(ROOTDIR)/3rdparty/tvm-ffi/3rdparty/dlpack - -all: $(addsuffix /all,$(TVM_BUILD_PATH)) - -runtime: $(addsuffix /runtime,$(TVM_BUILD_PATH)) -cpptest: $(addsuffix /cpptest,$(TVM_BUILD_PATH)) -crttest: $(addsuffix /crttest,$(TVM_BUILD_PATH)) - -# If there is a config.cmake in the tvm directory, preferentially use -# it. Otherwise, copy the default cmake/config.cmake. -ifeq ($(wildcard config.cmake),config.cmake) -%/config.cmake: | config.cmake - @echo "No config.cmake found in $(TVM_BUILD_PATH), using config.cmake in root tvm directory" - @mkdir -p $(@D) -else -# filter-out used to avoid circular dependency -%/config.cmake: | $$(filter-out %/config.cmake,$(ROOTDIR)/cmake/config.cmake) - @echo "No config.cmake found in $(TVM_BUILD_PATH), using default config.cmake" - @mkdir -p $(@D) - @cp $| $@ -endif - - -# Cannot use .PHONY with a pattern rule, using FORCE instead. For -# now, force CMake to be re-run with each compile to mimic previous -# behavior. This may be relaxed in the future with the -# CONFIGURE_DEPENDS option for GLOB (requires cmake >= 3.12). -FORCE: -%/CMakeCache.txt: %/config.cmake FORCE - @cd $(@D) && cmake $(ROOTDIR) - - -# Since the pattern stem is already being used for the directory name, -# cannot also have it refer to the command passed to CMake. -# Therefore, explicitly listing out the delegated. -CMAKE_TARGETS = all runtime cpptest crttest clean - -define GEN_CMAKE_RULE -%/$(CMAKE_TARGET): %/CMakeCache.txt FORCE - @$$(MAKE) -C $$(@D) $(CMAKE_TARGET) -endef -$(foreach CMAKE_TARGET,$(CMAKE_TARGETS),$(eval $(GEN_CMAKE_RULE))) - - - -# Dev tools for formatting, linting, and documenting. NOTE: lint -# scripts that are executed in the CI should be in tests/lint. This -# allows docker/lint.sh to behave similarly to the CI. -format: - pre-commit run ruff-format --all-files - pre-commit run clang-format --all-files - cd rust && which cargo && cargo fmt --all - -lint: - pre-commit run --all-files - -cpplint: - tests/lint/cpplint.sh - -cppdoc: - doxygen docs/Doxyfile - -# EMCC; Web related scripts -web: - $(MAKE) -C $(ROOTDIR)/web - -webclean: - $(MAKE) -C $(ROOTDIR)/web clean - - -# JVM build rules -INCLUDE_FLAGS = -Iinclude -I$(DLPACK_PATH)/include -PKG_CFLAGS = -Wall -O3 $(INCLUDE_FLAGS) -fPIC -PKG_LDFLAGS = - -ifeq ($(OS),Windows_NT) - JVM_PKG_PROFILE := windows - SHARED_LIBRARY_SUFFIX := dll -else - UNAME_S := $(shell uname -s) - ifeq ($(UNAME_S), Darwin) - JVM_PKG_PROFILE := osx-x86_64 - SHARED_LIBRARY_SUFFIX := dylib - else - JVM_PKG_PROFILE := linux-x86_64 - SHARED_LIBRARY_SUFFIX := so - endif -endif - -JVM_TEST_ARGS ?= -DskipTests -Dcheckstyle.skip=true - -# Built java docs are in jvm/core/target/site/apidocs -javadoc: - (cd $(ROOTDIR)/jvm; \ - mvn "javadoc:javadoc" -Dnotimestamp=true) - -jvmpkg: - (cd $(ROOTDIR)/jvm; \ - mvn clean package -P$(JVM_PKG_PROFILE) -Dcxx="$(CXX)" \ - -Dcflags="$(PKG_CFLAGS)" -Dldflags="$(PKG_LDFLAGS)" \ - -Dcurrent_libdir="$(TVM_BUILD_PATH)" $(JVM_TEST_ARGS)) - -jvminstall: - (cd $(ROOTDIR)/jvm; \ - mvn install -P$(JVM_PKG_PROFILE) -Dcxx="$(CXX)" \ - -Dcflags="$(PKG_CFLAGS)" -Dldflags="$(PKG_LDFLAGS)" \ - -Dcurrent_libdir="$(TVM_BUILD_PATH)" $(JVM_TEST_ARGS)) - -# Final cleanup rules, delegate to more specific rules. -clean: $(addsuffix /clean,$(TVM_BUILD_PATH)) cyclean webclean - -docs: - python3 tests/scripts/ci.py docs diff --git a/apps/cpp_rpc/README.md b/apps/cpp_rpc/README.md index 2c6111ac3c92..d8d7eee377b9 100644 --- a/apps/cpp_rpc/README.md +++ b/apps/cpp_rpc/README.md @@ -52,8 +52,7 @@ This folder contains a simple recipe to make RPC server in c++. - From within the configured tvm build directory, compile `tvm_runtime` and the `tvm_rpc` server: ``` - cd $TVM_ROOT/build - make -jN tvm_runtime tvm_rpc + cmake --build $TVM_ROOT/build --target tvm_runtime tvm_rpc -j$(nproc) ``` - Use `./tvm_rpc server` to start the RPC server diff --git a/docker/README.md b/docker/README.md index 7d3fd22dc911..7acab1df6cec 100644 --- a/docker/README.md +++ b/docker/README.md @@ -110,13 +110,13 @@ tasks. - lint the python codes ```bash - ./docker/build.sh ci_lint make pylint + ./docker/build.sh ci_lint pre-commit run --all-files ``` - build codes with CUDA support ```bash - ./docker/build.sh ci_gpu make -j$(nproc) + ./docker/build.sh ci_gpu bash -c "cd build && cmake -GNinja .. && ninja -j$(nproc)" ``` - do the python unittest @@ -128,5 +128,5 @@ tasks. - build the documents. The results will be available at `docs/_build/html` ```bash - ./docker/ci_build.sh ci_gpu make -C docs html + ./docker/ci_build.sh ci_gpu bash -c "cd docs && make html" ``` diff --git a/jvm/README.md b/jvm/README.md index 355a17a7b266..d28c935ae414 100644 --- a/jvm/README.md +++ b/jvm/README.md @@ -50,7 +50,7 @@ First please refer to [Installation Guide](https://tvm.apache.org/docs/install/) Then you can compile tvm4j by ```bash -make jvmpkg +bash tests/scripts/task_jvm_build.sh ``` (Optional) run unit test by @@ -62,7 +62,7 @@ sh tests/scripts/task_java_unittest.sh After it is compiled and packaged, you can install tvm4j in your local maven repository, ```bash -make jvminstall +bash tests/scripts/task_jvm_build.sh install ``` ## Convert and Register Java Function as TVM Function diff --git a/tests/lint/blocklint.sh b/tests/lint/blocklint.sh deleted file mode 100755 index e59c0056ad21..000000000000 --- a/tests/lint/blocklint.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/usr/bin/env bash -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -# Deprecated: functionality moved to pre-commit hooks. Kept as no-op for backward compatibility. -exit 0 diff --git a/tests/lint/check_asf_header.sh b/tests/lint/check_asf_header.sh deleted file mode 100755 index e59c0056ad21..000000000000 --- a/tests/lint/check_asf_header.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/usr/bin/env bash -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -# Deprecated: functionality moved to pre-commit hooks. Kept as no-op for backward compatibility. -exit 0 diff --git a/tests/lint/cppdocs.sh b/tests/lint/cppdocs.sh index b5067f777950..81b89e7b4f53 100755 --- a/tests/lint/cppdocs.sh +++ b/tests/lint/cppdocs.sh @@ -23,7 +23,7 @@ function cleanup() { } trap cleanup EXIT -make cppdoc 2>/tmp/$$.log.txt +doxygen docs/Doxyfile 2>/tmp/$$.log.txt grep -v -E "ENABLE_PREPROCESSING|unsupported tag|Inheritance graph|use_default_type_traits_v" < /tmp/$$.log.txt > /tmp/$$.logclean.txt || true echo "---------Error Log----------" diff --git a/tests/lint/flake8.sh b/tests/lint/flake8.sh deleted file mode 100755 index e59c0056ad21..000000000000 --- a/tests/lint/flake8.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/usr/bin/env bash -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -# Deprecated: functionality moved to pre-commit hooks. Kept as no-op for backward compatibility. -exit 0 diff --git a/tests/lint/git-black.sh b/tests/lint/git-black.sh deleted file mode 100755 index e59c0056ad21..000000000000 --- a/tests/lint/git-black.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/usr/bin/env bash -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -# Deprecated: functionality moved to pre-commit hooks. Kept as no-op for backward compatibility. -exit 0 diff --git a/tests/lint/git-clang-format.sh b/tests/lint/git-clang-format.sh deleted file mode 100755 index e59c0056ad21..000000000000 --- a/tests/lint/git-clang-format.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/usr/bin/env bash -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -# Deprecated: functionality moved to pre-commit hooks. Kept as no-op for backward compatibility. -exit 0 diff --git a/tests/lint/jnilint.sh b/tests/lint/jnilint.sh deleted file mode 100755 index e59c0056ad21..000000000000 --- a/tests/lint/jnilint.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/usr/bin/env bash -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -# Deprecated: functionality moved to pre-commit hooks. Kept as no-op for backward compatibility. -exit 0 diff --git a/tests/lint/pylint.sh b/tests/lint/pylint.sh deleted file mode 100755 index e59c0056ad21..000000000000 --- a/tests/lint/pylint.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/usr/bin/env bash -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -# Deprecated: functionality moved to pre-commit hooks. Kept as no-op for backward compatibility. -exit 0 diff --git a/tests/lint/whitespace.sh b/tests/lint/whitespace.sh deleted file mode 100755 index e59c0056ad21..000000000000 --- a/tests/lint/whitespace.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/usr/bin/env bash -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -# Deprecated: functionality moved to pre-commit hooks. Kept as no-op for backward compatibility. -exit 0 diff --git a/tests/scripts/task_java_unittest.sh b/tests/scripts/task_java_unittest.sh index f7c9f3c097af..35621a5a130e 100755 --- a/tests/scripts/task_java_unittest.sh +++ b/tests/scripts/task_java_unittest.sh @@ -35,7 +35,7 @@ cleanup() } trap cleanup 0 -make jvmpkg +bash "$(dirname "$0")/task_jvm_build.sh" # Skip the Java Tests for now exit 0 @@ -43,5 +43,5 @@ exit 0 # expose tvm runtime lib to system env export LD_LIBRARY_PATH=$CURR_DIR/../../build/:$LD_LIBRARY_PATH python "$SCRIPT_DIR"/prepare_test_libs.py "$TEMP_DIR" -make jvmpkg JVM_TEST_ARGS="-DskipTests=false\ - -Dtest.tempdir=$TEMP_DIR" +JVM_TEST_ARGS="-DskipTests=false -Dtest.tempdir=$TEMP_DIR" \ + bash "$(dirname "$0")/task_jvm_build.sh" diff --git a/tests/scripts/task_jvm_build.sh b/tests/scripts/task_jvm_build.sh new file mode 100755 index 000000000000..a38ea564bef6 --- /dev/null +++ b/tests/scripts/task_jvm_build.sh @@ -0,0 +1,66 @@ +#!/usr/bin/env bash +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +# Build the TVM JVM package (tvm4j) using Maven with platform detection. +# Usage: task_jvm_build.sh [goal] [mvn-extra-args...] +# +# The first positional argument sets the Maven goal (default: "clean package"). +# Extra arguments after the goal are passed through to mvn, e.g.: +# task_jvm_build.sh install +# task_jvm_build.sh "clean package" -DskipTests=false -Dtest.tempdir=/tmp/foo + +set -euxo pipefail + +GOAL="${1:-clean package}" +if [ "$#" -gt 0 ]; then + shift +fi + +ROOTDIR="$(cd "$(dirname "$0")/../.." && pwd)" +TVM_BUILD_PATH="${TVM_BUILD_PATH:-${ROOTDIR}/build}" +TVM_BUILD_PATH="$(realpath "${TVM_BUILD_PATH}")" + +DLPACK_PATH="${DLPACK_PATH:-${ROOTDIR}/3rdparty/tvm-ffi/3rdparty/dlpack}" + +INCLUDE_FLAGS="-I${ROOTDIR}/include -I${DLPACK_PATH}/include" +PKG_CFLAGS="-Wall -O3 ${INCLUDE_FLAGS} -fPIC" +PKG_LDFLAGS="" + +if [ "$(uname -s)" = "Darwin" ]; then + JVM_PKG_PROFILE="osx-x86_64" + SHARED_LIBRARY_SUFFIX="dylib" +elif [ "${OS:-}" = "Windows_NT" ]; then + JVM_PKG_PROFILE="windows" + SHARED_LIBRARY_SUFFIX="dll" +else + JVM_PKG_PROFILE="linux-x86_64" + SHARED_LIBRARY_SUFFIX="so" +fi + +JVM_TEST_ARGS="${JVM_TEST_ARGS:--DskipTests -Dcheckstyle.skip=true}" + +cd "${ROOTDIR}/jvm" +# shellcheck disable=SC2086 +mvn ${GOAL} \ + "-P${JVM_PKG_PROFILE}" \ + "-Dcxx=${CXX:-g++}" \ + "-Dcflags=${PKG_CFLAGS}" \ + "-Dldflags=${PKG_LDFLAGS}" \ + "-Dcurrent_libdir=${TVM_BUILD_PATH}" \ + ${JVM_TEST_ARGS} \ + "$@" diff --git a/tests/scripts/task_python_docs.sh b/tests/scripts/task_python_docs.sh index bb1fd2d95b8d..3109f76ab202 100755 --- a/tests/scripts/task_python_docs.sh +++ b/tests/scripts/task_python_docs.sh @@ -149,11 +149,11 @@ if [ "$IS_LOCAL" == "1" ] && [ "$PYTHON_DOCS_ONLY" == "1" ]; then fi # C++ doc -make cppdoc +doxygen docs/Doxyfile rm -f docs/doxygen/html/*.map docs/doxygen/html/*.md5 # Java doc -make javadoc +(cd jvm && mvn "javadoc:javadoc" -Dnotimestamp=true) # type doc cd web