blob: 8971bbdf2f965e8edd454c5d32f12a10cd108517 [file] [log] [blame]
Tensorflow uses its on implementation of ashmem_create if it is
not being built for Android.
That implementation has a bug, where if the same 'name' is passed in
for multiple invocations, it will resize the underlying shared memory
file, effectively ignoring the 'anonymous' aspect expected of ashmem.
Our implementation handles this better, and this ensures all of the ashmem
functionlity is consistenly served from our implementation.
diff --git a/tensorflow/lite/nnapi/nnapi_implementation.cc b/tensorflow/lite/nnapi/nnapi_implementation.cc
index 862c4ba2..e275f266 100644
--- a/tensorflow/lite/nnapi/nnapi_implementation.cc
+++ b/tensorflow/lite/nnapi/nnapi_implementation.cc
@@ -170,7 +170,8 @@ const NnApi LoadNnApi() {
// implementation, but don't have libneuralnetworks.so library, and
// platforms which use nnapi_implementation_disabled.cc stub.
if (libneuralnetworks != nullptr) {
- nnapi.ASharedMemory_create = ASharedMemory_create;
+ LOAD_FUNCTION_RENAME(libneuralnetworks, ASharedMemory_create,
+ "ashmem_create_region");
}
#endif // __ANDROID__