| /* |
| * Copyright 2017 The Android Open Source Project |
| * |
| * 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. |
| */ |
| |
| package { |
| // Inherits all licenses from parent to get Apache 2.0 and package name |
| default_applicable_licenses: [ |
| "packages_modules_NeuralNetworks_license", |
| ], |
| } |
| |
| cc_library_headers { |
| name: "libneuralnetworks_common_headers", |
| host_supported: true, |
| export_include_dirs: ["include"], |
| } |
| |
| // The following files took too much time to compile with clang-tidy. |
| tidy_disabled_common_operations_files = [ |
| "operations/ActivationExecution.cpp", |
| "operations/BroadcastExecution.cpp", |
| "operations/ConcatenationExecution.cpp", |
| "operations/Conv2DExecution.cpp", |
| "operations/FullyConnectedExecution.cpp", |
| "operations/L2NormalizationExecution.cpp", |
| "operations/LocalResponseNormalizationExecution.cpp", |
| "operations/PReluExecution.cpp", |
| "operations/PoolingExecution.cpp", |
| "operations/ReshapeExecution.cpp", |
| "operations/SimpleMathExecution.cpp", |
| "operations/SoftmaxExecution.cpp", |
| "operations/TransposeExecution.cpp", |
| ] |
| |
| cc_defaults { |
| name: "neuralnetworks_operations", |
| host_supported: true, |
| srcs: [ |
| "OperationResolver.cpp", |
| "operations/ActivationExecution.cpp", |
| "operations/BatchMatmulExecution.cpp", |
| "operations/BidirectionalSequenceRNNExecution.cpp", |
| "operations/BroadcastExecution.cpp", |
| "operations/ChannelShuffleExecution.cpp", |
| "operations/ComparisonsExecution.cpp", |
| "operations/ConcatenationExecution.cpp", |
| "operations/Conv2DExecution.cpp", |
| "operations/DensifyExecution.cpp", |
| "operations/DepthwiseConv2DExecution.cpp", |
| "operations/DequantizeExecution.cpp", |
| "operations/ElementwiseExecution.cpp", |
| "operations/EluExecution.cpp", |
| "operations/FillExecution.cpp", |
| "operations/FullyConnectedExecution.cpp", |
| "operations/GatherExecution.cpp", |
| "operations/GenerateProposalsExecution.cpp", |
| "operations/HeatmapMaxKeypointExecution.cpp", |
| "operations/InstanceNormalizationExecution.cpp", |
| "operations/L2NormalizationExecution.cpp", |
| "operations/LocalResponseNormalizationExecution.cpp", |
| "operations/LogSoftmaxExecution.cpp", |
| "operations/LogicalAndOrExecution.cpp", |
| "operations/LogicalNotExecution.cpp", |
| "operations/MirrorPadExecution.cpp", |
| "operations/NegExecution.cpp", |
| "operations/PReluExecution.cpp", |
| "operations/PackExecution.cpp", |
| "operations/PoolingExecution.cpp", |
| "operations/QLSTMExecution.cpp", |
| "operations/QuantizeExecution.cpp", |
| "operations/RankExecution.cpp", |
| "operations/ReduceExecution.cpp", |
| "operations/ResizeImageOpsExecution.cpp", |
| "operations/ReverseExecution.cpp", |
| "operations/RoiAlignExecution.cpp", |
| "operations/RoiPoolingExecution.cpp", |
| "operations/SelectExecution.cpp", |
| "operations/SliceExecution.cpp", |
| "operations/SoftmaxExecution.cpp", |
| "operations/SqueezeExecution.cpp", |
| "operations/StridedSliceExecution.cpp", |
| "operations/TopK_V2Execution.cpp", |
| "operations/TransposeConv2DExecution.cpp", |
| "operations/TransposeExecution.cpp", |
| "operations/UnidirectionalSequenceLSTMExecution.cpp", |
| "operations/UnidirectionalSequenceRNNExecution.cpp", |
| ], |
| tidy_disabled_srcs: tidy_disabled_common_operations_files, |
| } |
| |
| filegroup { |
| name: "neuralnetworks_operations_validation", |
| srcs: ["operations/*Validation.cpp"], |
| } |
| |
| // libneuralnetworks_common* provides common utilities for the NNAPI runtime, drivers, and tests to |
| // use. Two variants of the common library are provided: |
| // - libneuralnetworks_common: the common library, used by NNAPI runtime and tests. |
| // - libneuralnetworks_common_experimental: the common library with NN_EXPERIMENTAL_FEATURE flag |
| // turned on, used by NNAPI drivers and tests for experimental features. |
| // |
| // Both variants of the common library also link against all versions (1.0-3) of the NNAPI HIDL |
| // library. |
| // |
| cc_defaults { |
| name: "libneuralnetworks_common_defaults", |
| defaults: [ |
| "neuralnetworks_defaults", |
| "neuralnetworks_operations", |
| ], |
| host_supported: true, |
| apex_available: [ |
| "//apex_available:platform", |
| "com.android.neuralnetworks", |
| "test_com.android.neuralnetworks", |
| ], |
| vendor_available: true, |
| // b/109953668, disable OpenMP |
| // openmp: true, |
| export_include_dirs: [ |
| "include", |
| ], |
| srcs: [ |
| "ActivationFunctor.cpp", |
| "BufferTracker.cpp", |
| "CpuExecutor.cpp", |
| "ExecutionBurstController.cpp", |
| "ExecutionBurstServer.cpp", |
| "GraphDump.cpp", |
| "HalBufferTracker.cpp", |
| "IndexedShapeWrapper.cpp", |
| "LegacyHalUtils.cpp", |
| "LegacyUtils.cpp", |
| "MemoryUtils.cpp", |
| "MetaModel.cpp", |
| "ModelUtils.cpp", |
| "OperationsExecutionUtils.cpp", |
| "QuantUtils.cpp", |
| "TokenHasher.cpp", |
| "ValidateHal.cpp", |
| "operations/ArgMinMaxExecution.cpp", |
| "operations/BidirectionalSequenceLSTMExecution.cpp", |
| "operations/CastExecution.cpp", |
| "operations/EmbeddingLookupExecution.cpp", |
| "operations/ExpandDimsExecution.cpp", |
| "operations/GroupedConv2DExecution.cpp", |
| "operations/HashtableLookupExecution.cpp", |
| "operations/LSHProjectionExecution.cpp", |
| "operations/LSTMExecution.cpp", |
| "operations/MaximumMinimumExecution.cpp", |
| "operations/MultinomialExecution.cpp", |
| "operations/PowExecution.cpp", |
| "operations/QuantizedLSTMExecution.cpp", |
| "operations/RNNExecution.cpp", |
| "operations/ReshapeExecution.cpp", |
| "operations/SVDFExecution.cpp", |
| "operations/SimpleMathExecution.cpp", |
| "operations/SplitExecution.cpp", |
| "operations/TileExecution.cpp", |
| ], |
| shared_libs: [ |
| "[email protected]", |
| "[email protected]", |
| "[email protected]", |
| "[email protected]", |
| "[email protected]", |
| "[email protected]", |
| "libbase", |
| "libcutils", |
| "libfmq", |
| "libhidlbase", |
| "libhidlmemory", |
| "liblog", |
| "libutils", |
| ], |
| target: { |
| android: { |
| shared_libs: ["libnativewindow"], |
| }, |
| host: { |
| cflags: [ |
| "-D__INTRODUCED_IN(x)=", |
| ], |
| }, |
| }, |
| header_libs: [ |
| "gemmlowp_headers", |
| "libeigen", |
| "libneuralnetworks_headers", |
| "libtextclassifier_hash_headers", |
| "philox_random_headers", |
| "tensorflow_headers", |
| ], |
| whole_static_libs: [ |
| "libarect", |
| "libtflite_kernel_utils", |
| "neuralnetworks_types", |
| "neuralnetworks_utils_hal_1_0", // TODO(b/160669116): Remove VNDK dependencies. |
| "neuralnetworks_utils_hal_1_1", |
| "neuralnetworks_utils_hal_1_2", |
| "neuralnetworks_utils_hal_1_3", |
| "neuralnetworks_utils_hal_common", |
| "philox_random", |
| ], |
| static_libs: [ |
| "libcrypto_static", |
| "libruy_static", |
| "libtextclassifier_hash_static", |
| "neuralnetworks_types", |
| ], |
| cflags: [ |
| "-DNAMESPACE_FOR_HASH_FUNCTIONS=farmhash", |
| "-DNN_INCLUDE_CPU_IMPLEMENTATION", |
| "-DTF_LITE_DISABLE_X86_NEON", |
| ], |
| } |
| |
| cc_library_static { |
| name: "libneuralnetworks_common", |
| defaults: [ |
| "libneuralnetworks_common_defaults", |
| ], |
| } |
| |
| cc_library_static { |
| name: "libneuralnetworks_common_experimental", |
| defaults: [ |
| "libneuralnetworks_common_defaults", |
| ], |
| exclude_static_libs: [ |
| "neuralnetworks_types", |
| ], |
| static_libs: [ |
| "neuralnetworks_types_experimental", |
| ], |
| cflags: [ |
| "-DNN_EXPERIMENTAL_FEATURE", |
| ], |
| } |
| |
| cc_defaults { |
| name: "neuralnetworks_cl_defaults", |
| host_supported: false, |
| vendor_available: false, |
| stl: "libc++_static", |
| sdk_version: "current", |
| min_sdk_version: "29", |
| cflags: [ |
| "-DNN_COMPATIBILITY_LIBRARY_BUILD", |
| ], |
| } |
| |
| cc_defaults { |
| name: "libneuralnetworks_common_cl_defaults", |
| defaults: [ |
| "neuralnetworks_cl_defaults", |
| "neuralnetworks_defaults", |
| "neuralnetworks_operations", |
| ], |
| host_supported: false, |
| apex_available: [ |
| "//apex_available:platform", |
| "com.android.neuralnetworks", |
| "test_com.android.neuralnetworks", |
| ], |
| // b/109953668, disable OpenMP |
| // openmp: true, |
| export_include_dirs: [ |
| "include", |
| ], |
| srcs: [ |
| "BufferTracker.cpp", |
| "CpuExecutor.cpp", |
| "GraphDump.cpp", |
| "IndexedShapeWrapper.cpp", |
| "LegacyUtils.cpp", |
| "MetaModel.cpp", |
| "ModelUtils.cpp", |
| "OperationsExecutionUtils.cpp", |
| "TokenHasher.cpp", |
| ], |
| header_libs: [ |
| "libneuralnetworks_headers_ndk", |
| ], |
| static_libs: [ |
| "libbase_ndk", |
| "libcrypto_static", |
| "neuralnetworks_types_cl", |
| ], |
| shared_libs: [ |
| "libnativewindow", |
| ], |
| cflags: [ |
| "-DNAMESPACE_FOR_HASH_FUNCTIONS=farmhash", |
| "-DTF_LITE_DISABLE_X86_NEON", |
| ], |
| } |
| |
| cc_library_static { |
| name: "libneuralnetworks_common_cl", |
| defaults: ["libneuralnetworks_common_cl_defaults"], |
| } |
| |
| cc_library_static { |
| name: "libneuralnetworks_common_cl_cpu", |
| defaults: ["libneuralnetworks_common_cl_defaults"], |
| header_libs: [ |
| "gemmlowp_headers", |
| "libeigen", |
| "libruy_headers", |
| "libtextclassifier_hash_headers", |
| "philox_random_headers", |
| "tensorflow_headers", |
| ], |
| whole_static_libs: [ |
| "philox_random_cl", |
| ], |
| static_libs: [ |
| "libcrypto_static", |
| "libtextclassifier_hash_static", |
| ], |
| srcs: [ |
| "ActivationFunctor.cpp", |
| "QuantUtils.cpp", |
| "operations/ArgMinMaxExecution.cpp", |
| "operations/BidirectionalSequenceLSTMExecution.cpp", |
| "operations/CastExecution.cpp", |
| "operations/EmbeddingLookupExecution.cpp", |
| "operations/ExpandDimsExecution.cpp", |
| "operations/GroupedConv2DExecution.cpp", |
| "operations/HashtableLookupExecution.cpp", |
| "operations/LSHProjectionExecution.cpp", |
| "operations/LSTMExecution.cpp", |
| "operations/MaximumMinimumExecution.cpp", |
| "operations/MultinomialExecution.cpp", |
| "operations/PowExecution.cpp", |
| "operations/QuantizedLSTMExecution.cpp", |
| "operations/RNNExecution.cpp", |
| "operations/ReshapeExecution.cpp", |
| "operations/SVDFExecution.cpp", |
| "operations/SimpleMathExecution.cpp", |
| "operations/SplitExecution.cpp", |
| "operations/TileExecution.cpp", |
| ], |
| cflags: [ |
| "-DNAMESPACE_FOR_HASH_FUNCTIONS=farmhash", |
| "-DNN_COMPATIBILITY_LIBRARY_BUILD", |
| "-DNN_INCLUDE_CPU_IMPLEMENTATION", |
| "-DTF_LITE_DISABLE_X86_NEON", |
| ], |
| } |
| |
| cc_defaults { |
| name: "NeuralNetworksTest_common", |
| defaults: [ |
| "neuralnetworks_float16", |
| "neuralnetworks_use_latest_utils_hal_aidl", |
| ], |
| host_supported: true, |
| shared_libs: [ |
| "[email protected]", |
| "[email protected]", |
| "libcutils", |
| "libhidlbase", |
| "libhidlmemory", |
| "libneuralnetworks", |
| "libneuralnetworks_packageinfo", |
| "libutils", |
| ], |
| static_libs: [ |
| "[email protected]", |
| "[email protected]", |
| "[email protected]", |
| "[email protected]", |
| "libbase", |
| "libgmock", |
| "liblog", |
| "libneuralnetworks_common", |
| "neuralnetworks_types", |
| ], |
| target: { |
| android: { |
| shared_libs: [ |
| "libnativewindow", |
| ], |
| }, |
| host: { |
| cflags: [ |
| "-D__ANDROID_API_S__=31", |
| "-D__INTRODUCED_IN(n)=", |
| ], |
| }, |
| }, |
| local_include_dirs: ["include"], |
| } |
| |
| cc_test { |
| name: "NeuralNetworksTest_operations", |
| defaults: ["NeuralNetworksTest_common"], |
| srcs: [ |
| "operations/*Test.cpp", |
| ], |
| header_libs: [ |
| "gemmlowp_headers", |
| "libeigen", |
| "philox_random_headers", |
| "tensorflow_headers", |
| ], |
| } |
| |
| cc_test { |
| name: "NeuralNetworksTest_utils", |
| defaults: ["NeuralNetworksTest_common"], |
| srcs: [ |
| "UtilsTest.cpp", |
| ], |
| header_libs: [ |
| "gemmlowp_headers", |
| "libeigen", |
| "tensorflow_headers", |
| ], |
| test_suites: [ |
| "general-tests", |
| ], |
| } |
| |
| cc_test { |
| name: "NeuralNetworksTest_logtag", |
| defaults: ["NeuralNetworksTest_common"], |
| srcs: [ |
| "LogTagTest.cpp", |
| "LogTagTestExtra.cpp", |
| ], |
| } |