• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright 2017 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17cc_library_headers {
18    name: "libneuralnetworks_common_headers",
19    host_supported: false,
20    export_include_dirs: ["include"],
21}
22
23cc_defaults {
24    name: "neuralnetworks_operations",
25    srcs: [
26        "OperationResolver.cpp",
27        "operations/Activation.cpp",
28        "operations/BidirectionalSequenceRNN.cpp",
29        "operations/Broadcast.cpp",
30        "operations/ChannelShuffle.cpp",
31        "operations/Comparisons.cpp",
32        "operations/Concatenation.cpp",
33        "operations/Conv2D.cpp",
34        "operations/DepthwiseConv2D.cpp",
35        "operations/Dequantize.cpp",
36        "operations/Elementwise.cpp",
37        "operations/Elu.cpp",
38        "operations/Fill.cpp",
39        "operations/FullyConnected.cpp",
40        "operations/Gather.cpp",
41        "operations/GenerateProposals.cpp",
42        "operations/HeatmapMaxKeypoint.cpp",
43        "operations/InstanceNormalization.cpp",
44        "operations/L2Normalization.cpp",
45        "operations/LocalResponseNormalization.cpp",
46        "operations/LogSoftmax.cpp",
47        "operations/LogicalAndOr.cpp",
48        "operations/LogicalNot.cpp",
49        "operations/Neg.cpp",
50        "operations/PRelu.cpp",
51        "operations/Pooling.cpp",
52        "operations/QLSTM.cpp",
53        "operations/Quantize.cpp",
54        "operations/Rank.cpp",
55        "operations/Reduce.cpp",
56        "operations/ResizeImageOps.cpp",
57        "operations/RoiAlign.cpp",
58        "operations/RoiPooling.cpp",
59        "operations/Select.cpp",
60        "operations/Slice.cpp",
61        "operations/Softmax.cpp",
62        "operations/Squeeze.cpp",
63        "operations/StridedSlice.cpp",
64        "operations/TopK_V2.cpp",
65        "operations/Transpose.cpp",
66        "operations/TransposeConv2D.cpp",
67        "operations/UnidirectionalSequenceLSTM.cpp",
68        "operations/UnidirectionalSequenceRNN.cpp",
69    ],
70}
71
72cc_library_static {
73    name: "libneuralnetworks_utils",
74    defaults: [
75        "neuralnetworks_defaults",
76        "neuralnetworks_operations",
77    ],
78    host_supported: false,
79    vendor_available: true,
80    apex_available: [
81        "//apex_available:platform",
82        "com.android.neuralnetworks",
83        "test_com.android.neuralnetworks",
84    ],
85    export_include_dirs: ["include"],
86    srcs: [
87        "ExecutionBurstController.cpp",
88        "ExecutionBurstServer.cpp",
89        "MemoryUtils.cpp",
90        "Utils.cpp",
91    ],
92    header_libs: [
93        "gemmlowp_headers",
94        "libeigen",
95        "libneuralnetworks_headers",
96        "tensorflow_headers",
97    ],
98    shared_libs: [
99        "android.hardware.neuralnetworks@1.0",
100        "android.hardware.neuralnetworks@1.1",
101        "android.hardware.neuralnetworks@1.2",
102        "android.hardware.neuralnetworks@1.3",
103        "android.hidl.allocator@1.0",
104        "android.hidl.memory@1.0",
105        "libfmq",
106        "libhidlbase",
107        "libhidlmemory",
108        "libnativewindow",
109    ],
110    whole_static_libs: [
111        "libarect",
112    ],
113    cflags: [
114        "-DTF_LITE_DISABLE_X86_NEON",
115        "-Wall",
116        "-Werror",
117        "-Wextra",
118        "-Wno-extern-c-compat",
119        "-Wno-invalid-partial-specialization",
120        "-Wno-sign-compare",
121        "-Wno-unused-local-typedef",
122        "-Wno-unused-parameter",
123        "-Wno-unused-private-field",
124        "-Wno-unused-variable",
125    ],
126}
127
128cc_library_static {
129    name: "libneuralnetworks_common",
130    defaults: [
131        "neuralnetworks_defaults",
132        "neuralnetworks_operations",
133    ],
134    apex_available: [
135        "//apex_available:platform",
136        "com.android.neuralnetworks",
137        "test_com.android.neuralnetworks",
138    ],
139    host_supported: false,
140    vendor_available: true,
141    // b/109953668, disable OpenMP
142    // openmp: true,
143    export_include_dirs: [
144        "include",
145    ],
146    srcs: [
147        "BufferTracker.cpp",
148        "CpuExecutor.cpp",
149        "ExecutionBurstController.cpp",
150        "ExecutionBurstServer.cpp",
151        "GraphDump.cpp",
152        "IndexedShapeWrapper.cpp",
153        "MemoryUtils.cpp",
154        "MetaModel.cpp",
155        "OperationsUtils.cpp",
156        "QuantUtils.cpp",
157        "TokenHasher.cpp",
158        "Utils.cpp",
159        "ValidateHal.cpp",
160        "operations/ArgMinMax.cpp",
161        "operations/BidirectionalSequenceLSTM.cpp",
162        "operations/Cast.cpp",
163        "operations/EmbeddingLookup.cpp",
164        "operations/ExpandDims.cpp",
165        "operations/GroupedConv2D.cpp",
166        "operations/HashtableLookup.cpp",
167        "operations/LSHProjection.cpp",
168        "operations/LSTM.cpp",
169        "operations/MaximumMinimum.cpp",
170        "operations/Multinomial.cpp",
171        "operations/Pow.cpp",
172        "operations/QuantizedLSTM.cpp",
173        "operations/RNN.cpp",
174        "operations/Reshape.cpp",
175        "operations/SVDF.cpp",
176        "operations/SimpleMath.cpp",
177        "operations/Split.cpp",
178        "operations/Tile.cpp",
179    ],
180    shared_libs: [
181        "android.hardware.neuralnetworks@1.0",
182        "android.hardware.neuralnetworks@1.1",
183        "android.hardware.neuralnetworks@1.2",
184        "android.hardware.neuralnetworks@1.3",
185        "android.hidl.allocator@1.0",
186        "android.hidl.memory@1.0",
187        "libbase",
188        "libcutils",
189        "libfmq",
190        "libhidlbase",
191        "libhidlmemory",
192        "liblog",
193        "libnativewindow",
194        "libutils",
195    ],
196    header_libs: [
197        "gemmlowp_headers",
198        "libeigen",
199        "libneuralnetworks_headers",
200        "libtextclassifier_hash_headers",
201        "philox_random_headers",
202        "tensorflow_headers",
203    ],
204    whole_static_libs: [
205        "libarect",
206        "libtflite_kernel_utils",
207        "philox_random",
208    ],
209    static_libs: [
210        "libcrypto_static",
211        "libtextclassifier_hash_static",
212    ],
213    cflags: [
214        "-DNAMESPACE_FOR_HASH_FUNCTIONS=farmhash",
215        "-DNN_INCLUDE_CPU_IMPLEMENTATION",
216        "-DTF_LITE_DISABLE_X86_NEON",
217        "-Wall",
218        "-Werror",
219        "-Wextra",
220        "-Wno-array-bounds",
221        "-Wno-extern-c-compat",
222        "-Wno-invalid-partial-specialization",
223        "-Wno-sign-compare",
224        "-Wno-unused-local-typedef",
225        "-Wno-unused-parameter",
226        "-Wno-unused-private-field",
227        "-Wno-unused-variable",
228    ],
229}
230
231cc_defaults {
232    name: "NeuralNetworksTest_common",
233    defaults: ["neuralnetworks_float16"],
234    shared_libs: [
235        "android.hidl.allocator@1.0",
236        "android.hidl.memory@1.0",
237        "libhidlbase",
238        "libhidlmemory",
239        "libnativewindow",
240        "libneuralnetworks",
241        "libneuralnetworks_packageinfo",
242    ],
243    static_libs: [
244        "android.hardware.neuralnetworks@1.0",
245        "android.hardware.neuralnetworks@1.1",
246        "android.hardware.neuralnetworks@1.2",
247        "android.hardware.neuralnetworks@1.3",
248        "libbase",
249        "libgmock",
250        "liblog",
251        "libneuralnetworks_common",
252    ],
253    cflags: [
254        "-Wno-extern-c-compat",
255    ],
256    local_include_dirs: ["include"],
257}
258
259cc_test {
260    name: "NeuralNetworksTest_operations",
261    defaults: ["NeuralNetworksTest_common"],
262    srcs: [
263        "operations/*Test.cpp",
264    ],
265    header_libs: [
266        "gemmlowp_headers",
267        "libeigen",
268        "philox_random_headers",
269        "tensorflow_headers",
270    ],
271    cflags: [
272        "-Wno-invalid-partial-specialization",
273        "-Wno-unused-parameter",
274    ],
275}
276
277cc_test {
278    name: "NeuralNetworksTest_utils",
279    defaults: ["NeuralNetworksTest_common"],
280    srcs: [
281        "UtilsTest.cpp",
282    ],
283    header_libs: [
284        "gemmlowp_headers",
285        "libeigen",
286        "tensorflow_headers",
287    ],
288    cflags: [
289        "-Wno-unused-parameter",
290        "-Wno-unused-variable",
291    ],
292    test_suites: [
293        "general-tests",
294    ],
295}
296
297cc_test {
298    name: "NeuralNetworksTest_logtag",
299    defaults: ["NeuralNetworksTest_common"],
300    srcs: [
301        "LogTagTest.cpp",
302        "LogTagTestExtra.cpp",
303    ],
304}
305