More graph validation, including whole-graph valdation.

Validate:
- operations are in execution order
  - this is a requirement at the HAL level
  - at the API level, this is a requirement that there IS an
    execution order (i.e., the graph is acyclic and leaves
    no operands unwritten)
- operands are not read before written
- SUBGRAPH_INPUT/SUBGRAPH_OUTPUT operands are in
  inputIndexes/outputIndexes

Add tests:
- detect graph cycle (Cycle)
- detect operand read before written (AcyclicReadBeforeWrite)
- detect operand never written (MissingWrite, UnwrittenOperand)
- detect multiple writes to the same operand (MultipleWrite)

Also:
- improve some error messages
- clean up some comments

Bug: 66478689
Test: mma
Test: CtsNNAPITestCases
Test: NeuralNetworksTest_static
Test: VtsHalNeuralnetworksV1_*TargetTest
Change-Id: I018b0c195e59b8b89ac8b62e0d80039d673ce81e
Merged-In: I018b0c195e59b8b89ac8b62e0d80039d673ce81e
(cherry picked from commit 2da722e81bbeacb9c09770d2b4416295efca5b40)
4 files changed
tree: 5e5d05a541cd71a858d0cd498cc5792110031a36
  1. nn/
  2. .clang-format
  3. CleanSpec.mk
  4. CPPLINT.cfg
  5. OWNERS
  6. PREUPLOAD.cfg