Create utility code to clean up dead operands
This change adds the utility function "removeDeadOperands" to remove
operands that are no longer referenced within a model.
This change also adds "simplifyModel" to ModelBuilder to make it so
ModelBuilder::makeModel automatically removes dead operands from the
model. This fixes a problem where ModelBuilder generated dead operands
when removing arguments from operations that matched the default value.
Finally, this change also makes the following changes to
TestCompliance.cpp:
* Because ModelBuilder now reports the proper version after removing
any dead operands, the remaining testAvailableSinceV1_* test cases are
changed to testAvailableSinceVersion.
* testAvailableSinceVersion is similarly created for Request objects,
and the existing testAvailableSinceV1_* for Requests are changed to
instead use this new testAvailableSinceVersion.
Bug: 213801779
Test: mma
Test: NeuralNetworksTest_static
Change-Id: I518a6b0fbd6382284e6e9a7267b0e5b64360eab2
diff --git a/common/Android.bp b/common/Android.bp
index 6010093..61fa140 100644
--- a/common/Android.bp
+++ b/common/Android.bp
@@ -137,6 +137,7 @@
"LegacyUtils.cpp",
"MemoryUtils.cpp",
"MetaModel.cpp",
+ "ModelUtils.cpp",
"QuantUtils.cpp",
"TokenHasher.cpp",
"ValidateHal.cpp",
@@ -278,6 +279,7 @@
"IndexedShapeWrapper.cpp",
"LegacyUtils.cpp",
"MetaModel.cpp",
+ "ModelUtils.cpp",
"TokenHasher.cpp",
],
header_libs: [