summaryrefslogtreecommitdiffstats
path: root/neuralnetworks
Commit message (Collapse)AuthorAgeFilesLines
* Use proper alignment and padding for pointer arguments -- HAL.Xusong Wang2021-05-118-20/+34
| | | | | | | | | | | | | This CL modifies the shared memory allocation for pointer arguments to use proper alignment and padding. We use default alignment (64) and min padding (1) for HIDL drivers, and default alignment (64) and default padding (64) for sAIDL drivers. Bug: 184164929 Test: NNT_static Change-Id: I22591640fa047d5f75d437edac1a7645d3b05526 Merged-In: I22591640fa047d5f75d437edac1a7645d3b05526 (cherry picked from commit 8bfa243972d34c97111f0e7af6e77a0ab04d4f60)
* Introduce reusable burst to canonical interface -- HAL.Xusong Wang2021-05-1012-54/+395
| | | | | | | | | | | | | | | | | | | | | | | This CL modifies the canonical interface for reusable burst executions: - Add new method IBurst::createExecution The reusable burst execution will not fallback to another execution path if sending request packet fails. The behavior of single-time burst execution remains unchanged. Additionally, this CL enables pointer -> shared memory conversion in 1.2/1.3 burst implementation. Bug: 184073769 Test: NNT_static Test: neuralnetworks_utils_hal_1_0_test Test: neuralnetworks_utils_hal_1_1_test Test: neuralnetworks_utils_hal_1_2_test Test: neuralnetworks_utils_hal_1_3_test Test: neuralnetworks_utils_hal_common_test Change-Id: Iaac81668d247c2cb76d70e6abbd10f00b397b19f Merged-In: Iaac81668d247c2cb76d70e6abbd10f00b397b19f (cherry picked from commit ead6d37ae9fe5d840f4d92675814abea9216fc71)
* Introduce reusable execution to canonical interface -- HAL.Xusong Wang2021-05-1035-107/+2540
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This CL modifies the canonical interface for reusable executions: - Add new interface: IExecution with compute and computeFenced methods - Add new method IPreparedModel::createExecution In NNAPI runtime, the new interface IExecution is used to memoize request-specific execution resources (e.g. converted HAL request). The expected usage is that, IPreparedModel::createExecution will be invoked in the first computation of a reusable NDK ANNExecution object, and IExecution::compute* will be invoked repeatedly. The IPreparedModel::execute* methods are preserved to avoid redundant object creation and memoization overhead for a single-time (non-reusable) execution. For a vendor implementing the canonical interfaces, only the IPreparedModel::execute* methods will be called because there is currently no reusable execution at HAL interface. A DefaultExecution implementation is provided to reduce the work needed on the vendor side. Bug: 184073769 Test: NNT_static Test: neuralnetworks_utils_hal_1_0_test Test: neuralnetworks_utils_hal_1_1_test Test: neuralnetworks_utils_hal_1_2_test Test: neuralnetworks_utils_hal_1_3_test Test: neuralnetworks_utils_hal_common_test Test: neuralnetworks_utils_hal_aidl_test Change-Id: I91790bb5ccf5ae648687fe603f88ffda2c9fd2b2 Merged-In: I91790bb5ccf5ae648687fe603f88ffda2c9fd2b2 (cherry picked from commit 727a7b2104b0962509fedffe720eec508b2ee6de)
* aidl: Set explicit default values for enum-type fieldsJooyung Han2021-04-276-8/+8
| | | | | | Fixes: 179853674 Test: mma in hardware/interfaces/neuralnetworks Change-Id: I9fdc7089eaf1202299da098220875ef8398667fe
* Fix typo in PAD_V2 commentsAndy Dyer-Smith2021-04-233-3/+3
| | | | | | | Bug: 158315823 Test: m Change-Id: Ic7ba213f2e0ff523349e4b80926a302399db8d88
* Remove NN canonical IDevice::isUpdatable -- halMichael Butler2021-04-2117-66/+35
| | | | | | | | | | | This CL alters the AIDL utility "getDevices" to return whether or not a service is updatable. This CL additional removes IDevice::isUpdatable because it is now redundant with the changes to "getDevices". Bug: 170696350 Test: mma Test: NeuralNetworksTest_static Change-Id: I86228763937c0dd2ee5b1d9d547c367cd7504ed4
* Merge "Add units to hal times and durations names"Treehugger Robot2021-04-2113-94/+95
|\
| * Add units to hal times and durations namesLev Proleev2021-04-2013-94/+95
| | | | | | | | | | | | | | | | | | | | The change adds "Ns" suffix to timeOnDevice, timeInDriver, loopTimeoutDuration, deadline and duration. Fix: 183118329 Test: mm Change-Id: I4afe34f27fc8717ac28c8fa09edda9918641c39a Merged-In: Id1f9ee4b8e41873c97690bb19a5e84572dd9ccf1
* | Merge "Enable NN VTS and utility code to use lazy services"Michael Butler2021-04-144-6/+266
|\ \
| * | Enable NN VTS and utility code to use lazy servicesMichael Butler2021-04-134-6/+266
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This CL enables VtsHalNeuralnetworksTargetTest to use lazy services by changing from AServiceManager_getService (which will return nullptr for the service if the service is not able to be loaded within a short amount of time) to AServiceManager_waitForService (which will wait for a longer time, allowing lazy services to start up). Similarly, the utility code is changed from using AServiceManager_getService to AServiceManager_waitForService where possible. This CL also introduces an "InvalidDevice" utility class to the nnapi/hal/aidl utility code. InvalidDevices are minimal devices that support no functionality but are still able to pass VTS tests. Bug: 170696939 Test: mma Test: VtsHalNeuralnetworksTargetTest Change-Id: I4f806b104ef6af863ec55c2c3f2a2dd1f72b9633
* | | Merge "Add explanations for FusedActivationFunc values"Lev Proleev2021-04-141-0/+12
|\ \ \ | |/ / |/| |
| * | Add explanations for FusedActivationFunc valuesLev Proleev2021-04-121-0/+12
| |/ | | | | | | | | | | Fix: 183117976 Test: m Change-Id: I55f4b7e3287e5bfdde6c2a2f94cee757c020c2d0
* | Merge changes from topic "nnapi-aidl-memory"Michael Butler2021-04-1310-185/+366
|\ \ | | | | | | | | | | | | | | | * changes: Update NN utility code and VTS tests with new Memory type Improve the structure of NNAPI AIDL Memory
| * | Update NN utility code and VTS tests with new Memory typeMichael Butler2021-04-077-173/+343
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This CL fixes the compiler errors that arose of changing the Memory representation of the NN AIDL HAL, and updates the conversion and utility code to work with the new Memory type. This change also makes libaidlcommonsupport available to apex modules at min sdk level 29. Bug: 183118727 Test: mma Test: VtsHalNeuralnetworksTargetTest Change-Id: Ief565473b4d82e0bb43785fc3b8275b16bd26cf6 Merged-In: Ief565473b4d82e0bb43785fc3b8275b16bd26cf6 (cherry picked from commit b0fcb3927d848e9721f05a458b5d6d4d2cb8079d)
| * | Improve the structure of NNAPI AIDL MemoryMichael Butler2021-04-073-12/+23
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Prior to this change, the NN AIDL HAL created a Memory struct analogous to hidl_memory, consisting of a name, size, and native handle. However, this Memory struct is not very structured, and requires both the client and server to agree on how the data should be interpreted. This CL tightens the structure of the Memory representation by introducing Ashmem and MappableFile structs to android.hardware.common in order to hold specific file descriptors representing memory regions. Further, this CL redefines android.hardwre.neuralnetworks's Memory object as a union of the Ashmem, MappableFile, and (existing) HardwareBuffer memory types. This change also adds "com.android.neuralnetworks" to the graphics AIDL HAL's apex_available build rule. Bug: 183118727 Test: mma Change-Id: I32322df676b83597c9e95f13662c322a6a80accc Merged-In: I32322df676b83597c9e95f13662c322a6a80accc (cherry picked from commit 1158c80ff6f24223b8add271945b66f34db78d60)
* | Merge "Set correct API level for NNAPI AIDL service discovery."Przemyslaw Szczepaniak2021-04-121-1/+2
|\ \ | |/ |/|
| * Set correct API level for NNAPI AIDL service discovery.Przemysław Szczepaniak2021-04-091-1/+2
| | | | | | | | | | | | | | | | Use __ANDROID_API_FUTURE__ until the S version is finalized. Bug: 183657864 Test: Build & flashed CF, run TFLite benchmark util Change-Id: I1352aa33866487f955136c6fb8e4d0d279225f13
* | Change NNAPI time from steady_clock to boot_clock -- halMichael Butler2021-04-067-25/+131
|/ | | | | | | | | | | | | | | | | | | | Previously, the NNAPI used std::chrono::steady_clock to represent and measure timings. However, steady_clock does not count while the system is suspended. Instead, boot_clock is monotonic like steady_clock but does include the time when the system is suspended. This change also indicates that services may convert from std::chrono::steady_clock::time_point to android::base::boot_clock::time_point in the HIDL 1.3 NN HAL. Bug: 183118340 Test: mma Test: VtsHalNeuralnetworksV1_3TargetTest Test: VtsHalNeuralnetworksTargetTest Test: presubmit Change-Id: I5a7d039a31d9ce98602a301387ec99635f279f42 Merged-In: I5a7d039a31d9ce98602a301387ec99635f279f42 (cherry picked from commit b8cf54cf5a5dc1639364cc6d79cc986efa6dceab)
* Create NN AIDL Burst adapterMichael Butler2021-04-027-7/+408
| | | | | | | | | | Bug: 180492058 Bug: 177267324 Test: mma Test: NeuralNetworksTest_static Change-Id: I2947faeb3820faa963e4df1eaf7aefec57b66c79 Merged-In: I2947faeb3820faa963e4df1eaf7aefec57b66c79 (cherry picked from commit 504f44926c0e0ce0a5b5a591dbb848fdb732d8b2)
* Add additional parameters for NN Burst -- HALMichael Butler2021-04-0234-76/+357
| | | | | | | | | | | | | | | | Adds deadline and loopTimeoutDuration to nn::IBurst::execute. This CL additionally adds a test case for IPreparedModel::configureExecutionBurst and adds the suffix "_H" to the header guards that were missing "_H". Bug: 180492058 Bug: 177267324 Test: mma Test: NeuralNetworksTest_static Change-Id: Ic9ba2fb9b4dee4e40d99ae91bb9555a58d0508d2 Merged-In: Ic9ba2fb9b4dee4e40d99ae91bb9555a58d0508d2 (cherry picked from commit bbbdb0d5f118efa8159c3cc98304208fd7631609)
* Add missing validation for NN canonical typesMichael Butler2021-04-0212-264/+176
| | | | | | | | | Bug: 177669661 Test: mma Test: NeuralNetworksTest_static Change-Id: Ic05c177f61a906a69bf82ff9c4d5bb8b0556d5ca Merged-In: Ic05c177f61a906a69bf82ff9c4d5bb8b0556d5ca (cherry picked from commit 08ee3f9287811e9087a5263c3176ce1439f70c2c)
* Rename BufferRole.frequency -> probability -- HAL.Xusong Wang2021-04-026-40/+40
| | | | | | | | | | | | | | "Frenquency" often refers to the number of occurrences over a period of time, while "probability" refers to the number of occurrences of one event over the number of occurrences of all events. "Probability" is a better name for this field. Fixes: 183117895 Test: VtsHalNeuralnetworksTargetTest Test: NNT_static Change-Id: Ic86f73b8be2aed567ae4ca17bdb3a57c658fb349 Merged-In: Ic86f73b8be2aed567ae4ca17bdb3a57c658fb349 (cherry picked from commit 46bf892f46aac0f3269970267e6ab7ed0d7d61a3)
* Add std::this_thread::yield to Burst NN polling loopMichael Butler2021-03-301-0/+4
| | | | | | Bug: N/A Test: mma Change-Id: Ibda55cfd031161614acc0c137cefb3b445548cc5
* Merge changes from topic "nnapi-aidl-burst"Przemyslaw Szczepaniak2021-03-2248-51/+492
|\ | | | | | | | | | | | | * changes: Add Burst tests to NN AIDL HAL VTS Add IBurst to NN AIDL HAL -- hal Format NN AIDL HAL
| * Add Burst tests to NN AIDL HAL VTSMichael Butler2021-03-207-13/+237
| | | | | | | | | | | | | | | | | | | | Bug: 180492058 Bug: 177267324 Test: mma Test: VtsHalNeuralnetworksTargetTest Change-Id: I1744005cbf750b70b42367b81a2fa6b8f24c1904 Merged-In: I1744005cbf750b70b42367b81a2fa6b8f24c1904 (cherry picked from commit 8b7e8138685678c1e7b1d7de8b06ff0899c61b2d)
| * Add IBurst to NN AIDL HAL -- halMichael Butler2021-03-204-0/+179
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Burst executions are a sequence of executions of the same prepared model that occur in rapid succession, such as frames of a camera capture or successive audio samples. A burst object is used to control a set of burst executions, and to preserve resources between executions, enabling executions to have lower overhead. This CL has the following changes: 1) Adds an IBurst interface to the NN AIDL HAL 2) Adds IPreparedModel::configureExecutionBurst to create an IBurst object 3) Extends VTS's InvalidPreparedModel to implement configureExecutionBurst. Bug: 180492058 Bug: 177267324 Test: mma Test: VTS+presubmit Change-Id: I90cb18dcc392f07f342604a7fb2edae041848251 Merged-In: I90cb18dcc392f07f342604a7fb2edae041848251 (cherry picked from commit 5dc72d5485c1f64147815e4ca8caad6fd5db2886)
| * Format NN AIDL HALMichael Butler2021-03-2038-38/+76
| | | | | | | | | | | | | | | | | | | | There were some comment changes made to tha auto-generated AIDL files. Bug: N/A Test: mma Change-Id: I1a360115b82b0c222666c5d9189a220e74390654 Merged-In: I1a360115b82b0c222666c5d9189a220e74390654 (cherry picked from commit 402497e049ec2078026e1f3c5c3af0fcaa71cfee)
* | Merge "Move NNAPI type information to types.spec"Treehugger Robot2021-03-224-1320/+34
|\ \ | |/ |/|
| * Move NNAPI type information to types.specSlava Shklyaev2021-03-174-1320/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | See change Ic31ed957. The changes to the *.t files in this CL do not introduce any changes to the generated *.hal files. Bug: 160667417 Test: generate_api.sh Change-Id: Ie2dbbc0fc92e52b08adc807a7f514bd8945a055f Merged-In: Ie2dbbc0fc92e52b08adc807a7f514bd8945a055f (cherry picked from commit 14c1f985b0ac8d95e3b331871c4ddd0976da1bb3)
* | Merge "Test padded request memories in VTS generated tests."Xusong Wang2021-03-191-7/+21
|\ \
| * | Test padded request memories in VTS generated tests.Xusong Wang2021-03-181-7/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This CL modifies the VTS generated tests to specify input and output padding. Bug: 179691454 Test: VtsHalNeuralnetworksTargetTest Change-Id: Iec83199d6f046203acefdbd165887943447984a9 Merged-In: Iec83199d6f046203acefdbd165887943447984a9 (cherry picked from commit a0b82f3235bff3505b1c0fe5d5fd60be9ffa51da)
* | | Merge "NNAPI: Add AIDL drivers registration"Slava Shklyaev2021-03-194-20/+63
|\ \ \ | | |/ | |/|
| * | NNAPI: Add AIDL drivers registrationLev Proleev2021-03-174-20/+63
| | | | | | | | | | | | | | | | | | | | | | | | | | | Bug: 179015258 Test: adb shell setprop debug.nn.partition 2 && \ Test: NeuralNetworksTest_static Change-Id: I2c8c9a49ff917b243348043df1158a8d98f131ce Merged-In: I2c8c9a49ff917b243348043df1158a8d98f131ce (cherry picked from commit 5f732ff683211e14bcb489839e46b99ee4c39106)
* | | Document the default alignment and padding value.Xusong Wang2021-03-171-0/+5
| |/ |/| | | | | | | | | | | | | | | | | | | This CL documents the default value of the preferred alignment and padding for request memories. Bug: 179799921 Test: m Change-Id: I89c16c3e20939a0ad68d9e3b0061c4a16dc00d8b Merged-In: I89c16c3e20939a0ad68d9e3b0061c4a16dc00d8b (cherry picked from commit e6dcc9a38d3fbc2cbd957577657493e36783d3ed)
* | Merge "Passing padding information to the driver -- hal."Xusong Wang2021-03-174-3/+34
|\ \ | |/ |/|
| * Passing padding information to the driver -- hal.Xusong Wang2021-03-174-3/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This CL changes the sAIDL interface to enable passing padding information of the shared memory pool to the driver. The sAIDL interface defines the padding field explicitly in DataLocation to make it easy to convert to/from the canonical request. Bug: 179691454 Test: NNT_static Test: VtsHalNeuralnetworksTargetTest Change-Id: Ie13b421531ee4df48822086b027d94a622a3518c Merged-In: Ie13b421531ee4df48822086b027d94a622a3518c (cherry picked from commit 6365ea1dbba94da8a0f2fb63d00283109ee47f9b)
* | Implement full canonical Burst in NN util codeMichael Butler2021-03-1616-1060/+1013
| | | | | | | | | | | | | | | | | | | | Bug: 180492058 Bug: 177267324 Test: mma Test: presubmit Change-Id: I5018f6cf2dbaf705f74f4f46318142c64433e19d Merged-In: I5018f6cf2dbaf705f74f4f46318142c64433e19d (cherry picked from commit acff4063b63c04cbb28af87eab61e9a1fa70980a)
* | Add canonical types adapters for NNAPI AIDL interfaceLev Proleev2021-03-1628-44/+3258
| | | | | | | | | | | | | | | | | | | | | | | | | | Also: * Add missing AIDL<->CT conversions * Add AIDL-specific info to neuralnetworks/utils/README.md * Add mock classes and tests AIDL adapters Bug: 179015258 Test: neuralnetworks_utils_hal_test Change-Id: Ifa98fadd46dca5dbf9b3ceb4da811aa8da45b6e4 Merged-In: Ifa98fadd46dca5dbf9b3ceb4da811aa8da45b6e4 (cherry picked from commit 3b93b0b56a4f5128eaa942d804dd490317c0abcb)
* | Add missing NNAPI HIDL interface mock testsLev Proleev2021-03-162-2/+36
|/ | | | | | | | | | | | | prepareModelFromCache* was tested for handling of errors happening during the preparation launch but not during the actual preparation. Bug: 163801800 Test: mma Test: atest neuralnetworks_utils_hal_common_test Test: atest neuralnetworks_utils_hal_1_[0-3]_test Change-Id: I2c4b235fd4877238d7a18be8b0ea051434c1df6b Merged-In: I2c4b235fd4877238d7a18be8b0ea051434c1df6b (cherry picked from commit c6cf50ad425d60796da6a326f5d5515fb3b28fc0)
* Fix formattingSlava Shklyaev2021-03-054-40/+38
| | | | | | | Bug: 160667417 Test: generate_api.sh Test: m Change-Id: I282b8bc1ae009a9ce2e46419eba7881849e999a7
* Merge "Add VtsHalNeuralnetworksTargetTest to NNAPI test mapping"Treehugger Robot2021-03-021-0/+11
|\
| * Add VtsHalNeuralnetworksTargetTest to NNAPI test mappingLev Proleev2021-03-021-0/+11
| | | | | | | | | | | | | | | | Bug: 172921927 Test: presubmit on cuttlefish Change-Id: Ia59446246bef2a41912a6b0c9d11abd125e8d913 Merged-In: Ia59446246bef2a41912a6b0c9d11abd125e8d913 (cherry picked from commit 3665d245adf481cc7b710c642711565d256d326c)
* | Merge "neuralnetworks: fix out ParcelFileDescriptor"Jooyung Han2021-03-027-31/+101
|\ \ | |/ |/|
| * neuralnetworks: fix out ParcelFileDescriptorJooyung Han2021-02-267-31/+101
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Refactored "out @nullable ParacelFileDescriptor" into FencedExecutionResult. It works well with NDK backend, but not with Java backend. To avoid future incompatibility, AIDL compiler will forbid "out ParcelFileDescriptor". This change moves the out parameter to its own parcelable type, FencedExecutionResult, along with IFencedExecutionCallback. Bug: 181194872 Test: atest --test-mapping packages/modules/NeuralNetworks Change-Id: I8e628a7b96d81338fbe59ce8c0b849f98c00536c
* | [LSC] Add LOCAL_LICENSE_KINDS to hardware/interfacesBob Badour2021-02-261-0/+9
|/ | | | | | | | | | | | | | | Added SPDX-license-identifier-Apache-2.0 to: neuralnetworks/utils/adapter/Android.bp security/keymint/aidl/vts/performance/Android.bp Bug: 68860345 Bug: 151177513 Bug: 151953481 Test: m all Exempt-From-Owner-Approval: janitorial work Change-Id: I139497d894d893a405d9b16df5e23b69dc82674f
* Merge "Reformat neuralnetworks/1.2/types.hal according to clang-format"Treehugger Robot2021-02-232-12/+12
|\
| * Reformat neuralnetworks/1.2/types.hal according to clang-formatSlava Shklyaev2021-02-222-12/+12
| | | | | | | | | | | | | | | | | | | | | | | | While we cannot run clang-format on types.hal directly, we can do so on the canonical Types.h (which is generated from the same template) and observe the difference. See change Ia43936d8. Bug: 160667417 Test: m Change-Id: Id6a237f29c8156b213455ab093d11ed4c2015460 Merged-In: Id6a237f29c8156b213455ab093d11ed4c2015460 (cherry picked from commit dfc4a2fa322ea77bbf2ed5f15fa831fb1002be06)
* | Merge changes from topic "nnapi-numberOfConsumers"Michael Butler2021-02-2316-15/+1449
|\ \ | |/ |/| | | | | | | * changes: Create NNAPI adapter interface Make NNAPI countNumberOfConsumers return GeneralResult -- hal
| * Create NNAPI adapter interfaceMichael Butler2021-02-199-0/+1432
| | | | | | | | | | | | | | | | | | | | | | This CL creates Device, PreparedModel, and Buffer classes which adapt a canonical interface to a NN 1.3 HIDL interface. Bug: 160668438 Test: mma Change-Id: Ifee27858efd280307a299b3fe2e1a4bd9240e9de Merged-In: Ifee27858efd280307a299b3fe2e1a4bd9240e9de (cherry picked from commit 323dd0c2dc3ca771a5c66a8fe5fd41819e841a1c)
| * Make NNAPI countNumberOfConsumers return GeneralResult -- halMichael Butler2021-02-197-15/+17
| | | | | | | | | | | | | | | | | | | | | | | | Previously, countNumberOfConsumers would trigger a CHECK if the input was invalid. This CL makes countNumberOfConsumers gracefully fail on errors, instead returning the error through the GeneralResult. Bug: N/A Test: mma Change-Id: Iee54f87768e52fdf701c22d94083c053b881733d Merged-In: Iee54f87768e52fdf701c22d94083c053b881733d (cherry picked from commit c4d98007fd2ff50031b270801274ee4c498afd87)