summaryrefslogtreecommitdiff
path: root/nn/runtime/test/fuzzing
diff options
context:
space:
mode:
authorSlava Shklyaev <slavash@google.com>2020-03-04 17:15:05 +0000
committerSlava Shklyaev <slavash@google.com>2020-03-09 12:07:16 +0000
commit5573eefc99585c9438629c9e006942d1345f3651 (patch)
treef2a75e523893c750e5de3c116b911cc3c10e9cda /nn/runtime/test/fuzzing
parentc0c67a23e356d4a0e1b2b9aa2264441bfa7565c4 (diff)
downloadml-5573eefc99585c9438629c9e006942d1345f3651.tar.gz
Add test_wrapper::Compilation::createForDevice()
Bug: 147105700 Test: m Change-Id: I8d2b148c91b0b79d067b7f3020b42958163f7856 Merged-In: I8d2b148c91b0b79d067b7f3020b42958163f7856 (cherry picked from commit 8ee0edf5f65ecb72189d215f0f32c6349acf1897)
Diffstat (limited to 'nn/runtime/test/fuzzing')
-rw-r--r--nn/runtime/test/fuzzing/TestRandomGraph.cpp18
1 files changed, 2 insertions, 16 deletions
diff --git a/nn/runtime/test/fuzzing/TestRandomGraph.cpp b/nn/runtime/test/fuzzing/TestRandomGraph.cpp
index ee944dd1b..18e536f13 100644
--- a/nn/runtime/test/fuzzing/TestRandomGraph.cpp
+++ b/nn/runtime/test/fuzzing/TestRandomGraph.cpp
@@ -120,20 +120,6 @@ std::shared_ptr<Device> makeTestDevice() {
#endif
-// Manages compilation on one single device.
-class CompilationForDevice : public test_wrapper::Compilation {
- public:
- CompilationForDevice() = default;
- CompilationForDevice(const CompilationForDevice&) = delete;
- CompilationForDevice& operator=(const CompilationForDevice&) = delete;
-
- bool initialize(const test_wrapper::Model* model, const ANeuralNetworksDevice* device) {
- int ret = ANeuralNetworksCompilation_createForDevices(model->getHandle(), &device, 1,
- &mCompilation);
- return ret == ANEURALNETWORKS_NO_ERROR;
- }
-};
-
// NN API fuzzer logging setting comes from system property debug.nn.fuzzer.log and
// debug.nn.fuzzer.dumpspec.
// * setprop debug.nn.fuzzer.log 1 : enable logging.
@@ -245,8 +231,8 @@ class RandomGraphTest : public ::testing::TestWithParam<uint32_t> {
if (shouldSkipTest(featureLevel)) return;
// Create compilation for device.
- CompilationForDevice compilation;
- ASSERT_TRUE(compilation.initialize(model, device));
+ test_wrapper::Compilation compilation;
+ ASSERT_EQ(compilation.createForDevice(model, device), Result::NO_ERROR);
Result compileReturn = compilation.finish();
// Even if the model is fully supported, the compilation may still fail, e.g. each operation
// is supported, but model is too big (too many operations and/or too-large constants) for