-
Notifications
You must be signed in to change notification settings - Fork 257
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add __INTRODUCED_IN annotations to all APIs #706
Comments
May i ask how to use weak linking without linking to the library, for example libmediandk? For apple OSes, it's quit easy, app continues if the weak linked library can not be loaded. But on linux, app can not start without the dependent library. |
This isn't something we can support currently. After this bug is fixed it will be possible for us to add that option. |
Bug: android/ndk#706 Test: N/A Change-Id: I8a4f98f2c929e28d81672d7e2e0d5dd63d27c7a6
Bug: android/ndk#706 Test: builds Change-Id: Id9a0396d66411496fd50826f75396cd91726c333
all the __INTRODUCED_IN annotations should be in r18. |
I think we want the fix for http://b/110994763 in r18. |
true, but they're not regressions :-) |
marcone forgot to add the |
We've added the |
If __INTRODUCED_IN is overrideable (e.g. check if
EXPERIMENTAL_CUSTOM_INTRODUCED_IN is defined, use it if so), then
applications that need it can start experimenting with weak linking now.
Could we please have that?
2018年8月10日(金) 17:20 Ryan Prichard <notifications@github.com>:
… We've added the __INTRODUCED_IN annotations to many APIs, but the
__ANDROID_API__ guards are still there. We have an unscheduled item on
the roadmap for allowing weak linking to symbols:
https://android.googlesource.com/platform/ndk/+/master/docs/Roadmap.md#weak-symbols-for-api-additions
.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#706 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAL-sMe4H3POyXfYbF7atqUz0fpDiH5Iks5uPiNFgaJpZM4UOhnD>
.
|
There's still an ifdef around the whole header. We need to make some changes to one of our told before that's possible. |
Well, annotating the individual APIs was the large part of the job. The
rest of the work to make weak-linking possible (at least experimentally)
should not take long. I can send a patch if you point me to the right repo
(not this one, it seems).
2018年8月11日(土) 9:24 Dan Albert <notifications@github.com>:
… There's still an ifdef around the whole header. We need to make some
changes to one of our told before that's possible.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#706 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAL-sMyY5mS5VvovwO3PI1klEhbxrH_Dks5uPwVOgaJpZM4UOhnD>
.
|
Merged into r18. |
Bug: android/ndk#706 Bug: http://b/113052379 Test: builds Change-Id: I519d4fd825d40c3f72515f29a7e5b12c23a1749a Merged-In: I519d4fd825d40c3f72515f29a7e5b12c23a1749a (cherry picked from commit 85a4153)
Bug: android/ndk#706 Bug: http://b/113052379 Test: builds Change-Id: I5612b0d255f8d6a3dadffdc333adfd564073c52e Merged-In: I5612b0d255f8d6a3dadffdc333adfd564073c52e (cherry picked from commit 0429f40)
Bug: android/ndk#706 Test: builds Change-Id: I519d4fd825d40c3f72515f29a7e5b12c23a1749a Exempt-From-Owner-Approval: cherrypick (cherry picked from commit 85a4153)
Bug: android/ndk#706 Test: builds Change-Id: I5612b0d255f8d6a3dadffdc333adfd564073c52e
__INTRODUCED_IN only applies to function or variable declarations, not a typedef to a function pointer. Bug: android/ndk#706 Test: builds Change-Id: I472565d3e34e5c6a3cd88500ad03ef9ce4489c25 Exempt-From-Owner-Approval: cherrypick (cherry picked from commit e0ec2e3)
Bug: android/ndk#706 Test: builds Change-Id: I9854439b3dae0d1de32e36bb5bc6604c52f7f742
* Update frameworks/ml from branch 'master' to 6126eddb57fce32bc34c81f70a2f68906b33ed2c - Merge "Fix unnecessary copy initialization warnings" - Fix unnecessary copy initialization warnings Bug: 30413862 Test: build with WITH_TIDY=1 Change-Id: I74e18cb3a52e7805c108963322eba69e51f2f92d - Merge "Add __INTRODUCED_IN annotations to <android/NeuralNetworks.h>." - Add __INTRODUCED_IN annotations to <android/NeuralNetworks.h>. Bug: https://github.com/android-ndk/ndk/issues/706 Test: builds Change-Id: Id9a0396d66411496fd50826f75396cd91726c333 - Merge "NNAPI Error codes documentation." - NNAPI Error codes documentation. Bug: 78615721 Bug: 77732225 Bug: 76016693 Test: make ndk-docs Change-Id: I75bdfc768b391a231ee1584e2d49df7666ecde95 - Merge changes from topic "nnapi-cherrypick-from-master-and-pi-dev-to-aosp" * changes: NNAPI systrace for timing statistics Fix common/operations tests and make easier to run Split unknown dimensions test into 16 shards Tests for 1.0 device on paths in VersionedIDevice Iterate unknown dimensions combinations in code Multithreaded test with shared compilation Add ubsan build Make fully_connected op use reference implementation in certain cases. Script for repeatable runs of benchmark - NNAPI systrace for timing statistics This adds systrace tracing to NNAPI. The tracing will be helpful for: - getting numbers on where time is spent currently - diagnosing and improving performance - benchmarking TODOs: - Write analysis tools for traces Change-Id: I9026f1043428cb715b577901bec3a2e1e39a82e3 Merged-In: I9026f1043428cb715b577901bec3a2e1e39a82e3 Bug: 78137932 Test: manually run systrace.py against unit tests Test: manually run systrace.py against benchmarking app (cherry picked from commit e9e637ab73b68b5982281a3f7c621f6a75d51743) - Fix common/operations tests and make easier to run - Repackages tests under common/operations into one test target - Fixes handling of dimensions in tests so that they pass Bug: 110254321 Test: NeuralNetworksTest_operations Change-Id: I96ab8c350fc1c15819118f7719450212cc330aaa Merged-In: I96ab8c350fc1c15819118f7719450212cc330aaa (cherry picked from commit 48a2e1fa794125d397278b290561bf63e76b1870) - Split unknown dimensions test into 16 shards Running just one big loop made the automated tests think the run had hung when running the slower asan variant. Test: NeuralNetworksTest_static_asan Change-Id: If9aba2fd2df240c1054581e0d137474c8e3c641d Merged-In: If9aba2fd2df240c1054581e0d137474c8e3c641d (cherry picked from commit f763cdb947bb3209c821150dba779d22691429e2) - Tests for 1.0 device on paths in VersionedIDevice I'm planning to make small changes the VersionedIDevice code for systrace support. It was missing tests, which are added here. Bug: 78137932 Test: NeuralNetworksTest_static/*ExecutionTest* Test: changed VersionedIDevice to return errors in 1.0 path, tests failed Change-Id: If950cca0dbab447b08d337f559747dcaafe69608 Merged-In: If950cca0dbab447b08d337f559747dcaafe69608 (cherry picked from commit 0a573dc4f750f6aad7e8d723ab87f937ab87e9cc) - Iterate unknown dimensions combinations in code Using TEST_P creates 16k test cases, totalling 64k lines of output which causes issues with the test infrastructure (host log becomes too large). Changed to iterate in code inside the test case instead. (Downside is that it becomes impossible to run only one combination through --gtest_filter.) Bug: 109802904 Test: NeuralNetworksTest_static/*Unknown* Change-Id: I79ed1f5a4e605af9d54b8abb04ac1cc2109e5496 Merged-In: I79ed1f5a4e605af9d54b8abb04ac1cc2109e5496 (cherry picked from commit 3d309cf42ac3eb5fa44b2c5081b85730d9d776fa) - Multithreaded test with shared compilation Adds a variant of generated tests that shares a compiled model between multiple threads executing on it. Test: NeuralNetworksTest_mt_static Test: NeuralNetworksTest_mt_static_asan Bug: 79931091 Change-Id: I8247491bb553fdeb87c9f911fe325600e9f7c2c7 Merged-In: I8247491bb553fdeb87c9f911fe325600e9f7c2c7 (cherry picked from commit 8e5ce471b707e2424faa71eb5fa07e696dd3be41) - Add ubsan build Did not uncover any issues. Test: NeuralNetworksTest_static_ubsan Change-Id: I56ad947dbf192b87fd098640c06a9f71b6fc165a Merged-In: I56ad947dbf192b87fd098640c06a9f71b6fc165a (cherry picked from commit 07ed3972b37754367689cdc7a08d331544ec80f7) - Make fully_connected op use reference implementation in certain cases. - The optimized implementation will generate incorrect results when batch_size > 1 and the number of input elements is the square of batch_size. - This change makes fully_connected fallback to reference impelementation in this cases. - The bug only affects float32 path. Bug: 80425683 Bug: 109805089 Test: mma Test: NeuralNetworksTest_static --gtest_filter=*fully* Change-Id: Ib1aa9fb47e536c64756b4ff3904def5bb4fe0f48 Merged-In: Ib1aa9fb47e536c64756b4ff3904def5bb4fe0f48 (cherry picked from commit c78d7cc2580720eca5c91595b87615a213c0a99d) - Script for repeatable runs of benchmark tools/build_and_run_benchmark.sh: - makes sure the device is running roughly idle - turns the screen on - builds and installs nnapi runtime - builds and installs benchmark app - runs benchmark app 10 times - provides aggregate statistics of the 10 runs by using tools/parse_benchmark.py Bug: 79931091 Change-Id: I9d1198edaef654f520045baab47cb4dab512e07a Merged-In: I9d1198edaef654f520045baab47cb4dab512e07a Test: tools/build_and_run_benchmark.sh (cherry picked from commit c8d3581c9420e8e6b627bf74333883950a279a9c) - Merge "Update the build file for TF rebase." - Update the build file for TF rebase. Bug: 109953668 Test: mm Test: NeuralNetworksTest_static Change-Id: I634895ce1d850142a0cba750c1ae74cc1270eceb - Merge "Documentation improvements." - Merge "Documentation improvements." - Merge "Document unspecified dimensions." - Documentation improvements. Document OEM use restrictions. Document that every model must have at least one input and one output. Document graph constraints: A graph must be acyclic, and different kinds of operands are defined (or not defined) in different ways. Fix ANEURALNETWORKS_L2_NORMALIZATION documentation for output shape. ANEURALNETWORKS_SPACE_TO_DEPTH has inconsistent names for dimensions. ANEURALNETWORKS_PAD documentation doesn't clearly describe rank or dimensions of output tensor. Bug: 73252600 Bug: 67601776 Bug: 69631404 Bug: 66478689 Bug: 79482779 Bug: 79539157 Bug: 79539928 Test: mma from tree root Change-Id: I7901e84e7bf14ba2a4b164b8f2b6120e112dc235 - Documentation improvements. Specify that an output cannot overlap with an output/input/constant. Document required lifetime of ANeuralNetworksOperandType* parameters. Document ANEURALNETWORKS_OEM_OPERATION shape constraints: Because the semantics of an ANEURALNETWORKS_OEM_OPERATION are determined entirely by the driver, the NNAPI runtime cannot deduce the shape of its output(s); and we have not designed the HAL in a way that allows the driver to to communicate output shape back to the runtime. The NNAPI partitioner cannot handle an inter-partition temporary of unknown shape; and because ANEURALNETWORKS_OEM_OPERATION cannot be executed on the CPU, the partitioner has no guaranteed way to find a partitioning where every inter-partition temporary has known shape. We avoid this problem by requiring that any model containing an ANEURALNETWORKS_OEM_OPERATION either contain only one operation (so there is only one partition) or contain only operands of known shape. Fix typos. Test: mma at tree root Bug: 79888238 Bug: 79152812 Bug: 77236591 Change-Id: I1916f85c79f0942e8c313c4b1f67aea701fe58ba - Document unspecified dimensions. Test: mm Bug: 77234888 Bug: 109687058 Change-Id: I8bc8aa1cb3d5092e94f34aa245bc4185516ac434 (cherry picked from commit 9ecf6c51674bcf182185d3c80788c5d796415487) - Merge changes from topic "nnapi-cherrypick-from-master-to-aosp" * changes: Properly guard newly added APIs in P Openmp blocktime 1->20ms to keep cores enabled Add asan library dependency for CI - Properly guard newly added APIs in P - Use __ANDROID_API__ >= __ANDROID_API_P__ to guard all new APIs added in Android P. Bug: 109661480 Bug: 109661699 Test: mm Change-Id: I3ad4fba01d7950a6a51e6ee3ef7fc96bf9488dc4 Merged-In: I3ad4fba01d7950a6a51e6ee3ef7fc96bf9488dc4 (cherry picked from commit d78e9c0d7c9ca0db0c3177f2c93c80554728e77e) - Openmp blocktime 1->20ms to keep cores enabled With 1ms blocktime the benchmark app shows 3x performance degradation on Pixel 2 in float benchmarks (against no blocktime setting). In testing, 10ms was enough to give results comparable to no setting. 20ms was chosen as to have a 2x margin of safety while not keeping the threads busywaiting unnecessarily long. Bug: 109645291 Test: NeuralNetworksTest_static/*Openmp* Test: Run benchmark app multiple times Change-Id: Id2a909f6aefdbe29dd746019c2c9541e31d8c754 Merged-In: Id2a909f6aefdbe29dd746019c2c9541e31d8c754 (cherry picked from commit fed420cab2704afb2beb69577dbe75392954a57e) - Add asan library dependency for CI This explicit dependency is not needed for a local build, but should fix the continuous integration builds. See discussion in b/80307199 Bug: 80307199 Test: make continuous_native_tests, unzip -v out/target/product/walleye/obj/PACKAGING/continuous_native_tests_intermediates/continuous_native_tests.zip | grep asan Change-Id: Ib393965646eda3eea710562537d5f71e2a2dbda0 Merged-In: Ib393965646eda3eea710562537d5f71e2a2dbda0 (cherry picked from commit 648c42351e83d39801037b7a1d09794ebbdf9467) - Merge changes from topic "nnapi-cherrypick-from-master-to-aosp" * changes: Add float version for UnknownDimensionsTest Guard concurrent scratch_buffer and gemmlowp::GemmContext access Fix non-threadsafe static gemmlowp::GemmContext - Add float version for UnknownDimensionsTest This allows running the test against float-only drivers. Bug: 78268320 Test: NeuralNetworksTest/*Unknown* Change-Id: I35925e764bb5cdc89c61425cb3f309b0ed67e2a0 Merged-In: I35925e764bb5cdc89c61425cb3f309b0ed67e2a0 (cherry picked from commit 1b9cb79ce11afa0ebc089cfc659e0fb9179e832a) - Guard concurrent scratch_buffer and gemmlowp::GemmContext access - scrach_buffer is a file scoped static intended to minimize the allocation cost for Conv2D computations when possible. - In order to make it thread safe for multi-threaded execution, we need to make sure no concucrrent access to it. - Similarly for gemmlowp::GemmContext used in Conv2D and FullyConnected. - The mutex lock is added to prevent concurrent executions that may access the static scratch buffer and static gemmlowp::GemmContext. Bug: 80430825 Bug: 80465406 Test: NeuralNetworksTest_mt_static Test: NeuralNetworksApiBenchmark no visible performance impact Change-Id: I6b0df63a03d1f16a1e43a0c1062a997bfbe8f3f2 Merged-In: I6b0df63a03d1f16a1e43a0c1062a997bfbe8f3f2 (cherry picked from commit 9c63a9c428e5489bc8d118f52687a12206967208) - Fix non-threadsafe static gemmlowp::GemmContext gemmlowp::GemmContext is not threadsafe but was allocated as a function-level static, leading to memory corruption when multiple CPU executions were run in parallel. Fixed by changing to thread_local. This is a minimal change (compared to creating and passing a state object to cpu implementations) so that the change is more likely to be accepted for P. Note that there are some test failures (wrong outputs) in the new tests that are to be investigated: [ FAILED ] GeneratedTests.conv_1_h3_w2_SAME [ FAILED ] GeneratedTests.conv_1_h3_w2_SAME_relaxed [ FAILED ] GeneratedTests.conv_1_h3_w2_VALID [ FAILED ] GeneratedTests.conv_3_h3_w2_SAME (The new tests are not run as part of any continuous build yet). Bug: 80430825 Bug: 79931091 Test: NeuralNetworksTest_mt_static/*mobilenet* Test: NeuralNetworksTest_mt_static_asan/*mobilenet* Change-Id: Ief11843d5ecfaebb66c7983a8f61e604f55e0469 Merged-In: Ief11843d5ecfaebb66c7983a8f61e604f55e0469 (cherry picked from commit 8c1992b6a1dd716e8e1825cd7c864d3b47bf40c0) - Merge changes from topic "nnapi-cherrypick-from-master-to-aosp" * changes: Add Asan test target to NNAPI Move benchmark app to platform/tests/mlts/ Deflakify Openmp test Show benchmark inference count and stdDev. Split TestGenerated to file-per-case Validate strided slice output dims in cpu executor Fix the bug related to none static local variable of MobileNet test. Add support for passing inputs and expected outputs. - Add Asan test target to NNAPI Change-Id: Ie2cd83828d83cc6f5f947022b1329bfdb9456d16 Merged-In: Ie2cd83828d83cc6f5f947022b1329bfdb9456d16 Test: NeuralNetworksTest_static_asan Bug: 79855166 (cherry picked from commit aae51aab365a7c19207ea7f85dc0f459681403d5) - Move benchmark app to platform/tests/mlts/ Test: NeuralNetworksBenchmark Bug: 78139001 Change-Id: I9eaf4dbc172542f3aac782137763923d114f8724 Merged-In: I9eaf4dbc172542f3aac782137763923d114f8724 (cherry picked from commit 33f62e65578f3276a498404d20ceb607edebc164) - Deflakify Openmp test Accept 0 as the initial blocktime value. On-device kmp_get_blocktime returns 0 instead of 200 about 10% of time. Bug: 79908763 Test: NeuralNetworksTest_static Change-Id: I03e2e95175c6342ff1e85436fd7ce6b03d440bda Merged-In: I03e2e95175c6342ff1e85436fd7ce6b03d440bda (cherry picked from commit dd7b0eb7bbd139627069e999a3f7d2897e9ef901) - Show benchmark inference count and stdDev. Moved NNBenchmark.Result into seperate class, inference count and stdDev is presented in the benchmark UI. Test: NeuralNetworksBenchmark Bug: 78139001 Change-Id: Icf2a4fb13a4170630bdf8df32b5f8cc70900783b Merged-In: Icf2a4fb13a4170630bdf8df32b5f8cc70900783b (cherry picked from commit cc6d4bd4b5df3d61a0935170ec8889f5bb8b074d) - Split TestGenerated to file-per-case Allow more parallelization of the build by splitting up the generated test cases. This reduces the build time for address sanitizer builds to 2mins from 30+ mins. Change-Id: Ib11184a3db1dc454e76374e2a588a228d9778795 Merged-In: Ib11184a3db1dc454e76374e2a588a228d9778795 Bug: 79855166 Test: mm Test: NeuralNetworksTest_static (cherry picked from commit e08cbed1c67416d3028fc33fd3bf5b051e573af0) - Validate strided slice output dims in cpu executor This fixes a buffer overflow in the strided slice cpu implementation. The strided slice operation has an option to "shrink" an axis, meaning that a dimension of the input is removed from the output. This requires the corresponding slice to have size 1. The size constraint was not checked and unit tests were using a size of 2, leading to an overflow when executing the op. TODO: add a test for the validation, b/79856511. I want to get this fix in ASAP as currently the tests crash in the continuous build so we will not see other failures. TODO: cherry-pick to pi-dev - the test crash is in master and I want to verify it is fixed. Bug: 79705516 Test: NeuralNetworksTest_static/*strided_slice* with address sanitizer on marlin-userdebug Test: NeuralNetworksTest_static/*strided_slice* on marlin-userdebug Change-Id: I4db9c7460d1c4d943ba7ced36b4d8801d0e0ec99 Merged-In: I4db9c7460d1c4d943ba7ced36b4d8801d0e0ec99 (cherry picked from commit 7bdc10967deee216043f2dd8d79bb352776c66b7) - Fix the bug related to none static local variable of MobileNet test. Bug: 70529566 Test: mm and NeuralNetworksTest pass Change-Id: I34c528386c771230af456f6bdadf61d5acdc8511 Merged-In: I34c528386c771230af456f6bdadf61d5acdc8511 (cherry picked from commit 8cb05c0b59c1fee6fc29c6d27314e4f20e21d685) - Add support for passing inputs and expected outputs. - Each inference requires an input and expected output. - Benchmark loop moved to JNI code, time is sampled only during inference. - Benchmark run returns time measurements and error for each single inference. - Inference input/outputs are stored as raw, little-endian arrays of expected types. - Tool for generating inputs for mobilenet Further examples will be added and use of inference results will be done in following changesets. Added a giant panda input based on: https://commons.wikimedia.org/wiki/File:Giant_Panda_in_Beijing_Zoo_1.JPG Test: NeuralNetworksBenchmark Bug: 78878106 Change-Id: I3b4ba4533e59fec90021f21b69ad99ed8073638e Merged-In: I3b4ba4533e59fec90021f21b69ad99ed8073638e (cherry picked from commit 7b5e602ca26a552dc74eb318dc0136b73e043a21) - Merge changes from topic "nnapi-cherrypick-from-pi-to-aosp" * changes: Validate strided slice output dims in cpu executor Fix setOperandValue validation for optional operands. Reduce OpenMP thread busywait time (200 to 1 ms) Fix tests that are to only use public API to do so Unknown dimension tests for partitioning and hvx - Validate strided slice output dims in cpu executor This fixes a buffer overflow in the strided slice cpu implementation. The strided slice operation has an option to "shrink" an axis, meaning that a dimension of the input is removed from the output. This requires the corresponding slice to have size 1. The size constraint was not checked and unit tests were using a size of 2, leading to an overflow when executing the op. TODO: add a test for the validation, b/79856511. I want to get this fix in ASAP as currently the tests crash in the continuous build so we will not see other failures. Bug: 79705516 Test: NeuralNetworksTest_static/*strided_slice* with address sanitizer on marlin-userdebug Test: NeuralNetworksTest_static/*strided_slice* on marlin-userdebug Merged-In: I4db9c7460d1c4d943ba7ced36b4d8801d0e0ec99 (cherry picked from commit 7bdc10967deee216043f2dd8d79bb352776c66b7) Change-Id: Icbc0f6eb52fe8fd179c25312aff9d2374ad58679 Merged-In: Icbc0f6eb52fe8fd179c25312aff9d2374ad58679 (cherry picked from commit a7ca183f502c1de952e5783f1144380970d86378) - Fix setOperandValue validation for optional operands. - Also added a test to make sure optional operands can be set. Bug: 79605402 Test: mm Test: NeuralNetworksTest_static Change-Id: I4fe60575f94606c05e2e39c800797a0c765285e8 Merged-In: I4fe60575f94606c05e2e39c800797a0c765285e8 (cherry picked from commit 2627442c6aa4c694d01500391c1c84ed6beec717) - Reduce OpenMP thread busywait time (200 to 1 ms) Reduce the time OpenMP threads used by Eigen busywait for new work after completing a piece. This is 200ms by default, which meant that we tried to continuously run 8 threads for 200ms after completing operations using Eigen - starving both our other work and the rest of the system. Bug: 79159165 Test: mm Test: cherry-picked to systrace branch and look at traces Test: NeuralNetworksTest_static Change-Id: I3f21aea6d96c785dd7c47493a739b76876420f7d Merged-In: I3f21aea6d96c785dd7c47493a739b76876420f7d (cherry picked from commit 6a2a11dc1edaa61647c35650d7dbdd8893d6ce8b) - Fix tests that are to only use public API to do so Changes the test targets so that the "Subset of tests that rely only on public functionality" both: - includes only tests that use the public API - does not allow using internal APIs (remove includes and libs) In addition to making the targets consistent, this makes it easier to keep the CTS tests in sync. Bug: 72448000 Bug: 77234888 Test: CtsNNAPITestCases Change-Id: I799d7236c1f8107621efdd80036afc1bb901e024 Merged-In: I799d7236c1f8107621efdd80036afc1bb901e024 (cherry picked from commit 8af4cd092bd233e920ac8203ba62da2234edebc9) - Unknown dimension tests for partitioning and hvx More tests for unknown dimensions: - more extensive tests for partitioning - change existing unknown dimension test to use quantized tensors so that it uses the hvx driver when available Added logging to device selection to make it easier to debug why hvx was not getting chosen. TODO: parametrize unknown dimensions test for both floats and quantized tensors so that it can be used to test other drivers as well Test: NeuralNetworksTest_static Bug: 72448000 Bug: 77234888 Change-Id: Id9768cbd871a04d968627411cff90cfe6e73d84a Merged-In: Id9768cbd871a04d968627411cff90cfe6e73d84a (cherry picked from commit bb255b6e87dc343eb90dec998be1cf153106ab65) - Merge changes from topic "nnapi-cherrypick-from-pi-to-aosp" * changes: Free wrapper resource before assignment Add test for dimensions unknown at compile time Fix the error code ANEURALNETWORKS_UNMAPPABLE Sync updated NNAPI doc to HAL -- script Remove inconsistent references to "type" in NNAPI Script syncing of types.hal from NeuralNetworks.h Fix failing test by rerunning test generator Fix slicing.sh for new directory structure Create _relaxed tests for newly added tests -- generated tests Error code fix and added new (std::nothrow) where needed. Create _relaxed tests for newly added tests Fixed an error in LSTM documentation on peephole Update NNAPI OWNERS file -- runtime Document that RESIZE_BILINEAR will not force align corner pixels. Rewrite leak check for performance, selinux compliance Clarify Fully Connected Op comments and naming Make validateOperandType reject scale of 0.0f for QUANT8_ASYMM tensor Remove pointer values from the log and hide certain verbose logging unless building with NN_DEBUGGABLE. - Free wrapper resource before assignment Any resources owned by "this" (lefthand side of assignment) are never released (as the destructor would do), but are overwritten by the move-assignment process and are therefore leaked. This CL frees the resource before assignment. Additionally, it adds missing ownership documentation for Compilation. Bug: 79205067 Test: mma Test: NeuralNetworksTest_static Change-Id: Iacd561adee5205cb039fc7dea4fd1a816ca8d641 Merged-In: Iacd561adee5205cb039fc7dea4fd1a816ca8d641 (cherry picked from commit aec086a4a628f1f186323f7db8f4574515d74f24) - Add test for dimensions unknown at compile time Adds a test for operands which have one or more unknown dimensions at compile time but are fully known at execution time. This is meant to be supported but had a bug earlier. Bug: 72448000 Test: NeuralNetworksTest_static (emulator) Change-Id: I7ad5e6b6c29f8fe45098c9291d6a2d4b00c58eb8 Merged-In: I7ad5e6b6c29f8fe45098c9291d6a2d4b00c58eb8 (cherry picked from commit 951a1eeb114a6aacc87d6df67b9090bb94afe3bf) - Fix the error code ANEURALNETWORKS_UNMAPPABLE - The error codes should not clash with each other. - Change ANEURALNETWORKS_UNMAPPABLE to be of value 7. - The impact of this enum value change is expected to be minimal. Bug: 68356625 Test: make checkbuild Test: NNAPI CTS and VTS tests pass. Change-Id: I85a8b9a2180659d9057564119802d851e4011fc6 Merged-In: I85a8b9a2180659d9057564119802d851e4011fc6 (cherry picked from commit 2dcdbd97a63fb2563b7fe9865cea8d04481a2e27) - Sync updated NNAPI doc to HAL -- script Additionally reformatted text to fit within 80 character line limit for HIDL HALs. Additionally removed "of each addition" from "Specifies the activation to invoke on the result of each addition" because it was was included regardless of the operation. As one example, it was included in CONV_2D, which (although it includes a bias add) was confusing and unclear. Bug: 72650109 Test: None, only documentation change Change-Id: I779654aa30e1dec1f376ca173257e839fc68dc64 Merged-In: I779654aa30e1dec1f376ca173257e839fc68dc64 (cherry picked from commit f1a4694344c8acf2b157724ddf7df6ce2d1ac7bb) - Remove inconsistent references to "type" in NNAPI "Type" in the NNAPI refers both to "OperandCode" and "ANeuralNetworksOperandType" throughout the NNAPI documentation. To make the documentation more consistent and less ambiguous, this CL uses documentation links to the name itself instead of "type". Bug: 72650109 Test: None, only documentation changes Change-Id: I6718063da98a9c7ad10c4bb0452bca9a8986270b Merged-In: I6718063da98a9c7ad10c4bb0452bca9a8986270b (cherry picked from commit eb336294144d6e32ee7e5284cd2c51da32df7ef8) - Script syncing of types.hal from NeuralNetworks.h Automates the synchronization of Operand and Operation enums from NeuralNetworks.h to types.hal Fixed a couple of typos in NeuralNetworks.h that had been fixed in types.hal. Edited NeuralNetworks.h language and formatting to match types.hal for minimal diff and automatic syncing in the future. Change-Id: I527a8829132bf74d4c032056afb9b05d6bb42d04 Merged-In: I527a8829132bf74d4c032056afb9b05d6bb42d04 Bug: 77604249 Test: compared output with git diff Test: mm in $ANDROID_BUILD_TOP (cherry picked from commit 3340f8bea2913ee5f4d76193c11f1068b6582770) - Fix failing test by rerunning test generator Test: NeuralNetworksTest_static Change-Id: I683ee22a355c949c0aeab62fe81dff0d17245779 Merged-In: I683ee22a355c949c0aeab62fe81dff0d17245779 Bug: 73560182 (cherry picked from commit d6e310751d853ea0052a5e503c393c5795012453) - Fix slicing.sh for new directory structure Fix path handling in slicing.sh and helpers to work with versioned test directories. Added "set -eu" and a number of other checks to scripts to make them easier to debug in the future. Renegerated CTS tests with new scripts. The changes were not due to script changes in this CL, but due to not always running the scripts when changing models. TODO: set up a continuous build for slicing. Bug: 73560182 Test: ./slicing.sh 2 V1_0/mobilenet_quantized.mod.py Test: ./runtime/test/specs/generate_test.sh and NeuralNetworksTest_static Change-Id: I9cc00df1c10fc369410388d63c34689647c5c56b Merged-In: I9cc00df1c10fc369410388d63c34689647c5c56b (cherry picked from commit da754e01b78a20ba119ed59a55ee63619dbc1732) - Create _relaxed tests for newly added tests -- generated tests New tests were added to V1_0 and V1_1 specs, but they did not have a "_relaxed" test in V1_1. This CL generates the CTS and VTS tests as a followup CL. Bug: 76434855 Test: mma Test: NeuralNetworksTest_static Test: VtsHalNeuralnetworksV1_0TargetTest Test: VtsHalNeuralnetworksV1_1TargetTest Change-Id: Id3703db7091583de19e22b82eab75e88da785428 Merged-In: Id3703db7091583de19e22b82eab75e88da785428 (cherry picked from commit 3c2272e1cf69ef14d1a5dce34541bfd492272f69) - Error code fix and added new (std::nothrow) where needed. - 'new (std::nothrow)' was added for object allocations that may cause OUT_OF_MEMORY error code. - Changed Memory::create error code from OP_FAILED to OUT_OF_MEMORY. Bug: 77732225 Test: NeuralNetworkTests Change-Id: I063ff281cf819d546c6db67fc6da338fc87c632e Merged-In: I063ff281cf819d546c6db67fc6da338fc87c632e (cherry picked from commit a144106df8f9b82251a5e584b1b083fb39d33b88) - Create _relaxed tests for newly added tests New tests were added to V1_0 and V1_1 specs, but they did not have a "_relaxed" test in V1_1. Bug: 76434855 Test: mma Test: NeuralNetworksTest_static Test: VtsHalNeuralnetworksV1_0TargetTest Test: VtsHalNeuralnetworksV1_1TargetTest Change-Id: I13b95c526e167236ff69df8e0eb3c5c890b97932 Merged-In: I13b95c526e167236ff69df8e0eb3c5c890b97932 (cherry picked from commit ad1af843de16e98b215782f881985d08f0b03b98) - Fixed an error in LSTM documentation on peephole Bug: 76431010 One of the inputs is independent of the other two, and not related to the peephole optimization. Test: None. Documentation change only. Change-Id: Ia8aa3e86f31bfa5f5f8378bb9af1e293eae5bae8 Merged-In: Ia8aa3e86f31bfa5f5f8378bb9af1e293eae5bae8 (cherry picked from commit a98386dad9f0356e4e51395137d73bd558ed30bf) - Update NNAPI OWNERS file -- runtime Bug: 78353126 Test: Not necessary Change-Id: I07a570cb1fbbdecef8e4bcaa85e48d434f533217 Merged-In: I07a570cb1fbbdecef8e4bcaa85e48d434f533217 (cherry picked from commit 378d34c4ace56fc9027e3150e799dc9ef70162f6) - Document that RESIZE_BILINEAR will not force align corner pixels. Bug: 73961830 Test: mm Change-Id: I7c94f3488343db2cb8be6852c08de5cdad6645c9 Merged-In: I7c94f3488343db2cb8be6852c08de5cdad6645c9 (cherry picked from commit 369a512b5626af9f1722a9674166adeeed5bc057) - Rewrite leak check for performance, selinux compliance Rewrite the checking for memory leaks to check count of anonymous shared memory mappings rather than trying to fail by creating more mappings than the kernel supports. This has better performance and allows the tests to be run as non-root even if /proc/sys/vm/max_map_count is limited by sepolicy. Also fixed leaks in test code due to missing munmap. Bug: 70041527 Bug: 72179173 Test: cts-tradefed run cts -m CtsNNAPITestCases (on emulator) Change-Id: I136ad95d8725d55ef7f4c5186fe3c14912e6277d Merged-In: I136ad95d8725d55ef7f4c5186fe3c14912e6277d (cherry picked from commit a41ad77b27bc62579d09db6c5e0a3f92b3a6ea15) - Clarify Fully Connected Op comments and naming - Make the reshaping of input clearer in header comment - Make variable names in implementation match header comments - Add a test for the case where first dimension is not the batch size Bug: 74851002 Test: NeuralNetworksTest Change-Id: Ic914d5b61ef162f2be04834bcd128208f13a627f Merged-In: Ic914d5b61ef162f2be04834bcd128208f13a627f (cherry picked from commit 6d78cf0e572d4117b3011bcf0ab768c47dc58031) - Make validateOperandType reject scale of 0.0f for QUANT8_ASYMM tensor Bug: 77236592 Test: mm Test: NeuralNetworksTests_static pass on walleye Change-Id: Ie93b5caa2630dbdca054074a992cbcea290ec775 Merged-In: Ie93b5caa2630dbdca054074a992cbcea290ec775 (cherry picked from commit 8640b0d6e2677687bee54c29c072cdc410795b2c) - Remove pointer values from the log and hide certain verbose logging unless building with NN_DEBUGGABLE. Bug: 77605132 Test: mm Test: NeuralNetworksTest_static on walleye-eng with "debug.nn.vlog 1" All tests pass and complete verbose logging are seen in logcat. Test: NeuralNetworksTest_static on walleye-user with "debug.nn.vlog 1" All tests pass and *no* pointers showing in NNAPI verbose logging. Change-Id: Icc7357cded3ec5c197e9a4418d327b10c2ac7178 Merged-In: Icc7357cded3ec5c197e9a4418d327b10c2ac7178 (cherry picked from commit 64031fa26110e6d57896bfdbe1cd58e69cde3dbb) - Merge "Fix a bug in BATCH_SPACE_ND caused by recent rebase" - Fix a bug in BATCH_SPACE_ND caused by recent rebase - crops[] should be 4 zeros. Test: mm Test: NeuralNetworksTest_static Change-Id: I8410eb85b5dc0deabc8a34007c26353367609c24 - Merge "Corresponding changes after tflite rebase." - Corresponding changes after tflite rebase. Test: mm Test: NeuralNetworksTest_static Change-Id: Id54b67383eb1e1b5da23826768be4b557e142fac - Merge "Fix Conv2D crash in 64bit binary." - Fix Conv2D crash in 64bit binary. tflite::optimized_ops::Conv uses signed int for offsets, if the scratch buffer is larger than 0x7fff_ffff, it will overflow and cause a segfault. + Added a flag for excluding tests depending on non-public api Bug: 77982879 Test: NeuralNetworksTest Change-Id: Ia5b561b626259bdcc5cbbb9482f0ae7dff8e345f (cherry picked from commit 6e1812de773691c1a42dbc1d1906ca158a5d4951) - Merge changes from topic "nnapi-aosp-sync" * changes: NNAPI: Add execution preference to prepareModel (runtime) Upgrade NeuralNetworks v1.0 to v1.1 followup CL Use stubs libs for android.test.base/runner/mock Add NeuralNetworksApiBenchmark to apct suite metric Finalize STRIDED_SLICE Add validation tests for remaining operations Fix the spec for TENSOR_QUANT8_ASYMM to match our validation. Use abort() instead of exit(1) for bad activation functions Remove unused / unimplemented parameter "crops" for BATCH_TO_SPACE Make NNAPI support BroadcastSub and BroadcastDiv. - NNAPI: Add execution preference to prepareModel (runtime) A model can be compiled in different ways to optimize for different use-cases. This CL propagates the execution preference across the HAL so that the NN service can better fit the users needs. Bug: 77864669 Test: mma Test: NeuralNetworksTest_static Test: VtsHalNeuralnetworksV1_1TargetTest Merged-In: I93079b18224ea10cb0a23bfbdc1ed80e302071a8 Change-Id: I93079b18224ea10cb0a23bfbdc1ed80e302071a8 (cherry picked from commit 1e9666208595bc251a8958155b1e41eca90b69db) - Upgrade NeuralNetworks v1.0 to v1.1 followup CL This CL addresses some remaining comments from ag/3499102. Specifically, this CL: 1) Overloads CpuExecutor::run to work with both V1_0::Model and V1_1::Model 2) Documents all VersionedIDevice methods 3) Captures specific variables by reference in lambdas (instead of the general [&]) 4) Forward-declares VersionedIDevice instead of including the header. Bug: 63911257 Test: mm Test: cts and vts test binaries Merged-In: I457150346638ea8a2be912046c2bc3c49e95b44e Change-Id: I457150346638ea8a2be912046c2bc3c49e95b44e (cherry picked from commit 8ea26fd92ff697734e5ba690b61f9b0aeda2abf2) (cherry picked from commit aba8381570d7cc4b5431d741132d6f80519201eb) - Use stubs libs for android.test.base/runner/mock android.test.base/runner/mock libraries are shared libraries that are built without SDK, but with framework interanl libraries (framework.jar, etc). Apps or libs that are built with SDK (LOCAL_SDK_VERSION is set) shouldn't use them, but instead the stubs version of the test framework libraries, which are built using SDK. This is because, the build system does not allow a module built with SDK to depend on another module built without SDK. This has been exceptionally allowed with warnings, but will soon be errors. In order to prevent the expected build breakage, direct reference to the shared libraries are all changed to the stubs libraries. Note: no one has been using these shared libs statically. So, it is guaranteed that they won't encounter a problem due to missing <uses-library name="android.test.runner"/> even after this change. Bug: 69899800 Test: m -j checkbuild Merged-In: Ib48252e226a148b311433da760041011b9aa6b04 Change-Id: Ib48252e226a148b311433da760041011b9aa6b04 (cherry picked from commit 7a2ef1ba8a81fc3598ee7822b4f67fe8770e380c) - Add NeuralNetworksApiBenchmark to apct suite metric Add that module to the suite version APCT that will eventually replace the current execution model. Test: build device-tests.zip Bug: 77280599 Merged-In: I4195ed94c1d78c101c870ae25d0ec84381c44325 Change-Id: I4195ed94c1d78c101c870ae25d0ec84381c44325 (cherry picked from commit 8cc3d6a51a4729ef63076e7230518f6c01bf824b) - Finalize STRIDED_SLICE - Add documentation for begin_mask, end_mask, shrink_axis_mask. - Add support for shrink_axis_mask, and corresponding tests. - Add validation tests for STRIDED_SLICE. - Updated existing tests and re-generated CTS and VTS tests. Bug: 73661082 Test: NeuralNetworksTests_static Merged-In: I49ad2ffcb3b7496ee1225618833ba324bb01c5b5 Change-Id: I49ad2ffcb3b7496ee1225618833ba324bb01c5b5 (cherry picked from commit b66b5abcef40e88df6ac18ce7890372192102323) - Add validation tests for remaining operations Adds operation validation tests for the following ops: * embedding lookup * hashtable lookup * lsh projection * lstm * rnn * svdf Bug: 67828197 Test: mma Test: NeuralNetworksTest_static Merged-In: I018d6f9c8f09f5e3bdbf85c395dbb4cd9241a35e Change-Id: I018d6f9c8f09f5e3bdbf85c395dbb4cd9241a35e (cherry picked from commit 9b86f196698b386c0761d505e7c8c7b3a42e8d22) - Fix the spec for TENSOR_QUANT8_ASYMM to match our validation. - Scale of 0.0 is invalid for quantized tensor. Bug: 77236592 Test: mm Merged-In: I050d9f4f44134f3193ba4a82b281b2a770a51bfa Change-Id: I050d9f4f44134f3193ba4a82b281b2a770a51bfa (cherry picked from commit 56d801b8b91eab50228b754472cf1240a7e39acd) - Use abort() instead of exit(1) for bad activation functions Bug: 69008440 Test: mm Test: NeuralNetworksTests pass Merged-In: Ida0350d2c9c7325888c3eaaa3dbe285441ef655c Change-Id: Ida0350d2c9c7325888c3eaaa3dbe285441ef655c (cherry picked from commit 4b4a1819ae09475601e9c644ad9cb1976ed656a0) - Remove unused / unimplemented parameter "crops" for BATCH_TO_SPACE Bug: 73661175 Test: mm Test: NeuralNetworksTests Merged-In: If4b50c50e0847ce36016f6c257aac3b9d418c7b2 Change-Id: If4b50c50e0847ce36016f6c257aac3b9d418c7b2 (cherry picked from commit a9ce0001ca1df32fde3f322c385eef8ce7279329) - Make NNAPI support BroadcastSub and BroadcastDiv. - Make the CPU implementation able to handle BroadcastSub and BroadcastDiv. - Add corresponding tests. Bug: 73661777 Test: mm Test: NeuralNetworksTest and VTS tests Merged-In: I0b7921b6f0e9f298e94dcaebe5cfe9ac580295a3 Change-Id: I0b7921b6f0e9f298e94dcaebe5cfe9ac580295a3 (cherry picked from commit 02e33fc0ef3dce28cee468d1fa4e37511ba1dd48) - Merge "Map execution failure error status from driver through NN API to client." - Map execution failure error status from driver through NN API to client. Previously, we only ensured that we get ANEURALNETWORKS_NO_ERROR iff ErrorStatus::NONE -- that is, we knew whether or not we have an error, but not the kind of error we have. With this change, we try to do a sensible mapping from driver error kind to API error kind. Test: NeuralNetworksTest_static Bug: 77639748 Change-Id: I2d186c11c3fe01150cd0f66d40882590c2c05e9b (cherry picked from commit 07ed4d56a34eb1023c308f40ad7a0a1d07816642) - Merge "Fix documentation typos." - Merge "Mark libneuralnetworks as LLNDK" - Fix documentation typos. Test: NeuralNetworksTest_static Test: VtsHalNeuralnetworksV1_0TargetTest --hal_service_instance=android.hardware.neuralnetworks@1.0::IDevice/sample-all Test: VtsHalNeuralnetworksV1_1TargetTest --hal_service_instance=android.hardware.neuralnetworks@1.1::IDevice/sample-all Bug: 76016141 Bug: 67601776 (partial fix) Change-Id: Iff881734a2aad5de9b58177111cb9793ea4853a6 (cherry picked from commit 58cbcf3e037e9f6db040b0f8b4d5fc06d6015e65) - Mark libneuralnetworks as LLNDK This commit marks libneuralnetworks as LLNDK so that vendor modules may use libneuralnetworks. Bug: 77161122 Test: Port nn_sample to native executable, install it to /vendor/bin, and run it. Change-Id: I4db977745ac9c8d2d14e33d8f6c4fb35eca69eb4 - Merge "Make convFloat32 and convQuant8 not segfault when asking too much memory." - Make convFloat32 and convQuant8 not segfault when asking too much memory. Added check for 32 bit overflow due to largish conv size for 32 bit binaries. Added new[] operator return value check. Fixed guard unique_ptr type from Type to Type[]. Test: NeuralNetworksTest Bug: 73663843 Change-Id: Iab72337b7c78e79987b4f897393a05b34b4b79f9 (cherry picked from commit 9447966379a4b3fba92f4dfda65aaba6b0482f1a) - Merge "Remove libnativehelper from shared_libs" - Merge changes I706a968a,I8a54f95d,I98c627e8,I61c2d443,I0a573159, ... * changes: Add more validation to the HAL Fix memory leak in convQuant8 Change debug.nn.vlog to accept comma or colon as separator. Fix nullptr check in ExecutionPlan.cpp compile(). Only export public APIs from libneuralnetworks.so. Fix size of data in execution test Regenerate CTS and VTS test cases Fix resize_bilinear test height/width order Add validation to remaining ops and fix tests When test builds a Device from TestDriver, call Device::initialize(). Propagate execution failure from driver to NN API client. Fix WrapperTestModelFinish test to use TENSOR_FLOAT32 for TANH. Validate that a model input or output is only so designated once. Fix the validation tests which were using ADD incorrectly. Enforce validations for ANeuralNetworksExecution_setInput/Output Add basic validation for ANeuralNetworksModel_addOperation Explicitly set dimension to be nullptr when empty vector Add a field in ModelBuilder to indicate whether the model is invalid or not. Remove obsolete comments about ANeuralNetworksMemory_createShared Fix lstm tests to have correct scratch_buffer size Upgrade generated test cases Add tests for ANeuralNetworksModel_identifyInputsAndOutputs. Call validation from ModelBuilder::finish(). Relax fp32 to fp16 before model finish Prevent excessive logging of test failures - Add more validation to the HAL This CL adds additional validation to the common validation library: * checks scale of TENSOR_INT32 * fixes check for scale of TENSOR_QUANT8_ASYMM * check for zeroPoint of TENSOR_QUANT8_ASYMM * check for invalid 1.0 OperationType value * adds operation argument number and type validation This CL also makes some tangentially related changes, including: * fixing sample driver validation * changing mobilenet_224_* to use shared weights Bug: 67828197 Test: mma Test: VtsHalNeuralnetworksV1_0TargetTest Test: VtsHalNeuralnetworksV1_1TargetTest Merged-In: I706a968a7baf7f9942dd3b9260083514e0dafb7f Change-Id: I706a968a7baf7f9942dd3b9260083514e0dafb7f (cherry picked from commit 0b385e7a66d125117cdc952a249f2fdb156e893d) - Fix memory leak in convQuant8 convQuant8 is not freeing its heap allocated im2colData buffer in case where GetQuantizedConvolutionMultipler or QuantizeMultiplierSmallerThanOne was false. Test: WIP, working on the test case, will upload shortly. Bug: 73663843 Merged-In: I8a54f95d48f8c42734484b16f40069f43bb26e44 Change-Id: I8a54f95d48f8c42734484b16f40069f43bb26e44 (cherry picked from commit eea11acb2a183642f0c5687b283f975844ea99c2) - Change debug.nn.vlog to accept comma or colon as separator. debug.nn.vlog took a space-separated list of tokens. It can be difficult to set a property value containing embedded spaces. Therefore, allow a comma or a colon as an alternative separator -- i.e., any pair of tokens can be separated by a space, a comma, or a colon. Bug: 72883369 Test: hand experimentation with various values for the property Merged-In: I98c627e83eca16cf8b8ca7fdc14cc313274efb2e Change-Id: I98c627e83eca16cf8b8ca7fdc14cc313274efb2e (cherry picked from commit d55ec4af4b7ca211728b4c22ba28f9a1bfeb401c) - Fix nullptr check in ExecutionPlan.cpp compile(). Bug: 68148250 Test: NeuralNetworksTest_static Merged-In: I61c2d443183f25b1ab0681994a73e6cecb4bebca Change-Id: I61c2d443183f25b1ab0681994a73e6cecb4bebca (cherry picked from commit 040152219afef99e7c399abd3d5680a1cbdcdf9d) - Only export public APIs from libneuralnetworks.so. As a consequence, we can no longer have NeuralNetworksTest equivalent to NeuralNetworksTest_static, because some of NeuralNetworksTest* relies on non-public symbols from the runtime. Therefore, replace NeuralNetworksTest with NeuralNetworksTest_shared_partial, which links against libneuralnetworks.so but contains only the subset of tests that do not rely on non-public symbols from the runtime. Bug: 73169876 Test: NeuralNetworksTest_static Test: NeuralNetworksTest_shared_partial Test: CtsNNAPITestCases Merged-In: I0a57315944da338c37d91e5ea1ca2d5f0c19a212 Change-Id: I0a57315944da338c37d91e5ea1ca2d5f0c19a212 (cherry picked from commit da9c1f6c62709f9b7a2ee9a34a9de91f606bbf27) - Fix size of data in execution test sizeof(float*) was passed instead of sizeof(float), causing an assert when running as 64-bit. This CL fixes the sizeof, and changes the assert to a GTEST assert, allowing subsequent tests to run. Bug: 77147273 Test: mma Test: NeuralNetworksTest Merged-In: Ie97ffafe7b0d2da7685be53e91bab96ea26d31bc Change-Id: Ie97ffafe7b0d2da7685be53e91bab96ea26d31bc (cherry picked from commit 25bd94b6067a5f3dcc51f4e8579903d7a2bb5b46) - Regenerate CTS and VTS test cases This CL generates the tests after the spec file was changed: * lsh_projection * lstm * rnn * svdf This CL is a followup from ag/3802074. Bug: 67828197 Test: mma Test: NeuralNetworksTest Test: VtsHalNeuralnetworksV1_0TargetTest Merged-In: I0c40ac0556ed0770e694ac7a62eed7c073a031f4 Change-Id: I0c40ac0556ed0770e694ac7a62eed7c073a031f4 (cherry picked from commit 540bafe7bdf4d10fd813c81730d824414b91bfaf) - Fix resize_bilinear test height/width order resize_bilinear_relaxed had its height and width parameters reversed. This CL fixes this, and regenerates all CTS and VTS models. Bug: 73964023 Test: mma Test: NeuralNetworksTest Test: VtsHalNeuralnetworksV1_0TargetTest Test: VtsHalNeuralnetworksV1_1TargetTest Merged-In: Ia5714eb5335327b25521184752542baa4c0a56fa Change-Id: Ia5714eb5335327b25521184752542baa4c0a56fa (cherry picked from commit 03fde839dc0bfa4f2ead0d60fc4fe80f55e52660) - Add validation to remaining ops and fix tests Adds validation to the following operations: * embedding lookup * hashtable lookup * lsh projection * lstm * rnn * svdf Additionally corrects some tensor types to scalar types in the following tests: * lsh_projection * lstm * rnn * svdf Bug: 67828197 Test: mma Test: NeuralNetworksTest Test: VtsHalNeuralnetworksV1_0TargetTest Test: VtsHalNeuralnetworksV1_1TargetTest Merged-In: I7c4842f296392ae2d54824872a2ca3c8dccb4689 Change-Id: I7c4842f296392ae2d54824872a2ca3c8dccb4689 (cherry picked from commit e538bb0f9db55531dbc018c6b81ff1d6e4fbd8ac) - When test builds a Device from TestDriver, call Device::initialize(). Bug: 76116804 Test: NeuralNetworksTest_static --gtest_filter=PartitioningTest.*:Seed/RandomPartitioningTest.*:Flavor/ExecutionTest.* Merged-In: Iae2e0afb85dcccc345701180e01c8441e288f4bf Change-Id: Iae2e0afb85dcccc345701180e01c8441e288f4bf (cherry picked from commit 585b7224ba5a67984e1eff8825d242747229ef8f) - Propagate execution failure from driver to NN API client. There's no clear mapping from (driver) ErrorStatus to (API) ResultCode; except that ANEURALNETWORKS_NO_ERROR is returned from API if and only if ErrorStatus::NONE is returned from driver. Test: NeuralNetworksTest_static Bug: 73001894 Merged-In: I94771553a001cd9d594b14a79e1cad8470587db6 Change-Id: I94771553a001cd9d594b14a79e1cad8470587db6 (cherry picked from commit 1aa8959ae7662eb0abce47152a4abe20ab51d206) - Fix WrapperTestModelFinish test to use TENSOR_FLOAT32 for TANH. Bug: 76205840 Test: mm Test: WrapperTestModelFinish pass Merged-In: Id2b1b5b9c0046e212cb37ad3034b6f17c1edd935 Change-Id: Id2b1b5b9c0046e212cb37ad3034b6f17c1edd935 (cherry picked from commit ef72ca76e5b866e9fb3fce5112c25412f3d6836a) - Validate that a model input or output is only so designated once. Also tweak some log text. Test: NeuralNetworksTest_static Test: VtsHalNeuralnetworksV1_1TargetTest --hal_service_instance=android.hardware.neuralnetworks@1.1::IDevice/sample-all Test: VtsHalNeuralnetworksV1_0TargetTest --hal_service_instance=android.hardware.neuralnetworks@1.0::IDevice/sample-all Bug: 67828197 Merged-In: I8426a7363253c1ccbaf90c9a64a2890f62cf0158 Change-Id: I8426a7363253c1ccbaf90c9a64a2890f62cf0158 (cherry picked from commit b30f019c0f84532e52b95558c3ef4927cf1ea4bd) - Fix the validation tests which were using ADD incorrectly. - ADD expects 3 inputs: tensor1, tensor2, activation. Bug: 76171792 Test: mm Test: NeuralNetworksTest Merged-In: I44359dc429657e0eb8fcc6a3890538757335ecc3 Change-Id: I44359dc429657e0eb8fcc6a3890538757335ecc3 (cherry picked from commit f0efd0b6ca988f31323c2bf80dec74336fcaa835) - Enforce validations for ANeuralNetworksExecution_setInput/Output - Optional output / input must have both nullptr as buffer and 0 as length. - If newType is NULL, the operand dimensions must be fully specified. And ModelArgumentInfo.dimensions will be the same as the operand dimensions. - For non-optional input / output, user provided length must match the operand size. Bug: 75980924 Test: mm Test: NeuralNetworksTests Merged-In: Iaa8f8193c8a6911afd0990fcf0659d0050de833b Change-Id: Iaa8f8193c8a6911afd0990fcf0659d0050de833b (cherry picked from commit 43d018d1a66872031568857fa369024c9640a085) - Add basic validation for ANeuralNetworksModel_addOperation - This change tries to catch errors during ANeuralNetworksModel_addOperation. - It checks the expected number of arguments and their types. - Add tests for most of the operations. - Fix a bug in another test caught by this change. Bug: 67828197 Test: mm Test: NeuralNetworksTest Merged-In: I565a8a08f96dd9f2b15a8e413360df0bedc57f37 Change-Id: I565a8a08f96dd9f2b15a8e413360df0bedc57f37 (cherry picked from commit 137d278a0b2e3f2b518ab30b24755838d807759a) - Explicitly set dimension to be nullptr when empty vector An empty std::vector is allowed to have any value for the std::vector::data (pointer) field. When a std::vector is transferred into ANeuralNetworksOperandType::dimensionCount and ANeuralNetworksOperandType::dimensions, ANeuralNetworksOperandType::dimensions must be explicit set to nullptr if the std::vector is empty. This CL additionally has come code cleanup, such as removing the now-unused setFromIntList utility function. Bug: 76122637 Test: mma Test: NeuralNetworksTest Merged-In: I097464df78ee037fd87bc8a970f696d5d3bb6e3e Change-Id: I097464df78ee037fd87bc8a970f696d5d3bb6e3e (cherry picked from commit 247996038e3595d638dad6a54aeae69a634d8727) - Add a field in ModelBuilder to indicate whether the model is invalid or not. - Mutating an invalid model is disallowed, and will return BAD_STATE. - Currently only validation failures caught during finish() will flip this flag to true. - Slightly modify the validation cases to not expect finish() to always succeed. Bug: 75980486 Test: mm Test: ValidationTestModel.SetOperandValueFromMemory Test: NeuralNetworkTests (no new test failures) Merged-In: If9289b65501266baf9048d8cdc621b64064e90ec Change-Id: If9289b65501266baf9048d8cdc621b64064e90ec (cherry picked from commit 853931ff8e4df815699c30c2948b5a51aa4a206d) - Remove obsolete comments about ANeuralNetworksMemory_createShared Bug: 68822426 Test: mm Merged-In: I7546333107281b39de6fbf8ed18371f1ad3dc7cb Change-Id: I7546333107281b39de6fbf8ed18371f1ad3dc7cb (cherry picked from commit 0882987fa68df21b79fd1ddc6538da8a1fde65d2) - Fix lstm tests to have correct scratch_buffer size Bug: 75980924 Test: NeuralNetworksTest Merged-In: I2f9083362f3276db6d4e7d876e80c47c6aae7bf1 Change-Id: I2f9083362f3276db6d4e7d876e80c47c6aae7bf1 (cherry picked from commit aa2bba12a2ca49317a1a1c21df4aaa1480a29671) - Upgrade generated test cases There were some changes to strided_slice_float_1.mod.py, strided_slice_quant8_1.mod.py, and resize_bilinear.mod.py that did not have a followup CL to update the corresponding generated test cases. This CL updates those changes. Additionally, some variables in mobilenet_224_gender_basic_fixed and mobilenet_quantized had their order swapped. Bug: 73964023 Bug: 74000148 Test: mma Test: NeuralNetworksTest Test: VtsHalNeuralnetworksV1_0TargetTest Merged-In: I78a32f98fc8e7166094d861675e59e3a0f61edac Change-Id: I78a32f98fc8e7166094d861675e59e3a0f61edac (cherry picked from commit d6d2b0acd3b0e6914a2ca23214548e210a90b19c) - Add tests for ANeuralNetworksModel_identifyInputsAndOutputs. Test: NeuralNetworksTest_static --gtest_filter=ValidationTestIdentify.* Bug: 67828197 Merged-In: Iee1294d461e3b66140cc3c6a11edb3e2f404d9a3 Change-Id: Iee1294d461e3b66140cc3c6a11edb3e2f404d9a3 (cherry picked from commit 5c2e9d7348bf6b3f75572e814a399686222331a9) - Call validation from ModelBuilder::finish(). Also: - Make incompletely-initialized large operand values recognizable as incompletely-initialized (for easier validation and manual debugging). - Fix typos. Test: nn/runtime/test/NeuralNetworksTest_static Bug: 74784979 Merged-In: I4753ca137228d733b10097e68a3ef3e2fb6f46c7 Change-Id: I4753ca137228d733b10097e68a3ef3e2fb6f46c7 (cherry picked from commit 0deadd8c690b5a131d66e4bc03667315f28df321) - Relax fp32 to fp16 before model finish When creating a subModel, the model's computation would be relaxed after the model was finished. This CL relaxes the model before it is finished. This CL additionally adds ASSERT guards around a pointer to prevent a potential crash in the partitioning tests. Test: mma Test: NeuralNetworksTest Merged-In: I9997da17eab0d3e18b53e08d56eb491cea769673 Change-Id: I9997da17eab0d3e18b53e08d56eb491cea769673 (cherry picked from commit e0f07a47cd31c3454555e44ca457c0c5a666d601) - Prevent excessive logging of test failures In the generated tests, whenever the produced output data does not match the expected output data, each mismatched element is logged. For tensors with thousands of elements, this can spam logcat and take several minutes just to finish printing the test failure. This CL caps the total amount of elementwise error log messages to a preset number so that at most N error messages will be displayed per test. It will additionally log how many values were mismatched in a given test as a summary. Bug: 73253476 Test: mma Test: NeuralNetworksTest Merged-In: I13be298537318bda7beccefc6079ed606df17987 Change-Id: I13be298537318bda7beccefc6079ed606df17987 (cherry picked from commit 9ed85abd95babb953aa701e51523f37bd5a15476) - Remove libnativehelper from shared_libs This commit removes libnativehelper from shared_libs. It seems that it is not being used (neither the shared lib nor headers). Bug: 77161122 Test: aosp_walleye-userdebug builds Change-Id: I62717eda61b4ea9511851a6faa6652641e5fad3d - Merge "Enable openmp multi-threading for NNAPI CPU path." - Enable openmp multi-threading for NNAPI CPU path. Bug: 69002158 Test: mm Test: NNAPIBenchmark (mobilenet_float) shows 2x performance on walleye Merged-In: I08623e67c21406b6607144d229fd318f3fccb81e Change-Id: I08623e67c21406b6607144d229fd318f3fccb81e (cherry picked from commit f05bc49fb4d9fec8eccbb1350e9e51ed724ea141) - Merge changes If8ce9142,Icdbc4fd9 * changes: Fix / add various ANeuralNetworksModel_* validations Fix the validation for ANeuralNetworksExecution_setInput & setOutput - Fix / add various ANeuralNetworksModel_* validations - Validate dimensions and dimensionCount for scalar types. - Validate offset and length for Memory. - Make the returned error consistent for modifying a finished model. Bug: 74831097 Bug: 70942562 Test: mm Test: ValidationTestModel pass Merged-In: If8ce91427838950afa6684a014be1221528b8ded Change-Id: If8ce91427838950afa6684a014be1221528b8ded (cherry picked from commit ef9eb72853e0c19bb0342c4f820544675f5d4903) - Fix the validation for ANeuralNetworksExecution_setInput & setOutput - For optional inputs, buffer must be nullptr and length must be 0. Passing a nullptr for buffer and a non-zero length is invalid. Bug: 74829782 Test: mm Test: ValidationTestExecution#SetInput pass Merged-In: Icdbc4fd98f0d9bfb35a58bff7f6902dc23123548 Change-Id: Icdbc4fd98f0d9bfb35a58bff7f6902dc23123548 (cherry picked from commit c52c2d22d959bce01de3dec6e00cbec163fd7f95) - Merge changes I4e706b1a,I6cd91840 * changes: Add a bunch of validation tests. Fix setOperandValue for OEM_SCALAR operands - Add a bunch of validation tests. Tests added for the following APIs: - ANeuralNetworksModel_addOperand; - ANeuralNetworksModel_setOperandValue; - ANeuralNetworksModel_setOperandValueFromMemory; - ANeuralNetworksModel_addOperation; - ANeuralNetworksModel_relaxComputationFloat32toFloat16; - ANeuralNetworksExecution_setInput; - ANeuralNetworksExecution_setInputFromMemory; - ANeuralNetworksExecution_setOutput; - ANeuralNetworksExecution_setOutputFromMemory; - ANeuralNetworksExecution_startCompute; - ANeuralNetworksEvent_wait; Test: mm Test: NeuralNetworks Merged-In: I4e706b1a719e7b513a3bf155d993dbc342ba8322 Change-Id: I4e706b1a719e7b513a3bf155d993dbc342ba8322 (cherry picked from commit ee8da78f88aebeddcde85544cc126c0858badbc2) - Fix setOperandValue for OEM_SCALAR operands - Added unit test adding and setting OEM scalar and tensor operands. Bug: 67869090 Test: mm Test: NeuralNetworksTest Merged-In: I6cd91840c3fd0a72755c7e391db08758b28a7342 Change-Id: I6cd91840c3fd0a72755c7e391db08758b28a7342 (cherry picked from commit d90fdc99fe2bb7585ae8a3eb20c6feeb407cbbbd) - Merge changes from topic "cp_nnapi" * changes: Simplify lifetime management of ModelBuilder Add quantized MEAN tests Generate relaxed precision tests for CTS and VTS. Add ANeuralNetworksModel_relaxComputationFloat32toFloat16 to NDK whitelist Add relaxed execution tests Fixed a hardcoded path that breaks vendor tests NNAPI narrow evaluation for P -- runtime Fix resize_bilinear test arguments and strided_slice test types Generates new V1_0 tests from the newly added specs. Add more tests for V1_0 ops Add Capabilities::relaxedFloat32toFloat16Performance for 1.1. Add more tests for v1.1 ops Fix a typo in spaceToBatchPrepare. Update generated VTS test for mobilenet_quantized Create NNAPI v1.1 VTS tests. Update MobileNet quantized test UINT32 and OEM operand support in the test generator Removed subdirs from Android.bp file Make unit test framework friendly to vendor drivers Upgrade 1.0 sample driver to 1.1 - Simplify lifetime management of ModelBuilder ExecutionStep fully owns the ModelBuilder it contains, and only provides references to the subModel. This change simplifies the lifetime management to reflect the ownership, removing the unnecessary strong pointer behavior. Additionally, this CL removes the unnecessary virtual destructor in the ModelBuilder class, which was likely an artifact of a previous implementation. Test: mm Test: NeuralNetworksTest Test: VtsHalNeuralnetworksV1_0TargetTest Merged-In: I62571d9a61fd8bbc193586756267ad4ec8888e27 Change-Id: I62571d9a61fd8bbc193586756267ad4ec8888e27 (cherry picked from commit 57167f7ec8bfe682139a9a4d60cd8aa913899441) - Add quantized MEAN tests Bug: 63911257 Test: mm Test: NeuralNetworksTests and VTS pass on walleye Merged-In: Ia2374f5678202f1ae6aa2116f3eea1c739abcb50 Change-Id: Ia2374f5678202f1ae6aa2116f3eea1c739abcb50 (cherry picked from commit 70f401e3df8435bbb750e77a2341f1feec719556) - Generate relaxed precision tests for CTS and VTS. Bug: 63911257 Test: mm Test: CTS and VTS pass on walleye Merged-In: I62655872423e55201e94c05e2cd9da86815d4b26 Change-Id: I62655872423e55201e94c05e2cd9da86815d4b26 (cherry picked from commit e8e5d34c4159532eb324df393c2c752a508bced1) - Add ANeuralNetworksModel_relaxComputationFloat32toFloat16 to NDK whitelist Bug: 63911257 Test: make sure CTS builds. Merged-In: I570b7ef7b8383e2abff6b14d2d0cdc4cd5409f83 Change-Id: I570b7ef7b8383e2abff6b14d2d0cdc4cd5409f83 (cherry picked from commit 8989a28d4678609b602784cfd7b4d8e79e076208) - Add relaxed execution tests - Extend the test generator and test wrapper to allow relaxed execution. - Make the accpeted error range to be 5 ULP of FP16. - Copy and modify existing V1_0 tests to be V1_1 relaxed tests. Bug: 63911257 Test: mm Test: Relaxed tests pass on devices with FP16 support Merged-In: I8954aeeebcf7312d7d94580992708f1b42e2b32e Change-Id: I8954aeeebcf7312d7d94580992708f1b42e2b32e (cherry picked from commit b74d2837ab1687c1a4f913aa5f90a9838efe0add) - Fixed a hardcoded path that breaks vendor tests Recent changes to the test generator introduced a hardcoded path that breaks external users; this CL fixed that. Also added handling of TENSOR_OEM_BYTE in the test generator. Test: re-generate tests and diff Bug: 71364578 Merged-In: I6e8fa8f19989e8c1834290c7f4120d07c3d0f59c Change-Id: I6e8fa8f19989e8c1834290c7f4120d07c3d0f59c (cherry picked from commit b69da689183dd8258461d3c4326ddfa2d12cdc07) - NNAPI narrow evaluation for P -- runtime We have determined that for Android P it is sufficient to have a mechanism for a developer to specify on a per-model basis that it is acceptable for FLOAT32 operations to be carried out as if they were FLOAT16 operations. This CL manages the versioning differences between 1.0 and 1.1. Bug: 63911257 Test: mm Test: NeuralNetworksTest Test: VtsHalNeuralnetworksV1_0TargetTest Merged-In: If6…
Bug: android/ndk#706 Test: builds Change-Id: I519d4fd825d40c3f72515f29a7e5b12c23a1749a
__INTRODUCED_IN only applies to function or variable declarations, not a typedef to a function pointer. Bug: android/ndk#706 Test: builds Change-Id: I472565d3e34e5c6a3cd88500ad03ef9ce4489c25
Bug: android/ndk#706 Test: builds Change-Id: I23db5a2180517045bafabe6fbf783456cbddf21a
@camillol, can I ask if you ever got the weak linking working? We're looking at the same thing. |
Weak linking on Android works, I've used it for other APIs. For this one, I think we ended up calling the Java API via JNI, which IIRC gave us compatibility with earlier API levels. Anyway, if the header hasn't been updated to support weak linking your can make your own copy and add the attributes. |
@camillol, any chance I could get you to share a few more details of your weak linking fix? In general, did you find JNI to be a better solution? Or did you use both? Thanks so, so much. |
You need to add |
@camillol, few last things, if that's okay
Again, thanks so much. Helps a ton to get to draw on your learnings. |
this is something we're working on in the OS right now. once we've gotten the NDK off libgcc we'll be able to make it available in the NDK too. |
Ooh, that's awesome to hear. @enh-google, just to confirm, that means an official fix to #837 is coming down the line? Do you have a rough sense of when? We'd love to use an official solution. |
r23 is going to have a #define that you can set to get largely untested, undocumented, not recommended weak symbols for the NDK. I wouldn't call that official, but it'll exist. |
@cpsauer you can see an example in MediaPipe of how it can be done for OpenGL, whose headers include a Regarding what happens if the |
Thanks so much, all. |
really? i've never seen that, and i don't think we implement that if it does exist. do you have a reference for this? (the lack of this is one of the things that makes this way of working less useful than it might otherwise be, since the existence of a DT_NEEDED can mean [if the whole library is new, not just one API] that your library won't load on older OS versions.) |
Bug: android/ndk#706 Test: N/A Change-Id: I8a4f98f2c929e28d81672d7e2e0d5dd63d27c7a6 Former-commit-id: 2a35810
@camillol, to settle the issue above about the behavior when the .so is missing: Any chance you've got the ability to test, a memory of testing it, or any recollection of docs about it? If the Android loader did (like iOS) have the behavior you're saying, then that'd be game-changingly useful. |
Bug: android/ndk#706 Test: builds Change-Id: I23db5a2180517045bafabe6fbf783456cbddf21a (cherry picked from commit 9db409b)
Bug: android/ndk#706 Bug: b/113052379 Test: builds Change-Id: I23db5a2180517045bafabe6fbf783456cbddf21a (cherry picked from commit 9db409b)
Description
All NDK APIs (specifically, all symbols that are imported from system libraries) should be annotated with an
__INTRODUCED_IN
macro. This is currently missing from several APIs introduced in recent NDK versions, e.g. it's not in the NdkMedia*.h headers, hardware_buffer.h, etc.Looking at the unified headers from r17, several files just have large sections wrapped by #if blocks, e.g.
#if __ANDROID_API__ >= 21
. This is not a good substitute for annotating the individual symbol. With individual symbol annotations, we can change the definition of__INTRODUCED_IN
to insert availability attributes, enable weak-linking, etc.; with #if blocks, we cannot do any of that.Environment Details
Applies to all versions of the NDK.
The text was updated successfully, but these errors were encountered: