tflite: Add fp16 headers to cmake rule

This is needed to build GPU delegate without XNNPACK enabled.
It fixes the issue .

PiperOrigin-RevId: 351901574
Change-Id: Ib0dff4c51627dfcd72fbb23d688ab2ae37505056
This commit is contained in:
Terry Heo 2021-01-14 16:30:58 -08:00 committed by TensorFlower Gardener
parent 9aedc576ae
commit 82c9e09d20
3 changed files with 58 additions and 0 deletions

View File

@ -206,6 +206,7 @@ endif()
if(TFLITE_ENABLE_GPU)
find_package(opencl_headers REQUIRED)
find_package(vulkan_headers REQUIRED)
find_package(fp16_headers REQUIRED)
# Android NDK already has OpenGL, EGL headers.
if(NOT "${CMAKE_SYSTEM_NAME}" STREQUAL "Android")
find_package(opengl_headers REQUIRED)

View File

@ -0,0 +1,16 @@
#
# Copyright 2021 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
#
# https://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.
include(fp16_headers)

View File

@ -0,0 +1,41 @@
#
# Copyright 2021 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
#
# https://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.
# Skip installation when xnnpack is used since it also has fp16 headers.
if(TARGET fp16_headers OR fp16_headers_POPULATED OR TFLITE_ENABLE_XNNPACK)
return()
endif()
include(FetchContent)
OverridableFetchContent_Declare(
fp16_headers
GIT_REPOSITORY https://github.com/Maratyszcza/FP16
# GIT_TAG must keep in sync with https://github.com/google/XNNPACK/blob/master/cmake/DownloadFP16.cmake
GIT_TAG 3c54eacb74f6f5e39077300c5564156c424d77ba
GIT_PROGRESS TRUE
PREFIX "${CMAKE_BINARY_DIR}"
SOURCE_DIR "${CMAKE_BINARY_DIR}/fp16_headers"
)
OverridableFetchContent_GetProperties(fp16_headers)
if(NOT fp16_headers)
OverridableFetchContent_Populate(fp16_headers)
endif()
include_directories(
AFTER
"${fp16_headers_SOURCE_DIR}/include"
)