Skip to content

Commit 2dab201

Browse files
anhappdevmohitmundhragithubfreedomtanRSMNYS
authored
Merge branch 'submission-v4.1' into 'master' (#949)
* Enable stable_diffusion tests * Add a caption_id to coco_gen dataset (#918) * Final Submission for code for Qualcomm co-author: Aswin B <[email protected]> co-author: Utkarsh Mishra <[email protected]> * Addressing review comments * Update seed and num_steps for TFLite SD task (#16) * Ran make format * Applying linter changes * Update QTI backend for submission v4.1 (#13) * Ignore QTI private SDK and libs * Update path for QTI SDK * Download QTI libs for SD task * Fix QTI BUILD file * Update integration test * Set WITH_STABLEDIFFUSION=1 for CI build * Fix QTI pbtxt files * Disable SD task for Apple devices * Update model path and checksum for QTI * Remove tiny groundtruth_path for SD task * Update path for TFLite models * Update groundtruth_path for SD task * Update tflite_settings_mtk_mt6989.pbtxt * enable stable diffusion in Pixel backend (#936) * hacks to enable stable diffusion on Pixel backend * buildifer and clang-format * remove unnecessary line * adapt to submission-v4.1 * feat: add icon and description for Stable Diffusion benchmark (#917) * Add icon for stable_diffusion task * Add description for stable_diffusion task * Sort the order of task based on BenchmarkId.allIds * Fix ios-build-test.yml * Fix ios-build-test.yml * use time step embedding from file (#928) * feat: pass task-specific config to backend (#922) * Add TaskConfig.CustomConfig and pass them to backend * Add CustomConfig for main.cc * Use seed and num_steps from CustomConfig for TFLite backend * Replace std::cout with LOG(INFO) * Format files * feat: add ConvertOutputs() API (#927) * Add ConvertOutputs() API * Add ConvertOutputs() for mobile_back_tflite * Set minimum macos version * Set minimum macos version to 13.1 * Update _kIphoneOnGitHubAction * feat: timestamp-embedding-parser (WIP) * disabled bitcode to be able compile with new XCode * chore: formatting * refactor: use custom setting in Core ML backend to detect NCHW input. (#924) * Add GetConfigValue() * Add custom setting data-format for Core ML * Use GetConfigValue() to get stable_diffusion_seed and stable_diffusion_num_steps * fix: resolve crash due to permission denied on Android Play Store version (#930) * Set android:extractNativeLibs="true" * Set android.bundle.enableUncompressedNativeLibs=false * chore: increase Android minSdkVersion from 21 to 30 (#859) Increase minSdkVersion to 30 * feat: finalized SD pipeline to use embedding from the binary file. * refactor: updated embedding_utils to parse pkl file * chore: linting * fix: fixed lint issue in neuron * chore: BUILD cleanup * chore: cleanup * chore: ignore .fvm * chore: updated model paths and checksums for stable diffusion benchmark: tflite_settings_android.pbtxt * chore: reverse timesteps and embeddings to support descending order of the timesteps and embeddings * chore: fixed formatting * chore: added links to the sd models and timestep embeddings file * chore: add the proper name for the embedding_timesteps file * chore: added missed declaration for backend_convert_outputs * chore: clang formatting * chore: added missed files * chore: fixed build file for the pixel backend * chore: bazel formatting * fix: added missed interface implementation for pixel * chore: clang formatting --------- Co-authored-by: Anh <[email protected]> * Update model_path for stable_diffusion (#946) * Use CloudFare link for qti model_path * Use CloudFare link for tflite model_path * Fix build error * Add missing model_checksum * Update expected_throughput * qti backend blocking other backends fix --------- Co-authored-by: Mohit Mundhra <[email protected]> Co-authored-by: Koan-Sin Tan <[email protected]> Co-authored-by: RSMNYS <[email protected]>
1 parent 399ee37 commit 2dab201

File tree

89 files changed

+2953
-2406
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

89 files changed

+2953
-2406
lines changed

.bazelrc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ build:android_x86_64 --fat_apk_cpu=x86_64
4343

4444
# iOS configs
4545
build:ios --apple_platform_type=ios
46-
build:ios --apple_bitcode=embedded --copt=-fembed-bitcode
4746
build:ios --copt=-Wno-c++11-narrowing
4847
build:ios --cxxopt=-fobjc-arc
4948

.github/workflows/android-build-test.yml

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,15 +100,22 @@ jobs:
100100
rm /tmp/${SAMSUNG_LIB}.zip && \
101101
mkdir -p mobile_back_samsung/samsung/lib/internal && \
102102
mv /tmp/${SAMSUNG_LIB}/* mobile_back_samsung/samsung/lib/internal/
103+
- name: Download QTI SDK
104+
env:
105+
QTI_SDK: qairt-2.25.0.240728-linux
106+
run: |
107+
gsutil cp gs://mobile-app-build-290400_github-actions/lib/v4.1/${QTI_SDK}.zip /tmp/ && \
108+
unzip /tmp/${QTI_SDK}.zip -d /tmp/${QTI_SDK} && \
109+
rm /tmp/${QTI_SDK}.zip && \
110+
mv /tmp/${QTI_SDK}/* mobile_back_qti/
103111
- name: Download QTI libraries
104112
env:
105-
QTI_LIB: qaisw-2.20.0.240223_linux
113+
QTI_LIB: StableDiffusionShared
106114
run: |
107-
gsutil cp gs://mobile-app-build-290400_github-actions/lib/v4.0/${QTI_LIB}.zip /tmp/ && \
115+
gsutil cp gs://mobile-app-build-290400_github-actions/lib/v4.1/${QTI_LIB}.zip /tmp/ && \
108116
unzip /tmp/${QTI_LIB}.zip -d /tmp/${QTI_LIB} && \
109117
rm /tmp/${QTI_LIB}.zip && \
110-
mkdir -p mobile_back_qti/${QTI_LIB} && \
111-
mv /tmp/${QTI_LIB}/* mobile_back_qti/${QTI_LIB}/
118+
mv /tmp/${QTI_LIB}/* mobile_back_qti/cpp/backend_qti/StableDiffusionShared/
112119
- name: Cache bazel
113120
uses: actions/cache@v4
114121
with:
@@ -143,6 +150,7 @@ jobs:
143150
PERF_TEST: true
144151
WITH_TFLITE: 0
145152
WITH_QTI: 1
153+
WITH_STABLEDIFFUSION: 1
146154
run: |
147155
make flutter/android/release flutter/android/apk flutter/android/test-apk
148156
gsutil mv output/android-apks/test-main.apk $GCLOUD_BUCKET_PATH/test-main-qti.apk
@@ -191,6 +199,7 @@ jobs:
191199
WITH_QTI: 1
192200
WITH_SAMSUNG: 1
193201
WITH_APPLE: 0
202+
WITH_STABLEDIFFUSION: 1
194203
run: |
195204
make flutter/android/release
196205
gsutil cp flutter/build/app/outputs/bundle/release/app-release.aab $GCLOUD_BUCKET_PATH/app-release.aab

.gitignore

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,12 @@
44
.ijwb
55
.idea
66
.vscode
7+
.fvm
78
/bazel-*
89
/output
910
/output_logs
1011
/datasets/output
1112
/datasets/downloads
12-
/mobile_back_qti/snpe-*
13-
/mobile_back_qti/qaisw-*
1413
*.so
1514
* .apk
1615
* .tflite
@@ -22,3 +21,7 @@ __pycache__/
2221
*.log
2322
*.iml
2423
*.env
24+
25+
*.g.dart
26+
*.gen.dart
27+
*.gen.h

WORKSPACE

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
workspace(name = "mlperf_app")
22

3-
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
43
load("@bazel_tools//tools/build_defs/repo:git.bzl", "new_git_repository")
4+
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
55

66
http_archive(
77
name = "bazel_skylib",
@@ -49,11 +49,11 @@ http_archive(
4949
],
5050
)
5151

52-
load("@rules_python//python:repositories.bzl", "python_register_toolchains")
5352
load(
5453
"@org_tensorflow//tensorflow/tools/toolchains/python:python_repo.bzl",
5554
"python_repository",
5655
)
56+
load("@rules_python//python:repositories.bzl", "python_register_toolchains")
5757

5858
python_repository(name = "python_version_repo")
5959

@@ -107,3 +107,10 @@ snpe_version_loader(
107107
name = "snpe_version_loader",
108108
workspace_dir = __workspace_dir__,
109109
)
110+
111+
load("//mobile_back_qti/cpp/backend_qti/StableDiffusionShared:variables.bzl", "stable_diffusion_external_deps_shared")
112+
113+
stable_diffusion_external_deps_shared(
114+
name = "stable_diffusion_external_deps_shared",
115+
workspace_dir = __workspace_dir__,
116+
)

flutter/android/android-docker.mk

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2020-2022 The MLPerf Authors. All Rights Reserved.
1+
# Copyright 2020-2024 The MLPerf Authors. All Rights Reserved.
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.
@@ -42,6 +42,7 @@ flutter_common_docker_flags= \
4242
--env WITH_PIXEL=${WITH_PIXEL} \
4343
--env WITH_MEDIATEK=${WITH_MEDIATEK} \
4444
--env proxy_bazel_args=${proxy_bazel_args} \
45+
--env BAZEL_OUTPUT_ROOT_ARG="--output_user_root=/image-workdir/cache/bazel" \
4546
--env OFFICIAL_BUILD=${OFFICIAL_BUILD} \
4647
--env FIREBASE_CRASHLYTICS_ENABLED=${FIREBASE_CRASHLYTICS_ENABLED} \
4748
--env FLUTTER_BUILD_NUMBER=${FLUTTER_BUILD_NUMBER} \

flutter/android/android.mk

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ ANDROID_NDK_API_LEVEL?=33
2020

2121
flutter/android: flutter/android/libs
2222
flutter/android/release: flutter/check-release-env flutter/android flutter/prepare flutter/android/apk flutter/android/appbundle
23-
flutter/android/libs: flutter/android/libs/checksum flutter/android/libs/build flutter/android/libs/copy
23+
flutter/android/libs: flutter/android/libs/deps flutter/android/libs/checksum flutter/android/libs/build flutter/android/libs/copy
2424
# run `make flutter/android/apk` before `flutter/android/test-apk`
2525
flutter/android/test-apk: flutter/android/test-apk/main flutter/android/test-apk/helper
2626

@@ -35,6 +35,10 @@ else
3535
@echo "Skip checksum validation"
3636
endif
3737

38+
.PHONY: flutter/android/libs/deps
39+
flutter/android/libs/deps:
40+
${backend_qti_libs_deps}
41+
3842
.PHONY: flutter/android/libs/build
3943
flutter/android/libs/build:
4044
bazel ${BAZEL_OUTPUT_ROOT_ARG} ${proxy_bazel_args} ${sonar_bazel_startup_options} \

flutter/android/docker/Dockerfile

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ RUN curl --proto '=https' -L https://github.com/bazelbuild/bazelisk/releases/dow
3030
chmod +x /usr/local/bin/bazel
3131

3232
ENV ANDROID_SDK_ROOT=/opt/android
33+
ENV ANDROID_HOME=/opt/android
3334
WORKDIR $ANDROID_SDK_ROOT/cmdline-tools
3435
# sdkmanager expects to be placed into `$ANDROID_SDK_ROOT/cmdline-tools/tools`
3536
RUN curl --proto '=https' -L https://dl.google.com/android/repository/commandlinetools-linux-7583922_latest.zip | jar x && \
@@ -73,3 +74,94 @@ RUN mkdir $ANDROID_SDK_HOME && \
7374

7475
# Git repo will be mounted at '/image-workdir/project'
7576
RUN git config --global --add safe.directory /image-workdir/project
77+
78+
# Add 32-bit support since the adb in our sdk's are 32-bit binaries
79+
RUN dpkg --add-architecture i386
80+
ARG DEBIAN_FRONTEND=noninteractive
81+
ARG APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=DontWarn
82+
83+
# build-essential: for rest-kit(rest-kit needed for crad-repo)
84+
# file : used by ndk to determine if host is 32 or 64 bit
85+
# libtbb-dev: used for parallelization of postprocessing for pose-estimation
86+
# libcanberra-gtk-module, libgtk2.0-dev: required by opencv runtime
87+
# libstdc++6:i386: to add support for 32 bit binaries.
88+
# libxtst6 : required to run ide(e.g intellij) inside docker
89+
RUN apt-get update && apt-get install --no-install-recommends -y build-essential \
90+
cmake \
91+
curl \
92+
git \
93+
emacs \
94+
file \
95+
less \
96+
libcanberra-gtk-module \
97+
libgtk2.0-dev \
98+
libtbb-dev \
99+
libstdc++6:i386 \
100+
libxtst6
101+
102+
# pkg-config: required by opencv runtime
103+
# software-properties-common: for curl
104+
# xterm : to make resize available for avoiding line wrapping
105+
# zip : required when sourcing snpe envsetup
106+
RUN apt-get update && apt-get install --no-install-recommends -y mc \
107+
meld \
108+
pkg-config \
109+
python3-dev \
110+
software-properties-common \
111+
sudo \
112+
tmux \
113+
tree \
114+
unzip \
115+
vim \
116+
wget \
117+
xterm \
118+
zip \
119+
ffmpeg \
120+
libjpeg-dev \
121+
zlib1g-dev && \
122+
apt-get clean autoclean
123+
124+
# Get cmake-3.19.3
125+
# apt has 3.10.2 as latest version, so remove it
126+
RUN apt-get remove --no-install-recommends -y cmake
127+
RUN wget -q https://github.com/Kitware/CMake/releases/download/v3.19.3/cmake-3.19.3-Linux-x86_64.sh -O /opt/cmake-3.19.3-Linux-x86_64.sh && \
128+
chmod +x /opt/cmake-3.19.3-Linux-x86_64.sh && mkdir -p /opt/cmake && \
129+
bash /opt/cmake-3.19.3-Linux-x86_64.sh --skip-license --prefix=/opt/cmake && \
130+
rm -rf /opt/cmake-3.19.3-Linux-x86_64.sh
131+
# Add CMAKE into PATH
132+
ENV PATH "/opt/cmake/bin:${PATH}"
133+
134+
# OpenCV
135+
ENV CMAKE_TOOLCHAIN_FILE "${ANDROID_NDK_ROOT}/build/cmake/android.toolchain.cmake"
136+
ENV ANDROID_ABI "arm64-v8a"
137+
ENV API_LEVEL "31"
138+
ENV ANDROID_TOOLCHAIN_NAME "aarch64-linux-android-4.9"
139+
ARG COMMON_CMAKE_OPTIONS="-DBUILD_SHARED_LIBS=ON -DCMAKE_BUILD_TYPE=release \
140+
-DBUILD_ZLIB=ON -DWITH_FFMPEG=ON -DBUILD_TESTS=OFF \
141+
-DWITH_TBB=ON -DBUILD_PERF_TESTS=OFF -DWITH_IPP=OFF \
142+
-DWITH_OPENEXR=ON -DWITH_JASPER=ON -WITH_PNG=ON -DBUILD_FAT_JAVA_LIB=OFF WITH_IMGCODEC=ON"
143+
# Ref: https://docs.opencv.org/3.4.0/d7/d9f/tutorial_linux_install.html
144+
RUN wget -q https://github.com/opencv/opencv/archive/3.4.7/opencv-3.4.7.tar.gz -O /tmp/3.4.7.tar.gz && \
145+
tar -C /tmp -xvf /tmp/3.4.7.tar.gz && \
146+
# First build for arm-android
147+
cd /tmp/opencv-3.4.7 && mkdir -p /opt/opencv-3.4.7_android/ release_android && cd release_android && \
148+
cmake -DCMAKE_TOOLCHAIN_FILE="${CMAKE_TOOLCHAIN_FILE}" \
149+
-DANDROID_NDK="${ANDROID_NDK}" \
150+
-DANDROID_HOME="${ANDROID_HOME}" \
151+
-DANDROID_STL=c++_shared \
152+
-DBUILD_ANDROID_PROJECTS=OFF \
153+
-DANDROID_NATIVE_API_LEVEL="${API_LEVEL}" \
154+
-DANDROID_ABI="${ANDROID_ABI}" \
155+
-DWITH_CUDA=ON -DWITH_OPENCL=ON \
156+
$COMMON_CMAKE_OPTIONS \
157+
-D WITH_ITT=OFF \
158+
-DCMAKE_INSTALL_PREFIX=/opt/opencv-3.4.7_android/ .. && \
159+
make -j16 && \
160+
sudo make -j16 install && cp -rf ./3rdparty/ /opt/opencv-3.4.7_android/
161+
162+
# Set the variables to be used for actual app development/build
163+
ENV ANDROID_SYSROOT "${ANDROID_NDK}/toolchains/llvm/prebuilt/linux-x86_64/sysroot"
164+
ENV ANDROID_PLATFORM "${API_LEVEL}"
165+
ENV ANDROID_PLATFORM_TOOLS "${ANDROID_HOME}/platform-tools"
166+
ENV PATH "${ANDROID_PLATFORM_TOOLS}:${PATH}"
167+
ENV LD_LIBRARY_PATH "/usr/local/lib/:${LD_LIBRARY_PATH}"
Lines changed: 12 additions & 0 deletions
Loading
Lines changed: 12 additions & 0 deletions
Loading

flutter/cpp/binary/cmdline.mk

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,11 @@
1515

1616
include flutter/cpp/binary/cmdline-docker.mk
1717

18-
cmdline/android/bins/release: cmdline/android/bins/build cmdline/android/bins/copy
18+
cmdline/android/bins/release: cmdline/android/libs/deps cmdline/android/bins/build cmdline/android/bins/copy
19+
20+
.PHONY: cmdline/android/libs/deps
21+
cmdline/android/libs/deps:
22+
${backend_qti_libs_deps}
1923

2024
.PHONY: cmdline/android/bins/build
2125
cmdline/android/bins/build:

0 commit comments

Comments
 (0)