diff --git a/.gitattributes b/.gitattributes index 29e2373f30ff..1c7a460675f8 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,2 +1 @@ Jenkinsfile linguist-generated=true - diff --git a/.github/ISSUE_TEMPLATE/documentation.md b/.github/ISSUE_TEMPLATE/documentation.md index d6ae1180ee41..49d0695b8e4d 100644 --- a/.github/ISSUE_TEMPLATE/documentation.md +++ b/.github/ISSUE_TEMPLATE/documentation.md @@ -24,4 +24,3 @@ Otherwise, specify what actions should be taken to provide additional clarity/re Please refer to the list of label tags [here](https://github.com/apache/tvm/wiki/Issue-Triage-Labels) to find the relevant tags and add them below in a bullet format (example below). * needs-triage - diff --git a/.github/actions/setup/action.yml b/.github/actions/setup/action.yml index 9a3917c656ec..b32ff90325d7 100644 --- a/.github/actions/setup/action.yml +++ b/.github/actions/setup/action.yml @@ -33,4 +33,3 @@ runs: run: | conda info conda list - diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 38f8c629c3d5..946ba5338dbc 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -12,4 +12,4 @@ updates: directory: "/" schedule: interval: "monthly" - open-pull-requests-limit: 0 \ No newline at end of file + open-pull-requests-limit: 0 diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 55fe5f1441cb..b03a1795ef9e 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -60,7 +60,7 @@ jobs: -DCMAKE_OSX_DEPLOYMENT_TARGET=14.0 \ -DCMAKE_BUILD_WITH_INSTALL_NAME_DIR=ON \ -DUSE_IOS_RPC=ON" - + mkdir build-ios-simulator cd build-ios-simulator cmake .. ${CMAKE_FLAGS} @@ -164,4 +164,4 @@ jobs: uses: actions/upload-artifact@v2 with: name: android_camera-debug.apk - path: ./apps/android_camera/app/build/outputs/apk/debug/app-debug.apk \ No newline at end of file + path: ./apps/android_camera/app/build/outputs/apk/debug/app-debug.apk diff --git a/3rdparty/libcrc/tab/gentab_ccitt.inc b/3rdparty/libcrc/tab/gentab_ccitt.inc index e3699471421a..8cd92ebc1794 100644 --- a/3rdparty/libcrc/tab/gentab_ccitt.inc +++ b/3rdparty/libcrc/tab/gentab_ccitt.inc @@ -267,4 +267,3 @@ const uint16_t crc_tabccitt[256] = { 0x0ED1u, 0x1EF0u }; - diff --git a/NEWS.md b/NEWS.md index 85dc0fbf363c..2b575f7aa214 100644 --- a/NEWS.md +++ b/NEWS.md @@ -2770,5 +2770,3 @@ We also make major improvements in supporting new backends: ROCm for AMDGPUs and - DLPack integration support - AOT and module system - Basic code structure ready. - - diff --git a/apps/android_camera/app/src/main/jni/Android.mk b/apps/android_camera/app/src/main/jni/Android.mk index 4ff3da8f3327..513666a4ecb4 100644 --- a/apps/android_camera/app/src/main/jni/Android.mk +++ b/apps/android_camera/app/src/main/jni/Android.mk @@ -57,4 +57,4 @@ ifdef ADD_LDLIBS LOCAL_LDLIBS += $(ADD_LDLIBS) endif -include $(BUILD_SHARED_LIBRARY) \ No newline at end of file +include $(BUILD_SHARED_LIBRARY) diff --git a/apps/android_camera/app/src/main/res/layout/activity_main.xml b/apps/android_camera/app/src/main/res/layout/activity_main.xml index 80f9ac6902d6..14dba9cc01b5 100644 --- a/apps/android_camera/app/src/main/res/layout/activity_main.xml +++ b/apps/android_camera/app/src/main/res/layout/activity_main.xml @@ -20,4 +20,4 @@ android:layout_width="match_parent" android:layout_height="match_parent" android:background="#000" - tools:context="org.apache.tvm.android.androidcamerademo.MainActivity" /> \ No newline at end of file + tools:context="org.apache.tvm.android.androidcamerademo.MainActivity" /> diff --git a/apps/android_camera/models/requirements.txt b/apps/android_camera/models/requirements.txt index 1deff2b3548b..a44730c7ec37 100644 --- a/apps/android_camera/models/requirements.txt +++ b/apps/android_camera/models/requirements.txt @@ -1,4 +1,4 @@ keras==2.9 mxnet scipy -tensorflow==2.9.1 \ No newline at end of file +tensorflow==2.9.1 diff --git a/apps/android_deploy/app/build.gradle b/apps/android_deploy/app/build.gradle index 2949775349bb..235bdcff5bfa 100644 --- a/apps/android_deploy/app/build.gradle +++ b/apps/android_deploy/app/build.gradle @@ -20,7 +20,7 @@ project.ext.ASSET_DIR = projectDir.toString() + '/src/main/assets' project.ext.TMP_DIR = project.buildDir.toString() + '/downloads' // Download default models(darknet framework extraction model compiled version); -// if you wish to use your own models then place them in the "assets" directory +// if you wish to use your own models then place them in the "assets" directory // and comment out this line. apply from: "download-models.gradle" @@ -101,4 +101,4 @@ dependencies { implementation 'com.android.support:design:28.0.0' implementation files('../../../jvm/core/target/tvm4j-core-0.0.1-SNAPSHOT.jar') testImplementation 'junit:junit:4.13.2' -} \ No newline at end of file +} diff --git a/apps/android_deploy/app/download-models.gradle b/apps/android_deploy/app/download-models.gradle index 4d1620bfd953..38fd35a78653 100644 --- a/apps/android_deploy/app/download-models.gradle +++ b/apps/android_deploy/app/download-models.gradle @@ -78,4 +78,3 @@ tasks.whenTaskAdded { task -> task.dependsOn 'extractModels' } } - diff --git a/apps/android_deploy/dev_tools/gen_keystore.sh b/apps/android_deploy/dev_tools/gen_keystore.sh index 56bdfd2200ee..31f3d2acf3b9 100644 --- a/apps/android_deploy/dev_tools/gen_keystore.sh +++ b/apps/android_deploy/dev_tools/gen_keystore.sh @@ -6,9 +6,9 @@ # 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 diff --git a/apps/android_deploy/dev_tools/sign_apk.sh b/apps/android_deploy/dev_tools/sign_apk.sh index 2ef58046f4ae..cd28998a7782 100644 --- a/apps/android_deploy/dev_tools/sign_apk.sh +++ b/apps/android_deploy/dev_tools/sign_apk.sh @@ -6,9 +6,9 @@ # 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 diff --git a/apps/android_deploy/gradle.properties b/apps/android_deploy/gradle.properties index 972e391a31ea..a7f4fa066909 100644 --- a/apps/android_deploy/gradle.properties +++ b/apps/android_deploy/gradle.properties @@ -17,4 +17,4 @@ org.gradle.jvmargs=-Xmx4096M android.useAndroidX=true -android.enableJetifier=true \ No newline at end of file +android.enableJetifier=true diff --git a/apps/android_rpc/dev_tools/gen_keystore.sh b/apps/android_rpc/dev_tools/gen_keystore.sh index 6a5d5bb6f6ca..6eeada70dc19 100755 --- a/apps/android_rpc/dev_tools/gen_keystore.sh +++ b/apps/android_rpc/dev_tools/gen_keystore.sh @@ -6,9 +6,9 @@ # 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 diff --git a/apps/android_rpc/dev_tools/sign_apk.sh b/apps/android_rpc/dev_tools/sign_apk.sh index 0541e893961a..e20e7ca6465a 100755 --- a/apps/android_rpc/dev_tools/sign_apk.sh +++ b/apps/android_rpc/dev_tools/sign_apk.sh @@ -6,9 +6,9 @@ # 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 diff --git a/apps/bundle_deploy/README.md b/apps/bundle_deploy/README.md index 619a2d7d05cc..dc7d29619a6e 100644 --- a/apps/bundle_deploy/README.md +++ b/apps/bundle_deploy/README.md @@ -48,13 +48,13 @@ This will: - Compile the model with Relay - Build a `bundle.so` shared object containing the model specification and parameters -- Build a `demo_dynamic` executable that `dlopen`'s `bundle.so` (or `bundle_c.so` in +- Build a `demo_dynamic` executable that `dlopen`'s `bundle.so` (or `bundle_c.so` in terms of the MISRA-C runtime), instantiates the contained graph executor, and invokes the `GraphExecutor::Run` function on a cat image, then prints the output results. Type the following command to run the sample code with static linking. - + ```bash make demo_static ``` @@ -63,5 +63,5 @@ This will: - Download the mobilenet0.25 model from the MXNet Gluon Model Zoo - Compile the model with Relay and outputs `model.o` - Build a `bundle_static.o` object containing the runtime functions -- Build a `demo_static` executable which has static link to `bundle_static.o` and +- Build a `demo_static` executable which has static link to `bundle_static.o` and `model.o`, functions on a cat image, then prints the output results. diff --git a/apps/cpp_rpc/CMakeLists.txt b/apps/cpp_rpc/CMakeLists.txt index fc3aafcc4443..9f1180ee0fd3 100644 --- a/apps/cpp_rpc/CMakeLists.txt +++ b/apps/cpp_rpc/CMakeLists.txt @@ -70,5 +70,5 @@ if(BUILD_STATIC_RUNTIME) else() list(APPEND TVM_RPC_LINKER_LIBS tvm_runtime) endif() - + target_link_libraries(tvm_rpc ${TVM_RPC_LINKER_LIBS}) diff --git a/apps/hexagon_launcher/cmake/hexagon/CMakeLists.txt b/apps/hexagon_launcher/cmake/hexagon/CMakeLists.txt index fa17dcb4778b..5fae6b0a4099 100644 --- a/apps/hexagon_launcher/cmake/hexagon/CMakeLists.txt +++ b/apps/hexagon_launcher/cmake/hexagon/CMakeLists.txt @@ -100,4 +100,3 @@ add_library(h_tvm_runtime STATIC IMPORTED) set_target_properties(h_tvm_runtime PROPERTIES IMPORTED_LOCATION "${BINARY_DIR}/libtvm_runtime.a") target_link_libraries(launcher_rpc_skel -Wl,--whole-archive h_tvm_runtime -Wl,--no-whole-archive) - diff --git a/apps/ios_rpc/.gitignore b/apps/ios_rpc/.gitignore index 829e4e719b69..5ac22469e6ac 100644 --- a/apps/ios_rpc/.gitignore +++ b/apps/ios_rpc/.gitignore @@ -1,2 +1 @@ rpc_config.txt - diff --git a/apps/ios_rpc/README.md b/apps/ios_rpc/README.md index c268d15d0179..2d9cc52dc0ad 100644 --- a/apps/ios_rpc/README.md +++ b/apps/ios_rpc/README.md @@ -79,7 +79,7 @@ You can get value of your `team_id` in the following ways: select target `tvmrpc`. At the bottom of this panel go to `Signing & Capabilities` tab and in the field `Team` select your local developer profile (`Your Name (Personal Team)`). - + On the first run of the application you may see message `Could not launch "tvmrpc"` in the XCode and message `Untrusted Developer` on your device. In this case it will be necessary to check the certificate. Open @@ -210,7 +210,7 @@ model and execute it on the target device. For this purpose we will use ```shell python3 tests/ios_rpc_test.py --host --port 9190 --mode "tracker" ``` -The output will be the same as in section +The output will be the same as in section [Standalone RPC](#standalone-rpc). ## Communication without Wi-Fi and speed up in case of slow Wi-Fi diff --git a/apps/ios_rpc/tvmrpc/Assets.xcassets/AppIcon.appiconset/Contents.json b/apps/ios_rpc/tvmrpc/Assets.xcassets/AppIcon.appiconset/Contents.json index 1d060ed28827..d7070bc5c02a 100644 --- a/apps/ios_rpc/tvmrpc/Assets.xcassets/AppIcon.appiconset/Contents.json +++ b/apps/ios_rpc/tvmrpc/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -90,4 +90,4 @@ "version" : 1, "author" : "xcode" } -} \ No newline at end of file +} diff --git a/apps/microtvm/README.md b/apps/microtvm/README.md index 362bc407238e..1467c237c502 100644 --- a/apps/microtvm/README.md +++ b/apps/microtvm/README.md @@ -27,5 +27,3 @@ dependencies installed for running microTVM. To use it, run: $ poetry lock && poetry install $ poetry shell ``` - - diff --git a/apps/microtvm/cmsisnn/README.md b/apps/microtvm/cmsisnn/README.md index f7c9ddfa74a8..befcda6bb063 100644 --- a/apps/microtvm/cmsisnn/README.md +++ b/apps/microtvm/cmsisnn/README.md @@ -28,7 +28,7 @@ If the demo is run in the ci_cpu Docker container provided with TVM, then the fo software will already be installed. If the demo is not run in the ci_cpu Docker container, then you will need the following: -- Software required to build and run the demo (These can all be installed by running +- Software required to build and run the demo (These can all be installed by running tvm/docker/install/ubuntu_install_ethosu_driver_stack.sh.) - [Fixed Virtual Platform (FVP) based on Arm(R) Corstone(TM)-300 software](https://developer.arm.com/tools-and-software/open-source-software/arm-platforms-software/arm-ecosystem-fvps) - [cmake 3.19.5](https://github.com/Kitware/CMake/releases/) diff --git a/apps/microtvm/cmsisnn/corstone300.ld b/apps/microtvm/cmsisnn/corstone300.ld index e52b23da3360..2c5a0f7ef862 100644 --- a/apps/microtvm/cmsisnn/corstone300.ld +++ b/apps/microtvm/cmsisnn/corstone300.ld @@ -140,7 +140,7 @@ SECTIONS *(.rodata.tvm) . = ALIGN (16); *(.data.tvm); - . = ALIGN(16); + . = ALIGN(16); } > DDR .text : diff --git a/apps/microtvm/reference-vm/README.md b/apps/microtvm/reference-vm/README.md index 3d419cd36463..6fe039a9fda9 100644 --- a/apps/microtvm/reference-vm/README.md +++ b/apps/microtvm/reference-vm/README.md @@ -30,8 +30,8 @@ For more information on how to use them, see the Each RTOS or platform (like Zephyr, Ardunio, etc) that integrates with microTVM can check-in installation scripts in the Reference VM in this directory to help -the community collaborate. You should use the tools provided here to ensure a -uniform release process across all platforms. Typically, releases need to be +the community collaborate. You should use the tools provided here to ensure a +uniform release process across all platforms. Typically, releases need to be created by TVM committers. Generally speaking, it's expected that any integrated platform with a regression diff --git a/apps/microtvm/reference-vm/base-box/base_box_provision.sh b/apps/microtvm/reference-vm/base-box/base_box_provision.sh index d96852b7f57a..d8b987973735 100755 --- a/apps/microtvm/reference-vm/base-box/base_box_provision.sh +++ b/apps/microtvm/reference-vm/base-box/base_box_provision.sh @@ -16,7 +16,7 @@ # specific language governing permissions and limitations # under the License. # -# Using this script we can reuse docker/install scripts to configure the reference +# Using this script we can reuse docker/install scripts to configure the reference # virtual machine similar to CI Cortex-M setup. # @@ -42,7 +42,7 @@ cd ~ sudo apt-get install -y ca-certificates # Install Arduino-CLI (specific version) -# To keep in sync with the version +# To keep in sync with the version # defined in apps/microtvm/arduino/template_project/microtvm_api_server.py ARDUINO_CLI_VERSION="0.21.1" diff --git a/apps/microtvm/zephyr/README.md b/apps/microtvm/zephyr/README.md index 68e9975d4b1c..1003b65f824b 100644 --- a/apps/microtvm/zephyr/README.md +++ b/apps/microtvm/zephyr/README.md @@ -16,4 +16,3 @@ This directory contains code to interface microTVM with the [Zephyr RTOS](https://zephyrproject.org/). - diff --git a/apps/microtvm/zephyr/template_project/src/host_driven/fvp/semihost.c b/apps/microtvm/zephyr/template_project/src/host_driven/fvp/semihost.c index 64a43b02d933..2e03df096307 100644 --- a/apps/microtvm/zephyr/template_project/src/host_driven/fvp/semihost.c +++ b/apps/microtvm/zephyr/template_project/src/host_driven/fvp/semihost.c @@ -84,4 +84,4 @@ ssize_t semihost_write(void* unused_context, const uint8_t* data, size_t size) { write_req.size = size; uint32_t ret_val = semihost_cmd(0x05, &write_req); return size - ret_val; -} \ No newline at end of file +} diff --git a/apps/microtvm/zephyr_cmsisnn/CMakeLists.txt b/apps/microtvm/zephyr_cmsisnn/CMakeLists.txt index dd3582f86f7d..0ca000d48e6a 100644 --- a/apps/microtvm/zephyr_cmsisnn/CMakeLists.txt +++ b/apps/microtvm/zephyr_cmsisnn/CMakeLists.txt @@ -27,7 +27,7 @@ if (NOT DEFINED CMSIS_PATH) endif() set(TVMC_COMMAND python3 -m tvm.driver.tvmc) -set(TVMC_ARGS +set(TVMC_ARGS --target="cmsis-nn -mcpu=cortex-m55, c" # CMSIS-NN and C targets --runtime=crt # C Runtime --executor=aot # Ahead-of-Time Executor @@ -41,14 +41,14 @@ set(TVM_RUNTIME ${CMAKE_CURRENT_BINARY_DIR}/runtime/src/runtime/crt/common/crt_backend_api.c ${CMAKE_CURRENT_BINARY_DIR}/runtime/src/runtime/crt/memory/stack_allocator.c ) -set(CODEGEN_OUTPUT +set(CODEGEN_OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/codegen/host/src/default_lib0.c ${CMAKE_CURRENT_BINARY_DIR}/codegen/host/src/default_lib1.c ${CMAKE_CURRENT_BINARY_DIR}/codegen/host/src/default_lib2.c ) -set(DATA_FILES - ${CMAKE_CURRENT_BINARY_DIR}/inputs.c - ${CMAKE_CURRENT_BINARY_DIR}/outputs.c +set(DATA_FILES + ${CMAKE_CURRENT_BINARY_DIR}/inputs.c + ${CMAKE_CURRENT_BINARY_DIR}/outputs.c ${CMAKE_CURRENT_BINARY_DIR}/labels.c ) set(CMSIS_SOURCES @@ -71,7 +71,7 @@ set(CMSIS_SOURCES add_custom_command( OUTPUT ${TVM_RUNTIME} - OUTPUT ${CODEGEN_OUTPUT} + OUTPUT ${CODEGEN_OUTPUT} COMMAND ${TVMC_COMMAND} compile ${TVMC_ARGS} ${CMAKE_CURRENT_SOURCE_DIR}/model/cnn_s_quantized.tflite COMMAND tar xf ${CMAKE_CURRENT_BINARY_DIR}/module.tar WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} @@ -83,15 +83,15 @@ add_custom_command( WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} ) -target_sources(app PRIVATE +target_sources(app PRIVATE src/main.c ${TVM_RUNTIME} ${CODEGEN_OUTPUT} ${DATA_FILES} ${CMSIS_SOURCES} ) -target_include_directories(app - PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include +target_include_directories(app + PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include PUBLIC ${CMAKE_CURRENT_BINARY_DIR}/runtime/include ${CMAKE_CURRENT_BINARY_DIR}/codegen/host/include PUBLIC ${CMSIS_PATH}/CMSIS/NN/Include/ ${CMSIS_PATH}/CMSIS/DSP/Include ) diff --git a/apps/microtvm/zephyr_cmsisnn/README.md b/apps/microtvm/zephyr_cmsisnn/README.md index e3e8f1c27876..df54acfbc736 100644 --- a/apps/microtvm/zephyr_cmsisnn/README.md +++ b/apps/microtvm/zephyr_cmsisnn/README.md @@ -30,7 +30,7 @@ Download the keyword spotting model to the `model` directory: wget \ https://github.com/ARM-software/ML-zoo/blob/ee35139af86bdace5e502b09fe8b9da9cb1f06bb/models/keyword_spotting/cnn_small/tflite_int8/cnn_s_quantized.tflite \ -O model/cnn_s_quantized.tflite -``` +``` Checkout [CMSIS_5](https://github.com/ARM-software/CMSIS_5.git) (default is `/opt/arm/ethosu/cmsis` to reflect `tlcpack/ci_cortexm`): ``` diff --git a/apps/microtvm/zephyr_cmsisnn/model/labels.txt b/apps/microtvm/zephyr_cmsisnn/model/labels.txt index ba416458b011..f66507b143ec 100644 --- a/apps/microtvm/zephyr_cmsisnn/model/labels.txt +++ b/apps/microtvm/zephyr_cmsisnn/model/labels.txt @@ -9,4 +9,4 @@ right on off stop -go \ No newline at end of file +go diff --git a/apps/microtvm/zephyr_cmsisnn/run_demo.sh b/apps/microtvm/zephyr_cmsisnn/run_demo.sh index 6588b561743b..5617e96e95f1 100755 --- a/apps/microtvm/zephyr_cmsisnn/run_demo.sh +++ b/apps/microtvm/zephyr_cmsisnn/run_demo.sh @@ -46,7 +46,7 @@ west zephyr-export west build west build -t run &> ${LOGDIR}/west.log & -# Wait for "exit" keyword +# Wait for "exit" keyword until grep -m 1 "exit" ${LOGDIR}/west.log; do sleep 1 ; done # Check the log for correct output diff --git a/apps/pt_tvmdsoop/prepare_and_test_pt_tvm_class.sh b/apps/pt_tvmdsoop/prepare_and_test_pt_tvm_class.sh index 666f774017c8..ceb98857533a 100755 --- a/apps/pt_tvmdsoop/prepare_and_test_pt_tvm_class.sh +++ b/apps/pt_tvmdsoop/prepare_and_test_pt_tvm_class.sh @@ -22,12 +22,12 @@ echo "TVM_ROOT=${TVM_ROOT}" export PYTHONPATH=${TVM_ROOT}/python if [ ! -f $TVM_ROOT/build/libtvm.so ]; then - echo "$TVM_ROOT/build/libtvm.so missing" + echo "$TVM_ROOT/build/libtvm.so missing" exit 1 fi if [ ! -f $TVM_ROOT/build/libtvm_runtime.so ]; then - echo "$TVM_ROOT/build/libtvm_runtime.so missing" + echo "$TVM_ROOT/build/libtvm_runtime.so missing" exit 1 fi @@ -43,4 +43,3 @@ if [ "$?" -eq 0 ]; then LD_LIBRARY_PATH=${TVM_ROOT}/build:./build:$LD_LIBRARY_PATH python3 -m pytest -v ./tests fi - diff --git a/apps/tf_tvmdsoop/prepare_and_test_tfop_module.sh b/apps/tf_tvmdsoop/prepare_and_test_tfop_module.sh index 2bde4f87c84e..fa4f1f9f9715 100644 --- a/apps/tf_tvmdsoop/prepare_and_test_tfop_module.sh +++ b/apps/tf_tvmdsoop/prepare_and_test_tfop_module.sh @@ -22,14 +22,13 @@ echo "TVM_ROOT=${TVM_ROOT}" export PYTHONPATH=${TVM_ROOT}/python python3 -c "import tvm; print(tvm.runtime.enabled('gpu'))" | grep -e 1 -if [ "$?" -eq 0 ]; then +if [ "$?" -eq 0 ]; then echo "Build TF_TVMDSOOP with gpu support and execute tests" CMAKE_OPTIONS="-DUSE_CUDA=ON -DPython3_EXECUTABLE=python3 -DTVM_ROOT=${TVM_ROOT}" - + mkdir -p build cd build; cmake .. ${CMAKE_OPTIONS} && make cd .. LD_LIBRARY_PATH=${TVM_ROOT}/build:./build:$LD_LIBRARY_PATH python3 -m pytest -v ./tests fi - diff --git a/apps/vta_rpc/start_rpc_server.sh b/apps/vta_rpc/start_rpc_server.sh index a6f80e27f139..46258f9d7962 100755 --- a/apps/vta_rpc/start_rpc_server.sh +++ b/apps/vta_rpc/start_rpc_server.sh @@ -6,9 +6,9 @@ # 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 diff --git a/apps/wasm-standalone/README.md b/apps/wasm-standalone/README.md index b8a977f6ae50..34c844368029 100644 --- a/apps/wasm-standalone/README.md +++ b/apps/wasm-standalone/README.md @@ -169,8 +169,8 @@ input image belongs to the class `tiger cat` Note: this example also works without WASI support. Please modify `wasm-graph/.cargo/config` to change the target to `wasm32-unknown-unknown` and uncomment the raw wasm engine in `wasm-runtime/src/graph.rs` to run in pure wasm32. SIMD -may not be supported without WASI support. You may also need to delete ` -mattr=+simd128` in the -[build script](apps/wasm-standalone/wasm-graph/tools/build_graph_lib.py). +may not be supported without WASI support. You may also need to delete ` -mattr=+simd128` in the +[build script](apps/wasm-standalone/wasm-graph/tools/build_graph_lib.py). ## Future Work diff --git a/ci/jenkins/.gitignore b/ci/jenkins/.gitignore index 187a72392cc8..3d2dbd4b6317 100644 --- a/ci/jenkins/.gitignore +++ b/ci/jenkins/.gitignore @@ -1 +1 @@ -/_venv \ No newline at end of file +/_venv diff --git a/ci/scripts/git_skip_ci_globs.py b/ci/scripts/git_skip_ci_globs.py index 6c0f9d017605..f51df055c980 100755 --- a/ci/scripts/git_skip_ci_globs.py +++ b/ci/scripts/git_skip_ci_globs.py @@ -35,6 +35,8 @@ # microTVM "apps/microtvm/poetry.lock", "apps/microtvm/pyproject.toml", + "tests/lint/*", + "tests/scripts/task_lint.sh", ] diff --git a/cmake/modules/Git.cmake b/cmake/modules/Git.cmake index 23840023965d..46c0a9901c03 100644 --- a/cmake/modules/Git.cmake +++ b/cmake/modules/Git.cmake @@ -48,7 +48,7 @@ if (${GIT_FOUND}) message(STATUS "Found TVM_GIT_COMMIT_TIME=${TVM_GIT_COMMIT_TIME}") else() set(TVM_GIT_COMMIT_TIME "NOT-FOUND") - endif() + endif() else() message(WARNING "Git not found") set(TVM_GIT_COMMIT_HASH "NOT-FOUND") diff --git a/cmake/modules/contrib/BNNS.cmake b/cmake/modules/contrib/BNNS.cmake index 1adb3ba10231..95c034b1b9ec 100644 --- a/cmake/modules/contrib/BNNS.cmake +++ b/cmake/modules/contrib/BNNS.cmake @@ -27,4 +27,3 @@ if(USE_BNNS STREQUAL "ON") list(APPEND RUNTIME_SRCS ${BNNS_CONTRIB_SRC}) message(STATUS "Build with BNNS JSON runtime: " ${EXTERN_LIBRARY_BNNS}) endif() - diff --git a/cmake/modules/contrib/CODEGENC.cmake b/cmake/modules/contrib/CODEGENC.cmake index 412fa3e8ffc5..b461176e6a84 100644 --- a/cmake/modules/contrib/CODEGENC.cmake +++ b/cmake/modules/contrib/CODEGENC.cmake @@ -17,4 +17,3 @@ tvm_file_glob(GLOB CSOURCE_RELAY_CONTRIB_SRC src/relay/backend/contrib/codegen_c/*.cc) list(APPEND COMPILER_SRCS ${CSOURCE_RELAY_CONTRIB_SRC}) - diff --git a/cmake/modules/contrib/DNNL.cmake b/cmake/modules/contrib/DNNL.cmake index caa5a84e4492..7547af81eb1a 100644 --- a/cmake/modules/contrib/DNNL.cmake +++ b/cmake/modules/contrib/DNNL.cmake @@ -60,4 +60,3 @@ elseif(USE_DNNL STREQUAL "OFF") else() message(FATAL_ERROR "Invalid option: USE_DNNL=" ${USE_DNNL}) endif() - diff --git a/cmake/modules/contrib/Posit.cmake b/cmake/modules/contrib/Posit.cmake index d62e09f27910..b8d180ee4480 100644 --- a/cmake/modules/contrib/Posit.cmake +++ b/cmake/modules/contrib/Posit.cmake @@ -20,7 +20,7 @@ if(USE_BYODT_POSIT) if (NOT UNIVERSAL_PATH) message(FATAL_ERROR "Fail to get Universal path") endif(NOT UNIVERSAL_PATH) - + include_directories(${UNIVERSAL_PATH}/include) list(APPEND COMPILER_SRCS "src/target/datatype/posit/posit-wrapper.cc") endif(USE_BYODT_POSIT) diff --git a/cmake/modules/contrib/TF_TVMDSOOP.cmake b/cmake/modules/contrib/TF_TVMDSOOP.cmake index 86b14740212c..f5f3f036690f 100644 --- a/cmake/modules/contrib/TF_TVMDSOOP.cmake +++ b/cmake/modules/contrib/TF_TVMDSOOP.cmake @@ -17,14 +17,14 @@ if(NOT USE_TF_TVMDSOOP STREQUAL "OFF") find_package(Python3 COMPONENTS Interpreter) - + execute_process(COMMAND ${Python3_EXECUTABLE} -c "import tensorflow as tf; print(' '.join(tf.sysconfig.get_compile_flags()))" OUTPUT_VARIABLE TF_COMPILE_FLAGS_STR RESULT_VARIABLE TF_STATUS) if (NOT ${TF_STATUS} EQUAL 0) message(FATAL_ERROR "Fail to get TensorFlow compile flags") endif() - + if(NOT USE_CUDA STREQUAL "OFF") add_definitions(-DTF_TVMDSOOP_ENABLE_GPU) endif() @@ -45,13 +45,12 @@ if(NOT USE_TF_TVMDSOOP STREQUAL "OFF") tvm_file_glob(GLOB_RECURSE TFTVM_SRCS ${CMAKE_CURRENT_SOURCE_DIR}/src/contrib/tf_op/*.cc) add_library(${OP_LIBRARY_NAME} SHARED ${TFTVM_SRCS}) set(TFTVM_LINK_FLAGS -ltvm -L${CMAKE_CURRENT_BINARY_DIR}) - + if (NOT BUILD_TVMDSOOP_ONLY STREQUAL "ON") - add_dependencies(${OP_LIBRARY_NAME} tvm) + add_dependencies(${OP_LIBRARY_NAME} tvm) endif() target_compile_options(${OP_LIBRARY_NAME} PUBLIC ${TFTVM_COMPILE_FLAGS} ${TF_COMPILE_FLAGS}) target_link_libraries(${OP_LIBRARY_NAME} PUBLIC ${TFTVM_LINK_FLAGS} ${TF_LINK_FLAGS}) endif() - diff --git a/cmake/modules/contrib/Verilator.cmake b/cmake/modules/contrib/Verilator.cmake index e74e582969d1..61a2e309d06e 100644 --- a/cmake/modules/contrib/Verilator.cmake +++ b/cmake/modules/contrib/Verilator.cmake @@ -21,4 +21,3 @@ if(USE_VERILATOR STREQUAL "ON") list(APPEND COMPILER_SRCS ${VERILATOR_RELAY_CONTRIB_SRC}) list(APPEND RUNTIME_SRCS ${VERILATOR_CONTRIB_SRC}) endif() - diff --git a/cmake/utils/FindEthosN.cmake b/cmake/utils/FindEthosN.cmake index 07eaf5ddeee1..591d49f82915 100644 --- a/cmake/utils/FindEthosN.cmake +++ b/cmake/utils/FindEthosN.cmake @@ -85,7 +85,7 @@ macro(find_ethosn use_ethosn) else() set(ETHOSN_DEFINITIONS -DETHOSN_API_VERSION=${USE_ETHOSN_API_VERSION}) endif() - + if(ETHOSN_COMPILER_LIBRARY) set(ETHOSN_FOUND TRUE) endif() diff --git a/cmake/utils/FindVulkan.cmake b/cmake/utils/FindVulkan.cmake index 4349125d3f37..a2a6fb60352d 100644 --- a/cmake/utils/FindVulkan.cmake +++ b/cmake/utils/FindVulkan.cmake @@ -43,7 +43,7 @@ macro(find_vulkan use_vulkan use_khronos_spirv) set(__vulkan_sdk "") endif() - + if(IS_DIRECTORY ${use_khronos_spirv}) set(__use_khronos_spirv ${use_khronos_spirv}) message(STATUS "Custom khronos spirv PATH=" ${__use_khronos_spirv}) diff --git a/conda/condarc b/conda/condarc index eef4967f90fe..b4592374efcb 100644 --- a/conda/condarc +++ b/conda/condarc @@ -20,23 +20,23 @@ # remote_connect_timeout_secs (float) # The number seconds conda will wait for your client to establish a # connection to a remote url resource. -# +# remote_connect_timeout_secs: 10 # remote_max_retries (int) # The maximum number of retries each HTTP connection should attempt. -# +# remote_max_retries: 6 # remote_backoff_factor (int) # The factor determines the time HTTP connection should wait for # attempt. -# +# remote_backoff_factor: 5 # remote_read_timeout_secs (float) # Once conda has connected to a remote resource and sent an HTTP # request, the read timeout is the number of seconds conda will wait for # the server to send a response. -# +# remote_read_timeout_secs: 60.0 diff --git a/docker/Dockerfile.ci_minimal b/docker/Dockerfile.ci_minimal index b4ba758901b4..2a3da14f0fe1 100644 --- a/docker/Dockerfile.ci_minimal +++ b/docker/Dockerfile.ci_minimal @@ -58,4 +58,4 @@ RUN bash /install/ubuntu_install_redis.sh # sccache COPY install/ubuntu_install_sccache.sh /install/ubuntu_install_sccache.sh RUN bash /install/ubuntu_install_sccache.sh -ENV PATH /opt/sccache:$PATH \ No newline at end of file +ENV PATH /opt/sccache:$PATH diff --git a/docker/README.md b/docker/README.md index a05079d30881..c311e86d190a 100644 --- a/docker/README.md +++ b/docker/README.md @@ -80,7 +80,7 @@ You can also start an interactive session by typing The built docker images are prefixed by ``tvm.``, for example the command ````bash -./docker/build.sh image_name +./docker/build.sh image_name ```` produces the image ``tvm.ci_cpu`` that is displayed in the list of docker images @@ -90,7 +90,7 @@ using the command ``docker images``. To run an interactive terminal, execute: ./docker/bash.sh tvm.ci_cpu ```` -or +or ````bash ./docker/bash.sh tvm.ci_cpu echo hello tvm world @@ -98,7 +98,7 @@ or the same applies to the other images (``./docker/Dockerfile.*```). -The command ``./docker/build.sh image_name COMMANDS`` is almost equivelant to +The command ``./docker/build.sh image_name COMMANDS`` is almost equivelant to ``./docker/bash.sh image_name COMMANDS`` but in the case of ``bash.sh`` a build attempt is not done. diff --git a/docker/bash.sh b/docker/bash.sh index 3f8f3d8baba4..2af65b17f5ca 100755 --- a/docker/bash.sh +++ b/docker/bash.sh @@ -137,7 +137,7 @@ CONTAINER_NAME= # "${REPO_DIR}". The consistent directory for Jenkins is currently # necessary to allow cmake build commands to run in CI after the build # steps. -# TODO(https://github.com/apache/tvm/issues/11952): +# TODO(https://github.com/apache/tvm/issues/11952): # Figure out a better way to keep the same path # between build and testing stages. if [[ -n "${JENKINS_HOME:-}" ]]; then diff --git a/docker/install/ubuntu1804_manual_install_llvm.sh b/docker/install/ubuntu1804_manual_install_llvm.sh index f0e9abd1d9fd..bce4222b65c2 100755 --- a/docker/install/ubuntu1804_manual_install_llvm.sh +++ b/docker/install/ubuntu1804_manual_install_llvm.sh @@ -35,4 +35,3 @@ ninja install popd popd rm -rf llvm-project - diff --git a/docker/install/ubuntu_install_androidsdk.sh b/docker/install/ubuntu_install_androidsdk.sh index a809ff349c41..bf2d80cd28ba 100755 --- a/docker/install/ubuntu_install_androidsdk.sh +++ b/docker/install/ubuntu_install_androidsdk.sh @@ -6,9 +6,9 @@ # 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 @@ -83,4 +83,3 @@ for f in ${ANDROID_HOME}/ndk/21.3.6528147/* ; do ln --symbolic "$f" "/usr/bin/`basename $f`" done echo "export ANDROID_HOME=${ANDROID_HOME}" >> /etc/profile - diff --git a/docker/install/ubuntu_install_caffe2.sh b/docker/install/ubuntu_install_caffe2.sh index fa091f950497..1a27bc44ad10 100755 --- a/docker/install/ubuntu_install_caffe2.sh +++ b/docker/install/ubuntu_install_caffe2.sh @@ -6,9 +6,9 @@ # 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 diff --git a/docker/install/ubuntu_install_cmsis.sh b/docker/install/ubuntu_install_cmsis.sh index 9fcbcf61cefa..a41e3df0ae55 100755 --- a/docker/install/ubuntu_install_cmsis.sh +++ b/docker/install/ubuntu_install_cmsis.sh @@ -49,4 +49,3 @@ echo "$CMSIS_SHASUM" ${DOWNLOAD_PATH} | sha512sum -c tar -xf "${DOWNLOAD_PATH}" -C "${INSTALLATION_PATH}" --strip-components=1 touch "${INSTALLATION_PATH}"/"${CMSIS_SHA}".sha echo "SUCCESS" - diff --git a/docker/install/ubuntu_install_coreml.sh b/docker/install/ubuntu_install_coreml.sh index cbdc87666b4e..18802a89436b 100755 --- a/docker/install/ubuntu_install_coreml.sh +++ b/docker/install/ubuntu_install_coreml.sh @@ -6,9 +6,9 @@ # 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 diff --git a/docker/install/ubuntu_install_dnnl.sh b/docker/install/ubuntu_install_dnnl.sh index 3654d140f55b..5aaf3be7fbbf 100755 --- a/docker/install/ubuntu_install_dnnl.sh +++ b/docker/install/ubuntu_install_dnnl.sh @@ -6,9 +6,9 @@ # 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 diff --git a/docker/install/ubuntu_install_gluoncv.sh b/docker/install/ubuntu_install_gluoncv.sh index cb24ff74e9ff..d42705b86e2b 100755 --- a/docker/install/ubuntu_install_gluoncv.sh +++ b/docker/install/ubuntu_install_gluoncv.sh @@ -6,9 +6,9 @@ # 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 diff --git a/docker/install/ubuntu_install_golang.sh b/docker/install/ubuntu_install_golang.sh index 4e8e743266c1..05c57c955bf2 100755 --- a/docker/install/ubuntu_install_golang.sh +++ b/docker/install/ubuntu_install_golang.sh @@ -6,9 +6,9 @@ # 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 diff --git a/docker/install/ubuntu_install_gradle.sh b/docker/install/ubuntu_install_gradle.sh index 030be040c6e3..56dcb05a2014 100755 --- a/docker/install/ubuntu_install_gradle.sh +++ b/docker/install/ubuntu_install_gradle.sh @@ -6,9 +6,9 @@ # 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 diff --git a/docker/install/ubuntu_install_hexagon.sh b/docker/install/ubuntu_install_hexagon.sh index e616c8a4977c..18b8a0f66587 100755 --- a/docker/install/ubuntu_install_hexagon.sh +++ b/docker/install/ubuntu_install_hexagon.sh @@ -6,9 +6,9 @@ # 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 diff --git a/docker/install/ubuntu_install_java.sh b/docker/install/ubuntu_install_java.sh index d0ced98d89f1..5556f0d8fed5 100755 --- a/docker/install/ubuntu_install_java.sh +++ b/docker/install/ubuntu_install_java.sh @@ -6,9 +6,9 @@ # 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 diff --git a/docker/install/ubuntu_install_nodejs.sh b/docker/install/ubuntu_install_nodejs.sh index 2bb8a115a0c4..b295d9e3e41d 100755 --- a/docker/install/ubuntu_install_nodejs.sh +++ b/docker/install/ubuntu_install_nodejs.sh @@ -29,4 +29,4 @@ apt-install-and-clear -y curl # The node install script fetched and executed here will update the # apt source list, hence the second apt-get update --fix-missing is necessary. curl -s -S -L https://deb.nodesource.com/setup_14.x | bash - -apt-install-and-clear -y nodejs \ No newline at end of file +apt-install-and-clear -y nodejs diff --git a/docker/install/ubuntu_install_opencl.sh b/docker/install/ubuntu_install_opencl.sh index 705f4a65eedb..a1ae18471f85 100755 --- a/docker/install/ubuntu_install_opencl.sh +++ b/docker/install/ubuntu_install_opencl.sh @@ -6,9 +6,9 @@ # 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 diff --git a/docker/install/ubuntu_install_rocm.sh b/docker/install/ubuntu_install_rocm.sh index 15cb1e143ac4..f8ed4d00fe68 100755 --- a/docker/install/ubuntu_install_rocm.sh +++ b/docker/install/ubuntu_install_rocm.sh @@ -6,9 +6,9 @@ # 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 diff --git a/docker/install/ubuntu_install_universal.sh b/docker/install/ubuntu_install_universal.sh index a054aafdd5f7..07b38f1a5269 100755 --- a/docker/install/ubuntu_install_universal.sh +++ b/docker/install/ubuntu_install_universal.sh @@ -23,4 +23,4 @@ set -o pipefail git clone https://github.com/stillwater-sc/universal.git /opt/universal # Use specific versioning tag. -(cd /opt/universal && git checkout e32899d551b53d758865fabd5fdd69eed35bfb0f) \ No newline at end of file +(cd /opt/universal && git checkout e32899d551b53d758865fabd5fdd69eed35bfb0f) diff --git a/docker/install/ubuntu_install_vitis_ai_core.sh b/docker/install/ubuntu_install_vitis_ai_core.sh index 48980d2e7ba2..2e395b45daaa 100755 --- a/docker/install/ubuntu_install_vitis_ai_core.sh +++ b/docker/install/ubuntu_install_vitis_ai_core.sh @@ -6,9 +6,9 @@ # 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 diff --git a/docker/install/ubuntu_install_vitis_ai_packages_ci.sh b/docker/install/ubuntu_install_vitis_ai_packages_ci.sh index ccaf113cec58..569df12a37df 100755 --- a/docker/install/ubuntu_install_vitis_ai_packages_ci.sh +++ b/docker/install/ubuntu_install_vitis_ai_packages_ci.sh @@ -6,9 +6,9 @@ # 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 diff --git a/docker/utils/apt-install-and-clear.sh b/docker/utils/apt-install-and-clear.sh index 1840c17b37bb..56ef98b00fdb 100755 --- a/docker/utils/apt-install-and-clear.sh +++ b/docker/utils/apt-install-and-clear.sh @@ -17,4 +17,3 @@ # under the License. apt-get install $@ && apt-get clean - diff --git a/docs/_static/img/README b/docs/_static/img/README index 414328cc729d..8e908dc1af2f 100644 --- a/docs/_static/img/README +++ b/docs/_static/img/README @@ -1,2 +1,2 @@ The logo file in this repo is an exception due to the need of sphinx. -By default we avoid to put large binary blobs into this repo. \ No newline at end of file +By default we avoid to put large binary blobs into this repo. diff --git a/docs/arch/hybrid_script.rst b/docs/arch/hybrid_script.rst index 33a65f268335..a4fce342f728 100644 --- a/docs/arch/hybrid_script.rst +++ b/docs/arch/hybrid_script.rst @@ -96,5 +96,5 @@ except ``popcount`` and ``sigmoid``. I implemented them manually. Casting ~~~~~~~ -You can cast values by using the keywords ``uint8``, ``uint16`` ``uint32``, ``uint64``, ``int8``, ``int16``, ``int32``, ``int64``, +You can cast values by using the keywords ``uint8``, ``uint16`` ``uint32``, ``uint64``, ``int8``, ``int16``, ``int32``, ``int64``, ``float16``, ``float32``, ``float64``. diff --git a/docs/contribute/release_process.rst b/docs/contribute/release_process.rst index a0ebda650524..4e5747ccb970 100644 --- a/docs/contribute/release_process.rst +++ b/docs/contribute/release_process.rst @@ -57,7 +57,7 @@ It is recommended to open a Github issue to collect feedbacks for the release no Prepare the Release Candidate ----------------------------- -There may be some code changes necessary to the release branch before the release. Ensure all version numbers are up to date +There may be some code changes necessary to the release branch before the release. Ensure all version numbers are up to date Prepare the GPG Key @@ -145,12 +145,12 @@ Create GPG signature as well as the hash of the file, shasum -a 512 apache-tvm-src-v0.6.0.rc0.tar.gz > apache-tvm-src-v0.6.0.rc0.tar.gz.sha512 -Update TVM Version on Main +Update TVM Version on Main -------------------------- -After cutting a release candidate, make sure to update the version numbers throughout `main`. For example if we are -releasing `v0.10.0` we want to bump the version numbers throughout the codebase from `v0.10.dev0` to `v0.11.dev0`. An -example of how to do this can be found here: `https://github.com/apache/tvm/pull/12190 `_. +After cutting a release candidate, make sure to update the version numbers throughout `main`. For example if we are +releasing `v0.10.0` we want to bump the version numbers throughout the codebase from `v0.10.dev0` to `v0.11.dev0`. An +example of how to do this can be found here: `https://github.com/apache/tvm/pull/12190 `_. Upload the Release Candidate ---------------------------- diff --git a/docs/dev/how_to/relay_add_op.rst b/docs/dev/how_to/relay_add_op.rst index 2a8c771dc63d..225c60071fd0 100644 --- a/docs/dev/how_to/relay_add_op.rst +++ b/docs/dev/how_to/relay_add_op.rst @@ -15,13 +15,13 @@ specific language governing permissions and limitations under the License. -.. _relay-add-op: +.. _relay-add-op: Adding an Operator to Relay =========================== -In this document we will go over the steps needed to register a new TVM operator -in Relay. We will be following this PR which adds a `cumulative product`_ operation as an example. +In this document we will go over the steps needed to register a new TVM operator +in Relay. We will be following this PR which adds a `cumulative product`_ operation as an example. The PR itself builds upon another PR which adds a `cumulative sum`_ operation. .. _cumulative product: https://github.com/apache/tvm/pull/7722 @@ -30,20 +30,20 @@ The PR itself builds upon another PR which adds a `cumulative sum`_ operation. Registering a new operator requires a few steps: 1. Add an attribute node declaring fixed arguments which are known at compile time -2. Write a type relation for your operation to integrate into Relay's type system. -3. Use the ``RELAY_REGISTER_OP`` macro in C++ to register the operator's arity, type, and other hints for the compiler -4. Write how the operator is computed +2. Write a type relation for your operation to integrate into Relay's type system. +3. Use the ``RELAY_REGISTER_OP`` macro in C++ to register the operator's arity, type, and other hints for the compiler +4. Write how the operator is computed 5. Register the compute, schedule with the relay operator 6. Define a C++ function to produce a call node for the operator and registering a Python API hook for the function 7. Wrapping the above Python API hook in a neater interface -8. Writing tests for the new relay operator +8. Writing tests for the new relay operator 1. Defining an Attribute Node ----------------------------- -Attributes are fixed arguments which are supposed to be known at compile time. The stride and dilation of a convolution +Attributes are fixed arguments which are supposed to be known at compile time. The stride and dilation of a convolution operator would be an appropriate example of fields which might belong in an attribute node for a convolution operator. -Attributes should be defined in a file within the folder `include/tvm/relay/attrs/`_. +Attributes should be defined in a file within the folder `include/tvm/relay/attrs/`_. .. _include/tvm/relay/attrs/: https://github.com/apache/tvm/tree/main/include/tvm/relay/attrs @@ -78,7 +78,7 @@ Ultimately we want to create an operator whose interface can be seen clearly in A similiar interface exists for ``cumsum()``. -Therefore, when defining our attributes in ``include/tvm/relay/attrs/transform.h`` we choose the axis, +Therefore, when defining our attributes in ``include/tvm/relay/attrs/transform.h`` we choose the axis, accumulation dtype, and exclusivity of the operation as appropriate fields for the struct. .. code:: c++ @@ -104,13 +104,13 @@ expressivity and granularity in expressing types in Relay, operators are typed using relations between input and output types. These relations are represented as functions that take in a list of input types and output types (any of these types may be incomplete) and return a list -of input and output types that satisfies the relation. This includes shape +of input and output types that satisfies the relation. This includes shape information which can be determined statically at compile time. Essentially, a relation for an operator can enforce all the necessary typing rules (namely by inspecting the input types) in addition to computing the output type. -Type relation for the cumulative product and sum operators can be found in +Type relation for the cumulative product and sum operators can be found in ``src/relay/op/tensor/transform.cc``: .. code:: c++ @@ -182,13 +182,13 @@ Once again we add this to ``src/relay/op/tensor/transform.cc``: .set_attr("TOpPattern", kOpaque); In this case the ``TOpPattern`` is a hint to the compiler on the pattern of computation the operator does, which might be -useful for fusing operators. ``kOpaque`` tells TVM to not bother trying to fuse this operator. +useful for fusing operators. ``kOpaque`` tells TVM to not bother trying to fuse this operator. 4. Defining the Compute of the Operation ---------------------------------------- -While we've now defined the interface for our operations we still need to define -how to perform the actual calculations for cumulative sum and product. +While we've now defined the interface for our operations we still need to define +how to perform the actual calculations for cumulative sum and product. Writing this code is outside the scope of the tutorial. For now, we assume we have a well tested implementation for the operation's compute. For more details @@ -206,13 +206,13 @@ representation where tensor expressions and topi will lower into. 5. Hooking up Compute and Strategy with Relay --------------------------------------------- -After you have implemented your compute function we now need to glue it to our -relay operation. Within TVM this means not only defining the computation, but also the schedule +After you have implemented your compute function we now need to glue it to our +relay operation. Within TVM this means not only defining the computation, but also the schedule for an operation. A strategy is a method which picks which computation and which schedule to use. For example, for 2D convolutions we might recognize we are doing a depthwise convolution -and dispatch to a more efficient computation and schedule as a result. In our case however we have -no such need except for dispatching between our CPU and GPU implementations. In -``python/tvm/relay/op/strategy/generic.py`` and ``python/tvm/relay/op/strategy/cuda.py`` we +and dispatch to a more efficient computation and schedule as a result. In our case however we have +no such need except for dispatching between our CPU and GPU implementations. In +``python/tvm/relay/op/strategy/generic.py`` and ``python/tvm/relay/op/strategy/cuda.py`` we add the following strategies: .. code:: python @@ -259,8 +259,8 @@ add the following strategies: name="cumsum.cuda", ) return strategy - - + + @cumprod_strategy.register(["cuda", "gpu"]) def cumprod_strategy_cuda(attrs, inputs, out_type, target): """cumprod cuda strategy""" @@ -271,7 +271,7 @@ add the following strategies: name="cumprod.cuda", ) return strategy - + Where in each strategy we define the compute we wrote and the schedule to use within ``add_implementation()``. We finally link the strategy and compute with the defined relay operator in ``python/tvm/relay/op/_transform.py``: @@ -297,12 +297,12 @@ We finally link the strategy and compute with the defined relay operator in ``py _reg.register_strategy("cumprod", strategy.cumprod_strategy) _reg.register_shape_func("cumprod", False, elemwise_shape_func) -The shape functions are used for determining output shape given a dynamically shaped tensor. In this +The shape functions are used for determining output shape given a dynamically shaped tensor. In this case we tell TVM the output shape will be the same as the input shape. 6. Creating a Relay Call Node and Exposing a Python Hook -------------------------------------------------------- -We now have a working operation and now just need to properly call it +We now have a working operation and now just need to properly call it via a Relay Call Node. This step requires simply writing a function that takes the arguments to the operator (as Relay expressions) and returning a call node to the operator (i.e., the node that @@ -314,7 +314,7 @@ are not supported, so it suffices to use ``Op::Get`` to fetch the operator's information from the operator registry and pass in the arguments to the call node, as below. In ``src/relay/op/tensor/transform.cc``: -.. code:: c++ +.. code:: c++ Expr MakeCumsum(Expr data, Integer axis, DataType dtype, Bool exclusive) { auto attrs = make_object(); @@ -346,7 +346,7 @@ in Python via ``relay.op._make.cumsum(...)`` and ``relay.op._make.cumsum(...)``. It is generally the convention in Relay, that functions exported through ``TVM_REGISTER_GLOBAL`` should be wrapped in a separate -Python function rather than called directly in Python. For our +Python function rather than called directly in Python. For our operators we expose this cleaner interface in ``python/tvm/relay/op/transform.py`` .. code:: python @@ -383,7 +383,7 @@ before producing the call node: 8. Writing Unit Tests! ---------------------- This is self explanatory! Some example unit tests can be found in -`tests/python/relay/test_op_level3.py`_ for our cumulative sum +`tests/python/relay/test_op_level3.py`_ for our cumulative sum and product operators. .. _tests/python/relay/test_op_level3.py: https://github.com/apache/tvm/blob/main/tests/python/relay/test_op_level3.py diff --git a/docs/errors.rst b/docs/errors.rst index 84ea5551601a..42ffc88c1b44 100644 --- a/docs/errors.rst +++ b/docs/errors.rst @@ -69,4 +69,3 @@ pieces of information: Without these details it is very difficult for the TVM developers to do very much to help you. - diff --git a/docs/how_to/deploy/arm_compute_lib.rst b/docs/how_to/deploy/arm_compute_lib.rst index a7ec8b9501c7..31b815d05d19 100644 --- a/docs/how_to/deploy/arm_compute_lib.rst +++ b/docs/how_to/deploy/arm_compute_lib.rst @@ -34,7 +34,7 @@ Before installing Arm Compute Library, it is important to know what architecture to determine this is to use `lscpu` and look for the "Model name" of the CPU. You can then use this to determine the architecture by looking online. -TVM only supports a single version of ACL, currently this is v21.08, there are two recommended ways to build and install +TVM only supports a single version of ACL, currently this is v21.08, there are two recommended ways to build and install the required libraries: * Use the script located at `docker/install/ubuntu_download_arm_compute_lib_binaries.sh`. You can use this diff --git a/docs/how_to/deploy/index.rst b/docs/how_to/deploy/index.rst index f28883446fd5..74bae0f9234e 100644 --- a/docs/how_to/deploy/index.rst +++ b/docs/how_to/deploy/index.rst @@ -36,7 +36,7 @@ Unlike traditional deep learning frameworks. TVM stack is divided into two major - TVM runtime, which runs on the target devices. In order to integrate the compiled module, we **do not** need to build entire -TVM on the target device. You only need to build the TVM compiler stack on your +TVM on the target device. You only need to build the TVM compiler stack on your desktop and use that to cross-compile modules that are deployed on the target device. We only need to use a light-weight runtime API that can be integrated into various platforms. @@ -77,9 +77,9 @@ architecture to be able to run the cross compiled model. Cross compile the TVM runtime for other architectures ----------------------------------------------------- -In the example :ref:`above ` the runtime library was -compiled on a Raspberry Pi. Producing the runtime library can be done much faster on -hosts that have high performace processors with ample resources (such as laptops, workstation) +In the example :ref:`above ` the runtime library was +compiled on a Raspberry Pi. Producing the runtime library can be done much faster on +hosts that have high performace processors with ample resources (such as laptops, workstation) compared to a target devices such as a Raspberry Pi. In-order to cross compile the runtime the toolchain for the target device must be installed. After installing the correct toolchain, the main difference compared to compiling natively is to pass some additional command @@ -105,7 +105,7 @@ cross-compile for aarch64 -DCMAKE_FIND_ROOT_PATH=/usr/aarch64-linux-gnu \ -DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=NEVER \ -DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=ONLY \ - -DMACHINE_NAME=aarch64-linux-gnu + -DMACHINE_NAME=aarch64-linux-gnu make -j$(nproc) runtime @@ -135,7 +135,7 @@ cross-compile for RISC-V -DCMAKE_FIND_ROOT_PATH=/usr/riscv64-linux-gnu \ -DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=NEVER \ -DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=ONLY \ - -DMACHINE_NAME=riscv64-linux-gnu + -DMACHINE_NAME=riscv64-linux-gnu make -j$(nproc) runtime @@ -147,7 +147,7 @@ The ``file`` command can be used to query the architecture of the produced runti file libtvm_runtime.so libtvm_runtime.so: ELF 64-bit LSB shared object, UCB RISC-V, version 1 (GNU/Linux), dynamically linked, BuildID[sha1]=e9ak845b3d7f2c126dab53632aea8e012d89477e, not stripped - + Optimize and tune models for target devices ------------------------------------------- diff --git a/docs/how_to/deploy/vitis_ai.rst b/docs/how_to/deploy/vitis_ai.rst index 7e97ddce8a89..8185822593c7 100755 --- a/docs/how_to/deploy/vitis_ai.rst +++ b/docs/how_to/deploy/vitis_ai.rst @@ -28,9 +28,9 @@ full potential of AI acceleration on Xilinx FPGA and ACAP. The current Vitis AI flow inside TVM enables acceleration of Neural Network model inference on edge and cloud with the `Zynq Ultrascale+ -MPSoc `__, -`Alveo `__ -and `Versal `__ platforms. +MPSoc `__, +`Alveo `__ +and `Versal `__ platforms. The identifiers for the supported edge and cloud Deep Learning Processor Units (DPU's) are: +-----------------------------------------------------------------------------------------+-----------------------+----------------------------+ @@ -43,7 +43,7 @@ The identifiers for the supported edge and cloud Deep Learning Processor Units ( | `Kria KV260 `__ | DPUCZDX8G | DPUCZDX8G-kv260 | +-----------------------------------------------------------------------------------------+-----------------------+----------------------------+ | `VCK190 `__ | DPUCVDX8G | DPUCVDX8G | -+-----------------------------------------------------------------------------------------+-----------------------+----------------------------+ ++-----------------------------------------------------------------------------------------+-----------------------+----------------------------+ | `VCK5000 `__ | DPUCVDX8H | DPUCVDX8H | +-----------------------------------------------------------------------------------------+-----------------------+----------------------------+ | `U200 `__ | DPUCADF8H | DPUCADF8H | @@ -52,7 +52,7 @@ The identifiers for the supported edge and cloud Deep Learning Processor Units ( +-----------------------------------------------------------------------------------------+-----------------------+----------------------------+ | `U50 `__ | DPUCAHX8H / DPUCAHX8L | DPUCAHX8H-u50 / DPUCAHX8L | +-----------------------------------------------------------------------------------------+-----------------------+----------------------------+ -| `U280 `__ | DPUCAHX8H / DPUCAHX8L | DPUCAHX8H-u280 / DPUCAHX8L | +| `U280 `__ | DPUCAHX8H / DPUCAHX8L | DPUCAHX8H-u280 / DPUCAHX8L | +-----------------------------------------------------------------------------------------+-----------------------+----------------------------+ For more information about the DPU identifiers see following table: @@ -66,23 +66,23 @@ For more information about the DPU identifiers see following table: | | | | ZD: Zynq DDR | | R: RNN | | M: Mixed Precision | | C: Cost optimized | +-------------------+-------------+--------------------------------+------------------------+------------------------+------------------------+ -On this page you will find information on how to `setup <#setup-instructions>`__ TVM with Vitis AI -on different platforms (Zynq, Alveo, Versal) and on how to get started with `Compiling a Model <#compiling-a-model>`__ +On this page you will find information on how to `setup <#setup-instructions>`__ TVM with Vitis AI +on different platforms (Zynq, Alveo, Versal) and on how to get started with `Compiling a Model <#compiling-a-model>`__ and executing on different platforms: `Inference <#inference>`__. System Requirements ------------------- -The `Vitis AI System Requirements page `__ -lists the system requirements for running docker containers as well as doing executing on Alveo cards. -For edge devices (e.g. Zynq), deploying models requires a host machine for compiling models using the TVM with Vitis AI flow, +The `Vitis AI System Requirements page `__ +lists the system requirements for running docker containers as well as doing executing on Alveo cards. +For edge devices (e.g. Zynq), deploying models requires a host machine for compiling models using the TVM with Vitis AI flow, and an edge device for running the compiled models. The host system requirements are the same as specified in the link above. Setup instructions ------------------ -This section provide the instructions for setting up the TVM with Vitis AI flow for both cloud and edge. -TVM with Vitis AI support is provided through a docker container. The provided scripts and Dockerfile +This section provide the instructions for setting up the TVM with Vitis AI flow for both cloud and edge. +TVM with Vitis AI support is provided through a docker container. The provided scripts and Dockerfile compiles TVM and Vitis AI into a single image. 1. Clone TVM repo @@ -91,7 +91,7 @@ compiles TVM and Vitis AI into a single image. git clone --recursive https://github.com/apache/tvm.git cd tvm - + 2. Build and start the TVM - Vitis AI docker container. .. code:: bash @@ -122,7 +122,7 @@ compiles TVM and Vitis AI into a single image. pip3 install -e . --user Inside this docker container you can now compile models for both cloud and edge targets. -To run on cloud Alveo or Versal VCK5000 cards inside the docker container, please follow the +To run on cloud Alveo or Versal VCK5000 cards inside the docker container, please follow the `Alveo <#alveo-setup>`__ respectively `Versal VCK5000 <#versal-vck5000-setup>`__ setup instructions. To setup your Zynq or Versal VCK190 evaluation board for inference, please follow the `Zynq <#zynq-setup>`__ respectively `Versal VCK190 <#versal-vck190-setup>`__ instructions. @@ -135,12 +135,12 @@ Check out following page for setup information: `Alveo Setup /etc/fstab - + 7. Install hdf5 dependency (will take between 30 min and 1 hour to finish) - + .. code:: bash - + cd /tmp && \ wget https://support.hdfgroup.org/ftp/HDF5/releases/hdf5-1.10/hdf5-1.10.7/src/hdf5-1.10.7.tar.gz && \ tar -zxvf hdf5-1.10.7.tar.gz && \ @@ -194,25 +194,25 @@ the Zynq board will first have to be set up and more information on that can be make -j$(nproc) && \ make install && \ cd /tmp && rm -rf hdf5-1.10.7* - + 8. Install Python dependencies .. code:: bash - + pip3 install Cython==0.29.23 h5py==2.10.0 pillow -9. Install PyXIR +9. Install PyXIR .. code:: bash - + git clone --recursive --branch rel-v0.3.1 --single-branch https://github.com/Xilinx/pyxir.git cd pyxir sudo python3 setup.py install --use_vart_edge_dpu - + 10. Build and install TVM with Vitis AI .. code:: bash - + git clone --recursive https://github.com/apache/tvm cd tvm mkdir build @@ -230,29 +230,29 @@ the Zynq board will first have to be set up and more information on that can be .. code:: bash python3 -c 'import pyxir; import tvm' - + .. note:: You might see a warning about the 'cpu-tf' runtime not being found. This warning is expected on the board and can be ignored. - - + + Versal VCK190 Setup ~~~~~~~~~~~~~~~~~~~ For the Versal VCK190 setup, please follow the instructions for `Zynq Setup <#zynq-setup>`__, but now use the `VCK190 image `__ in step 1. The other steps are the same. - + Compiling a Model ----------------- -The TVM with Vitis AI flow contains two stages: Compilation and Inference. -During the compilation a user can choose a model to compile for the cloud or -edge target devices that are currently supported. Once a model is compiled, -the generated files can be used to run the model on a the specified target -device during the `Inference <#inference>`__ stage. Currently, the TVM with +The TVM with Vitis AI flow contains two stages: Compilation and Inference. +During the compilation a user can choose a model to compile for the cloud or +edge target devices that are currently supported. Once a model is compiled, +the generated files can be used to run the model on a the specified target +device during the `Inference <#inference>`__ stage. Currently, the TVM with Vitis AI flow supported a selected number of Xilinx data center and edge devices. In this section we walk through the typical flow for compiling models with Vitis AI @@ -272,16 +272,16 @@ Make sure to import PyXIR and the DPU target (``import pyxir.contrib.target.DPUC from tvm.contrib.target import vitis_ai from tvm.contrib import utils, graph_executor from tvm.relay.op.contrib.vitis_ai import partition_for_vitis_ai - + **Declare the Target** .. code:: python tvm_target = 'llvm' dpu_target = 'DPUCADF8H' # options: 'DPUCADF8H', 'DPUCAHX8H-u50', 'DPUCAHX8H-u280', 'DPUCAHX8L', 'DPUCVDX8H', 'DPUCZDX8G-zcu104', 'DPUCZDX8G-zcu102', 'DPUCZDX8G-kv260' - -The TVM with Vitis AI flow currently supports the DPU targets listed in -the table at the top of this page. Once the appropriate targets are defined, + +The TVM with Vitis AI flow currently supports the DPU targets listed in +the table at the top of this page. Once the appropriate targets are defined, we invoke the TVM compiler to build the graph for the specified target. **Import the Model** @@ -291,9 +291,9 @@ Example code to import an MXNet model: .. code:: python mod, params = relay.frontend.from_mxnet(block, input_shape) - -**Partition the Model** + +**Partition the Model** After importing the model, we utilize the Relay API to annotate the Relay expression for the provided DPU target and partition the graph. @@ -302,7 +302,7 @@ After importing the model, we utilize the Relay API to annotate the Relay expres mod = partition_for_vitis_ai(mod, params, dpu=dpu_target) -**Build the Model** +**Build the Model** The partitioned model is passed to the TVM compiler to generate the runtime libraries for the TVM Runtime. @@ -330,7 +330,7 @@ inference will be accelerated for all next inputs. Note that the edge flow deviates slightly from the explained flow in that inference won't be accelerated after the first N inputs but the model will have been quantized and compiled and can be moved to the edge device for -deployment. Please check out the `Running on Zynq <#running-on-zynq>`__ +deployment. Please check out the `Running on Zynq <#running-on-zynq>`__ section below for more information. .. code:: python @@ -344,30 +344,30 @@ section below for more information. module.set_input(input_name, inputs[i]) module.run() -By default, the number of images used for quantization is set to 128. -You could change the number of images used for On-The-Fly Quantization -with the PX_QUANT_SIZE environment variable. For example, execute the -following line in the terminal before calling the compilation script -to reduce the quantization calibration dataset to eight images. +By default, the number of images used for quantization is set to 128. +You could change the number of images used for On-The-Fly Quantization +with the PX_QUANT_SIZE environment variable. For example, execute the +following line in the terminal before calling the compilation script +to reduce the quantization calibration dataset to eight images. This can be used for quick testing. .. code:: bash export PX_QUANT_SIZE=8 - -Lastly, we store the compiled output from the TVM compiler on disk for -running the model on the target device. This happens as follows for + +Lastly, we store the compiled output from the TVM compiler on disk for +running the model on the target device. This happens as follows for cloud DPU's (Alveo, VCK5000): .. code:: python lib_path = "deploy_lib.so" lib.export_library(lib_path) - - -For edge targets (Zynq, VCK190) we have to rebuild for aarch64. To do this -we first have to normally export the module to also serialize the Vitis AI -runtime module (vitis_ai.rtmod). We will load this runtime module again + + +For edge targets (Zynq, VCK190) we have to rebuild for aarch64. To do this +we first have to normally export the module to also serialize the Vitis AI +runtime module (vitis_ai.rtmod). We will load this runtime module again afterwards to rebuild and export for aarch64. .. code:: python @@ -397,20 +397,20 @@ For instructions on how to run a compiled model please refer to the next section Inference --------- -The TVM with Vitis AI flow contains two stages: Compilation and Inference. -During the compilation a user can choose to compile a model for any of the -target devices that are currently supported. Once a model is compiled, the -generated files can be used to run the model on a target device during the +The TVM with Vitis AI flow contains two stages: Compilation and Inference. +During the compilation a user can choose to compile a model for any of the +target devices that are currently supported. Once a model is compiled, the +generated files can be used to run the model on a target device during the Inference stage. Check out the `Running on Alveo and VCK5000 <#running-on-alveo-and-vck5000>`__ -and `Running on Zynq and VCK190 <#running-on-zynq-and-vck190>`__ sections for +and `Running on Zynq and VCK190 <#running-on-zynq-and-vck190>`__ sections for doing inference on cloud accelerator cards respectively edge boards. Running on Alveo and VCK5000 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -After having followed the steps in the `Compiling a Model <#compiling-a-model>`__ +After having followed the steps in the `Compiling a Model <#compiling-a-model>`__ section, you can continue running on new inputs inside the docker for accelerated inference: @@ -418,8 +418,8 @@ inference: module.set_input(input_name, inputs[i]) module.run() - -Alternatively, you can load the exported runtime module (the deploy_lib.so + +Alternatively, you can load the exported runtime module (the deploy_lib.so exported in `Compiling a Model <#compiling-a-model>`__): .. code:: python @@ -429,7 +429,7 @@ exported in `Compiling a Model <#compiling-a-model>`__): from tvm.contrib import graph_executor dev = tvm.cpu() - + # input_name = ... # input_data = ... @@ -439,21 +439,21 @@ exported in `Compiling a Model <#compiling-a-model>`__): module = graph_executor.GraphModule(lib["default"](dev)) module.set_input(input_name, input_data) module.run() - + Running on Zynq and VCK190 ~~~~~~~~~~~~~~~~~~~~~~~~~~ -Before proceeding, please follow the `Zynq <#zynq-setup>`__ or +Before proceeding, please follow the `Zynq <#zynq-setup>`__ or `Versal VCK190 <#versal-vck190-setup>`__ setup instructions. -Prior to running a model on the board, you need to compile the model for -your target evaluation board and transfer the compiled model on to the board. -Please refer to the `Compiling a Model <#compiling-a-model>`__ section for +Prior to running a model on the board, you need to compile the model for +your target evaluation board and transfer the compiled model on to the board. +Please refer to the `Compiling a Model <#compiling-a-model>`__ section for information on how to compile a model. -Afterwards, you will have to transfer the compiled model (deploy_lib_edge.so) +Afterwards, you will have to transfer the compiled model (deploy_lib_edge.so) to the evaluation board. Then, on the board you can use the typical -"load_module" and "module.run" APIs to execute. For this, please make sure to +"load_module" and "module.run" APIs to execute. For this, please make sure to run the script as root (execute ``su`` in terminal to log into root). .. note:: @@ -468,7 +468,7 @@ run the script as root (execute ``su`` in terminal to log into root). from tvm.contrib import graph_executor dev = tvm.cpu() - + # input_name = ... # input_data = ... @@ -478,5 +478,3 @@ run the script as root (execute ``su`` in terminal to log into root). module = graph_executor.GraphModule(lib["default"](dev)) module.set_input(input_name, input_data) module.run() - - diff --git a/docs/install/from_source.rst b/docs/install/from_source.rst index b92a921d61b6..458a1570096c 100644 --- a/docs/install/from_source.rst +++ b/docs/install/from_source.rst @@ -90,7 +90,7 @@ Homebrew to ensure the dependencies are correctly installed and configured: brew install llvm brew install python@3.8 -If you are on macOS with an M1 Processor you may need to use conda to manage dependencies while building. Specifically you may need, `Miniforge `_ to ensure that the dependencies obtained using pip are compatible with M1. +If you are on macOS with an M1 Processor you may need to use conda to manage dependencies while building. Specifically you may need, `Miniforge `_ to ensure that the dependencies obtained using pip are compatible with M1. .. code:: bash diff --git a/docs/reference/api/python/auto_scheduler.rst b/docs/reference/api/python/auto_scheduler.rst index c5b8dccf1be2..8fa182307352 100644 --- a/docs/reference/api/python/auto_scheduler.rst +++ b/docs/reference/api/python/auto_scheduler.rst @@ -21,4 +21,3 @@ tvm.auto_scheduler :members: :imported-members: :autosummary: - diff --git a/docs/reference/api/python/topi.rst b/docs/reference/api/python/topi.rst index c77b9eae89d4..0528844d682a 100644 --- a/docs/reference/api/python/topi.rst +++ b/docs/reference/api/python/topi.rst @@ -45,5 +45,3 @@ tvm.topi.sparse :members: :imported-members: :autosummary: - - diff --git a/docs/reference/langref/relay_pattern.rst b/docs/reference/langref/relay_pattern.rst index 4682e5aa5b33..16211b2cb125 100644 --- a/docs/reference/langref/relay_pattern.rst +++ b/docs/reference/langref/relay_pattern.rst @@ -89,7 +89,7 @@ Or a convolution with a specific kernel size: x = relay.var('x') y = relay.var('y') assert is_conv2d.match(relay.op.nn.conv2d(x, y, kernel_size=[3, 3])) - + Matching an Optional Op diff --git a/docs/topic/vta/.gitignore b/docs/topic/vta/.gitignore index a07068979a60..7445cd0171c7 100644 --- a/docs/topic/vta/.gitignore +++ b/docs/topic/vta/.gitignore @@ -1 +1 @@ -tutorials \ No newline at end of file +tutorials diff --git a/docs/topic/vta/dev/config.rst b/docs/topic/vta/dev/config.rst index 2f98d777608e..b3ec49e769af 100644 --- a/docs/topic/vta/dev/config.rst +++ b/docs/topic/vta/dev/config.rst @@ -71,4 +71,3 @@ We provide additional detail below regarding each parameter: - ``HW_VER``: Hardware version which increments every time the VTA hardware design changes. This parameter is used to uniquely identity hardware bitstreams. - ``LOG_BATCH``: Equivalent to A in multiplication of shape (A, B) x (B, C), or typically, the batch dimension of inner tensor computation. - ``LOG_BLOCK``: Equivalent to B and C in multiplication of shape (A, B) x (B, C), or typically, the input/output channel dimensions of the inner tensor computation. - diff --git a/docs/topic/vta/dev/hardware.rst b/docs/topic/vta/dev/hardware.rst index baddb56b23f6..8251278994da 100644 --- a/docs/topic/vta/dev/hardware.rst +++ b/docs/topic/vta/dev/hardware.rst @@ -296,5 +296,3 @@ Load and Store Modules The load and store modules perform 2D DMA loads with a strided access pattern from DRAM to SRAM. In addition, the load module can insert 2D padding on the fly, which is useful when blocking 2D convolution. This means that VTA can tile 2D convolution inputs without paying the overhead of re-laying data out in DRAM to insert spatial padding around input and weight tiles. - - diff --git a/docs/topic/vta/dev/index.rst b/docs/topic/vta/dev/index.rst index 2b715740ed29..753af7a21721 100644 --- a/docs/topic/vta/dev/index.rst +++ b/docs/topic/vta/dev/index.rst @@ -28,4 +28,4 @@ This developer guide details the complete VTA-TVM hardware-software stack. :maxdepth: 2 config - hardware \ No newline at end of file + hardware diff --git a/docs/topic/vta/install.rst b/docs/topic/vta/install.rst index e4b309ea9b61..ba76df410c1f 100644 --- a/docs/topic/vta/install.rst +++ b/docs/topic/vta/install.rst @@ -486,4 +486,3 @@ If you would like to run the full hardware compilation for the ``de10nano`` boar This process might be a bit lengthy, and might take up to half an hour to complete depending on the performance of your PC. The Quartus Prime software would automatically detect the number of cores available on your PC and try to utilize all of them to perform such process. Once the compilation completes, the generated bistream can be found under ``/3rdparty/vta-hw/build/hardware/intel/quartus//export/vta.rbf``. You can also open the Quartus project file (.qpf) available at ``/3rdparty/vta-hw/build/hardware/intel/quartus//de10_nano_top.qpf`` to look around the generated reports. - diff --git a/gallery/how_to/tune_with_autoscheduler/tune_network_cuda.py b/gallery/how_to/tune_with_autoscheduler/tune_network_cuda.py index cc29f27ba22b..a430411fd9ee 100644 --- a/gallery/how_to/tune_with_autoscheduler/tune_network_cuda.py +++ b/gallery/how_to/tune_with_autoscheduler/tune_network_cuda.py @@ -23,7 +23,7 @@ best performance. This is a tutorial on how to tune a whole neural network for NVIDIA GPU with the auto-scheduler. -To auto-tune a neural network, we partition the network into small subgraphs and +To auto-tune a neural network, we partition the network into small subgraphs and tune them independently. Each subgraph is treated as one search task. A task scheduler slices the time and dynamically allocates time resources to these tasks. The task scheduler predicts the impact of each task on the end-to-end diff --git a/gallery/how_to/tune_with_autoscheduler/tune_network_x86.py b/gallery/how_to/tune_with_autoscheduler/tune_network_x86.py index 5a321104c8e4..f8caba075de3 100644 --- a/gallery/how_to/tune_with_autoscheduler/tune_network_x86.py +++ b/gallery/how_to/tune_with_autoscheduler/tune_network_x86.py @@ -24,7 +24,7 @@ best performance. This is a tutorial on how to tune a whole neural network for x86 CPU with the auto-scheduler. -To auto-tune a neural network, we partition the network into small subgraphs and +To auto-tune a neural network, we partition the network into small subgraphs and tune them independently. Each subgraph is treated as one search task. A task scheduler slices the time and dynamically allocates time resources to these tasks. The task scheduler predicts the impact of each task on the end-to-end diff --git a/gallery/how_to/work_with_microtvm/micro_aot.py b/gallery/how_to/work_with_microtvm/micro_aot.py index 9bfe4c39a967..79a72924cc63 100644 --- a/gallery/how_to/work_with_microtvm/micro_aot.py +++ b/gallery/how_to/work_with_microtvm/micro_aot.py @@ -24,8 +24,8 @@ `Alan MacDonald `_ This tutorial is showcasing microTVM host-driven AoT compilation with -a TFLite model. AoTExecutor reduces the overhead of parsing graph at runtime -compared to GraphExecutor. Also, we can have better memory management using ahead +a TFLite model. AoTExecutor reduces the overhead of parsing graph at runtime +compared to GraphExecutor. Also, we can have better memory management using ahead of time compilation. This tutorial can be executed on a x86 CPU using C runtime (CRT) or on Zephyr platform on a microcontroller/board supported by Zephyr. """ diff --git a/gallery/how_to/work_with_pytorch/using_as_torch.py b/gallery/how_to/work_with_pytorch/using_as_torch.py index e17a29e277ea..3528e754fdce 100644 --- a/gallery/how_to/work_with_pytorch/using_as_torch.py +++ b/gallery/how_to/work_with_pytorch/using_as_torch.py @@ -17,7 +17,7 @@ """ Wrap Your TVMScript as PyTorch Module ====================== -**Author**: +**Author**: `Yaoda Zhou `_ This article is a tutorial on wrapping the TVMScript code as the PyTorch module. diff --git a/gallery/how_to/work_with_pytorch/using_optimized_torch.py b/gallery/how_to/work_with_pytorch/using_optimized_torch.py index aa68d9e68ec6..dc6caf5d597c 100644 --- a/gallery/how_to/work_with_pytorch/using_optimized_torch.py +++ b/gallery/how_to/work_with_pytorch/using_optimized_torch.py @@ -17,7 +17,7 @@ """ Compile PyTorch Models ====================== -**Author**: +**Author**: `Yaoda Zhou `_ This article is a tutorial to optimize PyTorch models by using decorator `optimize_torch`. diff --git a/gallery/tutorial/tvmc_python.py b/gallery/tutorial/tvmc_python.py index 9658036a2cc6..0cd4f8ed9b9a 100644 --- a/gallery/tutorial/tvmc_python.py +++ b/gallery/tutorial/tvmc_python.py @@ -20,7 +20,7 @@ **Author**: `Jocelyn Shiue `_ -Hi! Here we explain the scripting tool designed for the complete TVM beginner. 🙂 +Hi! Here we explain the scripting tool designed for the complete TVM beginner. 🙂 Before we get started let's get an example model if you don't already have one. Follow the steps to download a resnet model via the terminal: diff --git a/jvm/conf/log4j.properties b/jvm/conf/log4j.properties index ef523cb7bc4f..5d039e7a61b6 100644 --- a/jvm/conf/log4j.properties +++ b/jvm/conf/log4j.properties @@ -5,9 +5,9 @@ # 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 diff --git a/jvm/core/src/main/java/org/apache/tvm/Base.java b/jvm/core/src/main/java/org/apache/tvm/Base.java index e6fef4153284..f5e677a2e0b3 100644 --- a/jvm/core/src/main/java/org/apache/tvm/Base.java +++ b/jvm/core/src/main/java/org/apache/tvm/Base.java @@ -189,4 +189,3 @@ public TVMError(String err) { private Base() { } } - diff --git a/jvm/core/src/main/java/org/apache/tvm/rpc/ConnectProxyServerProcessor.java b/jvm/core/src/main/java/org/apache/tvm/rpc/ConnectProxyServerProcessor.java index 2a1b3e81c28d..6a9fa010f024 100644 --- a/jvm/core/src/main/java/org/apache/tvm/rpc/ConnectProxyServerProcessor.java +++ b/jvm/core/src/main/java/org/apache/tvm/rpc/ConnectProxyServerProcessor.java @@ -45,8 +45,8 @@ public ConnectProxyServerProcessor(String host, int port, String key) { this.port = port; this.key = "server:" + key; } - - /** + + /** * Set a callback when a connection is received e.g., to record the time for a * watchdog. * @param callback Runnable object. diff --git a/jvm/core/src/test/java/org/apache/tvm/TestUtils.java b/jvm/core/src/test/java/org/apache/tvm/TestUtils.java index 3431bf6c5c5c..9b5c42862925 100644 --- a/jvm/core/src/test/java/org/apache/tvm/TestUtils.java +++ b/jvm/core/src/test/java/org/apache/tvm/TestUtils.java @@ -8,9 +8,9 @@ * 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 diff --git a/licenses/LICENSE.builtin_fp16.txt b/licenses/LICENSE.builtin_fp16.txt index 508c7f7ba7cd..5a79a1b9d5cb 100644 --- a/licenses/LICENSE.builtin_fp16.txt +++ b/licenses/LICENSE.builtin_fp16.txt @@ -308,4 +308,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. \ No newline at end of file +THE SOFTWARE. diff --git a/licenses/LICENSE.cma.txt b/licenses/LICENSE.cma.txt index 4205858e98ca..00028209d171 100644 --- a/licenses/LICENSE.cma.txt +++ b/licenses/LICENSE.cma.txt @@ -19,4 +19,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. \ No newline at end of file +THE SOFTWARE. diff --git a/licenses/LICENSE.concurrentqueue.txt b/licenses/LICENSE.concurrentqueue.txt index 4cd754581b49..b36f9eadc9f9 100644 --- a/licenses/LICENSE.concurrentqueue.txt +++ b/licenses/LICENSE.concurrentqueue.txt @@ -19,4 +19,4 @@ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PRO OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, -EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file +EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/licenses/LICENSE.libbacktrace.txt b/licenses/LICENSE.libbacktrace.txt index 097d2774e5df..e9e256244d69 100644 --- a/licenses/LICENSE.libbacktrace.txt +++ b/licenses/LICENSE.libbacktrace.txt @@ -5,13 +5,13 @@ # met: # (1) Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. +# notice, this list of conditions and the following disclaimer. # (2) Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in # the documentation and/or other materials provided with the -# distribution. - +# distribution. + # (3) The name of the author may not be used to # endorse or promote products derived from this software without # specific prior written permission. diff --git a/licenses/LICENSE.picojson.txt b/licenses/LICENSE.picojson.txt index 5373d53cc8c4..72f355391110 100644 --- a/licenses/LICENSE.picojson.txt +++ b/licenses/LICENSE.picojson.txt @@ -22,4 +22,4 @@ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file +POSSIBILITY OF SUCH DAMAGE. diff --git a/mypy.ini b/mypy.ini index 02564a85469e..4a429b7dadad 100644 --- a/mypy.ini +++ b/mypy.ini @@ -31,4 +31,3 @@ ignore_errors = True [mypy-python.tvm.tir.schedule.*] ignore_errors = False - diff --git a/python/tvm/meta_schedule/testing/torchbench/run.py b/python/tvm/meta_schedule/testing/torchbench/run.py index fe939b2c9ba9..20c633196900 100644 --- a/python/tvm/meta_schedule/testing/torchbench/run.py +++ b/python/tvm/meta_schedule/testing/torchbench/run.py @@ -197,7 +197,7 @@ def parse_args(): type=str, required=True, help=""" - The name of model to run. It should a directory name under + The name of model to run. It should a directory name under https://github.com/pytorch/benchmark/tree/main/torchbenchmark/models. """, ) @@ -228,7 +228,7 @@ def parse_args(): type=int, default=None, help=""" - The max number of trials to run per task extracted in MetaSchedule. + The max number of trials to run per task extracted in MetaSchedule. By default it's the same as --num-trials. """, ) diff --git a/python/tvm/micro/contrib/stm32/emitter.py b/python/tvm/micro/contrib/stm32/emitter.py index 814f98f1b788..af0eb53ad325 100644 --- a/python/tvm/micro/contrib/stm32/emitter.py +++ b/python/tvm/micro/contrib/stm32/emitter.py @@ -569,12 +569,12 @@ def _emit_params_data(self, name, out_h, out_c): f"""\ #ifndef __{name_upper}_DATA_H_ #define __{name_upper}_DATA_H_ - + #include \"ai_runtime_api.h\" AI_API_ENTRY const ai_ptr ai_{name}_data_weights_get (void); - + #endif /* __{name_upper}_DATA_H_ */ """ ) @@ -658,7 +658,7 @@ def _emit_open(self, name, out_h, out_c): f"""\ #ifndef __AI_{name_upper}_H__ #define __AI_{name_upper}_H__ - + #include \"ai_runtime_api.h\" #define _{name_upper}_INPUTS_COUNT_ ({input_size}) @@ -674,7 +674,7 @@ def _emit_open(self, name, out_h, out_c): textwrap.dedent( f"""\ #include - + #include \"dlpack/dlpack.h\" #include \"tvm/runtime/c_runtime_api.h\" #include \"{name}.h\" diff --git a/rust/.rustfmt.toml b/rust/.rustfmt.toml index 5a1f1d27514f..3c51bb384c68 100644 --- a/rust/.rustfmt.toml +++ b/rust/.rustfmt.toml @@ -29,4 +29,3 @@ merge_derives = true use_try_shorthand = false use_field_init_shorthand = false force_explicit_abi = true - diff --git a/src/relay/collage/README.md b/src/relay/collage/README.md index dc56496092cc..945a775e383d 100644 --- a/src/relay/collage/README.md +++ b/src/relay/collage/README.md @@ -20,7 +20,7 @@ The `CollagePartition` pass for finding optimal partitionings of Relay models. See the [RFC](https://github.com/mbs-octoml/mbs-tvm-rfcs/blob/mbs-rfcs-collage/rfcs/xxxx-collage.md). Based on: -> *Collage: Automated Integration of Deep Learning Backends* +> *Collage: Automated Integration of Deep Learning Backends* > Byungsoo Jeon, Sunghyun Park, Peiyuan Liao, Sheng Xu, Tianqi Chen, Zhihao Jia CAUTION: This is a prototype, do not use in prod. diff --git a/src/runtime/crt/host/Makefile b/src/runtime/crt/host/Makefile index f5f9ef8a2af2..d9e87c7d6a41 100644 --- a/src/runtime/crt/host/Makefile +++ b/src/runtime/crt/host/Makefile @@ -29,7 +29,7 @@ CXX ?= ${PREFIX}g++ RANLIB ?= ${PREFIX}ranlib ifeq (${VERBOSE}, 1) -QUIET ?= +QUIET ?= else QUIET ?= @ endif diff --git a/src/runtime/hexagon/README.md b/src/runtime/hexagon/README.md index fed1d33e4245..7e19105a9ce8 100644 --- a/src/runtime/hexagon/README.md +++ b/src/runtime/hexagon/README.md @@ -68,4 +68,3 @@ USE_HEXAGON_SDK=/path/to/sdk ``` As mentioned before, only build the `runtime` component (e.g. `make runtime`). - diff --git a/tests/crt/contrib/stm32/Makefile b/tests/crt/contrib/stm32/Makefile index 293e0e7c7793..b2515b854d4f 100644 --- a/tests/crt/contrib/stm32/Makefile +++ b/tests/crt/contrib/stm32/Makefile @@ -50,7 +50,7 @@ C_SOURCES += $(STM32_RUNTIME_PATH)/ai_runtime_api.c # # Application sources # -C_SOURCES += $(SRC_PATH)/main.c +C_SOURCES += $(SRC_PATH)/main.c vpath %.c $(sort $(dir $(C_SOURCES))) diff --git a/tests/lint/docker-format.sh b/tests/lint/docker-format.sh index 4ce804c83e62..6ee7cf98a661 100755 --- a/tests/lint/docker-format.sh +++ b/tests/lint/docker-format.sh @@ -31,4 +31,4 @@ if git grep "apt-get install" -- ':(exclude)docker/utils/apt-install-and-clear.s exit 1 fi -exit 0 \ No newline at end of file +exit 0 diff --git a/tests/lint/pylint.sh b/tests/lint/pylint.sh index 94fae289b6b9..6b5415987985 100755 --- a/tests/lint/pylint.sh +++ b/tests/lint/pylint.sh @@ -53,4 +53,3 @@ python3 -m pylint tests/python/frontend/oneflow/*.py --rcfile="$(dirname "$0")"/ python3 -m pylint tests/python/frontend/tensorflow/test_forward.py --rcfile="$(dirname "$0")"/pylintrc python3 -m pylint tests/python/frontend/pytorch/test_forward.py --rcfile="$(dirname "$0")"/pylintrc python3 -m pylint tests/python/frontend/tflite/test_forward.py --rcfile="$(dirname "$0")"/pylintrc - diff --git a/tests/lint/trailing_newlines.py b/tests/lint/trailing_newlines.py new file mode 100755 index 000000000000..2ace6a138749 --- /dev/null +++ b/tests/lint/trailing_newlines.py @@ -0,0 +1,51 @@ +#!/usr/bin/env python3 +# 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. + +import fileinput +import os + + +def has_one_trailing_newline(filename: str) -> bool: + """ + Returns True if 'filename' has a single trailing newline + """ + with open(filename, "rb") as f: + start_bytes = len(f.read(2)) + if start_bytes == 0: + # empty file + return True + elif start_bytes == 1: + # 1 byte file + return False + else: + # skip to the end + f.seek(-2, os.SEEK_END) + end_bytes = f.read(2) + + # should be a non-newline followed by a newline + return end_bytes[0] != ord("\n") and end_bytes[1] == ord("\n") + + +if __name__ == "__main__": + exit_code = 1 + for line in fileinput.input(): + filename = line.rstrip() + if not has_one_trailing_newline(filename): + exit_code = 0 + print(filename) + exit(exit_code) diff --git a/tests/lint/whitespace.sh b/tests/lint/whitespace.sh new file mode 100755 index 000000000000..78375ed58bdb --- /dev/null +++ b/tests/lint/whitespace.sh @@ -0,0 +1,39 @@ +#!/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. + +set -euo pipefail + +status=0 + +if git --no-pager grep -Il '' -- . | ./tests/lint/trailing_newlines.py; then + echo "The above files are missing a trailing newline or have too many trailing newlines" + status=1 +fi + +if git --no-pager grep -In '[[:blank:]]$' -- .; then + echo "The above files have trailing spaces" + status=1 +fi + +if [ $status == "1" ]; then + echo "Found whitespace lint failures, 'pre-commit run --all-files' can auto-correct them" + exit 1 +else + echo "Found no whitespace lint failures" + exit 0 +fi diff --git a/tests/python/ci/sample_prs/pr10786.json b/tests/python/ci/sample_prs/pr10786.json index 79f20ca6094b..688025d45cfe 100644 --- a/tests/python/ci/sample_prs/pr10786.json +++ b/tests/python/ci/sample_prs/pr10786.json @@ -126,4 +126,4 @@ } ] } - } \ No newline at end of file + } diff --git a/tests/python/contrib/test_ethosu/infra.py b/tests/python/contrib/test_ethosu/infra.py index 315c2367c82a..b2bbcd377b84 100644 --- a/tests/python/contrib/test_ethosu/infra.py +++ b/tests/python/contrib/test_ethosu/infra.py @@ -148,7 +148,7 @@ def create_test_runner( __attribute__((section(".bss.noinit.tvm"), aligned(16))) static uint8_t {pool.pool_name}[{_get_workspace_size_define_macro(pool.pool_name)}]; #endif - + """ ) diff --git a/tests/python/contrib/test_ethosu/test_create_tiles.py b/tests/python/contrib/test_ethosu/test_create_tiles.py index ffb828d9108a..77b69df91116 100644 --- a/tests/python/contrib/test_ethosu/test_create_tiles.py +++ b/tests/python/contrib/test_ethosu/test_create_tiles.py @@ -53,8 +53,8 @@ def main(placeholder1: T.Buffer[(100,), "int8"], placeholder2: T.Buffer[(100,), for i0 in T.serial(0, 1): for i1 in T.serial(0, 6): for i2 in T.serial(0, 1): - for i3 in T.serial(0, 1): - for i4 in T.serial(0, 16): + for i3 in T.serial(0, 1): + for i4 in T.serial(0, 16): placeholder1[((i1*16) + i4)] = placeholder2[((T.floormod((i1 + 4), 6)*16) + i4)] __tvm_meta__ = None @@ -84,8 +84,8 @@ def main(placeholder1: T.Buffer[(100,), "int8"], placeholder2: T.Buffer[(100,), for i0 in T.serial(0, 1): for i1 in T.serial(0, 1): for i2 in T.serial(0, 1): - for i3 in T.serial(0, 6): - for i4 in T.serial(0, 16): + for i3 in T.serial(0, 6): + for i4 in T.serial(0, 16): placeholder1[((i3*16) + i4)] = placeholder2[((T.floormod((i3 + 4), 6)*16) + i4)] __tvm_meta__ = None @@ -115,8 +115,8 @@ def main(placeholder1: T.Buffer[(100,), "int8"], placeholder2: T.Buffer[(100,), for i0 in T.serial(0, 1): for i1 in T.serial(0, 6): for i2 in T.serial(0, 1): - for i3 in T.serial(0, 1): - for i4 in T.serial(0, 16): + for i3 in T.serial(0, 1): + for i4 in T.serial(0, 16): placeholder1[((i1*16) + i4)] = placeholder2[((T.floormod((i1 + 4), 6)*8) + i4)] __tvm_meta__ = None @@ -146,7 +146,7 @@ def main(placeholder1: T.Buffer[(100,), "int8"], placeholder2: T.Buffer[(100,), for i0 in T.serial(0, 1): for i1 in T.serial(0, 5): for i2 in T.serial(0, 6): - for i3 in T.serial(0, 4): + for i3 in T.serial(0, 4): placeholder1[(((i1*24) + (i2*4)) + i3)] = placeholder2[(((((T.floordiv((i1 - 1), 2)*48) + (T.floormod((i1 + 1), 2)*24)) + (i2*4)) + i3) + 96)] __tvm_meta__ = None diff --git a/tests/python/contrib/test_ethosu/test_layout_optimizer.py b/tests/python/contrib/test_ethosu/test_layout_optimizer.py index eec963af7f35..4e134c9f4df0 100644 --- a/tests/python/contrib/test_ethosu/test_layout_optimizer.py +++ b/tests/python/contrib/test_ethosu/test_layout_optimizer.py @@ -381,7 +381,7 @@ def get_graph(): def test_multiple_outputs(): """Test the layout optimization pass works as expected when there are multiple outputs in the graph. - + pool_1 / | \ pool_2 pool_3 pool_4 diff --git a/tests/python/contrib/test_ethosu/test_lut_optimizer.py b/tests/python/contrib/test_ethosu/test_lut_optimizer.py index 87e625741b6c..12b6ed70d8ed 100644 --- a/tests/python/contrib/test_ethosu/test_lut_optimizer.py +++ b/tests/python/contrib/test_ethosu/test_lut_optimizer.py @@ -14,7 +14,7 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -"""Test the pass that removes unnecssary identity operation if the identity +"""Test the pass that removes unnecssary identity operation if the identity uses LUT and the preceding operator is LUT capable and doesn't already have a LUT. """ import pytest diff --git a/tests/python/contrib/test_hexagon/README.md b/tests/python/contrib/test_hexagon/README.md index a2b108f7a4ed..665ff9aa73ce 100644 --- a/tests/python/contrib/test_hexagon/README.md +++ b/tests/python/contrib/test_hexagon/README.md @@ -90,7 +90,7 @@ make -j2 # Build Hexagon API cd .. -./tests/scripts/task_build_hexagon_api.sh +./tests/scripts/task_build_hexagon_api.sh ``` Now that you have built required tools, you can jump to [run test examples](#run-tests). diff --git a/tests/python/contrib/test_hexagon/conv2d/README.md b/tests/python/contrib/test_hexagon/conv2d/README.md index 674e1af6029f..d29d8b9c8604 100644 --- a/tests/python/contrib/test_hexagon/conv2d/README.md +++ b/tests/python/contrib/test_hexagon/conv2d/README.md @@ -34,4 +34,4 @@ High Level Notes: [Conv2d](test_conv2d_blocked.md) -[Conv2d -> Conv2d](test_conv2d_conv2d.md) \ No newline at end of file +[Conv2d -> Conv2d](test_conv2d_conv2d.md) diff --git a/tests/python/contrib/test_hexagon/conv2d/test_conv2d_blocked.md b/tests/python/contrib/test_hexagon/conv2d/test_conv2d_blocked.md index 6250f99efc9d..417ce0b12310 100644 --- a/tests/python/contrib/test_hexagon/conv2d/test_conv2d_blocked.md +++ b/tests/python/contrib/test_hexagon/conv2d/test_conv2d_blocked.md @@ -44,7 +44,7 @@ pytest -sv "tests/python/contrib/test_hexagon/test_conv2d_blocked.py::TestConv2d ## To Do * n/a - + ## Annotated TIR ``` @@ -68,7 +68,7 @@ primfn(input_handle: handle, filter_handle: handle, output_handle: handle) -> () for (hi: int32, 0, 8) { for (wi: int32, 0, 8) { for (ci: int32, 0, 32) { - input.cache[(((((wo*4096) + (co*2048)) + (hi*256)) + (wi*32)) + ci)] = + input.cache[(((((wo*4096) + (co*2048)) + (hi*256)) + (wi*32)) + ci)] = (float32*)input_pointer[((((((ho.outer*32768) + (hi*4096)) + (wo*512)) + (wi*64)) + (co*32)) + ci)] } } @@ -81,7 +81,7 @@ primfn(input_handle: handle, filter_handle: handle, output_handle: handle) -> () for (ci8: int32, 0, 8) { for (ki: int32, 0, 32) { for (ci4: int32, 0, 4) { - filter.cache[((((co*1024) + (ci8*128)) + (ki*4)) + ci4)] = + filter.cache[((((co*1024) + (ci8*128)) + (ki*4)) + ci4)] = (float32*)filter_pointer[(((((ko.outer*2048) + (co*1024)) + (ci8*128)) + (ki*4)) + ci4)] } } @@ -106,9 +106,9 @@ primfn(input_handle: handle, filter_handle: handle, output_handle: handle) -> () for (wi.c: int32, 0, 8) { for (ki.c: int32, 0, 32) { for (rc.inner: int32, 0, 32) { - output.cache[((((wo.c*2048) + (hi.c*256)) + (wi.c*32)) + ki.c)] = + output.cache[((((wo.c*2048) + (hi.c*256)) + (wi.c*32)) + ki.c)] = ( - (float32*)output.cache[((((wo.c*2048) + (hi.c*256)) + (wi.c*32)) + ki.c)] + + (float32*)output.cache[((((wo.c*2048) + (hi.c*256)) + (wi.c*32)) + ki.c)] + ( (float32*)input.cache[(((((wo.c*4096) + (rc.outer*2048)) + (hi.c*256)) + (wi.c*32)) + rc.inner)] * (float32*)filter.cache[((((rc.outer*1024) + (floordiv(rc.inner, 4)*128)) + (ki.c*4)) + floormod(rc.inner, 4))] @@ -126,7 +126,7 @@ primfn(input_handle: handle, filter_handle: handle, output_handle: handle) -> () for (hi: int32, 0, 8) { for (wi: int32, 0, 8) { for (ki: int32, 0, 32) { - output_pointer[((((((ho.outer*65536) + (wo*8192)) + (ko.outer*2048)) + (hi*256)) + (wi*32)) + ki)] = + output_pointer[((((((ho.outer*65536) + (wo*8192)) + (ko.outer*2048)) + (hi*256)) + (wi*32)) + ki)] = (float32*)output.cache[((((wo*2048) + (hi*256)) + (wi*32)) + ki)] } } @@ -215,7 +215,7 @@ primfn(input_handle: handle, filter_handle: handle, output_handle: handle) -> () // output cache grows by factor of h_split * k_split = 4 allocate(output.cache: Pointer(global float32), float32, [65536]), storage_scope = global; - + // ko.outer = outer loop split on ko using k_split factor for (ko.outer: int32, 0, 2) { // ho.outer = outer loop split on ho using h_split factor @@ -229,7 +229,7 @@ primfn(input_handle: handle, filter_handle: handle, output_handle: handle) -> () for (hi: int32, 0, 8) { for (wi: int32, 0, 8) { for (ci: int32, 0, 32) { - input.cache[((((((ho.inner*32768) + (wo*4096)) + (co*2048)) + (hi*256)) + (wi*32)) + ci)] = + input.cache[((((((ho.inner*32768) + (wo*4096)) + (co*2048)) + (hi*256)) + (wi*32)) + ci)] = (float32*)input_pointer[(((((((ho.outer*65536) + (ho.inner*32768)) + (hi*4096)) + (wo*512)) + (wi*64)) + (co*32)) + ci)] } } @@ -244,7 +244,7 @@ primfn(input_handle: handle, filter_handle: handle, output_handle: handle) -> () for (ci8: int32, 0, 8) { for (ki: int32, 0, 32) { for (ci4: int32, 0, 4) { - filter.cache[(((((ko.inner*2048) + (co*1024)) + (ci8*128)) + (ki*4)) + ci4)] = + filter.cache[(((((ko.inner*2048) + (co*1024)) + (ci8*128)) + (ki*4)) + ci4)] = (float32*)filter_pointer[((((((ko.outer*4096) + (ko.inner*2048)) + (co*1024)) + (ci8*128)) + (ki*4)) + ci4)] } } @@ -272,9 +272,9 @@ primfn(input_handle: handle, filter_handle: handle, output_handle: handle) -> () for (wi.c: int32, 0, 8) { for (ki.c: int32, 0, 32) { for (rc.inner: int32, 0, 32) { - output.cache[((((((ho.c.inner*32768) + (wo.c*4096)) + (ko.c.inner*2048)) + (hi.c*256)) + (wi.c*32)) + ki.c)] = + output.cache[((((((ho.c.inner*32768) + (wo.c*4096)) + (ko.c.inner*2048)) + (hi.c*256)) + (wi.c*32)) + ki.c)] = ( - (float32*)output.cache[((((((ho.c.inner*32768) + (wo.c*4096)) + (ko.c.inner*2048)) + (hi.c*256)) + (wi.c*32)) + ki.c)] + + (float32*)output.cache[((((((ho.c.inner*32768) + (wo.c*4096)) + (ko.c.inner*2048)) + (hi.c*256)) + (wi.c*32)) + ki.c)] + ( (float32*)input.cache[((((((ho.c.inner*32768) + (wo.c*4096)) + (rc.outer*2048)) + (hi.c*256)) + (wi.c*32)) + rc.inner)] * (float32*)filter.cache[(((((ko.c.inner*2048) + (rc.outer*1024)) + (floordiv(rc.inner, 4)*128)) + (ki.c*4)) + floormod(rc.inner, 4))] @@ -296,7 +296,7 @@ primfn(input_handle: handle, filter_handle: handle, output_handle: handle) -> () for (hi: int32, 0, 8) { for (wi: int32, 0, 8) { for (ki: int32, 0, 32) { - output_pointer[((((((((ho.outer*131072) + (ho.inner*65536)) + (wo*8192)) + (ko.outer*4096)) + (ko.inner*2048)) + (hi*256)) + (wi*32)) + ki)] = + output_pointer[((((((((ho.outer*131072) + (ho.inner*65536)) + (wo*8192)) + (ko.outer*4096)) + (ko.inner*2048)) + (hi*256)) + (wi*32)) + ki)] = (float32*)output.cache[((((((ho.inner*32768) + (wo*4096)) + (ko.inner*2048)) + (hi*256)) + (wi*32)) + ki)] } } @@ -414,7 +414,7 @@ primfn(input_handle: handle, filter_handle: handle, output_handle: handle) -> () for (hi: int32, 0, 8) { for (wi: int32, 0, 8) { for (ci: int32, 0, 32) { - input.cache[((((((ho.inner*32768) + (wo*4096)) + (co*2048)) + (hi*256)) + (wi*32)) + ci)] = + input.cache[((((((ho.inner*32768) + (wo*4096)) + (co*2048)) + (hi*256)) + (wi*32)) + ci)] = (float32*)input_pointer[(((((((ho.outer*65536) + (ho.inner*32768)) + (hi*4096)) + (wo*512)) + (wi*64)) + (co*32)) + ci)] } } @@ -431,7 +431,7 @@ primfn(input_handle: handle, filter_handle: handle, output_handle: handle) -> () for (ci8: int32, 0, 8) { for (ki: int32, 0, 32) { for (ci4: int32, 0, 4) { - filter.cache[(((((((ko.inner*18432) + (co*9216)) + (rh*3072)) + (rw*1024)) + (ci8*128)) + (ki*4)) + ci4)] = + filter.cache[(((((((ko.inner*18432) + (co*9216)) + (rh*3072)) + (rw*1024)) + (ci8*128)) + (ki*4)) + ci4)] = (float32*)filter_pointer[((((((((ko.outer*36864) + (ko.inner*18432)) + (co*9216)) + (rh*3072)) + (rw*1024)) + (ci8*128)) + (ki*4)) + ci4)] } } @@ -457,9 +457,9 @@ primfn(input_handle: handle, filter_handle: handle, output_handle: handle) -> () for (rw: int32, 0, 3) { for (ki.c: int32, 0, 32) { for (rc.inner: int32, 0, 32) { - output.cache[((((((ho.c.inner*32768) + (wo.c*4096)) + (ko.c.inner*2048)) + (hi.c*256)) + (wi.c*32)) + ki.c)] = + output.cache[((((((ho.c.inner*32768) + (wo.c*4096)) + (ko.c.inner*2048)) + (hi.c*256)) + (wi.c*32)) + ki.c)] = ( - (float32*)output.cache[((((((ho.c.inner*32768) + (wo.c*4096)) + (ko.c.inner*2048)) + (hi.c*256)) + (wi.c*32)) + ki.c)] + + (float32*)output.cache[((((((ho.c.inner*32768) + (wo.c*4096)) + (ko.c.inner*2048)) + (hi.c*256)) + (wi.c*32)) + ki.c)] + ( (float32*)input.cache[((((((((floordiv((hi.c + rh), 8)*32768) + (ho.c.inner*32768)) + (floordiv((wi.c + rw), 8)*4096)) + (wo.c*4096)) + (rc.outer*2048)) + (floormod((hi.c + rh), 8)*256)) + (floormod((wi.c + rw), 8)*32)) + rc.inner)] * (float32*)filter.cache[(((((((ko.c.inner*18432) + (rc.outer*9216)) + (rh*3072)) + (rw*1024)) + (floordiv(rc.inner, 4)*128)) + (ki.c*4)) + floormod(rc.inner, 4))] @@ -481,14 +481,14 @@ primfn(input_handle: handle, filter_handle: handle, output_handle: handle) -> () for (hi: int32, 0, 8) { for (wi: int32, 0, 8) { for (ki: int32, 0, 32) { - output_pointer[((((((((ho.outer*131072) + (ho.inner*65536)) + (wo*8192)) + (ko.outer*4096)) + (ko.inner*2048)) + (hi*256)) + (wi*32)) + ki)] = + output_pointer[((((((((ho.outer*131072) + (ho.inner*65536)) + (wo*8192)) + (ko.outer*4096)) + (ko.inner*2048)) + (hi*256)) + (wi*32)) + ki)] = (float32*)output.cache[((((((ho.inner*32768) + (wo*4096)) + (ko.inner*2048)) + (hi*256)) + (wi*32)) + ki)] } } } } - } // end ho.inner + } // end ho.inner } // end ko.inner } // end ho.outer } // end ko.outer -}``` \ No newline at end of file +}``` diff --git a/tests/python/contrib/test_hexagon/conv2d/test_conv2d_conv2d.md b/tests/python/contrib/test_hexagon/conv2d/test_conv2d_conv2d.md index f7e3061c2230..61c1241c6792 100644 --- a/tests/python/contrib/test_hexagon/conv2d/test_conv2d_conv2d.md +++ b/tests/python/contrib/test_hexagon/conv2d/test_conv2d_conv2d.md @@ -179,7 +179,7 @@ primfn(placeholder_3: handle, placeholder_4: handle, placeholder_5: handle, outp for (hi: int32, 0, 8) { for (wi: int32, 0, 8) { for (ci: int32, 0, 32) { - packed_input.global[(((((wo*8192) + (co*2048)) + (hi*256)) + (wi*32)) + ci)] = + packed_input.global[(((((wo*8192) + (co*2048)) + (hi*256)) + (wi*32)) + ci)] = (float32*)placeholder_8[((((((ho.outer*65536) + (hi*8192)) + (wo*1024)) + (wi*128)) + (co*32)) + ci)] } } @@ -195,7 +195,7 @@ primfn(placeholder_3: handle, placeholder_4: handle, placeholder_5: handle, outp for (cio: int32, 0, 8) { for (ki: int32, 0, 32) { for (cii: int32, 0, 4) { - packed_filter.global[((((co*1024) + (cio*128)) + (ki*4)) + cii)] = + packed_filter.global[((((co*1024) + (cio*128)) + (ki*4)) + cii)] = (float32*)placeholder_7[(((((ko.outer_1*4096) + (co*1024)) + (cio*128)) + (ki*4)) + cii)] } } @@ -220,9 +220,9 @@ primfn(placeholder_3: handle, placeholder_4: handle, placeholder_5: handle, outp for (wi: int32, 0, 8) { for (ki: int32, 0, 32) { for (rc.inner: int32, 0, 32) { - temp_output[(((((wo*8192) + (ko.outer_1*2048)) + (hi*256)) + (wi*32)) + ki)] = + temp_output[(((((wo*8192) + (ko.outer_1*2048)) + (hi*256)) + (wi*32)) + ki)] = ( - (float32*)temp_output[(((((wo*8192) + (ko.outer_1*2048)) + (hi*256)) + (wi*32)) + ki)] + + (float32*)temp_output[(((((wo*8192) + (ko.outer_1*2048)) + (hi*256)) + (wi*32)) + ki)] + ( (float32*)packed_input.global[(((((wo*8192) + (rc.outer*2048)) + (hi*256)) + (wi*32)) + rc.inner)] * (float32*)packed_filter.global[((((rc.outer*1024) + (floordiv(rc.inner, 4)*128)) + (ki*4)) + floormod(rc.inner, 4))] @@ -242,7 +242,7 @@ primfn(placeholder_3: handle, placeholder_4: handle, placeholder_5: handle, outp for (cio: int32, 0, 8) { for (ki: int32, 0, 32) { for (cii: int32, 0, 4) { - packed_filter.global[((((co*1024) + (cio*128)) + (ki*4)) + cii)] = + packed_filter.global[((((co*1024) + (cio*128)) + (ki*4)) + cii)] = (float32*)placeholder_6[(((((ko.outer*4096) + (co*1024)) + (cio*128)) + (ki*4)) + cii)] } } @@ -268,9 +268,9 @@ primfn(placeholder_3: handle, placeholder_4: handle, placeholder_5: handle, outp for (wi.c: int32, 0, 8) { for (ki.c: int32, 0, 32) { for (rc.inner_1: int32, 0, 32) { - packed_input.global[((((wo.c*2048) + (hi.c*256)) + (wi.c*32)) + ki.c)] = + packed_input.global[((((wo.c*2048) + (hi.c*256)) + (wi.c*32)) + ki.c)] = ( - (float32*)packed_input.global[((((wo.c*2048) + (hi.c*256)) + (wi.c*32)) + ki.c)] + + (float32*)packed_input.global[((((wo.c*2048) + (hi.c*256)) + (wi.c*32)) + ki.c)] + ( (float32*)temp_output[(((((wo.c*8192) + (rc.outer_1*2048)) + (hi.c*256)) + (wi.c*32)) + rc.inner_1)] * (float32*)packed_filter.global[((((rc.outer_1*1024) + (floordiv(rc.inner_1, 4)*128)) + (ki.c*4)) + floormod(rc.inner_1, 4))] @@ -288,7 +288,7 @@ primfn(placeholder_3: handle, placeholder_4: handle, placeholder_5: handle, outp for (hi_1: int32, 0, 8) { for (wi_1: int32, 0, 8) { for (ki_1: int32, 0, 32) { - output_2[((((((ho.outer*65536) + (wo_1*8192)) + (ko.outer*2048)) + (hi_1*256)) + (wi_1*32)) + ki_1)] = + output_2[((((((ho.outer*65536) + (wo_1*8192)) + (ko.outer*2048)) + (hi_1*256)) + (wi_1*32)) + ki_1)] = (float32*)packed_input.global[((((wo_1*2048) + (hi_1*256)) + (wi_1*32)) + ki_1)] } } @@ -477,7 +477,7 @@ primfn(placeholder_3: handle, placeholder_4: handle, placeholder_5: handle, outp for (hi: int32, 0, 8) { for (wi: int32, 0, 8) { for (ci: int32, 0, 32) { - packed_input.global[((((((ho.inner*65536) + (wo*8192)) + (co*2048)) + (hi*256)) + (wi*32)) + ci)] = + packed_input.global[((((((ho.inner*65536) + (wo*8192)) + (co*2048)) + (hi*256)) + (wi*32)) + ci)] = (float32*)placeholder_8[(((((((ho.outer*131072) + (ho.inner*65536)) + (hi*8192)) + (wo*1024)) + (wi*128)) + (co*32)) + ci)] } } @@ -495,7 +495,7 @@ primfn(placeholder_3: handle, placeholder_4: handle, placeholder_5: handle, outp for (cio: int32, 0, 8) { for (ki: int32, 0, 32) { for (cii: int32, 0, 4) { - packed_filter.global[(((((ko.inner*4096) + (co*1024)) + (cio*128)) + (ki*4)) + cii)] = + packed_filter.global[(((((ko.inner*4096) + (co*1024)) + (cio*128)) + (ki*4)) + cii)] = (float32*)placeholder_7[((((((ko.outer_1*8192) + (ko.inner*4096)) + (co*1024)) + (cio*128)) + (ki*4)) + cii)] } } @@ -523,9 +523,9 @@ primfn(placeholder_3: handle, placeholder_4: handle, placeholder_5: handle, outp for (wi: int32, 0, 8) { for (ki: int32, 0, 32) { for (rc.inner: int32, 0, 32) { - temp_output[(((((((ho.inner*65536) + (wo*8192)) + (ko.outer_1*4096)) + (ko.inner*2048)) + (hi*256)) + (wi*32)) + ki)] = + temp_output[(((((((ho.inner*65536) + (wo*8192)) + (ko.outer_1*4096)) + (ko.inner*2048)) + (hi*256)) + (wi*32)) + ki)] = ( - (float32*)temp_output[(((((((ho.inner*65536) + (wo*8192)) + (ko.outer_1*4096)) + (ko.inner*2048)) + (hi*256)) + (wi*32)) + ki)] + + (float32*)temp_output[(((((((ho.inner*65536) + (wo*8192)) + (ko.outer_1*4096)) + (ko.inner*2048)) + (hi*256)) + (wi*32)) + ki)] + ( (float32*)packed_input.global[((((((ho.inner*65536) + (wo*8192)) + (rc.outer*2048)) + (hi*256)) + (wi*32)) + rc.inner)] * (float32*)packed_filter.global[(((((ko.inner*4096) + (rc.outer*1024)) + (floordiv(rc.inner, 4)*128)) + (ki*4)) + floormod(rc.inner, 4))] @@ -548,7 +548,7 @@ primfn(placeholder_3: handle, placeholder_4: handle, placeholder_5: handle, outp for (cio: int32, 0, 8) { for (ki: int32, 0, 32) { for (cii: int32, 0, 4) { - packed_filter.global[(((((ko.inner*4096) + (co*1024)) + (cio*128)) + (ki*4)) + cii)] = + packed_filter.global[(((((ko.inner*4096) + (co*1024)) + (cio*128)) + (ki*4)) + cii)] = (float32*)placeholder_6[((((((ko.outer*8192) + (ko.inner*4096)) + (co*1024)) + (cio*128)) + (ki*4)) + cii)] } } @@ -577,9 +577,9 @@ primfn(placeholder_3: handle, placeholder_4: handle, placeholder_5: handle, outp for (wi.c: int32, 0, 8) { for (ki.c: int32, 0, 32) { for (rc.inner_1: int32, 0, 32) { - packed_input.global[((((((ho.c.inner*32768) + (wo.c*4096)) + (ko.c.inner*2048)) + (hi.c*256)) + (wi.c*32)) + ki.c)] = + packed_input.global[((((((ho.c.inner*32768) + (wo.c*4096)) + (ko.c.inner*2048)) + (hi.c*256)) + (wi.c*32)) + ki.c)] = ( - (float32*)packed_input.global[((((((ho.c.inner*32768) + (wo.c*4096)) + (ko.c.inner*2048)) + (hi.c*256)) + (wi.c*32)) + ki.c)] + + (float32*)packed_input.global[((((((ho.c.inner*32768) + (wo.c*4096)) + (ko.c.inner*2048)) + (hi.c*256)) + (wi.c*32)) + ki.c)] + ( (float32*)temp_output[((((((ho.c.inner*65536) + (wo.c*8192)) + (rc.outer_1*2048)) + (hi.c*256)) + (wi.c*32)) + rc.inner_1)] * (float32*)packed_filter.global[(((((ko.c.inner*4096) + (rc.outer_1*1024)) + (floordiv(rc.inner_1, 4)*128)) + (ki.c*4)) + floormod(rc.inner_1, 4))] @@ -601,7 +601,7 @@ primfn(placeholder_3: handle, placeholder_4: handle, placeholder_5: handle, outp for (hi_1: int32, 0, 8) { for (wi_1: int32, 0, 8) { for (ki_1: int32, 0, 32) { - output_2[((((((((ho.outer*131072) + (ho.inner_1*65536)) + (wo_1*8192)) + (ko.outer*4096)) + (ko.inner_1*2048)) + (hi_1*256)) + (wi_1*32)) + ki_1)] = + output_2[((((((((ho.outer*131072) + (ho.inner_1*65536)) + (wo_1*8192)) + (ko.outer*4096)) + (ko.inner_1*2048)) + (hi_1*256)) + (wi_1*32)) + ki_1)] = (float32*)packed_input.global[((((((ho.inner_1*32768) + (wo_1*4096)) + (ko.inner_1*2048)) + (hi_1*256)) + (wi_1*32)) + ki_1)] } } @@ -827,7 +827,7 @@ primfn(placeholder_3: handle, placeholder_4: handle, placeholder_5: handle, outp for (hi: int32, 0, 8) { for (wi: int32, 0, 8) { for (ci: int32, 0, 32) { - packed_input.global[((((((ho.inner*65536) + (wo*8192)) + (co*2048)) + (hi*256)) + (wi*32)) + ci)] = + packed_input.global[((((((ho.inner*65536) + (wo*8192)) + (co*2048)) + (hi*256)) + (wi*32)) + ci)] = (float32*)placeholder_8[((((((((ho.outer_1*131072) + (ho.outer*131072)) + (ho.inner*65536)) + (hi*8192)) + (wo*1024)) + (wi*128)) + (co*32)) + ci)] } } @@ -845,7 +845,7 @@ primfn(placeholder_3: handle, placeholder_4: handle, placeholder_5: handle, outp for (cio: int32, 0, 8) { for (ki: int32, 0, 32) { for (cii: int32, 0, 4) { - packed_filter.global[(((((((ko.inner*36864) + (co*9216)) + (rh*3072)) + (rw*1024)) + (cio*128)) + (ki*4)) + cii)] = + packed_filter.global[(((((((ko.inner*36864) + (co*9216)) + (rh*3072)) + (rw*1024)) + (cio*128)) + (ki*4)) + cii)] = (float32*)placeholder_7[((((((((ko.outer_1*73728) + (ko.inner*36864)) + (co*9216)) + (rh*3072)) + (rw*1024)) + (cio*128)) + (ki*4)) + cii)] } } @@ -881,9 +881,9 @@ primfn(placeholder_3: handle, placeholder_4: handle, placeholder_5: handle, outp for (rw: int32, 0, 3) { for (ki: int32, 0, 32) { for (rc.inner: int32, 0, 32) { - temp_output[((((((((ho.outer_1*131072) + (ho.inner*65536)) + (wo*8192)) + (ko.outer_1*4096)) + (ko.inner*2048)) + (hi*256)) + (wi*32)) + ki)] = + temp_output[((((((((ho.outer_1*131072) + (ho.inner*65536)) + (wo*8192)) + (ko.outer_1*4096)) + (ko.inner*2048)) + (hi*256)) + (wi*32)) + ki)] = ( - (float32*)temp_output[((((((((ho.outer_1*131072) + (ho.inner*65536)) + (wo*8192)) + (ko.outer_1*4096)) + (ko.inner*2048)) + (hi*256)) + (wi*32)) + ki)] + + (float32*)temp_output[((((((((ho.outer_1*131072) + (ho.inner*65536)) + (wo*8192)) + (ko.outer_1*4096)) + (ko.inner*2048)) + (hi*256)) + (wi*32)) + ki)] + ( (float32*)packed_input.global[((((((((floordiv((hi + rh), 8)*65536) + (ho.inner*65536)) + (floordiv((wi + rw), 8)*8192)) + (wo*8192)) + (rc.outer*2048)) + (floormod((hi + rh), 8)*256)) + (floormod((wi + rw), 8)*32)) + rc.inner)] * (float32*)packed_filter.global[(((((((ko.inner*36864) + (rc.outer*9216)) + (rh*3072)) + (rw*1024)) + (floordiv(rc.inner, 4)*128)) + (ki*4)) + floormod(rc.inner, 4))] @@ -913,7 +913,7 @@ primfn(placeholder_3: handle, placeholder_4: handle, placeholder_5: handle, outp for (cio: int32, 0, 8) { for (ki: int32, 0, 32) { for (cii: int32, 0, 4) { - packed_filter.global[(((((((ko.inner*36864) + (co*9216)) + (rh*3072)) + (rw*1024)) + (cio*128)) + (ki*4)) + cii)] = + packed_filter.global[(((((((ko.inner*36864) + (co*9216)) + (rh*3072)) + (rw*1024)) + (cio*128)) + (ki*4)) + cii)] = (float32*)placeholder_6[((((((((ko.outer*73728) + (ko.inner*36864)) + (co*9216)) + (rh*3072)) + (rw*1024)) + (cio*128)) + (ki*4)) + cii)] } } @@ -946,9 +946,9 @@ primfn(placeholder_3: handle, placeholder_4: handle, placeholder_5: handle, outp for (rw_1: int32, 0, 3) { for (ki.c: int32, 0, 32) { for (rc.inner_1: int32, 0, 32) { - packed_input.global[((((((ho.c.inner*32768) + (wo.c*4096)) + (ko.c.inner*2048)) + (hi.c*256)) + (wi.c*32)) + ki.c)] = + packed_input.global[((((((ho.c.inner*32768) + (wo.c*4096)) + (ko.c.inner*2048)) + (hi.c*256)) + (wi.c*32)) + ki.c)] = ( - (float32*)packed_input.global[((((((ho.c.inner*32768) + (wo.c*4096)) + (ko.c.inner*2048)) + (hi.c*256)) + (wi.c*32)) + ki.c)] + + (float32*)packed_input.global[((((((ho.c.inner*32768) + (wo.c*4096)) + (ko.c.inner*2048)) + (hi.c*256)) + (wi.c*32)) + ki.c)] + ( (float32*)temp_output[((((((((floordiv((hi.c + rh_1), 8)*65536) + (ho.c.inner*65536)) + (floordiv((wi.c + rw_1), 8)*8192)) + (wo.c*8192)) + (rc.outer_1*2048)) + (floormod((hi.c + rh_1), 8)*256)) + (floormod((wi.c + rw_1), 8)*32)) + rc.inner_1)] * (float32*)packed_filter.global[(((((((ko.c.inner*36864) + (rc.outer_1*9216)) + (rh_1*3072)) + (rw_1*1024)) + (floordiv(rc.inner_1, 4)*128)) + (ki.c*4)) + floormod(rc.inner_1, 4))] @@ -972,7 +972,7 @@ primfn(placeholder_3: handle, placeholder_4: handle, placeholder_5: handle, outp for (hi_1: int32, 0, 8) { for (wi_1: int32, 0, 8) { for (ki_1: int32, 0, 32) { - output_2[((((((((ho.outer*131072) + (ho.inner_1*65536)) + (wo_1*8192)) + (ko.outer*4096)) + (ko.inner_1*2048)) + (hi_1*256)) + (wi_1*32)) + ki_1)] = + output_2[((((((((ho.outer*131072) + (ho.inner_1*65536)) + (wo_1*8192)) + (ko.outer*4096)) + (ko.inner_1*2048)) + (hi_1*256)) + (wi_1*32)) + ki_1)] = (float32*)packed_input.global[((((((ho.inner_1*32768) + (wo_1*4096)) + (ko.inner_1*2048)) + (hi_1*256)) + (wi_1*32)) + ki_1)] } } @@ -983,4 +983,4 @@ primfn(placeholder_3: handle, placeholder_4: handle, placeholder_5: handle, outp } } } -``` \ No newline at end of file +``` diff --git a/tests/python/contrib/test_hexagon/test_parallel_hvx.py b/tests/python/contrib/test_hexagon/test_parallel_hvx.py index 6ebe03d4e6b1..046f949a761f 100644 --- a/tests/python/contrib/test_hexagon/test_parallel_hvx.py +++ b/tests/python/contrib/test_hexagon/test_parallel_hvx.py @@ -16,7 +16,7 @@ # under the License. """ -Test parallelizing HVX workloads and compare them to single thread examples. +Test parallelizing HVX workloads and compare them to single thread examples. """ import numpy as np from numpy.random import default_rng diff --git a/tests/python/relay/backend/test_pass_lower_te.py b/tests/python/relay/backend/test_pass_lower_te.py index fb79c1f2e7a6..d439f22b1246 100644 --- a/tests/python/relay/backend/test_pass_lower_te.py +++ b/tests/python/relay/backend/test_pass_lower_te.py @@ -54,11 +54,11 @@ def test_lower_primitive(): """ #[version = "0.0.5"] def @main(%a: Tensor[(5, 7), float32]) -> Tensor[(5, 7), float32] { - %0 = fn(%x : Tensor[(5, 7), float32], %y : Tensor[(5, 7), float32], Primitive=1) -> Tensor[(5, 7), float32] { + %0 = fn(%x : Tensor[(5, 7), float32], %y : Tensor[(5, 7), float32], Primitive=1) -> Tensor[(5, 7), float32] { add(%x, %y) }; - %0(%a, %a) - } + %0(%a, %a) + } """, "from_string", None, @@ -99,11 +99,11 @@ def relay_ext_test_pass_lower_te(func): """ #[version = "0.0.5"] def @main(%a: Tensor[(5, 7), float32]) -> Tensor[(5, 7), float32] { - %0 = fn(%x : Tensor[(5, 7), float32], %y : Tensor[(5, 7), float32], Primitive=1, Compiler="test_pass_lower_te", global_symbol="test_add") -> Tensor[(5, 7), float32] { + %0 = fn(%x : Tensor[(5, 7), float32], %y : Tensor[(5, 7), float32], Primitive=1, Compiler="test_pass_lower_te", global_symbol="test_add") -> Tensor[(5, 7), float32] { add(%x, %y) }; - %0(%a, %a) - } + %0(%a, %a) + } """, "from_string", None, @@ -146,9 +146,9 @@ def test_lower_extern(): def @main(%a: Tensor[(5, 7), float32]) -> Tensor[(5, 7), float32] { @my_add(%a, %a) } - def @my_add(%x : Tensor[(5, 7), float32], %y : Tensor[(5, 7), float32], Extern=1) -> Tensor[(5, 7), float32] { + def @my_add(%x : Tensor[(5, 7), float32], %y : Tensor[(5, 7), float32], Extern=1) -> Tensor[(5, 7), float32] { add(%x, %y) - } + } """, "from_string", None, @@ -189,9 +189,9 @@ def test_lower_extern_with_dynamic_shape(): def @main(%a: Tensor[(5, 7), float32]) -> Tensor[(?, ?), float32] { @my_dyn(%a, %a) } - def @my_dyn(%x : Tensor[(5, 7), float32], %y : Tensor[(5, 7), float32], Extern=1) -> Tensor[(?, ?), float32] { + def @my_dyn(%x : Tensor[(5, 7), float32], %y : Tensor[(5, 7), float32], Extern=1) -> Tensor[(?, ?), float32] { add(%x, %y) - } + } """, "from_string", None, diff --git a/tests/python/relay/collage/demo_collage_partitioner.py b/tests/python/relay/collage/demo_collage_partitioner.py index c5a18c3832fa..47f2612d7f16 100644 --- a/tests/python/relay/collage/demo_collage_partitioner.py +++ b/tests/python/relay/collage/demo_collage_partitioner.py @@ -116,7 +116,7 @@ def run(label, name, device, lib_path, code_path, input_shapes, input_dtypes): for input_name in input_shapes.keys() }} logging.info(f"Benchmarking for {{name}} generated by {{label}}...") - profile = vm_estimate_seconds(device, vm, args) + profile = vm_estimate_seconds(device, vm, args) logging.info(f"Benchmarked for {{name}} generated by {{label}}: {{profile}}") logging.info(f"RESULT: {{label}} | {{name}} | {{profile.median * 1e3}}ms") diff --git a/tests/python/relay/collage/menangerie.py b/tests/python/relay/collage/menangerie.py index 2cd8e1bcebe3..d5275fbd34c5 100644 --- a/tests/python/relay/collage/menangerie.py +++ b/tests/python/relay/collage/menangerie.py @@ -2852,7 +2852,7 @@ def @main(%data: Tensor[(1, 3, 224, 224), float32]) -> Tensor[(1, 1000), float32 %223 = reshape(%222, newshape=[0, -1]); %224 = nn.dense(%223, meta[relay.Constant][257], units=1000); add(%224, meta[relay.Constant][258]) - } + } """, "from_string", None, @@ -3100,7 +3100,7 @@ def @main(%data: Tensor[(1, 3, 224, 224), float16]) -> Tensor[(1, 1000), float16 %223 = reshape(%222, newshape=[0, -1]); %224 = nn.dense(%223, meta[relay.Constant][257], units=1000); add(%224, meta[relay.Constant][258]) - } + } """, "from_string", None, diff --git a/tests/python/relay/collage/test_sub_graph.py b/tests/python/relay/collage/test_sub_graph.py index de2d974bf934..21f12c43dccd 100644 --- a/tests/python/relay/collage/test_sub_graph.py +++ b/tests/python/relay/collage/test_sub_graph.py @@ -140,7 +140,7 @@ def @main(%a: Tensor[(5, 3, 32, 32), float32], %b: Tensor[(2, 3, 5, 5), float32] %0 = nn.conv2d(%x, %y); %1 = add(%0, %z); nn.relu(%1) - })(%a, %b, %c); + })(%a, %b, %c); subtract(%2, %d) } """ @@ -160,7 +160,7 @@ def @main(%a: Tensor[(5, 3, 32, 32), float32], %b: Tensor[(2, 3, 5, 5), float32] %2 = nn.relu(%1); // node 7 %3 = nn.leaky_relu(%0, alpha=0f); // node 9 add(%2, %3) // node 10 - } + } """ ) @@ -194,7 +194,7 @@ def @main(%a: Tensor[(5, 3, 32, 32), float32], %b: Tensor[(2, 3, 5, 5), float32] %2 = nn.relu(%1); // node 7 %3 = nn.leaky_relu(%0, alpha=0f); // node 9 add(%2, %3) - } + } """ ) @@ -229,7 +229,7 @@ def @main(%a: Tensor[(5, 3, 32, 32), float32], %b: Tensor[(2, 3, 5, 5), float32] %0 = nn.conv2d(%a, %b, padding=[0, 0, 0, 0]); // node 5 %1 = nn.relu(%0); // node 6 add(%1, %0) - } + } """ ) @@ -244,9 +244,9 @@ def @main(%a: Tensor[(5, 3, 32, 32), float32], %b: Tensor[(2, 3, 5, 5), float32] (%0, %1) })(%a, %b); %3 = %2.1; - %4 = %2.0; + %4 = %2.0; add(%3, %4) - } + } """ ) @@ -262,10 +262,10 @@ def input(): """ #[version = "0.0.5"] def @main(%a: Tensor[(5, 7), float32], %b: Tensor[(5, 7), float32]) { - %0 = add(%a, %b); // node 3 + %0 = add(%a, %b); // node 3 %1 = add(%0, %b); add(%1, %b) // node 5 - } + } """ ) @@ -278,8 +278,8 @@ def @main(%a: Tensor[(5, 7), float32], %b: Tensor[(5, 7), float32]) { %0 = add(%x, %y); %1 = add(%0, %y); add(%1, %y) - })(%a, %b) - } + })(%a, %b) + } """ ) @@ -303,8 +303,8 @@ def @main(%a: Tensor[(5, 7), float32]) { %5 = nn.relu(%4); // node 8 %6 = nn.relu(%4); // node 9 %7 = add(%5, %6); // node 10 - nn.relu(%7) // node 11 - } + nn.relu(%7) // node 11 + } """ ) @@ -315,7 +315,7 @@ def expected(): def @main(%a: Tensor[(5, 7), float32]) { (fn(%aa: Tensor[(5, 7), float32], Compiler="foo") { %0 = nn.relu(%aa); - %4 = (fn(%y, Composite="a") { + %4 = (fn(%y, Composite="a") { %1 = nn.relu(%y); %2 = nn.relu(%1); %3 = nn.relu(%1); @@ -327,7 +327,7 @@ def @main(%a: Tensor[(5, 7), float32]) { add(%5, %6) })(%4); nn.relu(%7) - })(%a) + })(%a) } """ ) @@ -349,8 +349,8 @@ def @main(%a: Tensor[(5, 7), float32]) { %5 = nn.relu(%4); // node 8 %6 = nn.relu(%4); // node 9 %7 = add(%5, %6); // node 10 - add(%2, %7) // node 11 - } + add(%2, %7) // node 11 + } """ ) @@ -361,7 +361,7 @@ def expected(): def @main(%a: Tensor[(5, 7), float32]) { %0 = nn.relu(%a); %9 = (fn(%x: Tensor[(5, 7), float32], Compiler="foo") { - %5 = (fn(%y, Composite="a") { + %5 = (fn(%y, Composite="a") { %1 = nn.relu(%y); %2 = nn.relu(%1); %3 = nn.relu(%1); @@ -375,7 +375,7 @@ def @main(%a: Tensor[(5, 7), float32]) { })(%5.1); (%5.0, %8) })(%0); - add(%9.0, %9.1) + add(%9.0, %9.1) } """ ) diff --git a/tests/python/relay/test_ir_parser.py b/tests/python/relay/test_ir_parser.py index 3f0b74468b21..5ea6d7e5de6a 100644 --- a/tests/python/relay/test_ir_parser.py +++ b/tests/python/relay/test_ir_parser.py @@ -1011,7 +1011,7 @@ def test_init_module_and_metatable(): + """ def @f(%y : Tensor[(2, 3), float32]) -> Tensor[(2, 3), float32] { negative(%y) - } + } """, ) mod = tvm.parser.parse( diff --git a/tests/python/relay/test_pass_collage_partition.py b/tests/python/relay/test_pass_collage_partition.py index dfd4fb8fad52..fa7e0a472a49 100644 --- a/tests/python/relay/test_pass_collage_partition.py +++ b/tests/python/relay/test_pass_collage_partition.py @@ -473,7 +473,7 @@ def @collage_example_target_hook_concatenate(%FunctionVar_03: (Tensor[(10, 10), }; %4(%FunctionVar_03) } - + def @main(%x: Tensor[(10, 10), float32]) -> Tensor[(20, 10), float32] { %5 = @collage_example_target_hook(%x); %6 = %5.0; @@ -537,7 +537,7 @@ def @collage_example_target_hook_nn_relu_nn_relu_nn_relu_add_nn_relu(%FunctionVa }; %8(%7) } - + def @main(%x: Tensor[(10, 10), float32]) -> Tensor[(10, 10), float32] { %9 = abs(%x); %10 = @collage_example_target_hook_nn_relu_nn_relu_nn_relu_add_nn_relu(%x, %9); @@ -584,19 +584,19 @@ def @collage_example_target_hook_add_add(%FunctionVar_0: Tensor[(10, 10), float3 }; %2(%FunctionVar_0, %1) } - + def @collage_example_target_hook_nn_relu(%FunctionVar_03: Tensor[(10, 10), float32], Primitive=1, Compiler="example_target_hook", global_symbol="collage_example_target_hook_nn_relu") -> Tensor[(10, 10), float32] { %3 = fn (%FunctionVar_04: Tensor[(10, 10), float32], Composite="relu") -> Tensor[(10, 10), float32] { nn.relu(%FunctionVar_04) }; %3(%FunctionVar_03) } - + def @main(%x: Tensor[(10, 10), float32]) -> Tensor[(10, 10), float32] { %4 = @collage_example_target_hook_nn_relu(%x); %5 = abs(%4); @collage_example_target_hook_add_add(%5, %4) - } + } """ expected_mod = tvm.parser.fromtext(expected_txt) @@ -640,25 +640,25 @@ def @collage_example_target_hook_nn_relu_nn_relu_add_add( Compiler="example_target_hook", global_symbol="collage_example_target_hook_nn_relu_nn_relu_add_add") -> Tensor[(10, 10), float32] { %0 = fn (%FunctionVar_03: Tensor[(10, 10), float32] , Composite="relu") -> Tensor[(10, 10), float32] { - nn.relu(%FunctionVar_03) + nn.relu(%FunctionVar_03) }; %1 = %0(%FunctionVar_0) ; %2 = fn (%FunctionVar_02: Tensor[(10, 10), float32] , Composite="relu") -> Tensor[(10, 10), float32] { - nn.relu(%FunctionVar_02) + nn.relu(%FunctionVar_02) }; %3 = %2(%1); %4 = fn (%FunctionVar_04: Tensor[(10, 10), float32] , %FunctionVar_11: Tensor[(10, 10), float32] , Composite="add") -> Tensor[(10, 10), float32] { - add(%FunctionVar_04, %FunctionVar_11) + add(%FunctionVar_04, %FunctionVar_11) }; %5 = %4(%1, %3); %6 = fn (%FunctionVar_01: Tensor[(10, 10), float32] , %FunctionVar_1: Tensor[(10, 10), float32] , Composite="add") -> Tensor[(10, 10), float32] { - add(%FunctionVar_01, %FunctionVar_1) + add(%FunctionVar_01, %FunctionVar_1) }; - %6(%3, %5) + %6(%3, %5) } def @main(%x: Tensor[(10, 10), float32] ) -> Tensor[(10, 10), float32] { - @collage_example_target_hook_nn_relu_nn_relu_add_add(%x) + @collage_example_target_hook_nn_relu_nn_relu_add_add(%x) } """ expected_mod = tvm.parser.fromtext(expected_txt) diff --git a/tests/python/relay/test_pass_dead_code_elimination.py b/tests/python/relay/test_pass_dead_code_elimination.py index 8844de7567a6..abd9be99e3d9 100644 --- a/tests/python/relay/test_pass_dead_code_elimination.py +++ b/tests/python/relay/test_pass_dead_code_elimination.py @@ -321,7 +321,7 @@ def @f(%r) -> int { let %v = ref_read(%r); let %u = ref_write(%r, %v + 1); %v - } + } def @main() -> int { let %r = ref(0); let %y = @f(%r); diff --git a/tests/python/relay/test_pass_plan_devices.py b/tests/python/relay/test_pass_plan_devices.py index 1b3d2199a065..1c48589a51aa 100644 --- a/tests/python/relay/test_pass_plan_devices.py +++ b/tests/python/relay/test_pass_plan_devices.py @@ -1804,13 +1804,13 @@ def @main(%data1: Tensor[(1, 32, 40, 40), float32], %3 = %0(%data2); %5 = fn (%a {virtual_device=meta[VirtualDevice][0]}, // global %b {virtual_device=meta[VirtualDevice][0]}, // global - virtual_device=meta[VirtualDevice][1], // texture + virtual_device=meta[VirtualDevice][1], // texture Primitive=1) { add(%a, %b) }; %6 = %5(%1, %3); - %10 = fn (%a, - virtual_device=meta[VirtualDevice][0], // global + %10 = fn (%a, + virtual_device=meta[VirtualDevice][0], // global Primitive=1) { layout_transform(%a, src_layout="NCHW4c", dst_layout="NCHW") }; diff --git a/tests/python/relay/test_target_hooks.py b/tests/python/relay/test_target_hooks.py index 046b2c7e541d..3a76fd2fbbf3 100644 --- a/tests/python/relay/test_target_hooks.py +++ b/tests/python/relay/test_target_hooks.py @@ -79,14 +79,14 @@ def test_tir_external_generation_outline_with_target_instance(check_result): def @main(%x: Tensor[(8), float32], %y: Tensor[(8), float32]) -> Tensor[(8), float32] { @replace_add_with_subtract(%x, %y) * 2.0f } - + def @replace_add_with_subtract(%x: Tensor[(8), float32], %y: Tensor[(8), float32], Inline=1, Primitive=1, Compiler="example_target_hook", global_symbol="replace_add_with_subtract") -> Tensor[(8), float32] { %x + %y // will be rewritten to TIR implementing %x - %y - 42.0f by custom pass - } + } """ ) diff --git a/tests/python/relay/transform/test_compiler_function_utils.py b/tests/python/relay/transform/test_compiler_function_utils.py index b1056f60b82b..1bb07e268439 100644 --- a/tests/python/relay/transform/test_compiler_function_utils.py +++ b/tests/python/relay/transform/test_compiler_function_utils.py @@ -125,7 +125,7 @@ def @main(%x0 : Tensor[(1600, 768), float16], %x3 : Tensor[(600, 32, 64), float1 %3 = %2(%x3, meta[relay.Constant][2]); (%1, %3) } - + def @tvmgen_default_cutlass_main_0(%y_0_i0: Tensor[(1600, 768), float16], %y_0_i1: Tensor[(2304, 768), float16], %y_0_i2: Tensor[(2304), float16], Inline=1, Compiler="cutlass", global_symbol="tvmgen_default_cutlass_main_0", Primitive=1) -> Tensor[(1600, 2304), float16] { %4 = fn (%FunctionVar_0_0: Tensor[(1600, 768), float16], %FunctionVar_0_1: Tensor[(2304, 768), float16], %FunctionVar_0_2: Tensor[(2304), float16], @@ -159,7 +159,7 @@ def @main(%x0 : Tensor[(1600, 768), float16], %x3 : Tensor[(600, 32, 64), float1 %3 = %2(%x3, meta[relay.Constant][2]); (%1, %3) } - + def @tvmgen_default_cutlass_main_0(%y_0_i0: Tensor[(1600, 768), float16], %y_0_i1: Tensor[(2304, 768), float16], %y_0_i2: Tensor[(2304), float16], Extern=1) -> Tensor[(1600, 2304), float16] { %4 = fn (%FunctionVar_0_0: Tensor[(1600, 768), float16], %FunctionVar_0_1: Tensor[(2304, 768), float16], %FunctionVar_0_2: Tensor[(2304), float16], diff --git a/tests/python/unittest/test_auto_scheduler_feature.py b/tests/python/unittest/test_auto_scheduler_feature.py index 6f9493fcbf99..4140e7732d7e 100644 --- a/tests/python/unittest/test_auto_scheduler_feature.py +++ b/tests/python/unittest/test_auto_scheduler_feature.py @@ -67,7 +67,7 @@ def test_cpu_matmul(): """ lowered IR: - + Placeholder: A, B parallel i.0 (0,32) parallel j.0 (0,64) diff --git a/tests/python/unittest/test_tir_transform_compact_buffer_region.py b/tests/python/unittest/test_tir_transform_compact_buffer_region.py index 049de0bed4f9..34b3190b9aa2 100644 --- a/tests/python/unittest/test_tir_transform_compact_buffer_region.py +++ b/tests/python/unittest/test_tir_transform_compact_buffer_region.py @@ -878,7 +878,7 @@ def func(A: T.Buffer[(960, 770), "float32"], B: T.Buffer[(770, 2304), "float32"] for k_1, i_3, j_3, k_2, i_4, j_4 in T.grid(1, 8, 1, 4, 2, 2): with T.block("update_update"): C[(((bx // 18 + 0) * 8 + tx_p // 32) * 8 + i_3) * 2 + i_4, ((bx % 18 * 2 + vx % 2) * 32 + tx_p % 32 + j_3) * 2 + j_4] = C[(((bx // 18 + 0) * 8 + tx_p // 32) * 8 + i_3) * 2 + i_4, ((bx % 18 * 2 + vx % 2) * 32 + tx_p % 32 + j_3) * 2 + j_4] + A_shared[(((bx // 18 + 0) * 8 + tx_p // 32) * 8 + i_3) * 2 + i_4, (k_0 + k_1) * 4 + k_2] * B_shared[(k_0 + k_1) * 4 + k_2, ((bx % 18 * 2 + vx % 2) * 32 + tx_p % 32 + j_3) * 2 + j_4] - + @T.prim_func def compacted_func(A: T.Buffer[(960, 770), "float32"], B: T.Buffer[(770, 2304), "float32"], C: T.Buffer[(960, 2304), "float32"]) -> None: for bx in T.thread_binding(144, thread="blockIdx.x"): diff --git a/tests/scripts/release/.gitignore b/tests/scripts/release/.gitignore index 3f183296deea..35846d92d265 100644 --- a/tests/scripts/release/.gitignore +++ b/tests/scripts/release/.gitignore @@ -2,4 +2,3 @@ !README.md *.csv *.pkl - diff --git a/tests/scripts/release/README.md b/tests/scripts/release/README.md index 82e2e5040ba6..9992e631401e 100644 --- a/tests/scripts/release/README.md +++ b/tests/scripts/release/README.md @@ -40,4 +40,4 @@ git clone https://github.com/apache/tvm-rfcs.git python list_rfcs.py --since-commit --rfcs-repo ./tvm-rfcs > rfc.md ``` -Finally, combine `rfc.md` and `out.md` along with some prose to create the final release notes. \ No newline at end of file +Finally, combine `rfc.md` and `out.md` along with some prose to create the final release notes. diff --git a/tests/scripts/task_config_build_cortexm.sh b/tests/scripts/task_config_build_cortexm.sh index 7292f1c31e0d..f15ed81711f6 100755 --- a/tests/scripts/task_config_build_cortexm.sh +++ b/tests/scripts/task_config_build_cortexm.sh @@ -35,4 +35,3 @@ echo set\(HIDE_PRIVATE_SYMBOLS ON\) >> config.cmake echo set\(BACKTRACE_ON_SEGFAULT ON\) >> config.cmake echo set\(USE_CCACHE OFF\) >> config.cmake echo set\(SUMMARIZE ON\) >> config.cmake - diff --git a/tests/scripts/task_config_build_i386.sh b/tests/scripts/task_config_build_i386.sh index 5e94f864ec90..369706dfd34a 100755 --- a/tests/scripts/task_config_build_i386.sh +++ b/tests/scripts/task_config_build_i386.sh @@ -37,4 +37,3 @@ echo set\(USE_CCACHE OFF\) >> config.cmake echo set\(BACKTRACE_ON_SEGFAULT ON\) >> config.cmake echo set\(USE_UMA OFF\) >> config.cmake echo set\(SUMMARIZE ON\) >> config.cmake - diff --git a/tests/scripts/task_config_build_jvm.sh b/tests/scripts/task_config_build_jvm.sh index f14c90bebd4b..cf23c848127d 100755 --- a/tests/scripts/task_config_build_jvm.sh +++ b/tests/scripts/task_config_build_jvm.sh @@ -31,4 +31,4 @@ echo set\(USE_PROFILER ON\) >> config.cmake echo set\(CMAKE_CXX_FLAGS -Werror\) >> config.cmake echo set\(USE_CCACHE OFF\) >> config.cmake echo set\(SUMMARIZE ON\) >> config.cmake -echo set\(USE_LLVM ON\) >> config.cmake \ No newline at end of file +echo set\(USE_LLVM ON\) >> config.cmake diff --git a/tests/scripts/task_cpp_unittest.sh b/tests/scripts/task_cpp_unittest.sh index 27899d06d703..22cc937e8784 100755 --- a/tests/scripts/task_cpp_unittest.sh +++ b/tests/scripts/task_cpp_unittest.sh @@ -63,4 +63,3 @@ if grep -Fq "USE_MICRO ON" ${BUILD_DIR}/TVMBuildOptions.txt; then make test_dynamic test_static popd fi - diff --git a/tests/scripts/task_lint.sh b/tests/scripts/task_lint.sh index 84f46523370e..f71cb0f60243 100755 --- a/tests/scripts/task_lint.sh +++ b/tests/scripts/task_lint.sh @@ -60,6 +60,9 @@ function shard1 { } function shard2 { + echo "check whitespace..." + tests/lint/whitespace.sh + echo "Linting the Python code with pylint..." tests/lint/pylint.sh diff --git a/tests/scripts/task_python_integration.sh b/tests/scripts/task_python_integration.sh index 5eac7b45ba61..2caeeeee8766 100755 --- a/tests/scripts/task_python_integration.sh +++ b/tests/scripts/task_python_integration.sh @@ -61,7 +61,7 @@ run_pytest cython ${TVM_INTEGRATION_TESTSUITE_NAME}-dso_plugin_module-1 apps/dso run_pytest ctypes ${TVM_INTEGRATION_TESTSUITE_NAME}-integration tests/python/integration # Ignoring Arm(R) Ethos(TM)-U NPU tests in the collective to run to run them in parallel in the next step. -run_pytest ctypes ${TVM_INTEGRATION_TESTSUITE_NAME}-contrib tests/python/contrib --ignore=tests/python/contrib/test_ethosu --ignore=tests/python/contrib/test_cmsisnn +run_pytest ctypes ${TVM_INTEGRATION_TESTSUITE_NAME}-contrib tests/python/contrib --ignore=tests/python/contrib/test_ethosu --ignore=tests/python/contrib/test_cmsisnn # forked is needed because the global registry gets contaminated TVM_TEST_TARGETS="${TVM_RELAY_TEST_TARGETS:-llvm;cuda}" \ run_pytest ctypes ${TVM_INTEGRATION_TESTSUITE_NAME}-relay tests/python/relay diff --git a/vta/README.md b/vta/README.md index 0c0edb8475df..debf2482b479 100644 --- a/vta/README.md +++ b/vta/README.md @@ -30,4 +30,4 @@ The key features of VTA include: - Customized and extensible TVM compiler back-end. - Flexible RPC support to ease deployment, and program FPGAs with the convenience of Python. -Learn more about VTA [here](https://tvm.apache.org/docs/vta/index.html). \ No newline at end of file +Learn more about VTA [here](https://tvm.apache.org/docs/vta/index.html). diff --git a/vta/tutorials/autotvm/README.txt b/vta/tutorials/autotvm/README.txt index c511381dd57d..a282a740ec84 100644 --- a/vta/tutorials/autotvm/README.txt +++ b/vta/tutorials/autotvm/README.txt @@ -1,3 +1,2 @@ Auto tuning ------------- - diff --git a/web/Makefile b/web/Makefile index d6adc94170fc..1153990a1880 100644 --- a/web/Makefile +++ b/web/Makefile @@ -27,7 +27,7 @@ all: dist/wasm/tvmjs_runtime.wasm dist/wasm/tvmjs_runtime.wasi.js EMCC = emcc EMCC_CFLAGS = $(INCLUDE_FLAGS) -O3 -std=c++17 -Wno-ignored-attributes --no-entry \ - -s ALLOW_MEMORY_GROWTH=1 -s STANDALONE_WASM=1 -s ERROR_ON_UNDEFINED_SYMBOLS=0 + -s ALLOW_MEMORY_GROWTH=1 -s STANDALONE_WASM=1 -s ERROR_ON_UNDEFINED_SYMBOLS=0 EMCC_LDFLAGS = --pre-js emcc/preload.js diff --git a/web/package.json b/web/package.json index 825056a8e37b..a45737ceb8d8 100644 --- a/web/package.json +++ b/web/package.json @@ -29,4 +29,4 @@ "typescript": "^3.8.3", "ws": "^7.2.5" } -} \ No newline at end of file +} diff --git a/web/src/compact.ts b/web/src/compact.ts index ac6af35abeff..35d2becaea60 100644 --- a/web/src/compact.ts +++ b/web/src/compact.ts @@ -44,4 +44,4 @@ export function createWebSocket(url: string): WebSocket { return new (WebSocket as any)(url); } -} \ No newline at end of file +} diff --git a/web/src/environment.ts b/web/src/environment.ts index df0fe68c81e0..24126c096150 100644 --- a/web/src/environment.ts +++ b/web/src/environment.ts @@ -143,4 +143,4 @@ export class Environment implements LibraryProvider { }; return Object.assign(defaultEnv, initEnv, newEnv); } -} \ No newline at end of file +} diff --git a/web/src/index.ts b/web/src/index.ts index ed84ce7fbea1..ac82e5967f48 100644 --- a/web/src/index.ts +++ b/web/src/index.ts @@ -26,4 +26,4 @@ export { Disposable, LibraryProvider } from "./types"; export { RPCServer } from "./rpc_server"; export { wasmPath } from "./support"; export { detectGPUDevice } from "./webgpu"; -export { assert } from "./support"; \ No newline at end of file +export { assert } from "./support"; diff --git a/web/src/support.ts b/web/src/support.ts index 7a2667a2299f..8fce98f35f12 100644 --- a/web/src/support.ts +++ b/web/src/support.ts @@ -61,4 +61,4 @@ export function assert(condition: boolean, msg?: string): asserts condition { */ export function wasmPath(): string { return __dirname + "/wasm"; -} \ No newline at end of file +} diff --git a/web/tests/node/test_ndarray.js b/web/tests/node/test_ndarray.js index 9e50557e2a13..b7a5abdcb155 100644 --- a/web/tests/node/test_ndarray.js +++ b/web/tests/node/test_ndarray.js @@ -54,4 +54,3 @@ test("array copy", () => { testArrayCopy("uint8", Uint8Array); testArrayCopy("float64", Float64Array); }); -