From f582cd6b201f7bf93b81392c098cb1175d7b42bb Mon Sep 17 00:00:00 2001 From: Siva Date: Wed, 27 Sep 2023 11:10:04 +0530 Subject: [PATCH] [ADRENO] Minor changes for Adreno docs and halp scripts NCHW is mandatory layout for CLML offload. Updated the docs. CI scripts will keep OpenCL enbaled as fallback always. Enable configurable device bind ports. Helps in multi user environments. --- docs/how_to/deploy/adreno.rst | 2 +- tests/scripts/setup-adreno-env.sh | 18 +++++++++++++----- tests/scripts/task_config_build_adreno.sh | 2 ++ 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/docs/how_to/deploy/adreno.rst b/docs/how_to/deploy/adreno.rst index ed016a3ff744..f0b8c6f757cb 100644 --- a/docs/how_to/deploy/adreno.rst +++ b/docs/how_to/deploy/adreno.rst @@ -432,7 +432,7 @@ as the OpenCL path is fallback option for any operator didn't go through OpenCLM python3 -m tvm.driver.tvmc compile \ --cross-compiler ${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android28-clang \ - --target="opencl, clml, llvm" --target-llvm-mtriple aarch64-linux-gnu --target-opencl-device adreno \ + --target="opencl, clml, llvm" --desired-layout NCHW --target-llvm-mtriple aarch64-linux-gnu --target-opencl-device adreno \ --tuning-records keras-resnet50.log -o keras-resnet50.tar resnet50.h5 On successful compilation, above command produce ``keras-resnet50.tar``. diff --git a/tests/scripts/setup-adreno-env.sh b/tests/scripts/setup-adreno-env.sh index 55a92c5f6145..15c124a0f051 100755 --- a/tests/scripts/setup-adreno-env.sh +++ b/tests/scripts/setup-adreno-env.sh @@ -20,12 +20,13 @@ ENVIRONMENT="" RPC_PORT="" ADB_SERIAL="" +LISTEN_PORT=5000 function usage() { echo "Helper script to setup the environment for Tracker, RPC Device and for application" echo "Usage (Help) : source setup-adreno-env.sh -h" echo "Usage (Tracker): source setup-adreno-env.sh -e tracker -p " - echo "Usage (Device): source setup-adreno-env.sh -e device -p -d " + echo "Usage (Device): source setup-adreno-env.sh -e device -p -d [-l ]" echo "Usage (Query): source setup-adreno-env.sh -e query -p " } @@ -46,6 +47,11 @@ while [[ $# -gt 0 ]]; do shift # past argument shift # past value ;; + -l|--listen-port) + LISTEN_PORT="$2" + shift # past argument + shift # past value + ;; -h|--help) usage return 0 @@ -62,6 +68,7 @@ done echo "ENVIRONMENT = ${ENVIRONMENT}" echo "RPC_PORT = ${RPC_PORT}" echo "ADB_SERIAL = ${ADB_SERIAL}" +echo "DEVICE LISTEN POPRT = ${LISTEN_PORT}" function def_environment() { @@ -100,10 +107,11 @@ case ${ENVIRONMENT} in fi adb reverse tcp:${TVM_TRACKER_PORT} tcp:${TVM_TRACKER_PORT} - adb forward tcp:5000 tcp:5000 - adb forward tcp:5001 tcp:5001 - adb forward tcp:5002 tcp:5002 - adb shell "cd ${TARGET_FOLDER}; killall -9 tvm_rpc-${USER}; sleep 2; LD_LIBRARY_PATH=${TARGET_FOLDER}/ ./tvm_rpc-${USER} server --host=0.0.0.0 --port=5000 --port-end=5010 --tracker=127.0.0.1:${TVM_TRACKER_PORT} --key=${RPC_DEVICE_KEY}" + adb forward tcp:${LISTEN_PORT} tcp:${LISTEN_PORT} + adb forward tcp:$((LISTEN_PORT + 1)) tcp:$((LISTEN_PORT + 1)) + adb forward tcp:$((LISTEN_PORT + 2)) tcp:$((LISTEN_PORT + 2)) + adb forward tcp:$((LISTEN_PORT + 3)) tcp:$((LISTEN_PORT + 3)) + adb shell "cd ${TARGET_FOLDER}; killall -9 tvm_rpc-${USER}; sleep 2; LD_LIBRARY_PATH=${TARGET_FOLDER}/ ./tvm_rpc-${USER} server --host=0.0.0.0 --port=${LISTEN_PORT} --port-end=$((LISTEN_PORT + 10)) --tracker=127.0.0.1:${TVM_TRACKER_PORT} --key=${RPC_DEVICE_KEY}" ;; "query") diff --git a/tests/scripts/task_config_build_adreno.sh b/tests/scripts/task_config_build_adreno.sh index 62e6ffecbced..1b6750f16580 100755 --- a/tests/scripts/task_config_build_adreno.sh +++ b/tests/scripts/task_config_build_adreno.sh @@ -25,6 +25,8 @@ cp ../cmake/config.cmake . if [ -f "${ADRENO_OPENCL}/CL/cl_qcom_ml_ops.h" ] ; then echo set\(USE_CLML ${ADRENO_OPENCL}\) >> config.cmake +else +echo set\(USE_OPENCL ON\) >> config.cmake fi echo set\(USE_RPC ON\) >> config.cmake echo set\(USE_GRAPH_EXECUTOR ON\) >> config.cmake