Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 13 additions & 16 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -108,23 +108,16 @@ RUN DEBIAN_FRONTEND=noninteractive apt-get update
RUN DEBIAN_FRONTEND=noninteractive apt -y install git wget unzip

# Install QNN
RUN mkdir -p ~/build /usr/lib/dsp/cdsp /usr/local/lib
RUN mkdir -p ~/build /usr/lib/dsp/cdsp /usr/share/qcom /usr/local/lib -p
RUN cd ~/build ; \
wget https://softwarecenter.qualcomm.com/api/download/software/sdks/Qualcomm_AI_Runtime_Community/All/2.36.0.250627/v2.36.0.250627.zip; \
unzip v2.36.0.250627.zip ; \
rm ~/build/v2.36.0.250627.zip ; \
cp -v ~/build/qairt/2.36.0.250627/lib/aarch64-oe-linux-gcc11.2/* /usr/local/lib/ ; \
cp -v ~/build/qairt/2.36.0.250627/lib/hexagon-v68/unsigned/* /usr/lib/dsp/cdsp/ ; \
rm /usr/local/lib/libSNPE* -rf ; \
rm /usr/local/lib/libSnpe* -rf ; \
rm ~/build/qairt -rf

# Install hexagon binaries and copy binaries for RB3Gen2 : TODO add for others
RUN cd ~/build; \
mkdir -p /usr/lib/dsp/cdsp ; \
git clone https://github.com/linux-msm/hexagon-dsp-binaries.git ; \
cp -v hexagon-dsp-binaries/qcm6490/Thundercomm/RB3gen2/CDSP.HT.2.5.c3-00077-KODIAK-1/* /usr/lib/dsp/cdsp/ ; \
rm ~/build/hexagon-dsp-binaries -rf
wget https://apigwx-aws.qualcomm.com/qsc/public/v1/api/download/software/sdks/Qualcomm_AI_Runtime_Community/All/2.43.0.260128/v2.43.0.260128.zip; \
unzip v2.43.0.260128.zip ; \
rm ~/build/v2.43.0.260128.zip ; \
rm ~/build/qairt/2.43.0.260128/lib/aarch64-oe-linux-gcc11.2/libSNPE*; \
rm ~/build/qairt/2.43.0.260128/lib/aarch64-oe-linux-gcc11.2/libSnpe*; \
cp ~/build/qairt/2.43.0.260128/lib/aarch64-oe-linux-gcc11.2/* /usr/local/lib/ ; \
cp ~/build/qairt/*/lib/hexagon-v* /usr/share/qcom/ -rf; \
rm ~/build/qairt -rf

# Remove build folder
RUN rm -rf ~/build
Expand Down Expand Up @@ -225,7 +218,11 @@ COPY --from=build /root/tensorflow /root/tensorflow
COPY run-tflite.sh /
COPY benchmark-tflite.sh /
COPY install-gstreamer.sh /
COPY install-hexagon-bins.sh /
RUN chmod +x /*.sh
RUN mkdir /usr/share/qcom/conf.d -p
COPY fastrpc_config.yaml /usr/share/qcom/conf.d/
COPY devices.yaml /

# Remove cached files
RUN rm ~/.cache -rf
Expand Down
38 changes: 38 additions & 0 deletions devices.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# source: device-tree and https://workbench.aihub.qualcomm.com/devices/
devices:
- device_name: Dragonwing RB3 Gen 2 Vision Kit
device_dt_model:
- Qualcomm Technologies, Inc. Robotics RB3gen2
chipset: "Qualcomm® Dragonwing™ RB3 Gen 2 | QCS6490"
runtime_support:
tensorflow_lite: true
onnx_runtime: true
ai_engine_direct_qnn: false
hexagon_tensor_processor:
fp16_precision: true
version: v68
soc_model: "35"
soc_ids:
- "497"
- "498"
hexagon_bin_dir: qcm6490/Thundercomm/RB3gen2/
hexagon_bin_dir_prefix: ""

- device_name: Arduino Monza
device_dt_model:
- Arduino Monza
chipset: "Qualcomm® QCS8275"
runtime_support:
tensorflow_lite: true
onnx_runtime: true
ai_engine_direct_qnn: true
hexagon_tensor_processor:
fp16_precision: true
version: v75
soc_model: "67"
soc_ids:
- "675"
- "674"
hexagon_bin_dir: qcs8300/Qualcomm/QCS8300-RIDE/
hexagon_bin_dir_prefix: cdsp-

5 changes: 5 additions & 0 deletions fastrpc_config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
machines:
"Qualcomm Technologies, Inc. Robotics RB3gen2"
DSP_LIBRARY_PATH: "/hexagon-v68/;/hexagon-v68/unsigned/"
"Arduino Monza":
DSP_LIBRARY_PATH: "/hexagon-v75/;/hexagon-v75/unsigned/"
81 changes: 81 additions & 0 deletions install-hexagon-bins.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
#!/usr/bin/env bash
set -e

DEVICES_YAML="devices.yaml"

CDSP_DIRS=(
"/sys/kernel/debug/qcom_socinfo/cdsp"
"/sys/kernel/debug/qcom_socinfo/cdsp1"
"/sys/kernel/debug/qcom_socinfo/cdsp2"
"/sys/kernel/debug/qcom_socinfo/cdsp3"
)

read_soc_id() {
if [[ -f /sys/devices/soc0/soc_id ]]; then
tr -d '\0' < /sys/devices/soc0/soc_id | xargs
fi
}

read_device_model() {
if [[ -f /sys/firmware/devicetree/base/model ]]; then
tr -d '\0' < /sys/firmware/devicetree/base/model | xargs
fi
}

get_cdsp_firmware_version() {
for dir in "${CDSP_DIRS[@]}"; do
file="$dir/name"
if [[ -f "$file" ]]; then
line=$(cat "$file")
if [[ -n "$line" ]]; then
echo "$line" | awk -F: '{print $2}' | xargs
return
fi
fi
done
}

get_hexagon_version_by_soc() {
local soc_id="$1"
yq -r ".devices[] | select(.soc_ids[] == \"$soc_id\") | .hexagon_tensor_processor.version" "$DEVICES_YAML"
}

get_hexagon_bin_dir_by_model() {
local model="$1"
yq -r ".devices[] | select(.device_dt_model[] == \"$model\") | .hexagon_bin_dir" "$DEVICES_YAML"
}

get_hexagon_prefix_by_model() {
local model="$1"
yq -r ".devices[] | select(.device_dt_model[] == \"$model\") | .hexagon_bin_dir_prefix" "$DEVICES_YAML"
}

get_hexagon_src_dir() {
model=$(read_device_model)
bin_dir=$(get_hexagon_bin_dir_by_model "$model")
prefix=$(get_hexagon_prefix_by_model "$model")
fw_name=$(get_cdsp_firmware_version)

echo "/root/hexagon-binaries/${bin_dir}${prefix}${fw_name}/"
}

get_hexagon_dest_dir() {
soc_id=$(read_soc_id)
hex_ver=$(get_hexagon_version_by_soc "$soc_id")
echo "/usr/share/qcom/hexagon-${hex_ver}/"
}

copy_hexagon_bins() {
src=$(get_hexagon_src_dir)
dst=$(get_hexagon_dest_dir)

echo "Copying Hexagon bins:"
echo "SRC: $src"
echo "DST: $dst"

mkdir -p "$dst"
cp -r "$src"* "$dst"
}

copy_hexagon_bins

Loading