From b4a142283d670c89b8971d8fd7181a6f462fdd4e Mon Sep 17 00:00:00 2001 From: XinPing Wang Date: Tue, 5 Mar 2019 07:48:50 +0800 Subject: [PATCH 1/2] Disable NNAPI api for Raspberry Pi --- tensorflow/lite/tools/make/Makefile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tensorflow/lite/tools/make/Makefile b/tensorflow/lite/tools/make/Makefile index 8428e0d2e6b..2c7bc5757df 100644 --- a/tensorflow/lite/tools/make/Makefile +++ b/tensorflow/lite/tools/make/Makefile @@ -131,6 +131,9 @@ endif ifeq ($(TARGET),ios) BUILD_WITH_NNAPI=false endif +ifeq ($(TARGET),rpi) + BUILD_WITH_NNAPI=false +endif ifeq ($(BUILD_WITH_NNAPI),true) CORE_CC_EXCLUDE_SRCS += tensorflow/lite/nnapi_delegate_disabled.cc else From 5702bb9fd7b6696cf55e7301f9ef9d6b6926c998 Mon Sep 17 00:00:00 2001 From: XinPing Wang Date: Wed, 6 Mar 2019 12:59:26 +0800 Subject: [PATCH 2/2] New build target for aarch64 without NNAPI --- tensorflow/lite/tools/make/Makefile | 3 ++ .../tools/make/build_generic_aarch64_lib.sh | 22 +++++++++++++ .../make/targets/generic_aarch64_makefile.inc | 33 +++++++++++++++++++ 3 files changed, 58 insertions(+) create mode 100755 tensorflow/lite/tools/make/build_generic_aarch64_lib.sh create mode 100644 tensorflow/lite/tools/make/targets/generic_aarch64_makefile.inc diff --git a/tensorflow/lite/tools/make/Makefile b/tensorflow/lite/tools/make/Makefile index 2c7bc5757df..78208a76103 100644 --- a/tensorflow/lite/tools/make/Makefile +++ b/tensorflow/lite/tools/make/Makefile @@ -134,6 +134,9 @@ endif ifeq ($(TARGET),rpi) BUILD_WITH_NNAPI=false endif +ifeq ($(TARGET),generic-aarch64) + BUILD_WITH_NNAPI=false +endif ifeq ($(BUILD_WITH_NNAPI),true) CORE_CC_EXCLUDE_SRCS += tensorflow/lite/nnapi_delegate_disabled.cc else diff --git a/tensorflow/lite/tools/make/build_generic_aarch64_lib.sh b/tensorflow/lite/tools/make/build_generic_aarch64_lib.sh new file mode 100755 index 00000000000..d497b94ffc0 --- /dev/null +++ b/tensorflow/lite/tools/make/build_generic_aarch64_lib.sh @@ -0,0 +1,22 @@ +#!/bin/bash -x +# Copyright 2017 The TensorFlow Authors. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============================================================================== + +set -e + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +cd "$SCRIPT_DIR/../../../.." + +CC_PREFIX=aarch64-linux-gnu- make -j 3 -f tensorflow/lite/tools/make/Makefile TARGET=generic-aarch64 TARGET_ARCH=armv8-a diff --git a/tensorflow/lite/tools/make/targets/generic_aarch64_makefile.inc b/tensorflow/lite/tools/make/targets/generic_aarch64_makefile.inc new file mode 100644 index 00000000000..f4e4f1f9c4d --- /dev/null +++ b/tensorflow/lite/tools/make/targets/generic_aarch64_makefile.inc @@ -0,0 +1,33 @@ +# Settings for generic aarch64 boards such as Odroid C2 or Pine64. +ifeq ($(TARGET),generic-aarch64) + # The aarch64 architecture covers all 64-bit ARM chips. This arch mandates + # NEON, so FPU flags are not needed below. + TARGET_ARCH := armv8-a + TARGET_TOOLCHAIN_PREFIX := aarch64-linux-gnu- + + CXXFLAGS += \ + -march=armv8-a \ + -funsafe-math-optimizations \ + -ftree-vectorize \ + -fPIC + + CCFLAGS += \ + -march=armv8-a \ + -funsafe-math-optimizations \ + -ftree-vectorize \ + -fPIC + + LDFLAGS := \ + -Wl,--no-export-dynamic \ + -Wl,--exclude-libs,ALL \ + -Wl,--gc-sections \ + -Wl,--as-needed + + + LIBS := \ + -lstdc++ \ + -lpthread \ + -lm \ + -ldl + +endif