| 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 17635bcd..9e71c899 100644 |
| --- a/tensorflow/lite/nnapi/nnapi_implementation.cc |
| +++ b/tensorflow/lite/nnapi/nnapi_implementation.cc |
| @@ -221,7 +221,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__ |