Skip to content

Commit

Permalink
tfs:aarch64: add aarch64 mkl bazel config to enable onednn+acl backend
Browse files Browse the repository at this point in the history
  • Loading branch information
snadampal committed Jan 20, 2022
1 parent 4efd81f commit 1285e41
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
9 changes: 9 additions & 0 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,15 @@ build:mkl_open_source_only --define=build_with_mkl_dnn_only=true
build:mkl_open_source_only --define=build_with_mkl=true --define=enable_mkl=true
build:mkl_open_source_only --define=tensorflow_mkldnn_contraction_kernel=0

# Config setting to build oneDNN with Compute Library for the Arm Architecture (ACL).
# This build is for the inference regime only.
build:mkl_aarch64 --define=build_with_mkl_aarch64=true --define=enable_mkl=true
build:mkl_aarch64 --define=tensorflow_mkldnn_contraction_kernel=0
build:mkl_aarch64 --define=build_with_mkl_opensource=true
build:mkl_aarch64 --define=build_with_openmp=true
build:mkl_aarch64 --copt=-march=armv8.2-a
build:mkl_aarch64 --copt=-O3

# Processor native optimizations (depends on build host capabilities).
build:nativeopt --copt=-march=native
build:nativeopt --host_copt=-march=native
Expand Down
9 changes: 7 additions & 2 deletions tensorflow_serving/tools/pip_package/build_pip_package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,13 @@ function main() {
mkdir -p ${TMPDIR}/tensorflow_serving/apis
mkdir -p ${TMPDIR}/tensorflow_serving/config

BAZEL_OPT_DIR="k8-opt"
if [[ $(uname -m) == "aarch64" ]]; then
BAZEL_OPT_DIR="aarch64-opt"
fi

echo "Adding python files"
cp bazel-out/k8-opt/bin/tensorflow_serving/apis/*_pb2.py \
cp bazel-out/${BAZEL_OPT_DIR}/bin/tensorflow_serving/apis/*_pb2.py \
"${TMPDIR}/tensorflow_serving/apis"

cp ${BAZEL_PROJECT_DIR}/tensorflow_serving/apis/*_pb2.py \
Expand All @@ -47,7 +52,7 @@ function main() {
cp ${BAZEL_PROJECT_DIR}/tensorflow_serving/apis/*_grpc.py \
"${TMPDIR}/tensorflow_serving/apis"

cp bazel-out/k8-opt/bin/tensorflow_serving/config/*_pb2.py \
cp bazel-out/${BAZEL_OPT_DIR}/bin/tensorflow_serving/config/*_pb2.py \
"${TMPDIR}/tensorflow_serving/config"

touch "${TMPDIR}/tensorflow_serving/apis/__init__.py"
Expand Down

0 comments on commit 1285e41

Please sign in to comment.