tflite: Add fp16 headers to cmake rule
This is needed to build GPU delegate without XNNPACK enabled. It fixes the issue #46386. PiperOrigin-RevId: 351901574 Change-Id: Ib0dff4c51627dfcd72fbb23d688ab2ae37505056
This commit is contained in:
parent
9aedc576ae
commit
82c9e09d20
tensorflow/lite
@ -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)
|
||||
|
16
tensorflow/lite/tools/cmake/modules/Findfp16_headers.cmake
Normal file
16
tensorflow/lite/tools/cmake/modules/Findfp16_headers.cmake
Normal 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)
|
41
tensorflow/lite/tools/cmake/modules/fp16_headers.cmake
Normal file
41
tensorflow/lite/tools/cmake/modules/fp16_headers.cmake
Normal 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"
|
||||
)
|
Loading…
Reference in New Issue
Block a user