diff --git a/tensorflow/lite/g3doc/guide/build_arm64.md b/tensorflow/lite/g3doc/guide/build_arm64.md index 825e235d058..30ad231cabf 100644 --- a/tensorflow/lite/g3doc/guide/build_arm64.md +++ b/tensorflow/lite/g3doc/guide/build_arm64.md @@ -46,7 +46,7 @@ Then compile: ``` This should compile a static library in: -`tensorflow/lite/tools/make/gen/aarch64_armv8-a/lib/libtensorflow-lite.a`. +`tensorflow/lite/tools/make/gen/linux_aarch64/lib/libtensorflow-lite.a`. ## Compile natively on ARM64 @@ -75,4 +75,4 @@ Then compile: ``` This should compile a static library in: -`tensorflow/lite/tools/make/gen/aarch64_armv8-a/lib/libtensorflow-lite.a`. +`tensorflow/lite/tools/make/gen/linux_aarch64/lib/libtensorflow-lite.a`. diff --git a/tensorflow/lite/tools/make/Makefile b/tensorflow/lite/tools/make/Makefile index 43ded75fd6e..5dd6526c8f4 100644 --- a/tensorflow/lite/tools/make/Makefile +++ b/tensorflow/lite/tools/make/Makefile @@ -146,22 +146,15 @@ else CORE_CC_EXCLUDE_SRCS += tensorflow/lite/mmap_allocation_disabled.cc endif -BUILD_WITH_NNAPI ?= true -ifeq ($(BUILD_TYPE),micro) - BUILD_WITH_NNAPI=false +BUILD_WITH_RUY ?= false +ifeq ($(TARGET_ARCH),aarch64) + BUILD_WITH_RUY=true endif -ifeq ($(TARGET),windows) - BUILD_WITH_NNAPI=false -endif -ifeq ($(TARGET),ios) - BUILD_WITH_NNAPI=false -endif -ifeq ($(TARGET),rpi) - BUILD_WITH_NNAPI=false -endif -ifeq ($(TARGET),generic-aarch64) - BUILD_WITH_NNAPI=false +ifeq ($(BUILD_WITH_RUY),true) + CXXFLAGS += -DTFLITE_WITH_RUY endif + +BUILD_WITH_NNAPI ?= false ifeq ($(BUILD_WITH_NNAPI),true) CORE_CC_ALL_SRCS += tensorflow/lite/delegates/nnapi/nnapi_delegate.cc CORE_CC_ALL_SRCS += tensorflow/lite/delegates/nnapi/quant_lstm_sup.cc @@ -219,7 +212,8 @@ ALL_SRCS := \ $(CMD_LINE_TOOLS_SRCS) # Where compiled objects are stored. -GENDIR := $(MAKEFILE_DIR)/gen/$(TARGET)_$(TARGET_ARCH)/ +TARGET_OUT_DIR ?= $(TARGET)_$(TARGET_ARCH) +GENDIR := $(MAKEFILE_DIR)/gen/$(TARGET_OUT_DIR)/ OBJDIR := $(GENDIR)obj/ BINDIR := $(GENDIR)bin/ LIBDIR := $(GENDIR)lib/ diff --git a/tensorflow/lite/tools/make/build_generic_aarch64_lib.sh b/tensorflow/lite/tools/make/build_generic_aarch64_lib.sh deleted file mode 100755 index d497b94ffc0..00000000000 --- a/tensorflow/lite/tools/make/build_generic_aarch64_lib.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/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/build_lib.sh b/tensorflow/lite/tools/make/build_lib.sh index 7fdd262ee9c..b9d33a01515 100755 --- a/tensorflow/lite/tools/make/build_lib.sh +++ b/tensorflow/lite/tools/make/build_lib.sh @@ -20,5 +20,5 @@ set -e SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" TENSORFLOW_DIR="${SCRIPT_DIR}/../../../.." -make -j 4 BUILD_WITH_NNAPI=false -C "${TENSORFLOW_DIR}" -f tensorflow/lite/tools/make/Makefile +make -j 4 -C "${TENSORFLOW_DIR}" -f tensorflow/lite/tools/make/Makefile diff --git a/tensorflow/lite/tools/make/targets/aarch64_makefile.inc b/tensorflow/lite/tools/make/targets/aarch64_makefile.inc index 0c38463bb6e..32eab51f308 100644 --- a/tensorflow/lite/tools/make/targets/aarch64_makefile.inc +++ b/tensorflow/lite/tools/make/targets/aarch64_makefile.inc @@ -2,8 +2,9 @@ ifeq ($(TARGET),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_ARCH := aarch64 TARGET_TOOLCHAIN_PREFIX := aarch64-linux-gnu- + TARGET_OUT_DIR := linux_aarch64 CXXFLAGS += \ -march=armv8-a \ @@ -24,7 +25,6 @@ ifeq ($(TARGET),aarch64) -Wl,--as-needed \ -lrt - LIBS := \ -lstdc++ \ -lpthread \ diff --git a/tensorflow/lite/tools/make/targets/generic_aarch64_makefile.inc b/tensorflow/lite/tools/make/targets/generic_aarch64_makefile.inc deleted file mode 100644 index f4e4f1f9c4d..00000000000 --- a/tensorflow/lite/tools/make/targets/generic_aarch64_makefile.inc +++ /dev/null @@ -1,33 +0,0 @@ -# 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 diff --git a/tensorflow/lite/tools/make/targets/rpi_makefile.inc b/tensorflow/lite/tools/make/targets/rpi_makefile.inc index 9dbbd4fa6da..295f9d31450 100644 --- a/tensorflow/lite/tools/make/targets/rpi_makefile.inc +++ b/tensorflow/lite/tools/make/targets/rpi_makefile.inc @@ -7,7 +7,7 @@ ifeq ($(TARGET),rpi) ifeq ($(TARGET_ARCH), armv7l) CXXFLAGS += \ - -march=armv7-a \ + -march=armv7-a \ -mfpu=neon-vfpv4 \ -funsafe-math-optimizations \ -ftree-vectorize \ @@ -25,6 +25,8 @@ ifeq ($(TARGET),rpi) -Wl,--exclude-libs,ALL \ -Wl,--gc-sections \ -Wl,--as-needed + + BUILD_WITH_RUY := true endif # TODO(petewarden) In the future, we'll want to use OpenBLAS as a faster @@ -50,7 +52,7 @@ ifeq ($(TARGET),rpi) -Wl,--gc-sections \ -Wl,--as-needed endif - + LIBS := \ -lstdc++ \ -lpthread \