diff --git a/README.md b/README.md index fed2dfd..ad00ba1 100644 --- a/README.md +++ b/README.md @@ -60,6 +60,11 @@ BASE_IMAGE=ubuntu:20.04 ./docker_run.sh BASE_IMAGE=debian:12.5 ./docker_run.sh ``` + +## Git Tags for the Source Git Repositories + +All Git tags and parameters compatible with a specific Processor SDK release are captured in `scripts/config.yaml`. Each script parses the relevant Git tags and parameters from this YAML file. Please note that any instructions for parameter updates provided below are for informational purposes only. + ## Build ONNX-RT from Source @@ -67,9 +72,6 @@ All the commends below should be run **in the Docker container**. ### Prepare the source and update the build config -Update `PROTOBUF_VER` in `onnxrt_prepare.sh` by, e.g., checking "`git log`" at `onnxruntime/cmake/external/protobuf`. Currently it is set: -`PROTOBUF_VER=3.20.2`. - You can run the following in the Docker container for downloading source from git repo, applying patches, and downloading pre-built `protobuf`: ```bash @@ -77,7 +79,8 @@ You can run the following in the Docker container for downloading source from gi ``` ### Build -Update `PROTOBUF_VER` to match to the setting in `onnxrt_prepare.sh`. The following should be run in the Docker container with QEMU. + +The following should be run in the Docker container. (Optional) To build `protobuf` from source, run the following inside the container. ```bash @@ -90,8 +93,8 @@ Update "`--path_to_protoc_exe`" in `onnxrt_build.sh` accordingly. To build ONNX- ``` Outputs: -- Shared lib: `$WORK_DIR/workarea/onnxruntime/build/Linux/Release/libonnxruntime.so.1.14.0+${TIDL_VER}` -- Wheel file: `$WORK_DIR/workarea/onnxruntime/build/Linux/Release/dist/onnxruntime_tidl-1.14.0+${TIDL_VER}-cp310-cp310-linux_aarch64.whl` +- Shared lib: `$WORK_DIR/workarea/onnxruntime/build/Linux/Release/libonnxruntime.so.1.15.0` +- Wheel file: `$WORK_DIR/workarea/onnxruntime/build/Linux/Release/dist/onnxruntime_tidl-1.15.0-cp310-cp310-linux_aarch64.whl` ### Package @@ -99,7 +102,7 @@ Outputs: ./onnxrt_package.sh ``` -Output tarball: `$WORK_DIR/workarea/onnx-1.14.0-ubuntu22.04_aarch64.tar.gz` +Output tarball: `$WORK_DIR/workarea/onnx-1.15.0-ubuntu22.04_aarch64.tar.gz` ## Build TFLite-RT from Source diff --git a/patches/onnxruntime/tool.cmake_ORG b/patches/onnxruntime/tool.cmake_ORG index 2ec5f13..faa10d6 100644 --- a/patches/onnxruntime/tool.cmake_ORG +++ b/patches/onnxruntime/tool.cmake_ORG @@ -1,10 +1,14 @@ SET(CMAKE_SYSTEM_NAME Linux) SET(CMAKE_SYSTEM_PROCESSOR aarch64) -SET(tools /home/a0133185/ti/GIT_C7x_MMA_TIDL/c7x-mma-tidl/ti_dl/release/build_cloud/test/gcc-arm-9.2-2019.12-x86_64-aarch64-none-linux-gnu) SET(CMAKE_SYSTEM_VERSION 1) -SET(CMAKE_C_COMPILER ${tools}/bin/aarch64-none-linux-gnu-gcc) -SET(CMAKE_CXX_COMPILER ${tools}/bin/aarch64-none-linux-gnu-g++) SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) -SET(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) \ No newline at end of file +SET(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) + +# Set the gcc and g++ toolchain +SET(sdk_path /home/abhay/ti-firmware-builder-j721s2-evm-10_01_00_01) +SET(CMAKE_C_COMPILER ${sdk_path}/toolchain/sysroots/x86_64-arago-linux/usr/bin/aarch64-oe-linux/aarch64-oe-linux-gcc) +SET(CMAKE_CXX_COMPILER ${sdk_path}/toolchain/sysroots/x86_64-arago-linux/usr/bin/aarch64-oe-linux/aarch64-oe-linux-g++) +SET(CMAKE_SYSROOT ${sdk_path}/targetfs) +include_directories (${sdk_path}/targetfs/usr/lib/python3.12/site-packages/numpy/core/include) diff --git a/scripts/collect_libs.sh b/scripts/collect_libs.sh index c603185..6db9616 100755 --- a/scripts/collect_libs.sh +++ b/scripts/collect_libs.sh @@ -12,15 +12,16 @@ fi TARGET_DIR=$HOME/ubuntu22-deps -tidl_ver=$(get_yaml_value "onnxruntime" "tidl_ver") +onnx_ver=$(get_yaml_value "onnxruntime" "onnx_ver") +# tidl_ver=$(get_yaml_value "onnxruntime" "tidl_ver") # rm -rf $TARGET_DIR mkdir -p $TARGET_DIR lib_files=( # ONNX - "$HOME/osrt-build/workarea/onnxruntime/build/Linux/Release/dist/onnxruntime_tidl-1.14.0+${tidl_ver}-cp310-cp310-linux_aarch64.whl" - "$HOME/osrt-build/workarea/onnx-1.14.0+${tidl_ver}-ubuntu22.04_aarch64.tar.gz" + "$HOME/osrt-build/workarea/onnxruntime/build/Linux/Release/dist/onnxruntime_tidl-${onnx_ver}-cp310-cp310-linux_aarch64.whl" + "$HOME/osrt-build/workarea/onnx-${onnx_ver}+${tidl_ver}-ubuntu22.04_aarch64.tar.gz" # TFLite "$HOME/osrt-build/workarea/tensorflow/tensorflow/lite/tools/pip_package/gen/tflite_pip/python3/dist/tflite_runtime-2.12.0-cp310-cp310-linux_aarch64.whl" "$HOME/osrt-build/workarea/tflite-2.12-ubuntu22.04_aarch64.tar.gz" diff --git a/scripts/config.yaml b/scripts/config.yaml index f54ea57..f05bfbc 100644 --- a/scripts/config.yaml +++ b/scripts/config.yaml @@ -1,28 +1,30 @@ -# PSDK-Linux for EdgeAI: 10.01.00.01 +# PSDK-Linux for EdgeAI: 10.01.00.02 -# Below are for osrt-build. References: +# Below are for osrt-libs-build. References: # https://git.ti.com/cgit/edgeai/meta-edgeai/tree/recipes-tisdk/ti-tidl/ti-tidl.bb?h=scarthgap # https://git.ti.com/cgit/edgeai/meta-edgeai/tree/recipes-tisdk/ti-tidl/ti-tidl-osrt.bb?h=scarthgap arm-tidl: url: "https://git.ti.com/git/processor-sdk-vision/arm-tidl.git" - tag: "REL.PSDK.ANALYTICS.10.01.00.01" + tag: "REL.PSDK.ANALYTICS.10.01.00.02" branch: "master" - commit: "78a9795ab5a4acb070f7ef91072114fdaf1e968e" + commit: "d165b9ba24c28d23c28bc2f3eed15edc2569ee76" concerto: url: "https://git.ti.com/git/processor-sdk/concerto.git" - tag: "REL.PSDK.ANALYTICS.10.01.00.01" + tag: "REL.PSDK.ANALYTICS.10.01.00.02" branch: "main" - commit: "68d69c7d7623590b7f0311277708699428387709" + commit: "707b11afdbe5d0abb109a42b06828ba70f555bff" +# protobuf_ver_rel is typically the last two release numbers of protobuf_ver. onnxruntime: url: "https://github.com/TexasInstruments/onnxruntime.git" tag: "None" - branch: "tidl-1.14" - commit: "b07b733888500a37064f560f3d61d5c8ab1201c7" - onnx_ver: "1.14.0" + branch: "tidl-1.15" + commit: "f145bec7bee26b9dfa43b3e07645ee1a5f8b8140" + onnx_ver: "1.15.0" tidl_ver: "10000005" - protobuf_ver: "3.20.2" + protobuf_ver: "3.21.12" + protobuf_ver_rel: "21.12" tensorflow: url: "https://github.com/TexasInstruments/tensorflow.git" @@ -46,5 +48,5 @@ ti-rpmsg-char: vision-apps-lib-build: url: "https://github.com/TexasInstruments-Sandbox/edgeai-vision-apps-lib-build/releases/download" - release: "10.01.00.01" + release: "10.01.00.02" sdk_ver: "10.1.0" diff --git a/scripts/onnxrt_package.sh b/scripts/onnxrt_package.sh index 143770f..1608064 100755 --- a/scripts/onnxrt_package.sh +++ b/scripts/onnxrt_package.sh @@ -13,7 +13,6 @@ cd $WORK_DIR/workarea ## package into a tarball onnx_ver=$(get_yaml_value "onnxruntime" "onnx_ver") -tidl_ver=$(get_yaml_value "onnxruntime" "tidl_ver") pkg_dist=${BASE_IMAGE//:/} DST_DIR="onnx-${onnx_ver}+${tidl_ver}-${pkg_dist}_aarch64" LIB_DIR="onnxruntime/build/Linux/Release" @@ -23,7 +22,7 @@ rm -rf "$DST_DIR" mkdir -p "${DST_DIR}/onnxruntime" # package .so -src_lib_file="${LIB_DIR}/libonnxruntime.so.${onnx_ver}+${tidl_ver}" +src_lib_file="${LIB_DIR}/libonnxruntime.so.${onnx_ver}" if [ -f "$src_lib_file" ]; then cp "$src_lib_file" "$DST_DIR" else diff --git a/scripts/onnxrt_prepare.sh b/scripts/onnxrt_prepare.sh index 222227b..2a62664 100755 --- a/scripts/onnxrt_prepare.sh +++ b/scripts/onnxrt_prepare.sh @@ -22,17 +22,17 @@ git submodule init git submodule update --init --recursive # update tool.cmake -# TODO: eleminate this step. Instead pass env variables. +# TODO: eliminate this step. Instead pass env variables? mv tool.cmake tool.cmake_ORG cp ../../patches/onnxruntime/tool.cmake . -# pre-built protobuf -# update protobuf_ver by, e.g., "git log" at /cmake/external/protobuf +# install the protobuf protobuf_ver=$(get_yaml_value "onnxruntime" "protobuf_ver") -zip_file="protoc-${protobuf_ver}-linux-aarch_64.zip" +protobuf_ver_rel=$(get_yaml_value "onnxruntime" "protobuf_ver_rel") +zip_file="protoc-${protobuf_ver_rel}-linux-aarch_64.zip" cd $WORK_DIR/workarea -curl -O -L "https://github.com/protocolbuffers/protobuf/releases/download/v${protobuf_ver}/${zip_file}" -unzip "$zip_file" -d "onnxruntime/cmake/external/protoc-${protobuf_ver}-linux-aarch_64" +curl -O -L "https://github.com/protocolbuffers/protobuf/releases/download/v${protobuf_ver_rel}/${zip_file}" || { echo "Error: Failed to download $zip_file."; exit 1; } +unzip "$zip_file" -d "onnxruntime/cmake/external/protoc-${protobuf_ver}-linux-aarch_64" || { echo "Error: Failed to unzip $zip_file."; exit 1; } rm "$zip_file" # chmod @@ -40,4 +40,4 @@ chmod -R a+w $WORK_DIR/workarea cd $current_dir -echo "$(basename $0): Completed!" \ No newline at end of file +echo "$(basename $0): Completed!" diff --git a/scripts/tidl_prepare.sh b/scripts/tidl_prepare.sh index dbfc244..18573cd 100755 --- a/scripts/tidl_prepare.sh +++ b/scripts/tidl_prepare.sh @@ -25,8 +25,8 @@ fi protobuf_ver=$(get_yaml_value "onnxruntime" "protobuf_ver") REPO_DIR="${WORK_DIR}/workarea/protobuf-${protobuf_ver}" if [ ! -d "$REPO_DIR" ]; then - tarball="protobuf-cpp-${protobuf_ver}.tar.gz" - wget -q "https://github.com/protocolbuffers/protobuf/releases/download/v${protobuf_ver}/${tarball}" + tarball="v${protobuf_ver}.tar.gz" + wget -q "https://github.com/protocolbuffers/protobuf/archive/refs/tags/v${protobuf_ver}/${tarball}" tar -xzf "${tarball}" rm "${tarball}" else