aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin May <kevin.may@arm.com>2022-04-06 11:41:49 +0100
committerKevin May <kevin.may@arm.com>2022-05-05 16:33:55 +0100
commit3edefbb2da1efecebba12cd631ca9697f06db7d4 (patch)
tree9bd696b65ea697f9314c9999c62084f55bd0f90c
parent643355be8a8e94edb66e4586b406343d4342382b (diff)
downloadarmnn-3edefbb2da1efecebba12cd631ca9697f06db7d4.tar.gz
IVGCVSW-6758 Update SL AOSP repos to use SHA's from master 25/03/22
* Add new SHA's from master 25/03/2 to clone script * Fix changed AOSP paths in CMakelists * Add new aosp/external dependencies in CMakeLists * Update functions with FL8 parameters hints and extensionNameAndPrefix * Update sharedHandle which changed from having pointer * Fix broken NeuralNetwork patch after pulling on aosp master Signed-off-by: Kevin May <kevin.may@arm.com> Change-Id: I5e4b773b87591cec0347c3d739bce9858baed39f
-rw-r--r--shim/BuildGuideShimSupportLibrary.md4
-rw-r--r--shim/sl/CMakeLists.txt134
-rw-r--r--shim/sl/canonical/ArmnnDriver.hpp20
-rw-r--r--shim/sl/canonical/ArmnnDriverImpl.cpp22
-rw-r--r--shim/sl/canonical/ArmnnPreparedModel.cpp12
-rw-r--r--shim/sl/canonical/ArmnnPreparedModel.hpp12
-rw-r--r--shim/sl/scripts/NeuralNetworks.patch24
-rwxr-xr-xshim/sl/scripts/clone_aosp_libs.sh39
-rwxr-xr-xshim/sl/scripts/modify_aosp_libs.sh4
9 files changed, 161 insertions, 110 deletions
diff --git a/shim/BuildGuideShimSupportLibrary.md b/shim/BuildGuideShimSupportLibrary.md
index 8029032371..550a05f70f 100644
--- a/shim/BuildGuideShimSupportLibrary.md
+++ b/shim/BuildGuideShimSupportLibrary.md
@@ -31,8 +31,8 @@ export AOSP_ROOT=<path/to/aosp/root>
export NDK=<path/to/>/android-ndk-r20b
export NDK_TOOLCHAIN_ROOT=$NDK/toolchains/llvm/prebuilt/linux-x86_64
export PATH=$NDK_TOOLCHAIN_ROOT/bin/:$PATH
-export $FLATBUFFERS_ANDROID_BUILD=<path/to/flatbuffers/target/android/build>
-export $FLATBUFFERS_X86_BUILD=<path/to/flatbuffers/host/build-x86_64>
+export FLATBUFFERS_ANDROID_BUILD=<path/to/flatbuffers/target/android/build>
+export FLATBUFFERS_X86_BUILD=<path/to/flatbuffers/host/build-x86_64>
```
## Download Arm NN
diff --git a/shim/sl/CMakeLists.txt b/shim/sl/CMakeLists.txt
index 6c2d393fb9..3ce4b30c5f 100644
--- a/shim/sl/CMakeLists.txt
+++ b/shim/sl/CMakeLists.txt
@@ -9,7 +9,9 @@ include(GNUInstallDirs)
SET(libnnapi_support_include_directories)
list(APPEND libnnapi_support_include_directories
- aosp/packages/modules/NeuralNetworks/common/include/nnapi
+ aosp/packages/modules/NeuralNetworks/common/types/include/nnapi/
+ aosp/packages/modules/NeuralNetworks/common/types/include/
+ aosp/packages/modules/NeuralNetworks/common/operations/
aosp/packages/modules/NeuralNetworks/common/include
aosp/packages/modules/NeuralNetworks/runtime/include
aosp/packages/modules/NeuralNetworks/shim_and_sl/public
@@ -18,6 +20,10 @@ list(APPEND libnnapi_support_include_directories
aosp/frameworks/native/libs/nativewindow/include
aosp/system/core/libcutils/include
aosp/system/core/include
+ aosp/external/tensorflow
+ aosp/external/gemmlowp/
+ aosp/external/ruy/
+ aosp/external/eigen/
aosp/external/boringssl/include)
include_directories(${libnnapi_support_include_directories})
@@ -27,10 +33,11 @@ link_directories( ${ARMNN_SOURCE_DIR}/shim/sl/build )
set(base_sources)
list(APPEND base_sources
aosp/system/libbase/abi_compatibility.cpp
+ aosp/system/libbase/posix_strerror_r.cpp
aosp/system/libbase/chrono_utils.cpp
aosp/system/libbase/cmsg.cpp
aosp/system/libbase/file.cpp
-# aosp/system/libbase/hex.cpp # needed in AOSP Master FL7
+ aosp/system/libbase/hex.cpp
aosp/system/libbase/logging.cpp
aosp/system/libbase/mapped_file.cpp
aosp/system/libbase/parsebool.cpp
@@ -45,14 +52,20 @@ add_library(base STATIC ${base_sources})
target_include_directories (base PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
target_include_directories (base PUBLIC ${libnnapi_support_include_directories})
+file(GLOB TYPES_CL_SOURCE_FILES
+ aosp/packages/modules/NeuralNetworks/common/operations/*Validation.cpp
+)
+
set(neuralnetworks_types_cl_sources)
list(APPEND neuralnetworks_types_cl_sources
- aosp/packages/modules/NeuralNetworks/common/DynamicCLDeps.cpp
- aosp/packages/modules/NeuralNetworks/common/SharedMemory.cpp
- aosp/packages/modules/NeuralNetworks/common/SharedMemoryAndroid.cpp
- aosp/packages/modules/NeuralNetworks/common/TypeUtils.cpp
- aosp/packages/modules/NeuralNetworks/common/Types.cpp
- aosp/packages/modules/NeuralNetworks/common/Validation.cpp)
+ aosp/packages/modules/NeuralNetworks/common/types/src/DynamicCLDeps.cpp
+ aosp/packages/modules/NeuralNetworks/common/types/src/SharedMemory.cpp
+ aosp/packages/modules/NeuralNetworks/common/types/src/SharedMemoryAndroid.cpp
+ aosp/packages/modules/NeuralNetworks/common/types/src/TypeUtils.cpp
+ aosp/packages/modules/NeuralNetworks/common/types/src/OperationsValidationUtils.cpp
+ aosp/packages/modules/NeuralNetworks/common/types/src/Types.cpp
+ ${TYPES_CL_SOURCE_FILES}
+ aosp/packages/modules/NeuralNetworks/common/types/src/Validation.cpp)
add_library(neuralnetworks_types_cl STATIC ${neuralnetworks_types_cl_sources})
target_include_directories (neuralnetworks_types_cl PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
@@ -65,57 +78,59 @@ list(APPEND neuralnetworks_common_cl_sources
aosp/packages/modules/NeuralNetworks/common/GraphDump.cpp
aosp/packages/modules/NeuralNetworks/common/IndexedShapeWrapper.cpp
aosp/packages/modules/NeuralNetworks/common/LegacyUtils.cpp
+ aosp/packages/modules/NeuralNetworks/common/ModelUtils.cpp
aosp/packages/modules/NeuralNetworks/common/MetaModel.cpp
- aosp/packages/modules/NeuralNetworks/common/OperationsUtils.cpp
+ aosp/packages/modules/NeuralNetworks/common/OperationsExecutionUtils.cpp
+ aosp/packages/modules/NeuralNetworks/common/types/src/OperationsUtils.cpp
aosp/packages/modules/NeuralNetworks/common/TokenHasher.cpp
aosp/packages/modules/NeuralNetworks/common/OperationResolver.cpp
- aosp/packages/modules/NeuralNetworks/common/operations/Activation.cpp
-# aosp/packages/modules/NeuralNetworks/common/operations/BatchMatmul.cpp # needed in AOSP Master FL7
- aosp/packages/modules/NeuralNetworks/common/operations/BidirectionalSequenceRNN.cpp
- aosp/packages/modules/NeuralNetworks/common/operations/Broadcast.cpp
- aosp/packages/modules/NeuralNetworks/common/operations/ChannelShuffle.cpp
- aosp/packages/modules/NeuralNetworks/common/operations/Comparisons.cpp
- aosp/packages/modules/NeuralNetworks/common/operations/Concatenation.cpp
- aosp/packages/modules/NeuralNetworks/common/operations/Conv2D.cpp
- aosp/packages/modules/NeuralNetworks/common/operations/DepthwiseConv2D.cpp
- aosp/packages/modules/NeuralNetworks/common/operations/Dequantize.cpp
- aosp/packages/modules/NeuralNetworks/common/operations/Elementwise.cpp
- aosp/packages/modules/NeuralNetworks/common/operations/Elu.cpp
- aosp/packages/modules/NeuralNetworks/common/operations/Fill.cpp
- aosp/packages/modules/NeuralNetworks/common/operations/FullyConnected.cpp
- aosp/packages/modules/NeuralNetworks/common/operations/Gather.cpp
- aosp/packages/modules/NeuralNetworks/common/operations/GenerateProposals.cpp
- aosp/packages/modules/NeuralNetworks/common/operations/HeatmapMaxKeypoint.cpp
- aosp/packages/modules/NeuralNetworks/common/operations/InstanceNormalization.cpp
- aosp/packages/modules/NeuralNetworks/common/operations/L2Normalization.cpp
- aosp/packages/modules/NeuralNetworks/common/operations/LocalResponseNormalization.cpp
- aosp/packages/modules/NeuralNetworks/common/operations/LogSoftmax.cpp
- aosp/packages/modules/NeuralNetworks/common/operations/LogicalAndOr.cpp
- aosp/packages/modules/NeuralNetworks/common/operations/LogicalNot.cpp
-# aosp/packages/modules/NeuralNetworks/common/operations/MirrorPad.cpp #needed in AOSP Master FL7
- aosp/packages/modules/NeuralNetworks/common/operations/Neg.cpp
-# aosp/packages/modules/NeuralNetworks/common/operations/Pack.cpp #needed in AOSP Master FL7
- aosp/packages/modules/NeuralNetworks/common/operations/PRelu.cpp
- aosp/packages/modules/NeuralNetworks/common/operations/Pooling.cpp
- aosp/packages/modules/NeuralNetworks/common/operations/QLSTM.cpp
- aosp/packages/modules/NeuralNetworks/common/operations/Quantize.cpp
- aosp/packages/modules/NeuralNetworks/common/operations/Rank.cpp
- aosp/packages/modules/NeuralNetworks/common/operations/Reduce.cpp
-# aosp/packages/modules/NeuralNetworks/common/operations/Reshape.cpp #needed in AOSP Master FL7
-# aosp/packages/modules/NeuralNetworks/common/operations/Reverse.cpp #needed in AOSP Master FL7
- aosp/packages/modules/NeuralNetworks/common/operations/ResizeImageOps.cpp
- aosp/packages/modules/NeuralNetworks/common/operations/RoiAlign.cpp
- aosp/packages/modules/NeuralNetworks/common/operations/RoiPooling.cpp
- aosp/packages/modules/NeuralNetworks/common/operations/Select.cpp
- aosp/packages/modules/NeuralNetworks/common/operations/Slice.cpp
- aosp/packages/modules/NeuralNetworks/common/operations/Softmax.cpp
- aosp/packages/modules/NeuralNetworks/common/operations/Squeeze.cpp
- aosp/packages/modules/NeuralNetworks/common/operations/StridedSlice.cpp
- aosp/packages/modules/NeuralNetworks/common/operations/TopK_V2.cpp
- aosp/packages/modules/NeuralNetworks/common/operations/Transpose.cpp
- aosp/packages/modules/NeuralNetworks/common/operations/TransposeConv2D.cpp
- aosp/packages/modules/NeuralNetworks/common/operations/UnidirectionalSequenceLSTM.cpp
- aosp/packages/modules/NeuralNetworks/common/operations/UnidirectionalSequenceRNN.cpp)
+ aosp/packages/modules/NeuralNetworks/common/operations/ActivationExecution.cpp
+ aosp/packages/modules/NeuralNetworks/common/operations/BatchMatmulExecution.cpp
+ aosp/packages/modules/NeuralNetworks/common/operations/BidirectionalSequenceRNNExecution.cpp
+ aosp/packages/modules/NeuralNetworks/common/operations/BroadcastExecution.cpp
+ aosp/packages/modules/NeuralNetworks/common/operations/ChannelShuffleExecution.cpp
+ aosp/packages/modules/NeuralNetworks/common/operations/ComparisonsExecution.cpp
+ aosp/packages/modules/NeuralNetworks/common/operations/ConcatenationExecution.cpp
+ aosp/packages/modules/NeuralNetworks/common/operations/Conv2DExecution.cpp
+ aosp/packages/modules/NeuralNetworks/common/operations/DepthwiseConv2DExecution.cpp
+ aosp/packages/modules/NeuralNetworks/common/operations/DequantizeExecution.cpp
+ aosp/packages/modules/NeuralNetworks/common/operations/ElementwiseExecution.cpp
+ aosp/packages/modules/NeuralNetworks/common/operations/EluExecution.cpp
+ aosp/packages/modules/NeuralNetworks/common/operations/FillExecution.cpp
+ aosp/packages/modules/NeuralNetworks/common/operations/FullyConnectedExecution.cpp
+ aosp/packages/modules/NeuralNetworks/common/operations/GatherExecution.cpp
+ aosp/packages/modules/NeuralNetworks/common/operations/GenerateProposalsExecution.cpp
+ aosp/packages/modules/NeuralNetworks/common/operations/HeatmapMaxKeypointExecution.cpp
+ aosp/packages/modules/NeuralNetworks/common/operations/InstanceNormalizationExecution.cpp
+ aosp/packages/modules/NeuralNetworks/common/operations/L2NormalizationExecution.cpp
+ aosp/packages/modules/NeuralNetworks/common/operations/LocalResponseNormalizationExecution.cpp
+ aosp/packages/modules/NeuralNetworks/common/operations/LogSoftmaxExecution.cpp
+ aosp/packages/modules/NeuralNetworks/common/operations/LogicalAndOrExecution.cpp
+ aosp/packages/modules/NeuralNetworks/common/operations/LogicalNotExecution.cpp
+ aosp/packages/modules/NeuralNetworks/common/operations/MirrorPadExecution.cpp
+ aosp/packages/modules/NeuralNetworks/common/operations/NegExecution.cpp
+ aosp/packages/modules/NeuralNetworks/common/operations/PackExecution.cpp
+ aosp/packages/modules/NeuralNetworks/common/operations/PReluExecution.cpp
+ aosp/packages/modules/NeuralNetworks/common/operations/PoolingExecution.cpp
+ aosp/packages/modules/NeuralNetworks/common/operations/QLSTMExecution.cpp
+ aosp/packages/modules/NeuralNetworks/common/operations/QuantizeExecution.cpp
+ aosp/packages/modules/NeuralNetworks/common/operations/RankExecution.cpp
+ aosp/packages/modules/NeuralNetworks/common/operations/ReduceExecution.cpp
+ aosp/packages/modules/NeuralNetworks/common/operations/ReshapeExecution.cpp
+ aosp/packages/modules/NeuralNetworks/common/operations/ReverseExecution.cpp
+ aosp/packages/modules/NeuralNetworks/common/operations/ResizeImageOpsExecution.cpp
+ aosp/packages/modules/NeuralNetworks/common/operations/RoiAlignExecution.cpp
+ aosp/packages/modules/NeuralNetworks/common/operations/RoiPoolingExecution.cpp
+ aosp/packages/modules/NeuralNetworks/common/operations/SelectExecution.cpp
+ aosp/packages/modules/NeuralNetworks/common/operations/SliceExecution.cpp
+ aosp/packages/modules/NeuralNetworks/common/operations/SoftmaxExecution.cpp
+ aosp/packages/modules/NeuralNetworks/common/operations/SqueezeExecution.cpp
+ aosp/packages/modules/NeuralNetworks/common/operations/StridedSliceExecution.cpp
+ aosp/packages/modules/NeuralNetworks/common/operations/TopK_V2Execution.cpp
+ aosp/packages/modules/NeuralNetworks/common/operations/TransposeExecution.cpp
+ aosp/packages/modules/NeuralNetworks/common/operations/TransposeConv2DExecution.cpp
+ aosp/packages/modules/NeuralNetworks/common/operations/UnidirectionalSequenceLSTMExecution.cpp
+ aosp/packages/modules/NeuralNetworks/common/operations/UnidirectionalSequenceRNNExecution.cpp)
add_library(neuralnetworks_common_cl STATIC ${neuralnetworks_common_cl_sources})
target_include_directories (neuralnetworks_common_cl PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
@@ -128,14 +143,15 @@ list(APPEND neuralnetworks_cl_sources
aosp/packages/modules/NeuralNetworks/runtime/ExecutionBuilder.cpp
aosp/packages/modules/NeuralNetworks/runtime/ExecutionCallback.cpp
aosp/packages/modules/NeuralNetworks/runtime/ExecutionPlan.cpp
+ aosp/packages/modules/NeuralNetworks/runtime/ServerFlag.cpp
aosp/packages/modules/NeuralNetworks/runtime/Manager.cpp
aosp/packages/modules/NeuralNetworks/runtime/Memory.cpp
-# aosp/packages/modules/NeuralNetworks/runtime/ModelArchHasher.cpp #needed in AOSP Master FL7
+ aosp/packages/modules/NeuralNetworks/runtime/ModelArchHasher.cpp
aosp/packages/modules/NeuralNetworks/runtime/ModelArgumentInfo.cpp
aosp/packages/modules/NeuralNetworks/runtime/ModelBuilder.cpp
aosp/packages/modules/NeuralNetworks/runtime/NeuralNetworks.cpp
-# aosp/packages/modules/NeuralNetworks/runtime/SupportLibraryDiagnostic.cpp #needed in AOSP Master FL7
-# aosp/packages/modules/NeuralNetworks/runtime/Telemetry.cpp #needed in AOSP Master FL7
+ aosp/packages/modules/NeuralNetworks/runtime/SupportLibraryDiagnostic.cpp
+ aosp/packages/modules/NeuralNetworks/runtime/Telemetry.cpp
aosp/packages/modules/NeuralNetworks/runtime/TypeManager.cpp)
add_library(neuralnetworks_cl OBJECT ${neuralnetworks_cl_sources})
diff --git a/shim/sl/canonical/ArmnnDriver.hpp b/shim/sl/canonical/ArmnnDriver.hpp
index 6c8acd60c5..c42ffa20b5 100644
--- a/shim/sl/canonical/ArmnnDriver.hpp
+++ b/shim/sl/canonical/ArmnnDriver.hpp
@@ -22,7 +22,6 @@
#include "ModelToINetworkTransformer.hpp"
#include <log/log.h>
-
namespace armnn_driver
{
@@ -67,8 +66,7 @@ public:
Version getFeatureLevel() const override
{
VLOG(DRIVER) << "ArmnnDriver::getFeatureLevel()";
- // return kVersionFeatureLevel5;
- return Version::ANDROID_S;
+ return kVersionFeatureLevel5;
}
DeviceType getType() const override
@@ -175,12 +173,14 @@ public:
}
GeneralResult<SharedPreparedModel> prepareModel(const Model& model,
- ExecutionPreference preference,
- Priority priority,
- OptionalTimePoint deadline,
- const std::vector<SharedHandle>& modelCache,
- const std::vector<SharedHandle>& dataCache,
- const CacheToken& token) const override
+ ExecutionPreference preference,
+ Priority priority,
+ OptionalTimePoint deadline,
+ const std::vector<SharedHandle>& modelCache,
+ const std::vector<SharedHandle>& dataCache,
+ const CacheToken& token,
+ const std::vector<android::nn::TokenValuePair>& hints,
+ const std::vector<android::nn::ExtensionNameAndPrefix>& extensionNameToPrefix) const override
{
VLOG(DRIVER) << "ArmnnDriver::prepareModel()";
@@ -240,7 +240,7 @@ public:
const std::vector<BufferRole>&) const override
{
VLOG(DRIVER) << "ArmnnDriver::allocate()";
- return NN_ERROR(ErrorStatus::GENERAL_FAILURE) << "ArmnnDriver::allocate -- does not support allocate.";
+ return NN_ERROR(ErrorStatus::INVALID_ARGUMENT) << "ArmnnDriver::allocate -- does not support allocate.";
}
};
diff --git a/shim/sl/canonical/ArmnnDriverImpl.cpp b/shim/sl/canonical/ArmnnDriverImpl.cpp
index d3b4f23e12..3223d9e8bf 100644
--- a/shim/sl/canonical/ArmnnDriverImpl.cpp
+++ b/shim/sl/canonical/ArmnnDriverImpl.cpp
@@ -73,12 +73,12 @@ bool ArmnnDriverImpl::ValidateSharedHandle(const SharedHandle& sharedHandle)
{
bool valid = true;
- if (sharedHandle->fds[0] < 0)
+ if (*sharedHandle < 0)
{
return !valid;
}
- int dataCacheFileAccessMode = fcntl(sharedHandle->fds[0], F_GETFL) & O_ACCMODE;
+ int dataCacheFileAccessMode = fcntl(*sharedHandle, F_GETFL) & O_ACCMODE;
if (dataCacheFileAccessMode != O_RDWR)
{
return !valid;
@@ -102,7 +102,7 @@ bool ArmnnDriverImpl::ValidateDataCacheHandle(const std::vector<SharedHandle>& d
}
struct stat statBuffer;
- if (fstat(dataCacheHandle[0]->fds[0], &statBuffer) == 0)
+ if (fstat(*dataCacheHandle[0], &statBuffer) == 0)
{
unsigned long bufferSize = statBuffer.st_size;
if (bufferSize != dataSize)
@@ -189,7 +189,7 @@ GeneralResult<SharedPreparedModel> ArmnnDriverImpl::PrepareArmnnModel(
// For GpuAcc numberOfCachedFiles is 1
if (backend == armnn::Compute::GpuAcc)
{
- cachedFd = modelCacheHandle[index]->fds[0];
+ cachedFd = *modelCacheHandle[index];
saveCachedNetwork = true;
}
index += numberOfCachedModelFiles;
@@ -279,7 +279,7 @@ GeneralResult<SharedPreparedModel> ArmnnDriverImpl::PrepareArmnnModel(
size_t hashValue = 0;
if (dataCacheHandle.size() == 1 )
{
- write(dataCacheHandle[0]->fds[0], dataCacheData.data(), dataCacheData.size());
+ write(*dataCacheHandle[0], dataCacheData.data(), dataCacheData.size());
hashValue = CacheDataHandlerInstance().Hash(dataCacheData);
}
@@ -290,17 +290,17 @@ GeneralResult<SharedPreparedModel> ArmnnDriverImpl::PrepareArmnnModel(
{
for (uint32_t i = 0; i < modelCacheHandle.size(); ++i)
{
- int modelCacheFileAccessMode = fcntl(modelCacheHandle[i]->fds[0], F_GETFL) & O_ACCMODE;
+ int modelCacheFileAccessMode = fcntl(*modelCacheHandle[i], F_GETFL) & O_ACCMODE;
if (modelCacheFileAccessMode != O_RDONLY)
{
struct stat statBuffer;
- if (fstat(modelCacheHandle[i]->fds[0], &statBuffer) == 0)
+ if (fstat(*modelCacheHandle[i], &statBuffer) == 0)
{
long modelDataSize = statBuffer.st_size;
if (modelDataSize > 0)
{
std::vector<uint8_t> modelData(modelDataSize);
- pread(modelCacheHandle[i]->fds[0], modelData.data(), modelData.size(), 0);
+ pread(*modelCacheHandle[i], modelData.data(), modelData.size(), 0);
hashValue ^= CacheDataHandlerInstance().Hash(modelData);
}
}
@@ -403,7 +403,7 @@ GeneralResult<SharedPreparedModel> ArmnnDriverImpl::PrepareArmnnModelFromCache(
// Read the model
std::vector<uint8_t> dataCacheData(dataSize);
- pread(dataCacheHandle[0]->fds[0], dataCacheData.data(), dataCacheData.size(), 0);
+ pread(*dataCacheHandle[0], dataCacheData.data(), dataCacheData.size(), 0);
auto hashValue = CacheDataHandlerInstance().Hash(dataCacheData);
int gpuAccCachedFd = -1;
@@ -422,7 +422,7 @@ GeneralResult<SharedPreparedModel> ArmnnDriverImpl::PrepareArmnnModelFromCache(
return NN_ERROR(ErrorStatus::GENERAL_FAILURE)
<< "ArmnnDriverImpl::prepareModelFromCache(): Invalid model cache handle!";
}
- int cachedFd = modelCacheHandle[index]->fds[0];
+ int cachedFd = *modelCacheHandle[index];
struct stat statBuffer;
if (fstat(cachedFd, &statBuffer) == 0)
{
@@ -558,4 +558,4 @@ void ArmnnDriverImpl::ClearNetworks()
m_NetworkIDs.clear();
}
-} // namespace armnn_driver \ No newline at end of file
+} // namespace armnn_driver
diff --git a/shim/sl/canonical/ArmnnPreparedModel.cpp b/shim/sl/canonical/ArmnnPreparedModel.cpp
index 35edfb7d99..927d5bfad6 100644
--- a/shim/sl/canonical/ArmnnPreparedModel.cpp
+++ b/shim/sl/canonical/ArmnnPreparedModel.cpp
@@ -275,7 +275,9 @@ ExecutionResult<std::pair<std::vector<OutputShape>, Timing>> ArmnnPreparedModel:
const Request& request,
MeasureTiming measureTiming,
const OptionalTimePoint& deadline,
- const OptionalDuration&) const
+ const OptionalDuration&,
+ const std::vector<android::nn::TokenValuePair>& hints,
+ const std::vector<android::nn::ExtensionNameAndPrefix>& extensionNameToPrefix) const
{
VLOG(DRIVER) << "CanonicalDriver::PreparedModel::execute()";
@@ -443,7 +445,9 @@ GeneralResult<std::pair<SyncFence, ExecuteFencedInfoCallback>> ArmnnPreparedMode
MeasureTiming measureTiming,
const OptionalTimePoint& deadline,
const OptionalDuration&,
- const OptionalDuration&) const
+ const OptionalDuration&,
+ const std::vector<android::nn::TokenValuePair>& hints,
+ const std::vector<android::nn::ExtensionNameAndPrefix>& extensionNameToPrefix) const
{
VLOG(DRIVER) << "ArmnnPreparedModel::executeFenced()";
@@ -562,7 +566,9 @@ GeneralResult<std::pair<SyncFence, ExecuteFencedInfoCallback>> ArmnnPreparedMode
GeneralResult<SharedExecution> ArmnnPreparedModel::createReusableExecution(
const Request& request,
MeasureTiming measureTiming,
- const OptionalDuration& loopTimeoutDuration) const
+ const OptionalDuration& loopTimeoutDuration,
+ const std::vector<android::nn::TokenValuePair>& hints,
+ const std::vector<android::nn::ExtensionNameAndPrefix>& extensionNameToPrefix) const
{
VLOG(DRIVER) << "ArmnnPreparedModel::createReusableExecution()";
return std::make_shared<DefaultExecution>(shared_from_this(),
diff --git a/shim/sl/canonical/ArmnnPreparedModel.hpp b/shim/sl/canonical/ArmnnPreparedModel.hpp
index 4f0f456312..920c7fb314 100644
--- a/shim/sl/canonical/ArmnnPreparedModel.hpp
+++ b/shim/sl/canonical/ArmnnPreparedModel.hpp
@@ -59,7 +59,9 @@ public:
const Request& request,
MeasureTiming measureTiming,
const OptionalTimePoint& deadline,
- const OptionalDuration& loopTimeoutDuration) const override;
+ const OptionalDuration& loopTimeoutDuration,
+ const std::vector<android::nn::TokenValuePair>& hints,
+ const std::vector<android::nn::ExtensionNameAndPrefix>& extensionNameToPrefix) const override;
GeneralResult<std::pair<SyncFence, ExecuteFencedInfoCallback>> executeFenced(
const Request& request,
@@ -67,12 +69,16 @@ public:
MeasureTiming measureTiming,
const OptionalTimePoint& deadline,
const OptionalDuration& loopTimeoutDuration,
- const OptionalDuration& timeoutDurationAfterFence) const override;
+ const OptionalDuration& timeoutDurationAfterFence,
+ const std::vector<android::nn::TokenValuePair>& hints,
+ const std::vector<android::nn::ExtensionNameAndPrefix>& extensionNameToPrefix) const override;
GeneralResult<android::nn::SharedExecution> createReusableExecution(
const Request& request,
MeasureTiming measureTiming,
- const OptionalDuration& loopTimeoutDuration) const override;
+ const OptionalDuration& loopTimeoutDuration,
+ const std::vector<android::nn::TokenValuePair>& hints,
+ const std::vector<android::nn::ExtensionNameAndPrefix>& extensionNameToPrefix) const override;
GeneralResult<SharedBurst> configureExecutionBurst() const override;
diff --git a/shim/sl/scripts/NeuralNetworks.patch b/shim/sl/scripts/NeuralNetworks.patch
index c33177e081..81e859bd67 100644
--- a/shim/sl/scripts/NeuralNetworks.patch
+++ b/shim/sl/scripts/NeuralNetworks.patch
@@ -1,13 +1,17 @@
-diff --git a/common/SharedMemoryAndroid.cpp b/common/SharedMemoryAndroid.cpp
-index 4730de36b..896d643e7 100644
---- a/common/SharedMemoryAndroid.cpp
-+++ b/common/SharedMemoryAndroid.cpp
-@@ -160,8 +160,19 @@ GeneralResult<SharedMemory> allocateSharedMemory(size_t size) {
+diff --git a/common/types/src/SharedMemoryAndroid.cpp b/common/types/src/SharedMemoryAndroid.cpp
+index c361a1eb6..3c09c5f4d 100644
+--- a/common/types/src/SharedMemoryAndroid.cpp
++++ b/common/types/src/SharedMemoryAndroid.cpp
+@@ -115,8 +115,23 @@ GeneralResult<SharedMemory> allocateSharedMemory(size_t size) {
return createSharedMemoryFromUniqueFd(size, prot, std::move(fd), offset);
}
-GeneralResult<Mapping> map(const Memory::Ashmem& /*memory*/) {
- return NN_ERROR(ErrorStatus::INVALID_ARGUMENT) << "Cannot map ashmem memory";
++//GeneralResult<Mapping> map(const Memory::Ashmem& /*memory*/) {
++// return NN_ERROR(ErrorStatus::INVALID_ARGUMENT) << "Cannot map ashmem memory";
++//}
++
+GeneralResult<Mapping> map(const Memory::Ashmem& memory) {
+ constexpr off64_t offset = 0;
+ constexpr int prot = PROT_READ | PROT_WRITE;
@@ -25,15 +29,15 @@ index 4730de36b..896d643e7 100644
#endif // NN_COMPATIBILITY_LIBRARY_BUILD
diff --git a/runtime/NeuralNetworks.cpp b/runtime/NeuralNetworks.cpp
-index b91d3ce45..8977dac68 100644
+index 678888e9f..805a600bb 100644
--- a/runtime/NeuralNetworks.cpp
+++ b/runtime/NeuralNetworks.cpp
-@@ -1859,7 +1859,7 @@ int SL_ANeuralNetworksDevice_forEachVendorExtensionOperandTypeInformation(
+@@ -1927,7 +1927,7 @@ int SL_ANeuralNetworksDevice_forEachVendorExtensionOperandTypeInformation(
#define NNCL_FUNC(symbol) .symbol = symbol
- NnApiSLDriverImplFL5 slDriverImpl{
-- .base{.implFeatureLevel = ANEURALNETWORKS_FEATURE_LEVEL_5},
-+ .base={.implFeatureLevel = ANEURALNETWORKS_FEATURE_LEVEL_5},
+ NnApiSLDriverImplFL7 slDriverImpl{
+- .base{.implFeatureLevel = ANEURALNETWORKS_FEATURE_LEVEL_7},
++ .base={.implFeatureLevel = ANEURALNETWORKS_FEATURE_LEVEL_7},
NNCL_FUNC(ANeuralNetworksBurst_create),
NNCL_FUNC(ANeuralNetworksBurst_free),
NNCL_FUNC(ANeuralNetworksCompilation_createForDevices),
diff --git a/shim/sl/scripts/clone_aosp_libs.sh b/shim/sl/scripts/clone_aosp_libs.sh
index a33e341f9f..3a8615a19a 100755
--- a/shim/sl/scripts/clone_aosp_libs.sh
+++ b/shim/sl/scripts/clone_aosp_libs.sh
@@ -3,40 +3,63 @@
SCRIPT_PATH=$(dirname "$0")
AOSP_DIR="${SCRIPT_PATH}/../aosp/"
-# NNAPI SUPPORT
+# NNAPI SUPPORT (SHA's for each repo taken from master branch 25/03/22)
git clone https://android.googlesource.com/platform/packages/modules/NeuralNetworks/ "${AOSP_DIR}/packages/modules/NeuralNetworks"
pushd "${AOSP_DIR}/packages/modules/NeuralNetworks"
-git checkout remotes/origin/android12-s1-release
+git checkout 9c2360318a35756addcd5d321a85f9270e0a04da
popd
git clone https://android.googlesource.com/platform/system/core "${AOSP_DIR}/system/core/"
pushd "${AOSP_DIR}/system/core/"
-git checkout remotes/origin/android12-s1-release
+git checkout c408ee943a1d9c486e4fac10bee7f76a61c75bab
popd
git clone https://android.googlesource.com/platform/system/libbase "${AOSP_DIR}/system/libbase"
pushd "${AOSP_DIR}/system/libbase"
-git checkout remotes/origin/android12-s1-release
+git checkout 2d235ac982044ea4985c39a834e2d85c6a8bca8f
popd
git clone https://android.googlesource.com/platform/system/libfmq "${AOSP_DIR}/system/libfmq"
pushd "${AOSP_DIR}/system/libfmq"
-git checkout remotes/origin/android12-s1-release
+git checkout 331b20e54ddde93785d7688ebb0cdc1cbcf9fd9b
popd
git clone https://android.googlesource.com/platform/frameworks/native "${AOSP_DIR}/frameworks/native"
pushd "${AOSP_DIR}/frameworks/native"
-git checkout remotes/origin/android12-s1-release
+git checkout fea6523ac18c9d4d40db04c996e833f60ff88489
popd
git clone https://android.googlesource.com/platform/system/logging "${AOSP_DIR}/system/logging"
pushd "${AOSP_DIR}/system/logging"
-git checkout remotes/origin/android12-s1-release
+git checkout e1a669e529cf5a42cd8b331ca89634bb9dce5cae
popd
git clone https://android.googlesource.com/platform/external/boringssl "${AOSP_DIR}/external/boringssl"
pushd "${AOSP_DIR}/external/boringssl"
-git checkout remotes/origin/android12-s1-release
+git checkout ebeca38b4ecbe81fdf1d127ef7abb4689722308c
+popd
+
+git clone https://android.googlesource.com/platform/external/tensorflow "${AOSP_DIR}/external/tensorflow"
+pushd "${AOSP_DIR}/external/tensorflow"
+git checkout a6772d90a9b542ceb50f35f67e1cebf322d8b0d0
+popd
+
+git clone https://android.googlesource.com/platform/external/eigen "${AOSP_DIR}/external/eigen"
+pushd "${AOSP_DIR}/external/eigen"
+git checkout 10f298fc4175c1b8537c674f654a070c871960e5
+popd
+
+git clone https://android.googlesource.com/platform/external/ruy "${AOSP_DIR}/external/ruy"
+pushd "${AOSP_DIR}/external/ruy"
+git checkout 4377b97cf0850e0a61caa191586ebe68ccbc2abf
+popd
+
+git clone https://android.googlesource.com/platform/external/gemmlowp "${AOSP_DIR}/external/gemmlowp"
+pushd "${AOSP_DIR}/external/gemmlowp"
+git checkout 689c69e88b91e7bff068e33396f74c0a5b17390e
popd
git clone https://android.googlesource.com/platform/prebuilts/vndk/v29 "${AOSP_DIR}/prebuilts/vndk/v29"
+pushd "${AOSP_DIR}/prebuilts/vndk/v29"
+git checkout 5a73511dd91512681df643ce604d36763cd81b0e
+popd
diff --git a/shim/sl/scripts/modify_aosp_libs.sh b/shim/sl/scripts/modify_aosp_libs.sh
index b10a36cfd1..104e99105e 100755
--- a/shim/sl/scripts/modify_aosp_libs.sh
+++ b/shim/sl/scripts/modify_aosp_libs.sh
@@ -13,10 +13,6 @@ popd
pushd "${AOSP_DIR}/packages/modules/NeuralNetworks/"
echo "Applying NeuralNetworks patch"
git apply "${SCRIPT_PATH}/NeuralNetworks.patch"
-
- echo " Checking out master version of SharedMemory.h/.cpp which includes convertRequestFromPointerToShared"
- git checkout 736317504083629929373bd349f667893bc8204c -- common/SharedMemory.cpp
- git checkout 736317504083629929373bd349f667893bc8204c -- common/include/nnapi/SharedMemory.h
popd
pushd "${SCRIPT_PATH}/.."