diff options
Diffstat (limited to 'shim/sl')
-rwxr-xr-x | shim/sl/build/android_arm/libarmnn_support_library_prebuilt.so | bin | 0 -> 25176608 bytes | |||
-rwxr-xr-x | shim/sl/build/android_arm64/libarmnn_support_library_prebuilt.so | bin | 0 -> 31964448 bytes | |||
-rw-r--r-- | shim/sl/canonical/ArmnnDevice.cpp | 2 | ||||
-rw-r--r-- | shim/sl/canonical/ArmnnDriverImpl.cpp | 7 | ||||
-rw-r--r-- | shim/sl/canonical/ArmnnPreparedModel.cpp | 3 | ||||
-rw-r--r-- | shim/sl/canonical/ConversionUtils.hpp | 8 | ||||
-rw-r--r-- | shim/sl/canonical/DriverOptions.cpp | 11 | ||||
-rwxr-xr-x | shim/sl/generate_prebuilts.sh | 35 |
8 files changed, 53 insertions, 13 deletions
diff --git a/shim/sl/build/android_arm/libarmnn_support_library_prebuilt.so b/shim/sl/build/android_arm/libarmnn_support_library_prebuilt.so Binary files differnew file mode 100755 index 000000000..a655c7579 --- /dev/null +++ b/shim/sl/build/android_arm/libarmnn_support_library_prebuilt.so diff --git a/shim/sl/build/android_arm64/libarmnn_support_library_prebuilt.so b/shim/sl/build/android_arm64/libarmnn_support_library_prebuilt.so Binary files differnew file mode 100755 index 000000000..a4a88ea9c --- /dev/null +++ b/shim/sl/build/android_arm64/libarmnn_support_library_prebuilt.so diff --git a/shim/sl/canonical/ArmnnDevice.cpp b/shim/sl/canonical/ArmnnDevice.cpp index 71135cb13..8f2212dba 100644 --- a/shim/sl/canonical/ArmnnDevice.cpp +++ b/shim/sl/canonical/ArmnnDevice.cpp @@ -76,6 +76,7 @@ ArmnnDevice::ArmnnDevice(DriverOptions options) } armnn::IRuntime::CreationOptions runtimeOptions; +#if defined(ARMCOMPUTECL_ENABLED) if (std::find(m_Options.GetBackends().begin(), m_Options.GetBackends().end(), armnn::Compute::GpuAcc) != m_Options.GetBackends().end()) @@ -108,6 +109,7 @@ ArmnnDevice::ArmnnDevice(DriverOptions options) VLOG(DRIVER) << "ArmnnDevice: Unknown exception: %s. Device will be unavailable." << error.what(); } } +#endif runtimeOptions.m_EnableGpuProfiling = m_Options.IsGpuProfilingEnabled(); m_Runtime = armnn::IRuntime::Create(runtimeOptions); diff --git a/shim/sl/canonical/ArmnnDriverImpl.cpp b/shim/sl/canonical/ArmnnDriverImpl.cpp index 0f7888bb4..060dd5a25 100644 --- a/shim/sl/canonical/ArmnnDriverImpl.cpp +++ b/shim/sl/canonical/ArmnnDriverImpl.cpp @@ -1,5 +1,5 @@ // -// Copyright © 2022 Arm Ltd and Contributors. All rights reserved. +// Copyright © 2022-2023 Arm Ltd and Contributors. All rights reserved. // SPDX-License-Identifier: MIT // @@ -400,6 +400,11 @@ GeneralResult<SharedPreparedModel> ArmnnDriverImpl::PrepareArmnnModelFromCache( pread(*dataCacheHandle[0], hashValue.data(), hashValue.size(), 0); // Read the model + if (cachedDataSize < hashValue.size()) + { + return NN_ERROR(ErrorStatus::GENERAL_FAILURE) + << "ArmnnDriverImpl::prepareModelFromCache(): cachedDataSize is less than hashValue!"; + } std::vector<uint8_t> dataCacheData(cachedDataSize - hashValue.size()); pread(*dataCacheHandle[0], dataCacheData.data(), dataCacheData.size(), hashValue.size()); auto calculatedHashValue = Hash(dataCacheData); diff --git a/shim/sl/canonical/ArmnnPreparedModel.cpp b/shim/sl/canonical/ArmnnPreparedModel.cpp index 79cd24134..192ea599b 100644 --- a/shim/sl/canonical/ArmnnPreparedModel.cpp +++ b/shim/sl/canonical/ArmnnPreparedModel.cpp @@ -569,10 +569,13 @@ GeneralResult<std::pair<SyncFence, ExecuteFencedInfoCallback>> ArmnnPreparedMode { case ErrorStatus::OUTPUT_INSUFFICIENT_SIZE: result.error().code = (ErrorStatus::OUTPUT_INSUFFICIENT_SIZE); + [[fallthrough]]; case ErrorStatus::GENERAL_FAILURE: result.error().code = (ErrorStatus::GENERAL_FAILURE); + [[fallthrough]]; case ErrorStatus::INVALID_ARGUMENT: result.error().code = (ErrorStatus::INVALID_ARGUMENT); + [[fallthrough]]; default: { result.value() = std::make_pair(timingSinceLaunch, timingAfterFence); diff --git a/shim/sl/canonical/ConversionUtils.hpp b/shim/sl/canonical/ConversionUtils.hpp index 91a8e3080..f595db255 100644 --- a/shim/sl/canonical/ConversionUtils.hpp +++ b/shim/sl/canonical/ConversionUtils.hpp @@ -1,5 +1,5 @@ // -// Copyright © 2022 Arm Ltd and Contributors. All rights reserved. +// Copyright © 2022-2023 Arm Ltd and Contributors. All rights reserved. // SPDX-License-Identifier: MIT // @@ -455,7 +455,7 @@ void SanitizeBiasQuantizationScale(armnn::TensorInfo& biasInfo, // 4D Tensor Permutations const armnn::PermutationVector IdentityPermutation4D({ 0U, 1U, 2U, 3U }); const armnn::PermutationVector IdentityPermutation3D({ 0U, 1U, 2U }); -const armnn::PermutationVector SwapDim1And2({ 0U, 2U, 1U, 3U }); +const armnn::PermutationVector SwapDim2And3({ 0U, 1U, 3U, 2U }); // 3D Permutation Vectors const armnn::PermutationVector RotateTensorLeft({ 1U, 2U, 0U }); @@ -603,8 +603,8 @@ bool CreateConcatPermutationParameters(const unsigned int numberOfDimensions, // or along dimension 0 or 2 for a 3-D tensor. if (numberOfDimensions == 4 && concatDimension == 2) { - concatDimension = 1; - permutationPair = std::make_pair(SwapDim1And2, SwapDim1And2); + concatDimension = 3; + permutationPair = std::make_pair(SwapDim2And3, SwapDim2And3); needPermute = true; } else if (numberOfDimensions == 3 && concatDimension == 1) diff --git a/shim/sl/canonical/DriverOptions.cpp b/shim/sl/canonical/DriverOptions.cpp index 5c73edfaa..15d08d8cb 100644 --- a/shim/sl/canonical/DriverOptions.cpp +++ b/shim/sl/canonical/DriverOptions.cpp @@ -1,5 +1,5 @@ // -// Copyright © 2022 Arm Ltd and Contributors. All rights reserved. +// Copyright © 2022-2023 Arm Ltd and Contributors. All rights reserved. // SPDX-License-Identifier: MIT // @@ -254,13 +254,8 @@ DriverOptions::DriverOptions() // If no backends have been specified then the default value is GpuAcc. if (backends.empty()) { - VLOG(DRIVER) << "No backends have been specified:"; - std::cout << optionsDesc.help() << std::endl - << "Unable to start:" << std::endl - << "No backends have been specified" << std::endl; - m_ShouldExit = true; - m_ExitCode = EXIT_FAILURE; - return; + VLOG(DRIVER) << "No backends have been specified, defaulting to GpuAcc."; + m_Backends.emplace_back("GpuAcc"); } if (!unsupportedOperationsAsString.empty()) diff --git a/shim/sl/generate_prebuilts.sh b/shim/sl/generate_prebuilts.sh new file mode 100755 index 000000000..7e6c67120 --- /dev/null +++ b/shim/sl/generate_prebuilts.sh @@ -0,0 +1,35 @@ +#!/bin/bash +# +# Generate ArmNN SL driver prebuilts + +eval set -- "$OPTS" +if [[ -z "$ANDROID_BUILD_TOP" ]]; then + echo ANDROID_BUILD_TOP not set, bailing out + echo you must run lunch before running this script + exit 1 +fi + +set -e +cd $ANDROID_BUILD_TOP + +source build/envsetup.sh +ARCHS="arm,arm64" +ARMNN_SL_DRIVER="libarmnn_support_library" + +for arch in ${ARCHS//,/ } +do + lunch "aosp_${arch}-userdebug" + + LIB=lib + if [[ $arch =~ "64" ]]; then + LIB=lib64 + fi + + TMPFILE=$(mktemp) + build/soong/soong_ui.bash --make-mode ${ARMNN_SL_DRIVER} 2>&1 | tee ${TMPFILE} + TARGETDIR=external/armnn/shim/sl/build/android_${arch}/${ARMNN_SL_DRIVER}_prebuilt.so + mkdir -p ${TARGETDIR%/*} + cp $OUT/system/${LIB}/${ARMNN_SL_DRIVER}.so ${TARGETDIR} + +done + |