uniform_int_distribution<a> for types sizeof(a) < 2 are
not valid by the C++ library standard. Newer versions of LLVM
(particularly spurred on by ChromeOS toolchain changes)
require at least std::uniform_int_distribution<uint16_t>.
This is a required change for rolling LLVM to r458507.
This is necessary, but may not be sufficient to resolve
the issue.
Bug: 231351802
Test: mma
Change-Id: I04c3cc91507f3467c432b9a25effdac3f5fb56f3
NNAPI NN_TRY macros use Statement Expressions (a GNU extension) to
propagate errors. However, a "return" statement in a Statement
Expression can lead to memory leaks when the Statement Expression is
being used to initialize a member of a struct. Specifically, when one
member of a struct is already initialized, and a Statement Expression
used to initialize a subsequent member early-returns, the previously
initialized members will not have their destructors called.
This CL moves any NN_TRY macro out of struct initialization to avoid any
potential memory leaks.
Bug: 230500484
Test: mma
Test: presubmit
Change-Id: I3493fd4764f8eacc86750e6414e62bc891abaccd
Merged-In: I3493fd4764f8eacc86750e6414e62bc891abaccd
For IBurst, a slot value of -1 indicates the slot should be ignored.
However, GeneratedTestHarness still attempts to call
IBurst::releaseMemoryResource on ignored slots. Instead, we should skip
releasing any ignored slots.
Bug: 230103381
Test: mma
Test: VtsHalNeuralnetworksTargetTest
Test: presubmit
Change-Id: I82e538aa0fd9e8ecc077df1c1ceece46a6166e67
Merged-In: I82e538aa0fd9e8ecc077df1c1ceece46a6166e67
Prior to this change, if IDevice::prepareModel* was passed a null
callback, the code would still attempt to call "notify" on the callback
to return the error to the client. This CL ensures the "notify" method
will not be invoked if the callback is null.
Bug: N/A
Test: mma
Test: presubmit
Change-Id: I4a15d02c4879a0261ec26cc0e7a47d0a4da86b8b
This change alters the asynchronous execute* methods to be handled
synchronously (from the same thread) for three reasons:
1) To remove the need to use IPreparedModel::getUnderlyingResource
2) To simplify the code
3) To make the code more performant
Bug: N/A
Test: mma
Test: presubmit
Change-Id: I2c37deb03d1b1c34b0173bd741e55fce4de757f7
Union tags are of enum type. Streaming it would make more sense by
casting to underlying types.
For now casting is not required since tags are defined as `enum Tag`.
But we're going to change it to `enum class Tag` which won't work with
operator<< without casting.
Bug: 218912230
Test: m
Change-Id: Ia5e8a5c38fe23c72dffbdca320a32abdfa0eb38e
These defines are redundant because they are already defined in
neuralnetworks_utils_defaults.
Bug: N/A
Test: mma
Change-Id: I1c5c44e9e61da19bc10dd8ed2e38099f7c4baccd
* Timed out runs do not show any warning messages.
* These test files cannot finish clang-tidy runs with
the following settings:
TIDY_TIMEOUT=90
WITH_TIDY=1
CLANG_ANALYZER_CHECKS=1
* When TIDY_TIMEOUT is set, in Android continuous builds,
tidy_timeout_srcs files will not be compiled by clang-tidy.
When developers build locally without TIDY_TIMEOUT,
tidy_timeout_srcs files will be compiled.
* Some of these test modules may be split into smaller ones,
or disable some time consuming checks, and then
enable clang-tidy to run within limited time.
Bug: 201099167
Test: make droid tidy-hardware-interfaces_subset
Change-Id: I1de28f1572fff368f67eab512fffec9f2e5c2a9b
The NNAPI originally planned to have updated platform drivers delivered
through GMSCore. These updatable drivers would be retrieved through the
NN sAIDL utility code, and were known to be updatable through
Manager.cpp's Device::isUpdatable query.
However, the NNAPI ultimately did not move forward with its updatability
plans. This CL removes the updatability check in the NN AIDL utility
code.
Bug: N/A
Test: mma
Test: CtsNNAPITestCases
Test: NeuralNetworksTest_static
Change-Id: I6f9c1eac3af8cb54565bfaaeab7ddd382a85e3bd
The NNAPI is a Mainline Module, and its runtime version is determined by
an Android Feature Flag to remotely rollout and rollback Feature Levels
as needed. This change propagates the maximum feature level version
allowed by the runtime to the HAL utility code, and clamps the utility
code's version to the version allowed by the runtime.
Bug: N/A
Test: mma
Test: CtsNNAPITestCases
Test: NeuralNetworksTest_static
Test: logged driver version, set current_feature_level, and verified the
driver version was clamped by current_feature_level
Change-Id: Ibaa895f8e35d36b2ddf9432b3ef9468e5886075f
- Document that IPreparedModel::execute*WithConfig are for single-time
usages, and IPreparedModel::createReusableExecution is for reusable
usages.
- Make PrepareModelConfig::cacheToken a fixed sized array.
Fixes: 215566186
Test: VtsHalNeuralnetworksTargetTest
Test: NNT_static
Change-Id: I9c5a49c46a3eac2828b9eb666f3d742038493121
This CL relocates utility code that transfers data between pointer-based
memory and shared memory for Request objects and Model objects, moving
it from nnapi/hal/CommonUtils.h (hal utilities) to nnapi/SharedMemory.h
(canonical library).
This change also adds a check for whether Model and Requests have
pointer-based data in neuralnetworks/aidl/utils/src/Conversions.cpp to
make it consistent with the HIDL utility conversions.
Bug: 217217023
Test: mma
Test: presubmit
Change-Id: I55a0fea186708d806bc709681e10027a9e4b0ffb
This change adds a host build of VtsHalNeuralnetworksTargetTest. In the
existing device build of VtsHalNeuralnetworksTargetTest, the drivers run
out-of-process. In the host build of VtsHalNeuralnetworkaTargetTest, the
driver runs in-process.
The in-process driver that runs on the host is the canonical sample
driver (which is just the CPU "driver", located in
packages/modules/NeuralNetworks/driver/sample) adapted to an AIDL
interface (by the adapter code in
hardware/interfaces/neuralnetworks/utils/adapter/aidl).
Bug: N/A
Test: mma
Test: VtsHalNeuralnetworksTargetTest on host
Change-Id: Ia30dd3a7db8e0592b9f13d69c9831f8ffe10c371
The following AIDL types are added:
- TokenValuePair
- PrepareModelConfig
- ExecutionConfig
The following AIDL methods are added:
- IDevice::prepareModelWithConfig
- IPreparedModel::executeSynchronouslyWithConfig
- IPreparedModel::executeFencedWithConfig
- IBurst::executeSynchronouslyWithConfig
The compilation and execution hints are being stored as a list of
token-value pairs as part of the PrepareModelConfig / ExecutionConfig.
And the PrepareModelConfig / ExecutionConfig parcelables are created in
order to make future extensions to the execution related interfaces
easier.
It is the drivers responsibility to verify the hints, and it is allowed
for the driver to ignore them.
Bug: 203248587
Test: neuralnetworks_utils_hal_aidl_test
Change-Id: I98240fd75089fc85cdfcaa0be28aab8a6f0dfca5
Merged-In: I98240fd75089fc85cdfcaa0be28aab8a6f0dfca5
(cherry picked from commit 0e671f3edb)
- Modified generated tests and validation tests to exercise reusable
execution.
- Add a scoped trace to print the test config when an error occurs
Bug: 202405342
Bug: 202431255
Test: VtsHalNeuralnetworksTargetTest
Change-Id: I3e2346903e430080ec4d926bf08daf6825ea4dce
Merged-In: I3e2346903e430080ec4d926bf08daf6825ea4dce
(cherry picked from commit 859200800c)
This CL defines the AIDL interface for reusable execution.
This CL also fixes a stale statement in IBurst about deadlineNs:
boot_clock should be used rather than steady_clock.
Bug: 202405342
Bug: 202431255
Test: NNT_static
Test: VtsHalNeuralnetworksTargetTest
Change-Id: I07d26909081018ffd92264d76109a66d4a0de3bd
Merged-In: I07d26909081018ffd92264d76109a66d4a0de3bd
(cherry picked from commit 0d9b1a9d28)
Having the adapter retrieve the uid is redundant because the implementor
is already able to get the uid directly themselves with
IPCThreadState::self()->getCallingUid().
Bug: N/A
Test: mma
Change-Id: Ifeffea053cb92556be1aae8b17a94fafa1ac98e0
This change adds the following adapters:
* nn::IDevice -> BnDevice
* nn::IPreparedModel -> BnPreparedModel
* nn::IBurst -> BnBurst
* nn::IBuffer -> BnBuffer
Bug: N/A
Test: mma
Test: locally created a binderized service with this adapter code,
which passed VtsHalNeuralnetworksTargetTest
Change-Id: I966f65a1e4d75284c050b77f3f40c515e4970130
MemoryDomainTests.cpp#1131 in aosp/13591469 fixed a problem with
VtsHalNeuralnetworksTargetTest's MemoryDomainExecutionTest's
InvalidDimensions test where a dimension was doubled but the number of
bytes and size of shared memory did not double, but this change was not
ported to VtsHalNeuralnetworksV1_3TargetTest. This CL ports that fix to
VtsHalNeuralnetworksV1_3TargetTest.
Bug: 213197824
Test: mma
Test: VtsHalNeuralnetworksV1_3TargetTest
Change-Id: Ib7323e584c17ab230bde71487c0b94349701ec57
This change includes the NNAPI_OWNERS file from
packages/modules/NeuralNetworks instead of unnecessarily duplicating the
OWNERS file here.
Bug: N/A
Test: mma
Change-Id: I52daeb8f6ba91e0ec19b18fa9a6b2eda2fcb124e
Adds operations MIRROR_PAD and REVERSE.
Extends RSQRT to support QUANT8_ASYMM and QUANT8_ASYMM_SIGNED.
DOES NOT include tests or CPU reference implementation.
Bug: 202280917
Test: NeuralNetworksTest_static
Test: VtsHalNeuralnetworksTargetTest
Merged-In: I0b2133346b996849faac00c46885e3633c78f024
Change-Id: I0b2133346b996849faac00c46885e3633c78f024
(cherry picked from commit 04ed8595b5)
Prior to this change, version constants (e.g., Version::ANDROID_S) were
public static constants to make the version constants look as if they
were enum values. However, this method prevented versions from being
constexpr, because the Version type was incomplete by that point in
time. This change moves these version constants outside of the Version
struct, and makes them constexpr. They have the new names:
* Version::ANDROID_OC_MR1 -> kVersionFeatureLevel1
* Version::ANDROID_P -> kVersionFeatureLevel2
* Version::ANDROID_Q -> kVersionFeatureLevel3
* Version::ANDROID_R -> kVersionFeatureLevel4
* Version::ANDROID_S -> kVersionFeatureLevel5
* Version::FEATURE_LEVEL_6 -> kVersionFeatureLevel6
* Version::EXPERIMENTAL -> kVersionFeatureLevelExperimental
Bug: 206975939
Test: mma
Change-Id: Ibf5f2fdb1459a69c51865aa5fdcd0cb0c3a88ade
Prior to this topic, NNAPI Versions were linear and represented by an
enumeration. However, this did not properly account for the
non-linearity of runtime-specific features such as a control flow
operations with operands of dynamic sizes. This topic alters Version to
be a struct containing a feature level enumeration as well as a boolean
which indicates whether there are runtime-specific features.
Bug: 206975939
Test: mma
Test: NeuralNetworksTests_static
Change-Id: I78c54ef597bf269b137f2835332bdedac49883d4
Currently, there are two different versions of the NN AIDL utils:
* neuralnetworks_utils_hal_aidl_v1 (v1)
* neuralnetowrks_utils_hal_aidl (v2)
This change configures utils::kVersion to match the version of the
utility library that builds it.
Bug: N/A
Test: mma
Change-Id: I7d08bf50f76664702ec0828cc35a363eb29bdde3
This change deletes all existing OWNERS files under
hardware/interfaces/neuralnetworks and creates a new OWNERS file with
the current NNAPI team members.
This change also updates the NNAPI project path in
hardware/interfaces/neuralnetworks/README.
Bug: 179510251
Test: N/A
Change-Id: Iaca69505c8449ae7d93be0db99205f5f56556e86
This change removes the following header files, which were created
temporarily while NNAPI utility code was being re-organized, and are no
longer needed:
* include/AidlBufferTracker.h
* include/AidlHalInterfaces.h
* include/AidlHalUtils.h
* include/AidlValidateHal.h
Bug: 191442336
Test: mma
Test: atest neuralnetworks_utils_hal_*
Change-Id: I895d0bf6b5fd0ec4ef2977da0ecfe2a106e44083
This change is part of an effort to remove HAL types from
libneuralnetworks_common*. This change:
* Updates the header guard names for the new directory
* Removes the "Aidl" prefix from the files
* Adds temporary "Aidl" header files under include/ that redirect to
their corresponding files in include/nnapi/hal/aidl/
* Changes references of libneuralnetworks_common_hidl to
libneuralnetworks_common
Bug: 191442336
Test: mma
Change-Id: Icbcc04e0a49a9adf8d8826fd5735028ea26de0ca
This change is part of an effort to remove HAL types from
libneuralnetworks_common*. This change moves the following files to
hardware/interfaces/neuralnetworks/aidl/utils:
* AidlBufferTracker.h
* AidlHalInterfaces.h
* AidlHalUtils.h
* AidlValidateHal.h
Bug: 191442336
Test: mma
Change-Id: I799d8ba761c004af963fc6bc044125d8828f2053
This change:
* Renames ExecutionBurstController to Burst in 1.2/utils
* Renames ExecutionBurstUtils to BurstUtils in 1.2/utils
* Renames ExecutionBurstServer to Burst in common/adapter
Bug: N/A
Test: mma
Change-Id: Ibd460229887c8c9cd23ebc6ee61da37c7c820288
Reason for revert: rollforward fix of this topic
This change is a revert of I3d3ac4745, which itself is a revert of
I74f1798e8.
This CL modifies the AIDL utils libraries to be explicitly
versioned. Currently, we only have two versions: v1 and "current".
Specifically, the following changes are made:
- Remove AIDL dependencies from neuralnetworks_utils_hal_common
- Create explicitly versioned libs of neuralnetworks_utils_hal_aidl*
This is needed because it is not allowed for a build target to
link against multiple versions of the same AIDL lirary.
The canonical driver will report ANDROID_S for AIDL v1, and FL6 for v2.
Reverted Changes:
I2aefa0023:Revert "Use explicitly versioned NNAPI HAL util li...
Ia7df07ab9:Revert "Add neuralnetworks_utils_hal_aidl_v2 to al...
Iadd823460:Revert "Provide explicitly version NNAPI AIDL util...
I3d3ac4745:Revert "Provide explicitly versioned NNAPI AIDL ut...
Bug: 202405342
Test: NNT_static
Test: CtsNNAPITestCases
Test: VtsHalNeuralnetworksTargetTest
Change-Id: Ib3b732aa406f6d37e8f941082807c9232720c909
Merged-In: Ib3b732aa406f6d37e8f941082807c9232720c909
(cherry picked from commit 478a78ea77)
Also skip FL6 (AIDL_V2) tests for older AIDL drivers.
Bug: 203038813
Test: VtsHalNeuralnetworksTargetTest
Specifically, for old driver such as AIDL_V1 sample driver, it can pass
HIDL tests and skip AIDL_V2 tests. For new driver such as AIDL_V2
sample driver, it can pass all tests.
Change-Id: I689fef0945428f6548977628e3c43628dd1e5bf7
* changes:
Move NN HandleError from utils/common to 1.0/utils
Relocate NN ProtectCallback to 1.0/utils
Move NN memory utils from utils/common to 1.0/utils
Remove hal::utils::countNumberOfConsumers
This change is part of a larger chain of changes to remove HIDL and AIDL
libraries from neuralnetworks_utils_hal_common.
Bug: N/A
Test: mma
Change-Id: Iae9f692ffc72700294aae694c256e75c7e353fef