• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //
2 // Copyright (C) 2020 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 
17 // clang-format off
18 #include "native_bridge_support/vdso/interceptable_functions.h"
19 
20 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ANeuralNetworksBurst_create);
21 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ANeuralNetworksBurst_free);
22 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ANeuralNetworksCompilation_create);
23 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ANeuralNetworksCompilation_createForDevices);
24 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ANeuralNetworksCompilation_finish);
25 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ANeuralNetworksCompilation_free);
26 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ANeuralNetworksCompilation_setCaching);
27 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ANeuralNetworksCompilation_setPreference);
28 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ANeuralNetworksCompilation_setPriority);
29 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ANeuralNetworksCompilation_setTimeout);
30 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ANeuralNetworksDevice_getExtensionSupport);
31 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ANeuralNetworksDevice_getFeatureLevel);
32 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ANeuralNetworksDevice_getName);
33 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ANeuralNetworksDevice_getType);
34 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ANeuralNetworksDevice_getVersion);
35 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ANeuralNetworksDevice_wait);
36 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ANeuralNetworksEvent_createFromSyncFenceFd);
37 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ANeuralNetworksEvent_free);
38 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ANeuralNetworksEvent_getSyncFenceFd);
39 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ANeuralNetworksEvent_wait);
40 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ANeuralNetworksExecution_burstCompute);
41 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ANeuralNetworksExecution_compute);
42 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ANeuralNetworksExecution_create);
43 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ANeuralNetworksExecution_free);
44 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ANeuralNetworksExecution_getDuration);
45 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ANeuralNetworksExecution_getOutputOperandDimensions);
46 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ANeuralNetworksExecution_getOutputOperandRank);
47 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ANeuralNetworksExecution_setInput);
48 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ANeuralNetworksExecution_setInputFromMemory);
49 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ANeuralNetworksExecution_setLoopTimeout);
50 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ANeuralNetworksExecution_setMeasureTiming);
51 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ANeuralNetworksExecution_setOutput);
52 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ANeuralNetworksExecution_setOutputFromMemory);
53 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ANeuralNetworksExecution_setTimeout);
54 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ANeuralNetworksExecution_startCompute);
55 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ANeuralNetworksExecution_startComputeWithDependencies);
56 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ANeuralNetworksMemoryDesc_addInputRole);
57 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ANeuralNetworksMemoryDesc_addOutputRole);
58 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ANeuralNetworksMemoryDesc_create);
59 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ANeuralNetworksMemoryDesc_finish);
60 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ANeuralNetworksMemoryDesc_free);
61 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ANeuralNetworksMemoryDesc_setDimensions);
62 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ANeuralNetworksMemory_copy);
63 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ANeuralNetworksMemory_createFromAHardwareBuffer);
64 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ANeuralNetworksMemory_createFromDesc);
65 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ANeuralNetworksMemory_createFromFd);
66 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ANeuralNetworksMemory_free);
67 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ANeuralNetworksModel_addOperand);
68 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ANeuralNetworksModel_addOperation);
69 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ANeuralNetworksModel_create);
70 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ANeuralNetworksModel_finish);
71 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ANeuralNetworksModel_free);
72 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ANeuralNetworksModel_getExtensionOperandType);
73 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ANeuralNetworksModel_getExtensionOperationType);
74 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ANeuralNetworksModel_getSupportedOperationsForDevices);
75 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ANeuralNetworksModel_identifyInputsAndOutputs);
76 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ANeuralNetworksModel_relaxComputationFloat32toFloat16);
77 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ANeuralNetworksModel_setOperandExtensionData);
78 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ANeuralNetworksModel_setOperandSymmPerChannelQuantParams);
79 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ANeuralNetworksModel_setOperandValue);
80 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ANeuralNetworksModel_setOperandValueFromMemory);
81 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ANeuralNetworksModel_setOperandValueFromModel);
82 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ANeuralNetworks_getDefaultLoopTimeout);
83 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ANeuralNetworks_getDevice);
84 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ANeuralNetworks_getDeviceCount);
85 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ANeuralNetworks_getMaximumLoopTimeout);
86 
init_stub_library()87 static void __attribute__((constructor(0))) init_stub_library() {
88   INIT_INTERCEPTABLE_STUB_FUNCTION("libneuralnetworks.so", ANeuralNetworksBurst_create);
89   INIT_INTERCEPTABLE_STUB_FUNCTION("libneuralnetworks.so", ANeuralNetworksBurst_free);
90   INIT_INTERCEPTABLE_STUB_FUNCTION("libneuralnetworks.so", ANeuralNetworksCompilation_create);
91   INIT_INTERCEPTABLE_STUB_FUNCTION("libneuralnetworks.so", ANeuralNetworksCompilation_createForDevices);
92   INIT_INTERCEPTABLE_STUB_FUNCTION("libneuralnetworks.so", ANeuralNetworksCompilation_finish);
93   INIT_INTERCEPTABLE_STUB_FUNCTION("libneuralnetworks.so", ANeuralNetworksCompilation_free);
94   INIT_INTERCEPTABLE_STUB_FUNCTION("libneuralnetworks.so", ANeuralNetworksCompilation_setCaching);
95   INIT_INTERCEPTABLE_STUB_FUNCTION("libneuralnetworks.so", ANeuralNetworksCompilation_setPreference);
96   INIT_INTERCEPTABLE_STUB_FUNCTION("libneuralnetworks.so", ANeuralNetworksCompilation_setPriority);
97   INIT_INTERCEPTABLE_STUB_FUNCTION("libneuralnetworks.so", ANeuralNetworksCompilation_setTimeout);
98   INIT_INTERCEPTABLE_STUB_FUNCTION("libneuralnetworks.so", ANeuralNetworksDevice_getExtensionSupport);
99   INIT_INTERCEPTABLE_STUB_FUNCTION("libneuralnetworks.so", ANeuralNetworksDevice_getFeatureLevel);
100   INIT_INTERCEPTABLE_STUB_FUNCTION("libneuralnetworks.so", ANeuralNetworksDevice_getName);
101   INIT_INTERCEPTABLE_STUB_FUNCTION("libneuralnetworks.so", ANeuralNetworksDevice_getType);
102   INIT_INTERCEPTABLE_STUB_FUNCTION("libneuralnetworks.so", ANeuralNetworksDevice_getVersion);
103   INIT_INTERCEPTABLE_STUB_FUNCTION("libneuralnetworks.so", ANeuralNetworksDevice_wait);
104   INIT_INTERCEPTABLE_STUB_FUNCTION("libneuralnetworks.so", ANeuralNetworksEvent_createFromSyncFenceFd);
105   INIT_INTERCEPTABLE_STUB_FUNCTION("libneuralnetworks.so", ANeuralNetworksEvent_free);
106   INIT_INTERCEPTABLE_STUB_FUNCTION("libneuralnetworks.so", ANeuralNetworksEvent_getSyncFenceFd);
107   INIT_INTERCEPTABLE_STUB_FUNCTION("libneuralnetworks.so", ANeuralNetworksEvent_wait);
108   INIT_INTERCEPTABLE_STUB_FUNCTION("libneuralnetworks.so", ANeuralNetworksExecution_burstCompute);
109   INIT_INTERCEPTABLE_STUB_FUNCTION("libneuralnetworks.so", ANeuralNetworksExecution_compute);
110   INIT_INTERCEPTABLE_STUB_FUNCTION("libneuralnetworks.so", ANeuralNetworksExecution_create);
111   INIT_INTERCEPTABLE_STUB_FUNCTION("libneuralnetworks.so", ANeuralNetworksExecution_free);
112   INIT_INTERCEPTABLE_STUB_FUNCTION("libneuralnetworks.so", ANeuralNetworksExecution_getDuration);
113   INIT_INTERCEPTABLE_STUB_FUNCTION("libneuralnetworks.so", ANeuralNetworksExecution_getOutputOperandDimensions);
114   INIT_INTERCEPTABLE_STUB_FUNCTION("libneuralnetworks.so", ANeuralNetworksExecution_getOutputOperandRank);
115   INIT_INTERCEPTABLE_STUB_FUNCTION("libneuralnetworks.so", ANeuralNetworksExecution_setInput);
116   INIT_INTERCEPTABLE_STUB_FUNCTION("libneuralnetworks.so", ANeuralNetworksExecution_setInputFromMemory);
117   INIT_INTERCEPTABLE_STUB_FUNCTION("libneuralnetworks.so", ANeuralNetworksExecution_setLoopTimeout);
118   INIT_INTERCEPTABLE_STUB_FUNCTION("libneuralnetworks.so", ANeuralNetworksExecution_setMeasureTiming);
119   INIT_INTERCEPTABLE_STUB_FUNCTION("libneuralnetworks.so", ANeuralNetworksExecution_setOutput);
120   INIT_INTERCEPTABLE_STUB_FUNCTION("libneuralnetworks.so", ANeuralNetworksExecution_setOutputFromMemory);
121   INIT_INTERCEPTABLE_STUB_FUNCTION("libneuralnetworks.so", ANeuralNetworksExecution_setTimeout);
122   INIT_INTERCEPTABLE_STUB_FUNCTION("libneuralnetworks.so", ANeuralNetworksExecution_startCompute);
123   INIT_INTERCEPTABLE_STUB_FUNCTION("libneuralnetworks.so", ANeuralNetworksExecution_startComputeWithDependencies);
124   INIT_INTERCEPTABLE_STUB_FUNCTION("libneuralnetworks.so", ANeuralNetworksMemoryDesc_addInputRole);
125   INIT_INTERCEPTABLE_STUB_FUNCTION("libneuralnetworks.so", ANeuralNetworksMemoryDesc_addOutputRole);
126   INIT_INTERCEPTABLE_STUB_FUNCTION("libneuralnetworks.so", ANeuralNetworksMemoryDesc_create);
127   INIT_INTERCEPTABLE_STUB_FUNCTION("libneuralnetworks.so", ANeuralNetworksMemoryDesc_finish);
128   INIT_INTERCEPTABLE_STUB_FUNCTION("libneuralnetworks.so", ANeuralNetworksMemoryDesc_free);
129   INIT_INTERCEPTABLE_STUB_FUNCTION("libneuralnetworks.so", ANeuralNetworksMemoryDesc_setDimensions);
130   INIT_INTERCEPTABLE_STUB_FUNCTION("libneuralnetworks.so", ANeuralNetworksMemory_copy);
131   INIT_INTERCEPTABLE_STUB_FUNCTION("libneuralnetworks.so", ANeuralNetworksMemory_createFromAHardwareBuffer);
132   INIT_INTERCEPTABLE_STUB_FUNCTION("libneuralnetworks.so", ANeuralNetworksMemory_createFromDesc);
133   INIT_INTERCEPTABLE_STUB_FUNCTION("libneuralnetworks.so", ANeuralNetworksMemory_createFromFd);
134   INIT_INTERCEPTABLE_STUB_FUNCTION("libneuralnetworks.so", ANeuralNetworksMemory_free);
135   INIT_INTERCEPTABLE_STUB_FUNCTION("libneuralnetworks.so", ANeuralNetworksModel_addOperand);
136   INIT_INTERCEPTABLE_STUB_FUNCTION("libneuralnetworks.so", ANeuralNetworksModel_addOperation);
137   INIT_INTERCEPTABLE_STUB_FUNCTION("libneuralnetworks.so", ANeuralNetworksModel_create);
138   INIT_INTERCEPTABLE_STUB_FUNCTION("libneuralnetworks.so", ANeuralNetworksModel_finish);
139   INIT_INTERCEPTABLE_STUB_FUNCTION("libneuralnetworks.so", ANeuralNetworksModel_free);
140   INIT_INTERCEPTABLE_STUB_FUNCTION("libneuralnetworks.so", ANeuralNetworksModel_getExtensionOperandType);
141   INIT_INTERCEPTABLE_STUB_FUNCTION("libneuralnetworks.so", ANeuralNetworksModel_getExtensionOperationType);
142   INIT_INTERCEPTABLE_STUB_FUNCTION("libneuralnetworks.so", ANeuralNetworksModel_getSupportedOperationsForDevices);
143   INIT_INTERCEPTABLE_STUB_FUNCTION("libneuralnetworks.so", ANeuralNetworksModel_identifyInputsAndOutputs);
144   INIT_INTERCEPTABLE_STUB_FUNCTION("libneuralnetworks.so", ANeuralNetworksModel_relaxComputationFloat32toFloat16);
145   INIT_INTERCEPTABLE_STUB_FUNCTION("libneuralnetworks.so", ANeuralNetworksModel_setOperandExtensionData);
146   INIT_INTERCEPTABLE_STUB_FUNCTION("libneuralnetworks.so", ANeuralNetworksModel_setOperandSymmPerChannelQuantParams);
147   INIT_INTERCEPTABLE_STUB_FUNCTION("libneuralnetworks.so", ANeuralNetworksModel_setOperandValue);
148   INIT_INTERCEPTABLE_STUB_FUNCTION("libneuralnetworks.so", ANeuralNetworksModel_setOperandValueFromMemory);
149   INIT_INTERCEPTABLE_STUB_FUNCTION("libneuralnetworks.so", ANeuralNetworksModel_setOperandValueFromModel);
150   INIT_INTERCEPTABLE_STUB_FUNCTION("libneuralnetworks.so", ANeuralNetworks_getDefaultLoopTimeout);
151   INIT_INTERCEPTABLE_STUB_FUNCTION("libneuralnetworks.so", ANeuralNetworks_getDevice);
152   INIT_INTERCEPTABLE_STUB_FUNCTION("libneuralnetworks.so", ANeuralNetworks_getDeviceCount);
153   INIT_INTERCEPTABLE_STUB_FUNCTION("libneuralnetworks.so", ANeuralNetworks_getMaximumLoopTimeout);
154 }
155 // clang-format on
156